To our customers, Old Company Name in Catalogs and Other Documents On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology Corporation, and Renesas Electronics Corporation took over all the business of both companies. Therefore, although the old company name remains in this document, it is a valid Renesas Electronics document. We appreciate your understanding. Renesas Electronics website: http://www.renesas.com April 1st, 2010 Renesas Electronics Corporation Issued by: Renesas Electronics Corporation (http://www.renesas.com) Send any inquiries to http://www.renesas.com/inquiry. Notice 1. 2. 3. 4. 5. 6. 7. All information included in this document is current as of the date this document is issued. Such information, however, is subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please confirm the latest product information with a Renesas Electronics sales office. Also, please pay regular and careful attention to additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website. Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or others. You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software, and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits, software, or information. When exporting the products or technology described in this document, you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations. You should not use Renesas Electronics products or the technology described in this document for any purpose relating to military applications or use by the military, including but not limited to the development of weapons of mass destruction. Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein. Renesas Electronics products are classified according to the following three quality grades: "Standard", "High Quality", and "Specific". The recommended applications for each Renesas Electronics product depends on the product's quality grade, as indicated below. You must check the quality grade of each Renesas Electronics product before using it in a particular application. You may not use any Renesas Electronics product for any application categorized as "Specific" without the prior written consent of Renesas Electronics. Further, you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics. Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as "Specific" or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics. The quality grade of each Renesas Electronics product is "Standard" unless otherwise expressly specified in a Renesas Electronics data sheets or data books, etc. "Standard": 8. 9. 10. 11. 12. Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots. "High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anticrime systems; safety equipment; and medical equipment not specifically designed for life support. "Specific": Aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life. You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics, especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges. Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further, Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of Renesas Electronics. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products, or if you have any other inquiries. (Note 1) "Renesas Electronics" as used in this document means Renesas Electronics Corporation and also includes its majorityowned subsidiaries. (Note 2) "Renesas Electronics product(s)" means any product developed or manufactured by or for Renesas Electronics. User's Manual 78K0/KB1 8-Bit Single-Chip Microcontrollers PD780101 PD780102 PD780103 PD78F0103 PD780101(A) PD780102(A) PD780103(A) PD78F0103(A) Document No. U15836EJ5V0UD00 (5th edition) Date Published February 2005 N CP(K) c Printed in Japan PD780101(A1) PD780101(A2) PD780102(A1) PD780102(A2) PD780103(A1) PD780103(A2) PD78F0103(A1) [MEMO] 2 User's Manual U15836EJ5V0UD 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 VIH (MIN). 2 HANDLING OF UNUSED INPUT PINS Unconnected CMOS device inputs can be cause of malfunction. If an input pin is unconnected, it is possible that an internal input level may be generated due to noise, etc., causing malfunction. CMOS devices behave differently than Bipolar or NMOS devices. Input levels of CMOS devices must be fixed high or low by using pull-up or pull-down circuitry. Each unused pin should be connected to VDD or GND via a resistor if there is a possibility that it will be an output pin. All handling related to unused pins must be judged separately for each device and according to related specifications governing the device. 3 PRECAUTION AGAINST ESD A strong electric field, when exposed to a MOS device, can cause destruction of the gate oxide and ultimately degrade the device operation. Steps must be taken to stop generation of static electricity as much as possible, and quickly dissipate it when it has occurred. Environmental control must be adequate. When it is dry, a humidifier should be used. It is recommended to avoid using insulators that easily build up static electricity. Semiconductor devices must be stored and transported in an anti-static container, static shielding bag or conductive material. All test and measurement tools including work benches and floors should be grounded. The operator should be grounded using a wrist strap. Semiconductor devices must not be touched with bare hands. Similar precautions need to be taken for PW boards with mounted semiconductor devices. 4 STATUS BEFORE INITIALIZATION Power-on does not necessarily define the initial status of a MOS device. Immediately after the power source is turned ON, devices with reset functions have not yet been initialized. Hence, power-on does not guarantee output pin levels, I/O settings or contents of registers. A device is not initialized until the reset signal is received. A reset operation must be executed immediately after power-on for devices with reset functions. 5 POWER ON/OFF SEQUENCE In the case of a device that uses different power supplies for the internal operation and external interface, as a rule, switch on the external power supply after switching on the internal power supply. When switching the power supply off, as a rule, switch off the external power supply and then the internal power supply. Use of the reverse power on/off sequences may result in the application of an overvoltage to the internal elements of the device, causing malfunction and degradation of internal elements due to the passage of an abnormal current. The correct power on/off sequence must be judged separately for each device and according to related specifications governing the device. 6 INPUT OF SIGNAL DURING POWER OFF STATE Do not input signals or an I/O pull-up power supply while the device is not powered. The current injection that results from input of such a signal or I/O pull-up power supply may cause malfunction and the abnormal current that passes in the device at this time may cause degradation of internal elements. Input of signals during the power off state must be judged separately for each device and according to related specifications governing the device. User's Manual U15836EJ5V0UD 3 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. 4 User's Manual U15836EJ5V0UD These commodities, technology or software, must be exported in accordance with the export administration regulations of the exporting country. Diversion contrary to the law of that country is prohibited. * The information in this document is current as of September, 2004. The information is subject to change without notice. For actual design-in, refer to the latest publications of NEC Electronics data sheets or data books, etc., for the most up-to-date specifications of NEC Electronics products. Not all products and/or types are available in every country. Please check with an NEC Electronics sales representative for availability and additional information. * No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Electronics. NEC Electronics assumes no responsibility for any errors that may appear in this document. * NEC Electronics does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from the use of NEC Electronics products listed in this document or any other liability arising from the use of such products. No license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of NEC Electronics or others. * Descriptions of circuits, software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples. The incorporation of these circuits, software and information in the design of a customer's equipment shall be done under the full responsibility of the customer. NEC Electronics assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. * While NEC Electronics endeavors to enhance the quality, reliability and safety of NEC Electronics products, customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To minimize risks of damage to property or injury (including death) to persons arising from defects in NEC Electronics products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment and anti-failure features. * NEC Electronics products are classified into the following three quality grades: "Standard", "Special" and "Specific". The "Specific" quality grade applies only to NEC Electronics products developed based on a customerdesignated "quality assurance program" for a specific application. The recommended applications of an NEC Electronics product depend on its quality grade, as indicated below. Customers must check the quality grade of each NEC Electronics product before using it in a particular application. "Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots. "Special": Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life support). "Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems and medical equipment for life support, etc. The quality grade of NEC Electronics products is "Standard" unless otherwise expressly specified in NEC Electronics data sheets or data books, etc. If customers wish to use NEC Electronics products in applications not intended by NEC Electronics, they must contact an NEC Electronics sales representative in advance to determine NEC Electronics' willingness to support a given application. (Note) (1) "NEC Electronics" as used in this statement means NEC Electronics Corporation and also includes its majority-owned subsidiaries. (2) "NEC Electronics products" means any product developed or manufactured by or for NEC Electronics (as defined above). M8E 02. 11-1 User's Manual U15836EJ5V0UD 5 Regional Information Some information contained in this document may vary from country to country. Before using any NEC Electronics product in your application, pIease contact the NEC Electronics office in your country to obtain a list of authorized representatives and distributors. They will verify: * Device availability * Ordering information * Product release schedule * Availability of related technical literature * Development environment specifications (for example, specifications for third-party tools and components, host computers, power plugs, AC supply voltages, and so forth) * Network requirements In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary from country to country. [GLOBAL SUPPORT] http://www.necel.com/en/support/support.html NEC Electronics America, Inc. (U.S.) NEC Electronics (Europe) GmbH NEC Electronics Hong Kong Ltd. Santa Clara, California Tel: 408-588-6000 800-366-9782 Duesseldorf, Germany Tel: 0211-65030 Hong Kong Tel: 2886-9318 * Sucursal en Espana Madrid, Spain Tel: 091-504 27 87 * Succursale Francaise Velizy-Villacoublay, France Tel: 01-30-67 58 00 * Filiale Italiana Milano, Italy Tel: 02-66 75 41 * Branch The Netherlands Eindhoven, The Netherlands Tel: 040-244 58 45 * Tyskland Filial NEC Electronics Hong Kong Ltd. Seoul Branch Seoul, Korea Tel: 02-558-3737 NEC Electronics Shanghai Ltd. Shanghai, P.R. China Tel: 021-5888-5400 NEC Electronics Taiwan Ltd. Taipei, Taiwan Tel: 02-2719-2377 NEC Electronics Singapore Pte. Ltd. Novena Square, Singapore Tel: 6253-8311 Taeby, Sweden Tel: 08-63 80 820 * United Kingdom Branch Milton Keynes, UK Tel: 01908-691-133 J04.1 6 User's Manual U15836EJ5V0UD INTRODUCTION Readers This manual is intended for user engineers who wish to understand the functions of the 78K0/KB1 and design and develop application systems and programs for these devices. The target products are as follows. 78K0/KB1: PD780101, 780102, 780103, 78F0103, 780101(A), 780102(A), 780103(A), 78F0103(A), 780101(A1), 780102(A1), 780103(A1), 78F0103(A1), 780101(A2), 780102(A2), 780103(A2) Purpose This manual is intended to give users an understanding of the functions described in the Organization below. Organization The 78K0/KB1 manual is separated into two parts: this manual and the instructions edition (common to the 78K/0 Series). 78K0/KB1 78K/0 Series User's Manual User's Manual (This Manual) Instructions * Pin functions * CPU functions * Internal block functions * Instruction set * Interrupts * Explanation of each instruction * Other on-chip peripheral functions * Electrical specifications User's Manual U15836EJ5V0UD 7 How to Read This Manual It is assumed that the readers of this manual have general knowledge of electrical engineering, logic circuits, and microcontrollers. * When using this manual as the manual for (A) grade, (A1) grade, and (A2) grade products: Only the quality grade differs between standard products and (A) grade, (A1) grade, and (A2) grade products. Read the part number as follows. * * * * PD780101 PD780101(A), 780101(A1), 780101(A2) PD780102 PD780102(A), 780102(A1), 780102(A2) PD780103 PD780103(A), 780103(A1), 780103(A2) PD78F0103 PD78F0103(A), 78F0103(A1) * To gain a general understanding of functions: Read this manual in the order of the CONTENTS. The mark shows major revised points. * How to interpret the register format: For a bit number enclosed in angle brackets, the bit name is defined as a reserved word in the RA78K0, and is defined as an sfr variable using the #pragma sfr directive in the CC78K0. * To check the details of a register when you know the register name: See APPENDIX C REGISTER INDEX. * To know details of the 78K/0 Series instructions: Refer to the separate document 78K/0 Series Instructions User's Manual (U12326E). Caution Examples in this manual employ the "standard" quality grade for general electronics. When using examples in this manual for the "special" quality grade, review the quality grade of each part and/or circuit actually used. Conventions Data significance: Higher digits on the left and lower digits on the right Active low representations: xxx (overscore over pin and signal name) Note: Footnote for item marked with Note in the text Caution: Information requiring particular attention Remark: Supplementary information ... xxxx or xxxxB Numerical representations: Binary 8 Decimal ... xxxx Hexadecimal ... xxxxH User's Manual U15836EJ5V0UD Differences Between 78K0/KB1 and 78K0/KB1+ Series Name 78K0/KB1 78K0/KB1+ Item Mask ROM version Available None Flash Power supply Two power supplies Single power supply memory Self-programming function None Available Option byte None Ring-OSC can be stopped/cannot be version stopped selectable Power-on clear function 2.85 V 0.15 V or 3.5 V 0.2 V selectable 2.1 V 0.1 V (fixed) Minimum instruction execution time 0.166 s (at 12 MHz operation) 0.125 s (at 16 MHz operation) Note Note This value may change after evaluation. 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. 78K0/KB1 User's Manual This manual 78K0/KB1+ User's Manual U16846E 78K/0 Series Instructions User's Manual U12326E Documents Related to Development Tools (Software) (User's Manuals) Document Name RA78K0 Assembler Package CC78K0 C Compiler SM78K Series Ver. 2.52 System Simulator Document No. Operation U16629E Language U14446E Structured Assembly Language U11789E Operation U16613E Language U14298E Operation U16768E External Part User Open Interface U15802E Specifications ID78K0-NS Ver. 2.52 Integrated Debugger Operation U16488E ID78K0-QB Ver. 2.81 Integrated Debugger Operation U16996E PM plus Ver. 5.10 U16569E Caution The related documents listed above are subject to change without notice. Be sure to use the latest version of each document when designing. User's Manual U15836EJ5V0UD 9 Documents Related to Development Tools (Hardware) (User's Manuals) Document Name Document No. IE-78K0-NS In-Circuit Emulator U13731E IE-78K0-NS-A In-Circuit Emulator U14889E IE-78K0K1-ET In-Circuit Emulator U16604E QB-78K0KX1H In-Circuit Emulator U17081E IE-780148-NS-EM1 Emulation Board To be prepared Documents Related to Flash Memory Programming Document Name Document No. PG-FP3 Flash Memory Programmer User's Manual U13502E PG-FP4 Flash Memory Programmer User's Manual U15260E Other Documents Document Name Document No. SEMICONDUCTOR SELECTION GUIDE - Products and Packages - X13769X Semiconductor Device Mount Manual Note Quality Grades on NEC Semiconductor Devices C11531E NEC Semiconductor Device Reliability/Quality Control System C10983E Guide to Prevent Damage for Semiconductor Devices by Electrostatic Discharge (ESD) C11892E Note See the "Semiconductor Device Mount Manual" website (http://www.necel.com/pkg/en/mount/index.html). Caution The related documents listed above are subject to change without notice. Be sure to use the latest version of each document when designing. 10 User's Manual U15836EJ5V0UD CONTENTS CHAPTER 1 OUTLINE ............................................................................................................................ 17 1.1 Expanded-Specification Products and Conventional Products (Standard Products, (A) Grade Products Only) ...................................................................... 17 1.2 Features ...................................................................................................................................... 18 1.3 Applications................................................................................................................................ 19 1.4 Ordering Information ................................................................................................................. 20 1.5 Pin Configuration (Top View).................................................................................................... 22 1.6 Kx1 Series Lineup ...................................................................................................................... 23 1.7 1.8 1.6.1 78K0/Kx1, 78K0/Kx1+ product lineup .............................................................................................23 1.6.2 V850ES/Kx1, V850ES/Kx1+ product lineup ...................................................................................26 Block Diagram ............................................................................................................................ 29 Outline of Functions .................................................................................................................. 30 CHAPTER 2 PIN FUNCTIONS ............................................................................................................... 32 2.1 Pin Function List ........................................................................................................................ 32 2.2 Description of Pin Functions .................................................................................................... 34 2.2.1 P00 to P03 (port 0) .........................................................................................................................34 2.2.2 P10 to P17 (port 1) .........................................................................................................................34 2.2.3 P20 to P23 (port 2) .........................................................................................................................35 2.2.4 P30 to P33 (port 3) .........................................................................................................................35 2.2.5 P120 (port 12).................................................................................................................................35 2.2.6 P130 (port 13).................................................................................................................................36 2.2.7 AVREF ..............................................................................................................................................36 2.2.8 AVSS ...............................................................................................................................................36 2.2.9 RESET ...........................................................................................................................................36 2.2.10 X1 and X2.......................................................................................................................................36 2.3 2.2.11 VDD..................................................................................................................................................36 2.2.12 VSS ..................................................................................................................................................36 2.2.13 VPP (flash memory versions only) ...................................................................................................36 2.2.14 IC (mask ROM versions only).........................................................................................................36 Pin I/O Circuits and Recommended Connection of Unused Pins......................................... 37 CHAPTER 3 CPU ARCHITECTURE...................................................................................................... 39 3.1 Memory Space............................................................................................................................ 39 3.1.1 3.2 3.3 Internal program memory space.....................................................................................................44 3.1.2 Internal data memory space ...........................................................................................................45 3.1.3 Special function register (SFR) area...............................................................................................45 3.1.4 Data memory addressing ...............................................................................................................46 Processor Registers .................................................................................................................. 50 3.2.1 Control registers .............................................................................................................................50 3.2.2 General-purpose registers ..............................................................................................................54 3.2.3 Special function registers (SFRs) ...................................................................................................55 Instruction Address Addressing .............................................................................................. 59 3.3.1 Relative addressing ........................................................................................................................59 3.3.2 Immediate addressing ....................................................................................................................60 User's Manual U15836EJ5V0UD 11 3.4 3.3.3 Table indirect addressing............................................................................................................... 61 3.3.4 Register addressing ....................................................................................................................... 61 Operand Address Addressing .................................................................................................. 62 3.4.1 Implied addressing......................................................................................................................... 62 3.4.2 Register addressing ....................................................................................................................... 63 3.4.3 Direct addressing........................................................................................................................... 64 3.4.4 Short direct addressing .................................................................................................................. 65 3.4.5 Special function register (SFR) addressing.................................................................................... 66 3.4.6 Register indirect addressing .......................................................................................................... 67 3.4.7 Based addressing .......................................................................................................................... 68 3.4.8 Based indexed addressing............................................................................................................. 69 3.4.9 Stack addressing ........................................................................................................................... 70 CHAPTER 4 PORT FUNCTIONS ........................................................................................................... 71 4.1 Port Functions ............................................................................................................................ 71 4.2 Port Configuration...................................................................................................................... 72 4.3 4.4 4.2.1 Port 0 ............................................................................................................................................. 73 4.2.2 Port 1 ............................................................................................................................................. 76 4.2.3 Port 2 ............................................................................................................................................. 81 4.2.4 Port 3 ............................................................................................................................................. 82 4.2.5 Port 12 ........................................................................................................................................... 83 4.2.6 Port 13 ........................................................................................................................................... 84 Registers Controlling Port Function ........................................................................................ 84 Port Function Operations .......................................................................................................... 88 4.4.1 Writing to I/O port........................................................................................................................... 88 4.4.2 Reading from I/O port .................................................................................................................... 88 4.4.3 Operations on I/O port ................................................................................................................... 88 CHAPTER 5 CLOCK GENERATOR ...................................................................................................... 89 5.1 Functions of Clock Generator................................................................................................... 89 5.2 Configuration of Clock Generator ............................................................................................ 89 5.3 Registers Controlling Clock Generator.................................................................................... 91 5.4 System Clock Oscillator ............................................................................................................ 97 5.5 5.6 5.7 5.8 5.4.1 X1 oscillator ................................................................................................................................... 97 5.4.2 Ring-OSC oscillator ....................................................................................................................... 99 5.4.3 Prescaler........................................................................................................................................ 99 Clock Generator Operation ..................................................................................................... 100 Time Required to Switch Between Ring-OSC Clock and X1 Input Clock........................... 105 Time Required for CPU Clock Switchover............................................................................. 106 Clock Switching Flowchart and Register Setting ................................................................. 107 5.8.1 Switching from Ring-OSC clock to X1 input clock........................................................................ 107 5.8.2 Switching from X1 input clock to Ring-OSC clock........................................................................ 108 5.8.3 Register settings .......................................................................................................................... 109 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 ........................................................................... 110 6.1 Functions of 16-Bit Timer/Event Counter 00 ......................................................................... 110 6.2 Configuration of 16-Bit Timer/Event Counter 00................................................................... 111 6.3 Registers Controlling 16-Bit Timer/Event Counter 00 .......................................................... 115 12 User's Manual U15836EJ5V0UD 6.4 Operation of 16-Bit Timer/Event Counter 00 ......................................................................... 121 6.4.1 6.5 Interval timer operation.................................................................................................................121 6.4.2 PPG output operations .................................................................................................................124 6.4.3 Pulse width measurement operations...........................................................................................127 6.4.4 External event counter operation..................................................................................................135 6.4.5 Square-wave output operation......................................................................................................138 6.4.6 One-shot pulse output operation ..................................................................................................140 Cautions for 16-Bit Timer/Event Counter 00 ......................................................................... 145 CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50............................................................................. 148 7.1 Functions of 8-Bit Timer/Event Counter 50........................................................................... 148 7.2 Configuration of 8-Bit Timer/Event Counter 50 .................................................................... 149 7.3 Registers Controlling 8-Bit Timer/Event Counter 50............................................................ 151 7.4 Operations of 8-Bit Timer/Event Counter 50 ......................................................................... 154 7.5 7.4.1 Operation as interval timer ...........................................................................................................154 7.4.2 Operation as external event counter.............................................................................................156 7.4.3 Operation as square-wave output.................................................................................................157 7.4.4 Operation as PWM output ............................................................................................................158 Cautions for 8-Bit Timer/Event Counter 50 ........................................................................... 160 CHAPTER 8 8-BIT TIMERS H0 AND H1 .......................................................................................... 161 8.1 Functions of 8-Bit Timers H0 and H1 ..................................................................................... 161 8.2 Configuration of 8-Bit Timers H0 and H1 .............................................................................. 161 8.3 Registers Controlling 8-Bit Timers H0 and H1...................................................................... 165 8.4 Operation of 8-Bit Timers H0 and H1 ..................................................................................... 169 8.4.1 Operation as interval timer/square-wave output ...........................................................................169 8.4.2 Operation as PWM output mode ..................................................................................................172 CHAPTER 9 WATCHDOG TIMER ....................................................................................................... 178 9.1 Functions of Watchdog Timer ................................................................................................ 178 9.2 Configuration of Watchdog Timer.......................................................................................... 180 9.3 Registers Controlling Watchdog Timer ................................................................................. 181 9.4 Operation of Watchdog Timer ................................................................................................ 184 9.4.1 Watchdog timer operation when "Ring-OSC cannot be stopped" is selected by mask option ......184 9.4.2 Watchdog timer operation when "Ring-OSC can be stopped by software" is selected by mask option............................................................................................................................................185 9.4.3 Watchdog timer operation in STOP mode (when "Ring-OSC can be stopped by software" is selected by mask option) ..............................................................................................................186 9.4.4 Watchdog timer operation in HALT mode (when "Ring-OSC can be stopped by software" is selected by mask option) ..............................................................................................................188 CHAPTER 10 A/D CONVERTER ......................................................................................................... 189 10.1 Function of A/D Converter ...................................................................................................... 189 10.2 Configuration of A/D Converter.............................................................................................. 190 10.3 Registers Used in A/D Converter ........................................................................................... 192 10.4 A/D Converter Operations....................................................................................................... 196 10.4.1 Basic operations of A/D converter ................................................................................................196 10.4.2 Input voltage and conversion results ............................................................................................198 User's Manual U15836EJ5V0UD 13 10.4.3 A/D converter operation mode ..................................................................................................... 199 10.5 How to Read A/D Converter Characteristics Table............................................................... 202 10.6 Cautions for A/D Converter ..................................................................................................... 204 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) .................. 209 11.1 Functions of Serial Interface UART0...................................................................................... 209 11.2 Configuration of Serial Interface UART0 ............................................................................... 210 11.3 Registers Controlling Serial Interface UART0....................................................................... 213 11.4 Operation of Serial Interface UART0 ...................................................................................... 218 11.4.1 Operation stop mode ................................................................................................................... 218 11.4.2 Asynchronous serial interface (UART) mode............................................................................... 219 11.4.3 Dedicated baud rate generator .................................................................................................... 225 CHAPTER 12 SERIAL INTERFACE UART6 ...................................................................................... 230 12.1 Functions of Serial Interface UART6...................................................................................... 230 12.2 Configuration of Serial Interface UART6 ............................................................................... 234 12.3 Registers Controlling Serial Interface UART6....................................................................... 237 12.4 Operation of Serial Interface UART6 ...................................................................................... 245 12.4.1 Operation stop mode ................................................................................................................... 245 12.4.2 Asynchronous serial interface (UART) mode............................................................................... 246 12.4.3 Dedicated baud rate generator .................................................................................................... 260 CHAPTER 13 SERIAL INTERFACE CSI10 ........................................................................................ 267 13.1 Functions of Serial Interface CSI10........................................................................................ 267 13.2 Configuration of Serial Interface CSI10 ................................................................................. 267 13.3 Registers Controlling Serial Interface CSI10......................................................................... 269 13.4 Operation of Serial Interface CSI10 ........................................................................................ 272 13.4.1 Operation stop mode ................................................................................................................... 272 13.4.2 3-wire serial I/O mode.................................................................................................................. 273 CHAPTER 14 INTERRUPT FUNCTIONS............................................................................................. 280 14.1 Interrupt Function Types ......................................................................................................... 280 14.2 Interrupt Sources and Configuration ..................................................................................... 280 14.3 Registers Controlling Interrupt Function............................................................................... 283 14.4 Interrupt Servicing Operations ............................................................................................... 289 14.4.1 Maskable interrupt request acknowledgment............................................................................... 289 14.4.2 Software interrupt request acknowledgment................................................................................ 291 14.4.3 Multiple interrupt servicing ........................................................................................................... 292 14.4.4 Interrupt request hold................................................................................................................... 295 CHAPTER 15 STANDBY FUNCTION .................................................................................................. 296 15.1 Standby Function and Configuration..................................................................................... 296 15.1.1 Standby function .......................................................................................................................... 296 15.1.2 Registers controlling standby function ......................................................................................... 298 15.2 Standby Function Operation................................................................................................... 301 15.2.1 HALT mode.................................................................................................................................. 301 15.2.2 14 STOP mode ................................................................................................................................. 304 User's Manual U15836EJ5V0UD CHAPTER 16 RESET FUNCTION ....................................................................................................... 308 16.1 Register for Confirming Reset Source .................................................................................. 314 CHAPTER 17 CLOCK MONITOR ........................................................................................................ 315 17.1 Functions of Clock Monitor .................................................................................................... 315 17.2 Configuration of Clock Monitor .............................................................................................. 315 17.3 Register Controlling Clock Monitor ....................................................................................... 316 17.4 Operation of Clock Monitor..................................................................................................... 317 CHAPTER 18 POWER-ON-CLEAR CIRCUIT ..................................................................................... 322 18.1 Functions of Power-on-Clear Circuit ..................................................................................... 322 18.2 Configuration of Power-on-Clear Circuit............................................................................... 323 18.3 Operation of Power-on-Clear Circuit ..................................................................................... 323 18.4 Cautions for Power-on-Clear Circuit...................................................................................... 324 CHAPTER 19 LOW-VOLTAGE DETECTOR ....................................................................................... 326 19.1 Functions of Low-Voltage Detector ....................................................................................... 326 19.2 Configuration of Low-Voltage Detector................................................................................. 327 19.3 Registers Controlling Low-Voltage Detector ........................................................................ 327 19.4 Operation of Low-Voltage Detector........................................................................................ 330 19.5 Cautions for Low-Voltage Detector........................................................................................ 334 CHAPTER 20 MASK OPTIONS ........................................................................................................... 337 CHAPTER 21 PD78F0103................................................................................................................... 338 21.1 Internal Memory Size Switching Register ............................................................................. 339 21.2 Writing with Flash Programmer.............................................................................................. 340 21.3 Programming Environment..................................................................................................... 347 21.4 Communication Mode ............................................................................................................. 347 21.5 Handling of Pins on Board...................................................................................................... 351 21.5.1 VPP pin ..........................................................................................................................................351 21.5.2 Serial interface pins ......................................................................................................................351 21.5.3 RESET pin....................................................................................................................................353 21.5.4 Port pins .......................................................................................................................................353 21.5.5 Other signal pins...........................................................................................................................353 21.5.6 Power supply ................................................................................................................................353 21.6 Programming Method.............................................................................................................. 354 21.6.1 Controlling flash memory ..............................................................................................................354 21.6.2 Flash memory programming mode...............................................................................................354 21.6.3 Selecting communication mode....................................................................................................355 21.6.4 Communication commands ..........................................................................................................356 CHAPTER 22 INSTRUCTION SET ...................................................................................................... 357 22.1 Conventions Used in Operation List...................................................................................... 357 22.1.1 Operand identifiers and specification methods .............................................................................357 22.1.2 Description of operation column ...................................................................................................358 22.1.3 Description of flag operation column ............................................................................................358 22.2 Operation List........................................................................................................................... 359 User's Manual U15836EJ5V0UD 15 22.3 Instructions Listed by Addressing Type................................................................................ 367 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) ...................................... 370 CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS)........................................................... 388 CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) ................................ 405 CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) ................................ 420 CHAPTER 27 PACKAGE DRAWING................................................................................................... 430 CHAPTER 28 RECOMMENDED SOLDERING CONDITIONS........................................................... 431 CHAPTER 29 CAUTIONS FOR WAIT................................................................................................. 433 29.1 Cautions for Wait...................................................................................................................... 433 29.2 Peripheral Hardware That Generates Wait ............................................................................ 434 29.3 Example of Wait Occurrence .................................................................................................. 435 APPENDIX A DEVELOPMENT TOOLS............................................................................................... 436 A.1 Software Package..................................................................................................................... 440 A.2 Language Processing Software.............................................................................................. 440 A.3 Control Software ...................................................................................................................... 441 A.4 Flash Memory Writing Tools ................................................................................................... 441 A.5 Debugging Tools (Hardware) .................................................................................................. 442 A.5.1 When using in-circuit emulators IE-78K0-NS and IE-78K0-NS-A ................................................ 442 A.5.2 When using in-circuit emulator IE-78K0K1-ET............................................................................. 443 A.5.3 When using in-circuit emulator QB-78K0KX1H............................................................................ 444 A.6 Debugging Tools (Software) ................................................................................................... 445 APPENDIX B NOTES ON TARGET SYSTEM DESIGN ................................................................... 446 B.1 When Using IE-78K0-NS, IE-78K0-NS-A, or IE-78K0K1-ET .................................................. 446 B.2 When Using QB-78K0KX1H..................................................................................................... 448 APPENDIX C REGISTER INDEX ......................................................................................................... 449 C.1 Register Index (In Alphabetical Order with Respect to Register Names) .......................... 449 C.2 Register Index (In Alphabetical Order with Respect to Register Symbol) ......................... 452 APPENDIX D LIST OF CAUTIONS ..................................................................................................... 455 APPENDIX E REVISION HISTORY...................................................................................................... 475 E.1 Major Revisions in This Edition.............................................................................................. 475 E.2 Revision History of Previous Editions ................................................................................... 477 16 User's Manual U15836EJ5V0UD CHAPTER 1 OUTLINE 1.1 Expanded-Specification Products and Conventional Products (Standard Products, (A) Grade Products Only) The expanded-specification products and conventional products refer to the following products. Expanded-specification products: Products with a rankNote E or after * Mask ROM version for which order was received on or after mid-March, 2004 * Flash memory version for which order was received on or after mid-July, 2004 Conventional products: Products with rankNote I or K * Products other than the above expanded-specification products Note The rank is indicated by the 5th digit from the left in the 3rd column (lot number) marked on the package. x x x x Lot number Year Week code code Rank Expanded-specification products and conventional products of standard products and (A) grade products differ in the operating frequency ratings. Table 1-1 shows the differences between these products. Table 1-1. Differences Between Expanded-Specification Products and Conventional Products of Standard Products and (A) Grade Products Guaranteed Operating Speed Power Supply Voltage (VDD) (Minimum Instruction Execution Time) Conventional Products Expanded-Specification Products (Rank: I, K) (Rank: E or After) 12 MHz (0.166 s) Not used 4.0 to 5.5 V 10 MHz (0.2 s) 4.0 to 5.5 V 3.5 to 4.0 V 8.38 MHz (0.238 s) 3.3 to 4.0 V 3.0 to 3.5 V 5 MHz (0.4 s) 2.7 to 3.3 V 2.5 to 3.0 V Cautions 1. The specifications of the peripheral functions (such as the timer, serial interface, and A/D converter) at VDD = 2.7 to 5.5 V remain unchanged. Consequently when selecting the count clock or base clock of a peripheral function, set to satisfy the following conditions. * VDD = 4.0 to 5.5 V: Count clock or base clock 10 MHz * VDD = 3.3 to 4.0 V: Count clock or base clock 8.38 MHz * VDD = 2.7 to 3.3 V: Count clock or base clock 5 MHz * VDD = 2.5 to 2.7 V: Count clock or base clock 2.5 MHz 2. Rewrite the flash memory within the ranges of fX = 2 to 10 MHz and VDD = 2.7 to 5.5 V as before. User's Manual U15836EJ5V0UD 17 CHAPTER 1 OUTLINE 1.2 Features { Minimum instruction execution time can be changed from high speed (0.166 s: @ 12 MHz operation with X1 input clock) to low-speed (2.666 s: @ 12 MHz operation with X1 input clock) { General-purpose register: 8 bits x 32 registers (8 bits x 8 registers x 4 banks) { ROM, RAM capacities Part Number Program Memory Data Memory (ROM) (Internal High-Speed RAM) Item PD780101 Mask ROM 8 KB 512 bytes PD780102 16 KB 768 bytes PD780103 24 KB PD78F0103 Note Flash memory 24 KB Note The internal flash memory and internal high-speed RAM capacities can be changed using the internal memory size switching register (IMS). { On-chip power-on-clear (POC) circuit and low-voltage detector (LVI) { Short startup is possible via the CPU default start using the on-chip Ring-OSC { On-chip clock monitor function using on-chip Ring-OSC { On-chip watchdog timer (operable with Ring-OSC clock) { I/O ports: 22 { Timer: 5 channels { Serial interface: 2 channels UART (LIN (Local Interconnect Network)-bus supported): 1 channel CSI1/UARTNote 1: 1 channel (PD780101 only, CSI1: 1 channel) { 10-bit resolution A/D converter: 4 channels { Supply voltage: VDD = 2.5 to 5.5 VNotes 2, 3 (expanded-specification products of standard and (A) grade products) VDD = 2.7 to 5.5 VNotes 2, 3 (conventional products of standard and (A) grade products) VDD = 3.3 to 5.5 VNote 3 ((A1) grade and (A2) grade products) { Operating ambient temperature: TA = -40 to +85C (standard and (A) grade products) TA = -40 to +105C (flash memory version of (A1) grade product) TA = -40 to +110C (mask ROM version of (A1) grade product) TA = -40 to +125C (mask ROM version of (A2) grade product) Notes 1. Select either of the functions of these alternate-function pins. 2. If the POC circuit detection voltage (VPOC) is used with 2.85 V 0.15 V, then use the products in the voltage range of 3.0 to 5.5 V. 3. If the POC circuit detection voltage (VPOC) is used with 3.5 V 0.2 V, then use the products in the voltage range of 3.7 to 5.5 V. 18 User's Manual U15836EJ5V0UD CHAPTER 1 OUTLINE 1.3 Applications { Automotive equipment * System control for body electricals (power windows, keyless entry reception, etc.) * Sub-microcontrollers for control { Home audio, car audio { AV equipment { PC peripheral equipment (keyboards, etc.) { Household electrical appliances * Outdoor air conditioner units * Microwave ovens, electric rice cookers { Industrial equipment * Pumps * Vending machines * FA (Factory Automation) User's Manual U15836EJ5V0UD 19 CHAPTER 1 OUTLINE 1.4 Ordering Information (1) Mask ROM version Part Number PD780101MC-xxx-5A4 PD780102MC-xxx-5A4 PD780103MC-xxx-5A4 PD780101MC(A)-xxx-5A4 PD780102MC(A)-xxx-5A4 PD780103MC(A)-xxx-5A4 PD780101MC(A1)-xxx-5A4 PD780102MC(A1)-xxx-5A4 PD780103MC(A1)-xxx-5A4 PD780101MC(A2)-xxx-5A4 PD780102MC(A2)-xxx-5A4 PD780103MC(A2)-xxx-5A4 Package Quality Grade 30-pin plastic SSOP (7.62 mm (300)) Standard 30-pin plastic SSOP (7.62 mm (300)) Standard 30-pin plastic SSOP (7.62 mm (300)) Standard 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special (2) Flash memory version Part Number PD78F0103M1MC-5A4 PD78F0103M2MC-5A4 PD78F0103M3MC-5A4 PD78F0103M4MC-5A4 PD78F0103M5MC-5A4 PD78F0103M6MC-5A4 PD78F0103M1MC(A)-5A4 PD78F0103M2MC(A)-5A4 PD78F0103M3MC(A)-5A4 PD78F0103M4MC(A)-5A4 PD78F0103M5MC(A)-5A4 PD78F0103M6MC(A)-5A4 PD78F0103M1MC(A1)-5A4 PD78F0103M2MC(A1)-5A4 PD78F0103M5MC(A1)-5A4 PD78F0103M6MC(A1)-5A4 Remark Package Quality Grade 30-pin plastic SSOP (7.62 mm (300)) Standard 30-pin plastic SSOP (7.62 mm (300)) Standard 30-pin plastic SSOP (7.62 mm (300)) Standard 30-pin plastic SSOP (7.62 mm (300)) Standard 30-pin plastic SSOP (7.62 mm (300)) Standard 30-pin plastic SSOP (7.62 mm (300)) Standard 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special 30-pin plastic SSOP (7.62 mm (300)) Special xxx indicates ROM code suffix. Please refer to "Quality Grades on NEC Semiconductor Devices" (Document No. C11531E) published by NEC Electronics Corporation to know the specification of quality grade on the devices and its recommended applications. 20 User's Manual U15836EJ5V0UD CHAPTER 1 OUTLINE Mask ROM versions (PD780101, 780102, and 780103) include mask options. When ordering, it is possible to select "Power-on-clear (POC) circuit can be used/cannot be used" and "Ring-OSC can be stopped/cannot be stopped by software". Flash memory versions supporting the mask options of the mask ROM versions are as follows. Table 1-2. Flash Memory Versions Supporting Mask Options of Mask ROM Versions Flash Memory Versions Mask Option POC Circuit POC cannot be used POC used (VPOC = 2.85 V 0.15 V) POC used (VPOC = 3.5 V 0.2 V) Ring-OSC (Part Number) Cannot be stopped PD78F0103M1MC-5A4 PD78F0103M1MC(A)-5A4 PD78F0103M1MC(A1)-5A4 Can be stopped by software PD78F0103M2MC-5A4 PD78F0103M2MC(A)-5A4 PD78F0103M2MC(A1)-5A4 Cannot be stopped PD78F0103M3MC-5A4 PD78F0103M3MC(A)-5A4 Can be stopped by software PD78F0103M4MC-5A4 PD78F0103M4MC(A)-5A4 Cannot be stopped PD78F0103M5MC-5A4 PD78F0103M5MC(A)-5A4 PD78F0103M5MC(A1)-5A4 Can be stopped by software PD78F0103M6MC-5A4 PD78F0103M6MC(A)-5A4 PD78F0103M6MC(A1)-5A4 User's Manual U15836EJ5V0UD 21 CHAPTER 1 OUTLINE 1.5 Pin Configuration (Top View) * 30-pin plastic SSOP (7.62 mm (300)) P33/INTP4 1 30 P120/INTP0 P32/INTP3 2 29 AVSS P31/INTP2 3 28 AVREF P30/INTP1 4 27 P20/ANI0 IC (VPP) 5 26 P21/ANI1 VSS 6 25 P22/ANI2 VDD 7 24 P23/ANI3 X1 8 23 P130 X2 9 22 P17/TI50/TO50 RESET 10 21 P16/TOH1/INTP5 P03 11 20 P15/TOH0 P02 12 19 P14/RxD6 P01/TI010/TO00 13 18 P13/TxD6 P00/TI000 14 17 P12/SO10 P10/SCK10/TxD0Note 15 16 P11/SI10/RxD0Note Note TxD0 and RxD0 are available only in the PD780102, 780103, and 78F0103. Cautions 1. Connect the IC (Internally Connected) pin directly to VSS. 2. Connect the AVSS pin to VSS. 3. Connect the VPP pin to VSS during normal operation. Remark Figures in parentheses apply only to the PD78F0103. Pin Identification Analog input RxD0Note, RxD6: AVREF: Analog reference voltage SCK10: Serial clock input/output IC: Internally connected SI10: Serial data input INTP0 to INTP5: External interrupt input SO10: Serial data output P00 to P03: Port 0 TI000, TI010, TI50: Timer input P10 to P17: Port 1 TO00, TO50, TOH0, TOH1: Timer output P20 to P23: Port 2 TxD0Note, TxD6: Transmit data ANI0 to ANI3: Receive data P30 to P33: Port 3 VDD: Power supply P120: Port 12 VPP: Programming power supply P130: Port 13 VSS: Ground RESET: Reset X1, X2: Crystal oscillator (X1 input clock) Note TxD0 and RxD0 are available only in the PD780102, 780103, and 78F0103. 22 User's Manual U15836EJ5V0UD CHAPTER 1 OUTLINE 1.6 Kx1 Series Lineup 1.6.1 78K0/Kx1, 78K0/Kx1+ product lineup * 30-pin SSOP (7.62 mm 0.65 mm pitch) 78K0/KB1 PD78F0103 Two-power-supply flash memory: 24 KB, RAM: 768 B 78K0/KB1+ PD780103 Mask ROM: 24 KB, RAM: 768 B Single-power-supply flash memory: 24 KB, RAM: 768 B PD780102 Mask ROM: 16 KB, RAM: 768 B PD78F0102H Single-power-supply flash memory: 16 KB, RAM: 768 B PD780101 Mask ROM: 8 KB, RAM: 512 B PD78F0103H PD78F0101H Single-power-supply flash memory: 8 KB, RAM: 512 B * 44-pin LQFP (10 x 10 mm 0.8 mm pitch) 78K0/KC1 PD78F0114 Two-power-supply flash memory: 32 KB, RAM: 1 KB 78K0/KC1+ PD780114 Mask ROM: 32 KB, RAM: 1 KB PD780113 Mask ROM: 24 KB, RAM: 1 KB PD780112 Mask ROM: 16 KB, RAM: 512 B PD78F0114H/HDNote Single-power-supply flash memory: 32 KB, RAM: 1 KB PD78F0113H Single-power-supply flash memory: 24 KB, RAM: 1 KB PD78F0112H Single-power-supply flash memory: 16 KB, RAM: 512 B PD780111 Mask ROM: 8 KB, RAM: 512 B * 52-pin LQFP (10 x 10 mm 0.65 mm pitch) 78K0/KD1 PD78F0124 Two-power-supply flash memory: 32 KB, RAM: 1 KB 78K0/KD1+ PD780124 Mask ROM: 32 KB, RAM: 1 KB PD780123 Mask ROM: 24 KB, RAM: 1 KB PD780122 Mask ROM: 16 KB, RAM: 512 B PD78F0124H/HDNote Single-power-supply flash memory: 32 KB, RAM: 1 KB PD78F0123H Single-power-supply flash memory: 24 KB, RAM: 1 KB PD78F0122H Single-power-supply flash memory: 16 KB, RAM: 512 B PD780121 Mask ROM: 8 KB, RAM: 512 B * 64-pin LQFP, TQFP (10 x 10 mm 0.5 mm pitch, 12 x 12 mm 0.65 mm pitch, 14 x 14 mm 0.8 mm pitch) 78K0/KE1 PD78F0138 Two-power-supply flash memory: 60 KB, RAM: 2 KB PD78F0134 Two-power-supply flash memory: 32 KB, RAM: 1 KB 78K0/KE1+ PD780138 PD78F0138H/HDNote Mask ROM: 60 KB, RAM: 2 KB Single-power-supply flash memory: 60 KB, RAM: 2 KB PD780136 Mask ROM: 48 KB, RAM: 2 KB PD78F0136H Single-power-supply flash memory: 48 KB, RAM: 2 KB PD780134 PD78F0134H Mask ROM: 32 KB, RAM: 1 KB Single-power-supply flash memory: 32 KB, RAM: 1 KB PD780133 Mask ROM: 24 KB, RAM: 1 KB Single-power-supply flash memory: 24 KB, RAM: 1 KB PD780132 Mask ROM: 16 KB, RAM: 512 B PD78F0133H PD78F0132H Single-power-supply flash memory: 16 KB, RAM: 512 B PD780131 Mask ROM: 8 KB, RAM: 512 B * 80-pin TQFP, QFP (12 x 12 mm 0.5 mm pitch, 14 x 14 mm 0.65 mm pitch) 78K0/KF1 PD78F0148 Two-power-supply flash memory: 60 KB, RAM: 2 KB 78K0/KF1+ PD780148 Mask ROM: 60 KB, RAM: 2 KB PD78F0148H/HDNote Single-power-supply flash memory: 60 KB, RAM: 2 KB PD780146 Mask ROM: 48 KB, RAM: 2 KB PD780144 Mask ROM: 32 KB, RAM: 1 KB PD780143 Mask ROM: 24 KB, RAM: 1 KB Note Product with on-chip debug function User's Manual U15836EJ5V0UD 23 CHAPTER 1 OUTLINE The list of functions in the 78K0/Kx1 is shown below. Part Number 78K0/KB1 78K0/KC1 78K0/KD1 78K0/KE1 78K0/KF1 Item Number of pins Internal memory (KB) 30 pins Mask ROM 8 - Flash memory RAM 16/ 24 44 pins - 8/ 16 - 24 0.5 0.75 52 pins - 24/ 32 8/ 16 - 32 0.5 1 Minimum instruction execution time Clock 1 0.166 s (when 12 MHz, VDD = 4.0 to 5.5 V) 0.2 s (when 10 MHz, VDD = 3.5 to 5.5 V) 0.238 s (when 8.38 MHz, VDD = 3.0 to 5.5 V) 0.4 s (when 5 MHz, VDD = 2.5 to 5.5 V) X1 input 32 - 1 - 24/ 32 - 48/ 60 - 60 2 60 1 2 Notes 1, 2 32.768 kHz 240 kHz (TYP.) CMOS I/O 17 CMOS input 4 19 26 38 54 8 CMOS output 1 - 4 16 bits (TM0) 1 ch 8 bits (TM5) 1 ch 2 ch 1 ch 2 ch 1 ch 2 ch 2 ch 8 bits (TMH) 2 ch - For watch 1 ch WDT 1 ch Note 3 3-wire CSI Serial interface Automatic transmit/ receive 3-wire CSI Note 3 UART 1 ch - 1 ch UART supporting LIN-bus 1 ch 4 ch External Internal Key return input 8 ch 6 11 7 12 8 - Standby function Operating ambient temperature 17 20 Provided 2.85 V 0.15 V/3.5 V 0.20 V (selectable by mask option) 2.85 V/3.1 V/3.3 V 0.15 V/3.5 V/3.7 V/3.9 V/4.1 V/4.3 V 0.2 V (selectable by software) Provided WDT ROM correction 9 19 8 ch Clock monitor Multiplier/divider 16 4 ch POC Clock output/buzzer output 9 15 RESET pin LVI 2 ch 1 ch - 10-bit A/D converter Reset 48/ 60 2 to 12 MHz - N-ch open-drain I/O Interrupt - 80 pins - 0.166 s (when 12 MHz, VDD = 4.0 to 5.5 V) 0.2 s (when 10 MHz, VDD = 3.5 to 5.5 V) 0.238 s (when 8.38 MHz, VDD = 3.0 to 5.5 V) 0.4 s (when 5 MHz, VDD = 2.5 to 5.5 V) Ring-OSC Timer 24/ 32 0.5 VDD = 2.5 to 5.5 V Subclock Port 8/ 16 32 0.5 Power supply voltage 64 pins - 24/ 32 Provided - Provided Clock output only 16 bits x 16 bits, 32 bits / 16 bits - - Provided - HALT/STOP mode Standard and special (A) grade products: -40 to +85C Special (A1) grade products: -40 to +110C (mask ROM version), -40 to +105C (flash memory version) Special (A2) grade products: -40 to +125C (mask ROM version) Notes 1. If the POC circuit detection voltage (VPOC) is used with 2.85 V 0.15 V, then use the products in the voltage range of 3.0 to 5.5 V. 2. If the POC circuit detection voltage (VPOC) is used with 3.5 V 0.2 V, then use the products in the voltage range of 3.7 to 5.5 V. 3. Select either of the functions of these alternate-function pins. 24 User's Manual U15836EJ5V0UD CHAPTER 1 OUTLINE The list of functions in the 78K0/Kx1+ is shown below. Part Number 78K0/KB1+ 78K0/KC1+ 78K0/KD1+ 78K0/KE1+ 78K0/KF1+ 64 pins 80 pins Item Number of pins Internal memory (KB) 30 pins Flash memory RAM 52 pins 16/24 16 24/32 16 24/32 16 24/32 48/60 60 0.5 0.75 0.5 1 0.5 1 0.5 1 2 2 Power supply voltage VDD = 2.5 to 5.5 V (with Ring-OSC clock or subclock: VDD = 2.0 to 5.5 V Crystal/ceramic - 3 to 4 MHz - Subclock 32.768 kHz Ring-OSC 240 kHz (TYP.) CMOS I/O 17 CMOS input 4 19 26 54 1 - 4 16 bits (TM0) 1 ch 8 bits (TM5) 2 ch 1 ch 2 ch 8 bits (TMH) 2 ch - For watch 1 ch WDT 1 ch Note 2 Serial 3-wire CSI interface Automatic transmit/ receive 3-wire CSI Note 2 UART 1 ch 2 ch - 1 ch - 1 ch UART supporting LIN-bus 1 ch 10-bit A/D converter 4 ch Interrupts External 6 Internal Key return input Reset 38 8 CMOS output N-ch open-drain I/O Timer 11 8 ch 7 12 8 16 Provided 2.1 V 0.1 V (detection voltage is fixed) 2.35 V/2.6 V/2.85 V/3.1 V/3.3 V 0.15 V/3.5 V/3.7 V/3.9 V/4.1 V/4.3 V 0.2 V (selectable by software) Clock monitor Provided Provided - Clock output only ROM correction Provided - External bus interface Multiplier/divider 20 8 ch WDT Clock output/buzzer output 9 19 4 ch POC LVI 9 15 - RESET pin Provided 16 bits x 16 bits, 32 bits / 16 bits - - Provided Self-programming function Provided Product with on-chip debug function PD78F0114HD, 78F0124HD, 78F0138HD, 78F0148HD Standby function HALT/STOP mode Operating ambient temperature TA = -40 to +85C Notes 1. ) 2 to 16 MHz RC Ports Note 1 0.125 s (when 16 MHz, VDD = 4.0 to 5.5 V), 0.2 s (when 10 MHz, VDD = 3.5 to 5.5 V), 0.238 s (when 8.38 MHz, VDD = 3.0 to 5.5 V), 0.4 s (when 5 MHz, VDD = 2.5 to 5.5 V) Minimum instruction execution time Clock 44 pins 8 - Because the POC circuit detection voltage (VPOC) is 2.1 V 0.1 V, use the products in the voltage range of 2.2 to 5.5 V. 2. Select either of the functions of these alternate-function pins. User's Manual U15836EJ5V0UD 25 CHAPTER 1 OUTLINE 1.6.2 V850ES/Kx1, V850ES/Kx1+ product lineup * 64-pin plastic LQFP (10 x 10 mm, 0.5 mm pitch) * 64-pin plastic TQFP (12 x 12 mm, 0.65 mm pitch) * 64-pin plastic LQFP (14 x 14 mm, 0.8 mm pitch) V850ES/KE1 PD70F3207HY PD70F3207H Single-power-supply flash memory: 128 KB, RAM: 4 KB PD703207Y PD703207 Mask ROM: 128 KB, RAM: 4 KB PD703206Y V850ES/KE1+ PD70F3302Y PD70F3302 Single-power-supply flash memory: 128 KB, RAM: 4 KB PD703302Y PD703302 Mask ROM: 128 KB, RAM: 4 KB PD703301Y PD703206 Mask ROM: 96 KB, PD703301 Mask ROM: 96 KB, RAM: 4 KB RAM: 4 KB * 80-pin plastic TQFP (12 x 12 mm, 0.5 mm pitch) * 80-pin plastic QFP (14 x 14 mm, 0.65 mm pitch) V850ES/KF1 V850ES/KF1+ PD70F3211HY PD70F3211H Single-power-supply flash memory: 256 KB, PD703211Y PD703211 Mask ROM: 256 KB, PD70F3308Y PD70F3308 Single-power-supply flash memory: 256 KB, PD703308Y PD703308 Mask ROM: 256 KB, RAM: 12 KB RAM: 12 KB RAM: 12 KB RAM: 12 KB PD70F3210HY PD70F3210H Single-power-supply flash memory: 128 KB, PD703210Y PD703210 Mask ROM: 128 KB, RAM: 6 KB PD70F3210Y RAM: 4 KB PD703209Y PD70F3306Y PD70F3306 Single-power-supply flash memory: 128 KB, PD70F3210 Two-power-supply flash memory: 128 KB, PD703209 Mask ROM: 96 KB, RAM: 6 KB RAM: 6 KB RAM: 4 KB PD703208Y PD703208 Mask ROM: 64 KB, RAM: 4 KB * 100-pin plastic LQFP (14 x 14 mm, 0.5 mm pitch) * 100-pin plastic QFP (14 x 20 mm, 0.65 mm pitch) V850ES/KG1 V850ES/KG1+ PD70F3215HY PD70F3215H Single-power-supply flash memory: 256 KB, PD703215Y PD703215 Mask ROM: 256 KB, PD70F3313Y PD70F3313 Single-power-supply flash memory: 256 KB, PD703313Y PD703313 Mask ROM: 256 KB, RAM: 16 KB RAM: 16 KB RAM: 16 KB RAM: 16 KB PD70F3214HY PD703214Y PD70F3214H Single-power-supply flash memory: 128 KB, PD703214 Mask ROM: 128 KB, RAM: 6 KB PD70F3214Y RAM: 6 KB PD703213Y PD70F3214 Two-power-supply flash memory: 128 KB, PD703213 Mask ROM: 96 KB, RAM: 6 KB PD70F3311Y PD70F3311 Single-power-supply flash memory: 128 KB, RAM: 6 KB RAM: 4 KB PD703212Y PD703212 Mask ROM: 64 KB, RAM: 4 KB * 144-pin plastic LQFP (20 x 20 mm, 0.5 mm pitch) V850ES/KJ1 PD70F3218HY PD703218Y V850ES/KJ1+ PD70F3318Y PD703218 Mask ROM: 256 KB, PD70F3318 Single-power-supply flash memory: 256 KB, PD703318 Mask ROM: 256 KB, RAM: 16 KB RAM: 16 KB RAM: 16 KB RAM: 16 KB PD70F3217HY PD703217Y PD70F3217H Single-power-supply flash memory: 128 KB, PD703217 Mask ROM: 128 KB, RAM: 6 KB PD70F3217Y RAM: 6 KB PD703216Y PD70F3217 Two-power-supply flash memory: 128 KB, PD703216 Mask ROM: 96 KB, PD70F3316Y PD70F3316 Single-power-supply flash memory: 128 KB, RAM: 6 KB RAM: 4 KB RAM: 6 KB 26 PD703318Y PD70F3218H Single-power-supply flash memory: 256 KB, User's Manual U15836EJ5V0UD CHAPTER 1 OUTLINE The list of functions in the V850ES/Kx1 is shown below. Part Number V850ES/KE1 V850ES/KF1 V850ES/KG1 V850ES/KJ1 Item Number of pins Internal memory (KB) Mask ROM 64 pins Flash memory RAM 80 pins - 96/128 - 128 4 64/ 128 96 - - 4 100 pins - 256 - 128 - 256 6 64/ 128 96 12 - - 4 VDD = 2.7 to 5.5 V Minimum instruction execution time 50 ns @ 20 MHz X1 input 2 to 10 MHz Subclock 32.768 kHz Timer 96/ 128 128 - 256 - 16 - 256 128 - 6 8 8 8 16 CMOS I/O 43 59 76 112 N-ch open-drain I/O 1 2 4 6 256 - 1 ch 2 ch 4 ch 6 ch 8 bits (TM5) 2 ch 2 ch 2 ch 2 ch 8 bits (TMH) 2 ch 2 ch 2 ch 2 ch Interval timer 1 ch 1 ch 1 ch 1 ch For watch 1 ch 1 ch 1 ch 1 ch WDT1 1 ch 1 ch 1 ch 1 ch WDT2 1 ch 1 ch 1 ch 1 ch 6 bits x 1 ch 6 bits x 1 ch 6 bits x 1 ch 6 bits x 2 ch 2 ch 2 ch 2 ch 3 ch - 1 ch 2 ch 2 ch 2 ch 2 ch 2 ch 3 ch - - - - UART supporting LIN-bus 2 Note IC 1 ch - 1 ch 16 bits (TM0) UART 1 ch - 16 bits (TMP) Serial CSI interface Automatic transmit/ receive 3-wire CSI 1 ch 1 ch 1 ch 1 ch 2 ch Address space - 128 KB 3 MB 15 MB Address bus - 16 bits 22 bits 24 bits - Multiplexed mode only - - - - 8 ch 8 ch 8 ch 16 ch 8-bit D/A converter - - 2 ch 2 ch Interrupts External 8 8 8 Mode DMA controller 10-bit A/D converter Internal Key return input Reset - 16 CMOS input RTO External bus - - Ring-OSC Ports 256 6 Power supply voltage Clock 144 pins - 26 26 8 ch 29 40 43 8 ch Provided Not provided LVI Not provided Clock monitor Not provided WDT1 Provided WDT2 Provided ROM correction Operating ambient temperature 8 34 8 ch POC Standby function 31 8 ch RESET pin Regulator Multiplexed/separate mode 4 points Not provided Provided HALT/IDLE/STOP/sub-IDLE mode TA = -40 to +85C Note Provided in the Y version only. User's Manual U15836EJ5V0UD 27 CHAPTER 1 OUTLINE The list of functions in the V850ES/Kx1+ is shown below. Part Number V850ES/KE1+ V850ES/KF1+ V850ES/KG1+ V850ES/KJ1+ Item Number of pins Internal memory (KB) Mask ROM 64 pins 80 pins 100 pins - 128 256 - 128/256 - 128/256 - - 128 - - 256 - 256 - 256 6 16 6 16 Flash memory RAM 4 6 12 Power supply voltage VDD = 2.7 to 5.5 V Minimum instruction execution time 50 ns @ 20 MHz Clock Ports X1 input 2 to 10 MHz Subclock 32.768 kHz Ring-OSC 240 kHz (TYP.) CMOS input 8 8 8 16 CMOS I/O 43 59 76 112 N-ch open-drain I/O Timer 144 pins 96/128 1 2 16 bits (TMP) 1 ch 1 ch 1 ch 4 1 ch 6 16 bits (TM0) 1 ch 2 ch 4 ch 6 ch 8 bits (TM5) 2 ch 2 ch 2 ch 2 ch 8 bits (TMH) 2 ch 2 ch 2 ch 2 ch Interval timer 1 ch 1 ch 1 ch 1 ch For watch 1 ch 1 ch 1 ch 1 ch WDT1 1 ch 1 ch 1 ch 1 ch WDT2 1 ch 1 ch 1 ch 1 ch 6 bits x 1 ch 6 bits x 1 ch 6 bits x 1 ch 6 bits x 2 ch 2 ch 2 ch 2 ch 3 ch - 1 ch 2 ch 2 ch UART 1 ch 1 ch 1 ch 2 ch UART supporting LIN-bus 1 ch 1 ch 1 ch 1 ch 1 ch 1 ch 1 ch 2 ch Address space - 128 KB 3 MB 15 MB Address bus - 16 bits 22 bits 24 bits Mode - Multiplexed mode only - - 4 ch 4 ch 10-bit A/D converter 8 ch 8 ch 8 ch 16 ch 8-bit D/A converter - - 2 ch 2 ch Interrupts External 9 9 9 9 27 30 42 48 8 ch 8 ch 8 ch 8 ch RTO Serial CSI interface Automatic transmit/ receive 3-wire CSI 2 Note IC External bus DMA controller Internal Key return input Reset RESET pin Provided POC LVI Fixed to 2.7 V or lower 3.1 V/3.3 V 0.15 V or 3.5 V/3.7 V/3.9 V/4.1 V/4.3 V 0.2 V (selectable by software) Clock monitor Provided (monitoring by Ring-OSC) WDT1 Provided WDT2 Provided ROM correction Regulator Standby function Operating ambient temperature 4 points Not provided Provided HALT/IDLE/STOP/sub-IDLE mode TA = -40 to +85C Note Provided in the Y version only. 28 Multiplexed/separate mode User's Manual U15836EJ5V0UD CHAPTER 1 OUTLINE 1.7 Block Diagram TO00/TI010/P01 TI000/P00 16-bit timer/ event counter 00 TOH0/P15 8-bit timer H0 TOH1/P16 8-bit timer H1 78K/0 CPU core 8-bit timer/ event counter 50 TI50/TO50/P17 ROM (Flash memory) Port 0 4 P00 to P03 Port 1 8 P10 to P17 Port 2 4 P20 to P23 Port 3 4 P30 to P33 Port 12 P120 Port 13 P130 Watchdog timer Clock monitor RxD0Note/P11 TxD0Note/P10 Serial interface UART0Note RxD6/P14 TxD6/P13 Serial interface UART6 SI1/P11 SO10/P12 SCK10/P10 Serial interface CSI10 Ring-OSC A/D converter System control ANI0/P20 to ANI3/P23 AVREF AVSS Power-on-clear/ low voltage indicator Internal high-speed RAM POC/LVI control Reset control 4 RESET X1 X2 INTP0/P120 INTP1/P30 to INTP4/P33 Interrupt control 4 VDD VSS IC (VPP) Note PD780102, 780103, and 78F0103 only. Remark Items in parentheses are available only in the PD78F0103. User's Manual U15836EJ5V0UD 29 CHAPTER 1 OUTLINE 1.8 Outline of Functions (1/2) PD780101 Item Internal memory PD780102 ROM 8 KB 16 KB High-speed RAM 512 bytes 768 bytes PD780103 24 KB Memory space 64 KB X1 input clock (oscillation frequency) Ceramic/crystal/external clock oscillation Expandedspecification products of standard and (A) grade products 2 to 12 MHz: VDD = 4.0 to 5.5 V, 2 to 10 MHz: VDD = 3.5 to 5.5 V, 2 to 8.38 MHz: VDD = 3.0 to 5.5 V, 2 to 5 MHz: VDD = 2.5 to 5.5 V Conventional products of standard and (A) grade products 2 to 10 MHz: VDD = 4.0 to 5.5 V, 2 to 8.38 MHz: VDD = 3.3 to 5.5 V, 2 to 5 MHz: VDD = 2.7 to 5.5 V (A1) grade products 2 to 10 MHz: VDD = 4.5 to 5.5 V, 2 to 8.38 MHz: VDD = 4.0 to 5.5 V, 2 to 5 MHz: VDD = 3.3 to 5.5 V (A2) grade products 2 to 8.38 MHz: VDD = 4.0 to 5.5 V, 2 to 5 MHz: VDD = 3.3 to 5.5 V PD78F0103 24 KB (flash memory) Ring-OSC clock (oscillation frequency) On-chip Ring oscillation (240 kHz (TYP.): VDD = 2.5 to 5.5 V) General-purpose registers 8 bits x 32 registers (8 bits x 8 registers x 4 banks) Minimum instruction execution time 0.166 s/0.333 s/0.666 s/1.333 s/2.666 s (X1 input clock: @ fXP = 12 MHz operation) 8.3 s/16.6 s/33.2 s/66.4 s/132.8 s (TYP.) (Ring-OSC clock: @ fR = 240 kHz (TYP.) operation) Instruction set * * * * I/O ports Total: 22 CMOS I/O CMOS input CMOS output 17 4 1 Timers * * * * Timer outputs 16-bit operation Multiply/divide (8 bits x 8 bits, 16 bits / 8 bits) Bit manipulate (set, reset, test, and Boolean operation) BCD adjust, etc. 16-bit timer/event counter: 8-bit timer/event counter: 8-bit timer: Watchdog timer: 1 channel 1 channel 2 channels 1 channel 4 (PWM: 3) A/D converter 10-bit resolution x 4 channels Serial interface * UART mode supporting LIN-bus: 1 channel Note * 3-wire serial I/O mode/UART mode : 1 channel (PD780101 only, 3-wire serial I/O mode: 1 channel) Vectored interrupt sources Reset Internal 10 External 6 * * * * * 12 Reset using RESET pin Internal reset by watchdog timer Internal reset by clock monitor Internal reset by power-on-clear Internal reset by low-voltage detector Note Select either of the functions of these alternate-function pins. 30 User's Manual U15836EJ5V0UD CHAPTER 1 OUTLINE (2/2) PD780101 Item PD780102 PD780103 PD78F0103 Supply voltage * Expanded-specification products of standard and (A) grade products: VDD = 2.5 to 5.5 Notes 1, 2 V Notes 1, 2 * Conventional products of standard and (A) grade products: VDD = 2.7 to 5.5 V Note 2 * (A1) grade and (A2) grade products: VDD = 3.3 to 5.5 V Operating ambient temperature * Standard and (A) grade products: TA = -40 to +85C * (A1) grade products: TA = -40 to +110C (mask ROM version), -40 to +105C (flash memory version) * (A2) grade products: TA = -40 to +125C (mask ROM version) Package 30-pin plastic SSOP (7.62 mm (300)) Notes 1. If the POC circuit detection voltage (VPOC) is used with 2.85 V 0.15 V, then use the products in the voltage range of 3.0 to 5.5 V. 2. If the POC circuit detection voltage (VPOC) is used with 3.5 V 0.2 V, then use the products in the voltage range of 3.7 to 5.5 V. An outline of the timer is shown below. 16-Bit Timer/Event 8-Bit Timer/Event Counter 00 Counter 50 TMH0 TMH1 8-Bit Timers H0 and H1 Watchdog Timer Operation Interval timer 1 channel 1 channel 1 channel 1 channel - mode External event counter 1 channel 1 channel - - - - - - - 1 channel Timer output 1 output 1 output 1 output 1 output - PPG output 1 output - - - - PWM output - 1 output 1 output 1 output - Pulse width measurement 2 inputs - - - - Square-wave output 1 output 1 output 1 output 1 output - 2 1 1 1 - Watchdog timer Function Interrupt source User's Manual U15836EJ5V0UD 31 CHAPTER 2 PIN FUNCTIONS 2.1 Pin Function List There are two types of pin I/O buffer power supplies: AVREF and VDD. The relationship between these power supplies and the pins is shown below. Table 2-1. Pin I/O Buffer Power Supplies Power Supply Corresponding Pins AVREF P20 to P23 VDD Pins other than P20 to P23 (1) Port pins Pin Name P00 I/O I/O Port 0. After Reset Input 4-bit I/O port. P01 Alternate Function TI000 TI010/TO00 Input/output can be specified in 1-bit units. P02 - Use of an on-chip pull-up resistor can be specified by a P03 P10 Function software setting. I/O Port 1. Input 8-bit I/O port. P11 SI10/RxD0 Input/output can be specified in 1-bit units. P12 Note SO10 Use of an on-chip pull-up resistor can be specified by a P13 Note SCK10/TxD0 TxD6 software setting. P14 RxD6 P15 TOH0 P16 TOH1/INTP5 P17 TI50/TO50 P20 to P23 Input Port 2. Input ANI0 to ANI3 Input INTP1 to INTP4 Input INTP0 4-bit input-only port. P30 to P33 I/O Port 3. 4-bit I/O port. Input/output can be specified in 1-bit units. Use of an on-chip pull-up resistor can be specified by a software setting. P120 I/O Port 12. 1-bit I/O port. Use of an on-chip pull-up resistor can be specified by a software setting. P130 Output Port 13. Output 1-bit output-only port. Note TxD0 and RxD0 are available only in the PD780102, 780103, and 78F0103. 32 User's Manual U15836EJ5V0UD - CHAPTER 2 PIN FUNCTIONS (2) Non-port pins Pin Name INTP0 I/O Input Function External interrupt request input for which the valid edge (rising After Reset P120 Input edge, falling edge, or both rising and falling edges) can be INTP1 to INTP4 P30 to P33 specified INTP5 Alternate Function P16/TOH1 SI10 Input Serial data input to serial interface Input P11/RxD0 SO10 Output Serial data output from serial interface Input P12 SCK10 I/O Clock input/output for serial interface Input P10/TxD0 Input Serial data input to asynchronous serial interface Input P11/SI10 Note RxD0 RxD6 TxD0 Note Note P14 Output Serial data output from asynchronous serial interface Input P10/SCK10 Input External count clock input to 16-bit timer/event counter 00 Input P00 TxD6 TI000 Note P13 Capture trigger input to capture registers (CR000, CR010) of 16-bit timer/event counter 00 Capture trigger input to capture register (CR000) of 16-bit TI010 P01/TO00 timer/event counter 00 TO00 Output 16-bit timer/event counter 00 output Input P01/TI010 TI50 Input External count clock input to 8-bit timer/event counter 50 Input P17/TO50 TO50 Output 8-bit timer/event counter 50 output Input P17/TI50 TOH0 Output 8-bit timer H0 output Input P15 TOH1 8-bit timer H1 output ANI0 to ANI3 Input A/D converter analog input AVREF Input A/D converter reference voltage input and positive power P16/INTP5 Input P20 to P23 - - - - supply for port 2 AVSS - A/D converter ground potential. Make the same potential as VSS. RESET Input System reset input - - X1 Input Connecting resonator for X1 input clock - - X2 - - - VDD - Positive power supply - - VSS - Ground potential - - IC - Internally connected. Connect directly to VSS. - - VPP - Flash memory programming mode setting. High-voltage - - application for program write/verify. Connect to VSS in normal operation mode. Note TxD0 and RxD0 are available only in the PD780102, 780103, and 78F0103. User's Manual U15836EJ5V0UD 33 CHAPTER 2 PIN FUNCTIONS 2.2 Description of Pin Functions 2.2.1 P00 to P03 (port 0) P00 to P03 function as a 4-bit I/O port. These pins also function as timer I/O. The following operation modes can be specified in 1-bit units. (1) Port mode P00 to P03 function as a 4-bit I/O port. P00 to P03 can be set to input or output in 1-bit units using port mode register 0 (PM0). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 0 (PU0). (2) Control mode P00 to P03 function as timer I/O. (a) TI000 This is the pins for inputting an external count clock to 16-bit timer/event counter 00 and is also for inputting a capture trigger signal to the capture registers (CR000, CR010) of 16-bit timer/event counter 00. (b) TI010 This is the pin for inputting a capture trigger signal to the capture register (CR000) of 16-bit timer/event counter 00. (c) TO00 This is a timer output pin. 2.2.2 P10 to P17 (port 1) P10 to P17 function as an 8-bit I/O port. These pins also function as pins for external interrupt request input, serial interface data I/O, clock I/O, and timer I/O. The following operation modes can be specified in 1-bit units. (1) Port mode P10 to P17 function as an 8-bit I/O port. P10 to P17 can be set to input or output in 1-bit units using port mode register 1 (PM1). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 1 (PU1). (2) Control mode P10 to P17 function as external interrupt request input, serial interface data I/O, clock I/O, and timer I/O. (a) SI10 This is a serial data input pin of the serial interface. (b) SO10 This is a serial data output pin of the serial interface. (c) SCK10 This is a serial clock I/O pin of the serial interface. (d) RxD0Note, RxD6 These are the serial data input pins of the asynchronous serial interface. 34 User's Manual U15836EJ5V0UD CHAPTER 2 PIN FUNCTIONS (e) TxD0Note, TxD6 These are serial data output pins of the asynchronous serial interface. Note TxD0 and RxD0 are available only in the PD780102, 780103, and 78F0103. (f) TI50 This is the pin for inputting an external count clock to 8-bit timer/event counter 50. (g) TO50, TOH0, and TOH1 These are timer output pins. (h) INTP5 This is an external interrupt request input pin for which the valid edge (rising edge, falling edge, or both rising and falling edges) can be specified. 2.2.3 P20 to P23 (port 2) P20 to P23 function as a 4-bit input-only port. These pins also function as pins for A/D converter analog input. The following operation modes can be specified in 1-bit units. (1) Port mode P20 to P23 function as a 4-bit input-only port. (2) Control mode P20 to P23 function as A/D converter analog input pins (ANI0 to ANI3). When using these pins as analog input pins, see (5) ANI0/P20 to ANI3/P23 in 10.6 Cautions for A/D Converter. 2.2.4 P30 to P33 (port 3) P30 to P33 function as a 4-bit I/O port. These pins also function as pins for external interrupt request input. The following operation modes can be specified in 1-bit units. (1) Port mode P30 to P33 function as a 4-bit I/O port. P30 to P33 can be set to input or output in 1-bit units using port mode register 3 (PM3). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 3 (PU3). (2) Control mode P30 to P33 function as external interrupt request input pins (INTP1 to INTP4) for which the valid edge (rising edge, falling edge, or both rising and falling edges) can be specified. 2.2.5 P120 (port 12) P120 functions as a 1-bit I/O port. This pin also functions as a pin for external interrupt request input. The following operation modes can be specified. (1) Port mode P120 functions as a 1-bit I/O port. P120 can be set to input or output using port mode register 12 (PM12). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 12 (PU12). User's Manual U15836EJ5V0UD 35 CHAPTER 2 PIN FUNCTIONS (2) Control mode P120 functions as an external interrupt request input pin (INTP0) for which the valid edge (rising edge, falling edge, or both rising and falling edges) can be specified. 2.2.6 P130 (port 13) P130 functions as a 1-bit output-only port. 2.2.7 AVREF This is the A/D converter reference voltage input pin. When A/D converter is not used, connect this pin directly to VDD. 2.2.8 AVSS This is the A/D converter ground potential pin. Even when the A/D converter is not used, always use this pin with the same potential as the VSS pin. 2.2.9 RESET This is the active-low system reset input pin. 2.2.10 X1 and X2 These are the pins for connecting a resonator for X1 input clock oscillation. When supplying an external clock, input a signal to the X1 pin and input the inverse signal to the X2 pin. 2.2.11 VDD This is the positive power supply pin. 2.2.12 VSS This is the ground potential pin. 2.2.13 VPP (flash memory versions only) This is a pin for flash memory programming mode setting and high-voltage application for program write/verify. Connect to VSS in the normal operation mode. 2.2.14 IC (mask ROM versions only) The IC (Internally Connected) pin is provided to set the test mode to check the 78K0/KB1 at shipment. Connect it directly to VSS with the shortest possible wire in the normal operation mode. When a potential difference is produced between the IC pin and the VSS pin because the wiring between these two pins is too long or external noise is input to the IC pin, the user's program may not operate normally. * Connect the IC pin directly to VSS. VSS IC As short as possible 36 User's Manual U15836EJ5V0UD CHAPTER 2 PIN FUNCTIONS 2.3 Pin I/O Circuits and Recommended Connection of Unused Pins Table 2-2 shows the types of pin I/O circuit and the recommended connections of unused pins. See Figure 2-1 for the configuration of the I/O circuits of each type. Table 2-2. Pin I/O Circuit Types Pin Name I/O Circuit Type 8-A P00/TI000 I/O Recommended Connection of Unused Pins Input: I/O Independently connect to VDD or VSS via a resistor. Output: Leave open. P01/TI010/TO00 P02 P03 P10/SCK10/TxD0 P11/SI10/RxD0 Note Note P12/SO10 5-A P13/TxD6 P14/RxD6 8-A P15/TOH0 5-A P16/TOH1/INTP5 8-A P17/TI50/TO50 P20/ANI0 to P23/ANI3 9-C Input P30/INTP1 to P33/INTP4 8-A I/O Connect to VDD or VSS. Input: Independently connect to VSS via a resistor. Output: Leave open. Input: P120/INTP0 Independently connect to VDD or VSS via a resistor. Output: Leave open. P130 3-C Output Leave open. RESET 2 Input Connect to VDD. Input Connect directly to VDD. - Connect directly to VSS. AVREF AVSS - IC VPP Connect to VSS. Note TxD0 and RxD0 are available only in the PD780102, 780103, and 78F0103. User's Manual U15836EJ5V0UD 37 CHAPTER 2 PIN FUNCTIONS Figure 2-1. Pin I/O Circuit List Type 8-A Type 2 VDD Pull-up enable P-ch IN VDD Data P-ch IN/OUT Schmitt-triggered input with hysteresis characteristics Output disable N-ch Type 9-C Type 3-C VDD IN P-ch Data Comparator P-ch + N-ch - AVSS OUT VREF (threshold voltage) N-ch Input enable Type 5-A VDD Pull-up enable P-ch VDD Data P-ch IN/OUT Output disable N-ch Input enable 38 User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE 3.1 Memory Space Products in the 78K0/KB1 can each access a 64 KB memory space. Figures 3-1 to 3-4 show the memory maps. Caution Regardless of the internal memory capacity, the initial values of internal memory size switching register (IMS) of all products in the 78K0/KB1 are fixed (IMS = CFH). Therefore, set the value corresponding to each product as indicated below. Table 3-1. Internal Memory Size Switching Register (IMS) Set Value Internal Memory Size Switching Register (IMS) PD780101 42H PD780102 04H PD780103 06H PD78F0103 Value corresponding to mask ROM version User's Manual U15836EJ5V0UD 39 CHAPTER 3 CPU ARCHITECTURE Figure 3-1. Memory Map (PD780101) F F F FH Special function registers (SFR) 256 x 8 bits F F 0 0H F E F FH F E E 0H F E D FH General-purpose registers 32 x 8 bits Internal high-speed RAM 512 x 8 bits 1 F F FH F D 0 0H F C F FH Program area Data memory space 1 0 0 0H 0 F F FH CALLF entry area Reserved 0 8 0 0H 0 7 F FH Program area 0 0 8 0H 0 0 7 FH 2 0 0 0H 1 F F FH Program memory space CALLT table area Internal ROM 8192 x 8 bits 0 0 0 0H 40 0 0 4 0H 0 0 3 FH Vector table area 0 0 0 0H User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE Figure 3-2. Memory Map (PD780102) F F F FH Special function registers (SFR) 256 x 8 bits F F 0 0H F E F FH F E E 0H F E D FH General-purpose registers 32 x 8 bits Internal high-speed RAM 768 x 8 bits 3 F F FH F C 0 0H F B F FH Program area Data memory space 1 0 0 0H 0 F F FH CALLF entry area Reserved 0 8 0 0H 0 7 F FH Program area 0 0 8 0H 0 0 7 FH CALLT table area 4 0 0 0H 3 F F FH Program memory space Internal ROM 16384 x 8 bits 0 0 4 0H 0 0 3 FH Vector table area 0 0 0 0H 0 0 0 0H User's Manual U15836EJ5V0UD 41 CHAPTER 3 CPU ARCHITECTURE Figure 3-3. Memory Map (PD780103) F F F FH Special function registers (SFR) 256 x 8 bits F F 0 0H F E F FH F E E 0H F E D FH General-purpose registers 32 x 8 bits Internal high-speed RAM 768 x 8 bits 5 F F FH F C 0 0H F B F FH Program area Data memory space 1 0 0 0H 0 F F FH CALLF entry area Reserved 0 8 0 0H 0 7 F FH Program area 0 0 8 0H 0 0 7 FH 6 0 0 0H 5 F F FH Program memory space CALLT table area Internal ROM 24576 x 8 bits Vector table area 0 0 0 0H 0 0 0 0H 42 0 0 4 0H 0 0 3 FH User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE Figure 3-4. Memory Map (PD78F0103) F F F FH Special function registers (SFR) 256 x 8 bits F F 0 0H F E F FH F E E 0H F E D FH General-purpose registers 32 x 8 bits Internal high-speed RAM 768 x 8 bits 5 F F FH F C 0 0H F B F FH Program area Data memory space 1 0 0 0H 0 F F FH CALLF entry area Reserved 0 8 0 0H 0 7 F FH Program area 0 0 8 0H 0 0 7 FH 6 0 0 0H 5 F F FH Program memory space CALLT table area Flash memory 24576 x 8 bits 0 0 4 0H 0 0 3 FH Vector table area 0 0 0 0H 0 0 0 0H User's Manual U15836EJ5V0UD 43 CHAPTER 3 CPU ARCHITECTURE 3.1.1 Internal program memory space The internal program memory space stores the program and table data. Normally, it is addressed with the program counter (PC). 78K0/KB1 products incorporate internal ROM (mask ROM or flash memory), as shown below. Table 3-2. Internal ROM Capacity Part Number Internal ROM Structure PD780101 Capacity 8192 x 8 bits (0000H to 1FFFH) Mask ROM PD780102 16384 x 8 bits (0000H to 3FFFH) PD780103 24576 x 8 bits (0000H to 5FFFH) PD78F0103 24576 x 8 bits (0000H to 5FFFH) Flash memory The internal program memory space is divided into the following areas. (1) Vector table area The 64-byte area 0000H to 003FH is reserved as a vector table area. The program start addresses for branch upon reset signal input or generation of each interrupt request are stored in the vector table area. Of the 16-bit address, the lower 8 bits are stored at even addresses and the higher 8 bits are stored at odd addresses. Table 3-3. Vector Table Vector Table Address Interrupt Source Vector Table Address Interrupt Source RESET input, POC, LVI 0016H INTST6 clock monitor, WDT 0018H INTCSI10/INTST0 0004H INTLVI 001AH INTTMH1 0006H INTP0 001CH INTTMH0 0008H INTP1 001EH INTTM50 000AH INTP2 0020H INTTM000 000CH INTP3 0022H INTTM010 000EH INTP4 0024H INTAD 0010H INTP5 0026H INTSR0 0012H INTSRE6 003EH BRK 0014H INTSR6 0000H Note Note Note Available only in the PD780102, 780103, and 78F0103. (2) CALLT instruction table area The 64-byte area 0040H to 007FH can store the subroutine entry address of a 1-byte call instruction (CALLT). (3) CALLF instruction entry area The area 0800H to 0FFFH can perform a direct subroutine call with a 2-byte call instruction (CALLF). 44 User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE 3.1.2 Internal data memory space 78K0/KB1 products incorporate the following internal high-speed RAM. Table 3-4. Internal High-Speed RAM Capacity Part Number Internal High-Speed RAM PD780101 512 x 8 bits (FD00H to FEFFH) PD780102 768 x 8 bits (FC00H to FEFFH) PD780103 PD78F0103 The 32-byte area FEE0H to FEFFH is assigned to four general-purpose register banks consisting of eight 8-bit registers per bank. This area cannot be used as a program area in which instructions are written and executed. The internal high-speed RAM can also be used as a stack memory. 3.1.3 Special function register (SFR) area On-chip peripheral hardware special function registers (SFRs) are allocated in the area FF00H to FFFFH (see Table 3-5 Special Function Register List in 3.2.3 Special function registers (SFRs)). Caution Do not access addresses to which SFRs are not assigned. User's Manual U15836EJ5V0UD 45 CHAPTER 3 CPU ARCHITECTURE 3.1.4 Data memory addressing Addressing refers to the method of specifying the address of the instruction to be executed next or the address of the register or memory relevant to the execution of instructions. Several addressing modes are provided for addressing the memory relevant to the execution of instructions for the 78K0/KB1, based on operability and other considerations. For areas containing data memory in particular, special addressing methods designed for the functions of special function registers (SFR) and general-purpose registers are available for use. Figures 3-5 to 3-8 show the correspondence between data memory and addressing. For details of each addressing mode, see 3.4 Operand Address Addressing. Figure 3-5. Correspondence Between Data Memory and Addressing (PD780101) F F F FH Special function registers (SFR) 256 x 8 bits SFR addressing F F 2 0H F F 1 FH F F 0 0H F E F FH F E E 0H F E D FH General-purpose registers 32 x 8 bits Register addressing Short direct addressing Internal high-speed RAM 512 x 8 bits F E 2 0H F E 1 FH F D 0 0H F C F FH Direct addressing Register indirect addressing Based addressing Based indexed addressing Reserved 2 0 0 0H 1 F F FH Internal ROM 8192 x 8 bits 0 0 0 0H 46 User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE Figure 3-6. Correspondence Between Data Memory and Addressing (PD780102) F F F FH Special function registers (SFR) 256 x 8 bits SFR addressing F F 2 0H F F 1 FH F F 0 0H F E F FH F E E 0H F E D FH General-purpose registers 32 x 8 bits Register addressing Short direct addressing Internal high-speed RAM 768 x 8 bits F E 2 0H F E 1 FH Direct addressing F C 0 0H F B F FH Register indirect addressing Based addressing Based indexed addressing Reserved 4 0 0 0H 3 F F FH Internal ROM 16384 x 8 bits 0 0 0 0H User's Manual U15836EJ5V0UD 47 CHAPTER 3 CPU ARCHITECTURE Figure 3-7. Correspondence Between Data Memory and Addressing (PD780103) F F F FH Special function registers (SFR) 256 x 8 bits SFR addressing F F 2 0H F F 1 FH F F 0 0H F E F FH F E E 0H F E D FH General-purpose registers 32 x 8 bits Register addressing Short direct addressing Internal high-speed RAM 768 x 8 bits F E 2 0H F E 1 FH Direct addressing F C 0 0H F B F FH Register indirect addressing Based addressing Based indexed addressing Reserved 6 0 0 0H 5 F F FH Internal ROM 24576 x 8 bits 0 0 0 0H 48 User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE Figure 3-8. Correspondence Between Data Memory and Addressing (PD78F0103) F F F FH Special function registers (SFR) 256 x 8 bits SFR addressing F F 2 0H F F 1 FH F F 0 0H F E F FH F E E 0H F E D FH General-purpose registers 32 x 8 bits Register addressing Short direct addressing Internal high-speed RAM 768 x 8 bits F E 2 0H F E 1 FH Direct addressing F C 0 0H F B F FH Register indirect addressing Based addressing Based indexed addressing Reserved 6 0 0 0H 5 F F FH Flash memory 24576 x 8 bits 0 0 0 0H User's Manual U15836EJ5V0UD 49 CHAPTER 3 CPU ARCHITECTURE 3.2 Processor Registers 78K0/KB1 products incorporate the following processor registers. 3.2.1 Control registers The control registers control the program sequence, statuses and stack memory. The control registers consist of a program counter (PC), a program status word (PSW) and a stack pointer (SP). (1) Program counter (PC) The program counter is a 16-bit register that holds the address information of the next program to be executed. In normal operation, the PC is automatically incremented according to the number of bytes of the instruction to be fetched. When a branch instruction is executed, immediate data and register contents are set. RESET input sets the reset vector table values at addresses 0000H and 0001H to the program counter. Figure 3-9. Format of Program Counter 15 PC 0 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 automatically stacked upon interrupt request generation or PUSH PSW instruction execution and are reset upon execution of the RETB, RETI and POP PSW instructions. RESET input sets the PSW to 02H. Figure 3-10. Format of Program Status Word 7 PSW IE 0 Z RBS1 AC RBS0 0 ISP CY (a) Interrupt enable flag (IE) This flag controls the interrupt request acknowledgment operations of the CPU. When 0, the IE flag is set to the interrupt disabled (DI) state, and maskable interrupt requests are all disabled. When 1, the IE flag is set to the interrupt enabled (EI) state and interrupt request acknowledgment enable is controlled with an in-service priority flag (ISP), an interrupt mask flag for various interrupt sources and a priority specification flag. The IE flag is reset (0) upon DI instruction execution or interrupt acknowledgment and is set (1) upon EI instruction execution. (b) Zero flag (Z) When the operation result is zero, this flag is set (1). It is reset (0) in all other cases. 50 User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE (c) Register bank select flags (RBS0 and RBS1) These are 2-bit flags to select one of the four register banks. In these flags, the 2-bit information that indicates the register bank selected by SEL RBn instruction execution is stored. (d) Auxiliary carry flag (AC) If the operation result has a carry from bit 3 or a borrow at bit 3, this flag is set (1). It is reset (0) in all other cases. (e) In-service priority flag (ISP) This flag manages the priority of acknowledgeable maskable vectored interrupts. When this flag is 0, lowlevel vectored interrupt requests specified by a priority specification flag register (PR0L, PR0H, PR1L) (see 14.3 (3) Priority specification flag registers (PR0L, PR0H, PR1L)) can not be acknowledged. Actual request acknowledgment is controlled by the interrupt enable flag (IE). (f) Carry flag (CY) This flag stores on overflow or underflow upon add/subtract instruction execution. It stores the shift-out value upon rotate instruction execution and functions as a bit accumulator during bit 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. Figure 3-11. Format of Stack Pointer 15 SP 0 SP15 SP14 SP13 SP12 SP11 SP10 SP9 SP8 SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0 The SP is decremented ahead of write (save) to the stack memory and is incremented after read (restore) from the stack memory. Each stack operation saves/restores data as shown in Figures 3-12 and 3-13. Caution Since RESET input makes the SP contents undefined, be sure to initialize the SP before use. User's Manual U15836EJ5V0UD 51 CHAPTER 3 CPU ARCHITECTURE Figure 3-12. Data to Be Saved to Stack Memory (a) PUSH rp instruction (when SP = FEE0H) SP SP FEE0H FEDEH FEE0H FEDFH Register pair upper FEDEH Register pair lower (b) CALL, CALLF, CALLT instructions (when SP = FEE0H) SP SP FEE0H FEDEH FEE0H FEDFH PC15-PC8 FEDEH PC7-PC0 (c) Interrupt, BRK instructions (when SP = FEE0H) SP SP 52 FEE0H FEDDH FEE0H FEDFH PSW FEDEH PC15-PC8 FEDDH PC7-PC0 User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE Figure 3-13. Data to Be Restored from Stack Memory (a) POP rp instruction (when SP = FEDEH) SP SP FEE0H FEDEH FEE0H FEDFH Register pair upper FEDEH Register pair lower (b) RET instruction (when SP = FEDEH) SP SP FEE0H FEDEH FEE0H FEDFH PC15-PC8 FEDEH PC7-PC0 (c) RETI, RETB instructions (when SP = FEDDH) SP SP FEE0H FEDDH FEE0H FEDFH PSW FEDEH PC15-PC8 FEDDH PC7-PC0 User's Manual U15836EJ5V0UD 53 CHAPTER 3 CPU ARCHITECTURE 3.2.2 General-purpose registers General-purpose registers are mapped at particular addresses (FEE0H to FEFFH) of the data memory. The general-purpose registers consists of 4 banks, each bank consisting of eight 8-bit registers (X, A, C, B, E, D, L, and H). Each register can be used as an 8-bit register, and two 8-bit registers can also be used in a pair as a 16-bit register (AX, BC, DE, and HL). These 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). Register banks to be used for instruction execution are set by the CPU control instruction (SEL RBn). Because of the 4-register bank configuration, an efficient program can be created by switching between a register for normal processing and a register for interrupts for each bank. Figure 3-14. Configuration of General-Purpose Registers (a) Absolute name 16-bit processing 8-bit processing FEFFH R7 BANK0 RP3 R6 FEF8H R5 BANK1 RP2 R4 FEF0H R3 RP1 BANK2 R2 FEE8H R1 RP0 BANK3 R0 FEE0H 15 0 7 0 (b) Function name 16-bit processing 8-bit processing FEFFH H BANK0 HL L FEF8H D BANK1 DE E FEF0H B BC BANK2 C FEE8H A AX BANK3 X FEE0H 15 54 User's Manual U15836EJ5V0UD 0 7 0 CHAPTER 3 CPU ARCHITECTURE 3.2.3 Special function registers (SFRs) Unlike a general-purpose register, each special function register has a special function. SFRs are allocated to the FF00H to FFFFH area. Special function registers can be manipulated like general-purpose registers, using operation, transfer and bit manipulation instructions. The manipulatable bit units, 1, 8, and 16, depend on the special function register type. Each manipulation bit unit can be specified as follows. * 1-bit manipulation Describe the symbol reserved by the assembler for the 1-bit manipulation instruction operand (sfr.bit). This manipulation can also be specified with an address. * 8-bit manipulation Describe the symbol reserved by the assembler for the 8-bit manipulation instruction operand (sfr). This manipulation can also be specified with an address. * 16-bit manipulation Describe the symbol reserved by the assembler for the 16-bit manipulation instruction operand (sfrp). When specifying an address, describe an even address. Table 3-5 gives a list of the special function registers. The meanings of items in the table are as follows. * Symbol Symbol indicating the address of a special function register. It is a reserved word in the RA78K0, and is defined as an sfr variable using the #pragma sfr directive in the CC78K0. When using the RA78K0, ID78K0-NS, ID78K0, and SM78K0, symbols can be written as an instruction operand. * R/W Indicates whether the corresponding special function register can be read or written. R/W: Read/write enable R: Read only W: Write only * Manipulatable bit units Indicates the manipulatable bit unit (1, 8, or 16). "-" indicates a bit unit for which manipulation is not possible. * After reset Indicates each register status upon RESET input. User's Manual U15836EJ5V0UD 55 CHAPTER 3 CPU ARCHITECTURE Table 3-5. Special Function Register List (1/3) Address Special Function Register (SFR) Name Symbol R/W After Manipulatable Bit Unit 1 Bit 8 Bits 16 Bits Reset FF00H Port register 0 P0 R/W - 00H FF01H Port register 1 P1 R/W - 00H FF02H Port register 2 P2 R - Undefined FF03H Port register 3 P3 R/W - 00H FF08H A/D conversion result register ADCR R - - Undefined FF0AH Receive buffer register 6 RXB6 R - - FFH FF0BH Transmit buffer register 6 TXB6 R/W - - FFH FF0CH Port register 12 P12 R/W - 00H FF0DH Port register 13 P13 R/W - 00H FF0FH Serial I/O shift register 10 SIO10 R - - 00H FF10H 16-bit timer counter 00 TM00 R - - 0000H 16-bit timer capture/compare register 000 CR000 R/W - - 0000H 16-bit timer capture/compare register 010 CR010 R/W - - 0000H FF16H 8-bit timer counter 50 TM50 R - - 00H FF17H 8-bit timer compare register 50 CR50 R/W - - 00H FF18H 8-bit timer H compare register 00 CMP00 R/W - - 00H FF19H 8-bit timer H compare register 10 CMP10 R/W - - 00H FF1AH 8-bit timer H compare register 01 CMP01 R/W - - 00H FF1BH 8-bit timer H compare register 11 CMP11 R/W - - 00H FF20H Port mode register 0 PM0 R/W - FFH FF21H Port mode register 1 PM1 R/W - FFH FF23H Port mode register 3 PM3 R/W - FFH FF28H A/D converter mode register ADM R/W - 00H FF29H Analog input channel specification register ADS R/W - 00H FF2AH Power-fail comparison mode register PFM R/W - 00H FF2BH Power-fail comparison threshold register PFT R/W - - 00H FF2CH Port mode register 12 PM12 R/W - FFH FF30H Pull-up resistor option register 0 PU0 R/W - 00H FF31H Pull-up resistor option register 1 PU1 R/W - 00H FF33H Pull-up resistor option register 3 PU3 R/W - 00H FF3CH Pull-up resistor option register 12 PU12 R/W - 00H FF48H External interrupt rising edge enable register EGP R/W - 00H FF49H External interrupt falling edge enable register EGN R/W - 00H FF4FH Input switch control register ISC R/W - 00H FF09H FF11H FF12H FF13H FF14H FF15H 56 User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE Table 3-5. Special Function Register List (2/3) Address Special Function Register (SFR) Name Asynchronous serial interface operation mode FF50H Symbol R/W After Manipulatable Bit Unit 1 Bit 8 Bits 16 Bits Reset ASIM6 R/W - 01H ASIS6 R - - 00H ASIF6 R - - 00H register 6 Asynchronous serial interface reception error FF53H status register 6 Asynchronous serial interface transmission FF55H status register 6 FF56H Clock selection register 6 CKSR6 R/W - - 00H FF57H Baud rate generator control register 6 BRGC6 R/W - - FFH FF58H Asynchronous serial interface control register 6 ASICL6 R/W - 16H FF69H 8-bit timer H mode register 0 TMHMD0 R/W - 00H FF6AH Timer clock selection register 50 TCL50 R/W - - 00H FF6BH 8-bit timer mode control register 50 TMC50 R/W - 00H FF6CH 8-bit timer H mode register 1 TMHMD1 R/W - 00H FF70H Asynchronous serial interface operation mode ASIM0 R/W - 01H BRGC0 R/W - - 1FH RXB0 R - - FFH ASIS0 R - - 00H W - - FFH 00H register 0 FF71H Note 1 Baud rate generator control register 0 FF72H Receive buffer register 0 Note 1 Note 1 Asynchronous serial interface reception error FF73H status register 0 Note 1 Note 1 FF74H Transmit shift register 0 TXS0 FF80H Serial operation mode register 10 CSIM10 R/W - FF81H Serial clock selection register 10 CSIC10 R/W - 00H FF84H Transmit buffer register 10 SOTB10 R/W - - Undefined FF98H Watchdog timer mode register WDTM R/W - - 67H FF99H Watchdog timer enable register WDTE R/W - - 9AH FFA0H Ring-OSC mode register RCM R/W - 00H FFA1H Main clock mode register MCM R/W - 00H FFA2H Main OSC control register MOC R/W - 00H FFA3H Oscillation stabilization time counter status OSTC R - 00H register FFA4H Oscillation stabilization time select register OSTS R/W - - 05H FFA9H Clock monitor mode register CLM R/W - 00H FFACH Reset control flag register RESF R - - FFBAH 16-bit timer mode control register 00 TMC00 R/W - 00H FFBBH Prescaler mode register 00 PRM00 R/W - 00H Notes 1. 2. Note 2 00H PD780102, 780103, and 78F0103 only. This value varies depending on the reset source. User's Manual U15836EJ5V0UD 57 CHAPTER 3 CPU ARCHITECTURE Table 3-5. Special Function Register List (3/3) Address Special Function Register (SFR) Name Symbol R/W After Manipulatable Bit Unit 1 Bit 8 Bits 16 Bits Reset FFBCH Capture/compare control register 00 CRC00 R/W - 00H FFBDH 16-bit timer output control register 00 TOC00 R/W - 00H FFBEH Low-voltage detection register LVIM R/W - 00H FFBFH Low-voltage detection level selection register LVIS R/W - - 00H FFE0H Interrupt request flag register 0L IF0 IF0L R/W 00H FFE1H Interrupt request flag register 0H IF0H R/W FFE2H Interrupt request flag register 1L IF1L R/W - 00H FFE4H Interrupt mask flag register 0L MK0 MK0L R/W FFH FFE5H Interrupt mask flag register 0H MK0H R/W FFE6H Interrupt mask flag register 1L MK1L R/W - FFH FFE8H Priority specification flag register 0L PR0 PR0L R/W FFH FFE9H Priority specification flag register 0H PR0H R/W FFEAH Priority specification flag register 1L PR1L R/W - FFH IMS R/W - - CFH PCC R/W - 00H FFF0H Internal memory size switching register FFFBH Processor clock control register Note 00H FFH FFH Note The default value of IMS is fixed (IMS = CFH) in all products in the 78K0/KB1 regardless of the internal memory capacity. Therefore, set the following value to each product. Internal Memory Size Switching Register (IMS) 58 PD780101 42H PD780102 04H PD780103 06H PD78F0103 Value corresponding to mask ROM version User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE 3.3 Instruction Address Addressing An instruction address is determined by program counter (PC) contents and is normally incremented (+1 for each byte) automatically according to the number of bytes of an instruction to be fetched each time another instruction is executed. When a branch instruction is executed, the branch destination information is set to the PC and branched by the following addressing (for details of instructions, refer to 78K/0 Series Instructions User's Manual (U12326E)). 3.3.1 Relative addressing [Function] The value obtained by adding 8-bit immediate data (displacement value: jdisp8) of an instruction code to the start address of the following instruction is transferred to the program counter (PC) and branched. The displacement value is treated as signed two's complement data (-128 to +127) and bit 7 becomes a sign bit. In other words, relative addressing consists of relative branching from the start address of the following instruction to the -128 to +127 range. This function is carried out when the BR $addr16 instruction or a conditional branch instruction is executed. [Illustration] 15 0 ... PC indicates the start address of the instruction after the BR instruction. PC + 8 15 7 6 0 S jdisp8 15 0 PC When S = 0, all bits of are 0. When S = 1, all bits of are 1. User's Manual U15836EJ5V0UD 59 CHAPTER 3 CPU ARCHITECTURE 3.3.2 Immediate addressing [Function] Immediate data in the instruction word is transferred to the program counter (PC) and branched. This function is carried out when the CALL !addr16 or BR !addr16 or CALLF !addr11 instruction is executed. CALL !addr16 and BR !addr16 instructions can be branched to the entire memory space. The CALLF !addr11 instruction is branched to the 0800H to 0FFFH area. [Illustration] In the case of CALL !addr16 and BR !addr16 instructions 7 0 CALL or BR Low Addr. High Addr. 15 8 7 0 PC In the case of CALLF !addr11 instruction 7 6 4 3 fa10-8 0 CALLF fa7-0 15 PC 60 0 11 10 0 0 0 8 7 1 User's Manual U15836EJ5V0UD 0 CHAPTER 3 CPU ARCHITECTURE 3.3.3 Table indirect addressing [Function] Table contents (branch destination address) of the particular location to be addressed by bits 1 to 5 of the immediate data of an operation code are transferred to the program counter (PC) and branched. This function is carried out when the CALLT [addr5] instruction is executed. This instruction references the address stored in the memory table from 40H to 7FH, and allows branching to the entire memory space. [Illustration] 7 Operation code 6 1 5 1 1 ta4-0 1 15 Effective address 0 7 0 0 0 0 0 0 0 Memory (Table) 8 7 6 0 0 1 5 1 0 0 0 Low Addr. High Addr. Effective address+1 8 15 7 0 PC 3.3.4 Register addressing [Function] Register pair (AX) contents to be specified with an instruction word are transferred to the program counter (PC) and branched. This function is carried out when the BR AX instruction is executed. [Illustration] 7 rp 0 7 A 15 0 X 8 7 0 PC User's Manual U15836EJ5V0UD 61 CHAPTER 3 CPU ARCHITECTURE 3.4 Operand Address Addressing The following methods are available to specify the register and memory (addressing) to undergo manipulation during instruction execution. 3.4.1 Implied addressing [Function] The register that functions as an accumulator (A and AX) among the general-purpose registers is automatically (implicitly) addressed. Of the 78K0/KB1 instruction words, the following instructions employ implied addressing. Instruction Register to Be Specified by Implied Addressing MULU A register for multiplicand and AX register for product storage DIVUW AX register for dividend and quotient storage ADJBA/ADJBS A register for storage of numeric values that become decimal correction targets ROR4/ROL4 A register for storage of digit data that undergoes digit rotation [Operand format] Because implied addressing can be automatically employed with an instruction, no particular operand format is necessary. [Description example] In the case of MULU X With an 8-bit x 8-bit multiply instruction, the product of A register and X register is stored in AX. In this example, the A and AX registers are specified by implied addressing. 62 User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE 3.4.2 Register addressing [Function] The general-purpose register to be specified is accessed as an operand with the register bank select flags (RBS0 to RBS1) and the register specify codes (Rn and RPn) of an operation code. Register addressing is carried out when an instruction with the following operand format is executed. When an 8-bit register is specified, one of the eight registers is specified with 3 bits in the operation code. [Operand format] Identifier Description r X, A, C, B, E, D, L, H rp AX, BC, DE, HL `r' and `rp' can be described by absolute names (R0 to R7 and RP0 to RP3) as well as function names (X, A, C, B, E, D, L, H, AX, BC, DE, and HL). [Description example] MOV A, C; when selecting C register as r Operation code 0 1 1 0 0 0 1 0 Register specify code INCW DE; when selecting DE register pair as rp Operation code 1 0 0 0 0 1 0 0 Register specify code User's Manual U15836EJ5V0UD 63 CHAPTER 3 CPU ARCHITECTURE 3.4.3 Direct addressing [Function] The memory to be manipulated is directly addressed with immediate data in an instruction word becoming an operand address. [Operand format] Identifier Description addr16 Label or 16-bit immediate data [Description example] MOV A, !0FE00H; when setting !addr16 to FE00H Operation code 1 0 0 0 1 1 1 0 OP code 0 0 0 0 0 0 0 0 00H 1 1 1 1 1 1 1 0 FEH [Illustration] 7 0 OP code addr16 (lower) addr16 (upper) Memory 64 User's Manual U15836EJ5V0UD CHAPTER 3 CPU ARCHITECTURE 3.4.4 Short direct addressing [Function] The memory to be manipulated in the fixed space is directly addressed with 8-bit data in an instruction word. This addressing is applied to the 256-byte space FE20H to FF1FH. Internal RAM and special function registers (SFRs) are mapped at FE20H to FEFFH and FF00H to FF1FH, respectively. The SFR area (FF00H to FF1FH) where short direct addressing is applied is a part of the overall SFR area. Ports that are frequently accessed in a program and compare and capture registers of the timer/event counter are mapped in this area, allowing SFRs to 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 the [Illustration]. [Operand format] Identifier Description saddr Immediate data that indicate label or FE20H to FF1FH saddrp Immediate data that indicate label or FE20H to FF1FH (even address only) [Description example] MOV 0FE30H, A; when transferring value of A register to saddr (FE30H) Operation code 1 1 1 1 0 0 1 0 OP code 0 0 1 1 0 0 0 0 30H (saddr-offset) [Illustration] 7 0 OP code saddr-offset Short direct memory 8 7 15 Effective address 1 1 1 1 1 1 1 0 When 8-bit immediate data is 20H to FFH, = 0 When 8-bit immediate data is 00H to 1FH, = 1 User's Manual U15836EJ5V0UD 65 CHAPTER 3 CPU ARCHITECTURE 3.4.5 Special function register (SFR) addressing [Function] A memory-mapped special function register (SFR) is addressed with 8-bit immediate data in an instruction word. This addressing is applied to the 240-byte spaces FF00H to FFCFH and FFE0H to FFFFH. However, the SFRs mapped at FF00H to FF1FH can be accessed with short direct addressing. [Operand format] Identifier Description sfr Special function register name sfrp 16-bit manipulatable special function register name (even address only) [Description example] MOV PM0, A; when selecting PM0 (FF20H) as sfr Operation code 1 1 1 1 0 1 1 0 OP code 0 0 1 0 0 0 0 0 20H (sfr-offset) [Illustration] 7 0 OP code sfr-offset SFR 15 Effective address 66 1 8 7 1 1 1 1 1 1 1 User's Manual U15836EJ5V0UD 0 CHAPTER 3 CPU ARCHITECTURE 3.4.6 Register indirect addressing [Function] Register pair contents specified by a register pair specify code in an instruction word and by a register bank select flag (RBS0 and RBS1) serve as an operand address for addressing the memory. This addressing can be carried out for all the memory spaces. [Operand format] Identifier Description - [DE], [HL] [Description example] MOV A, [DE]; when selecting [DE] as register pair Operation code 1 0 0 0 0 1 0 1 [Illustration] 16 DE 8 7 D 0 E 7 Memory 0 The memory address specified with the register pair DE The contents of the memory addressed are transferred. 7 0 A User's Manual U15836EJ5V0UD 67 CHAPTER 3 CPU ARCHITECTURE 3.4.7 Based addressing [Function] 8-bit immediate data is added as offset data to the contents of the base register, that is, the HL register pair in the register bank specified by the register bank select flag (RBS0 and RBS1), and the sum is used to address the memory. Addition is performed by expanding the offset data as a positive number to 16 bits. A carry from the 16th bit is ignored. This addressing can be carried out for all the memory spaces. [Operand format] Identifier - Description [HL + byte] [Description example] MOV A, [HL + 10H]; when setting byte to 10H Operation code 1 0 1 0 1 1 1 0 0 0 0 1 0 0 0 0 [Illustration] 16 8 7 H HL 0 L 7 Memory The contents of the memory addressed are transferred. 7 0 A 68 User's Manual U15836EJ5V0UD 0 +10 CHAPTER 3 CPU ARCHITECTURE 3.4.8 Based indexed addressing [Function] The B or C register contents specified in an instruction word are added to the contents of the base register, that is, the HL register pair in the register bank specified by the register bank select flag (RBS0 and RBS1), and the sum is used to address the memory. Addition is performed by expanding the B or C register contents as a positive number to 16 bits. A carry from the 16th bit is ignored. This addressing can be carried out for all the memory spaces. [Operand format] Identifier - Description [HL + B], [HL + C] [Description example] In the case of MOV A, [HL + B] (selecting B register) Operation code 1 0 1 0 1 0 1 1 [Illustration] 16 HL 8 7 0 H L + 7 0 B 7 Memory 0 The contents of the memory addressed are transferred. 7 0 A User's Manual U15836EJ5V0UD 69 CHAPTER 3 CPU ARCHITECTURE 3.4.9 Stack addressing [Function] The stack area is indirectly addressed with the stack pointer (SP) contents. This addressing method is automatically employed when the PUSH, POP, subroutine call and return instructions are executed or the register is saved/reset upon generation of an interrupt request. With stack addressing, only the internal high-speed RAM area can be accessed. [Description example] In the case of PUSH DE (saving DE register) Operation code 1 0 1 1 0 1 0 1 [Illustration] 7 SP SP 70 FEE0H FEDEH Memory FEE0H FEDFH D FEDEH E User's Manual U15836EJ5V0UD 0 CHAPTER 4 PORT FUNCTIONS 4.1 Port Functions There are two types of pin I/O buffer power supplies: AVREF and VDD. The relationship between these power supplies and the pins is shown below. Table 4-1. Pin I/O Buffer Power Supplies Power Supply Corresponding Pins AVREF P20 to P23 VDD Pins other than P20 to P23 78K0/KB1 products are provided with the ports shown in Figure 4-1, which enable variety of control operations. The functions of each port are shown in Table 4-2. In addition to the function as digital I/O ports, these ports have several alternate functions. For details of the alternate functions, see CHAPTER 2 PIN FUNCTIONS. Figure 4-1. Port Types P20 P00 Port 2 Port 0 P23 P03 P30 P10 Port 3 P33 Port 1 Port 12 P120 Port 13 P130 P17 User's Manual U15836EJ5V0UD 71 CHAPTER 4 PORT FUNCTIONS Table 4-2. Port Functions Pin Name I/O P00 I/O Function After Reset Port 0. Input 4-bit I/O port. P01 Alternate Function TI000 TI010/TO00 Input/output can be specified in 1-bit units. P02 - Use of an on-chip pull-up resistor can be specified by a P03 software setting. P10 I/O Port 1. Input 8-bit I/O port. P11 SI10/RxD0 Input/output can be specified in 1-bit units. P12 Note SO10 Use of an on-chip pull-up resistor can be specified by a P13 Note SCK10/TxD0 TxD6 software setting. P14 RxD6 P15 TOH0 P16 TOH1/INTP5 P17 TI50/TO50 P20 to P23 Input Port 2. Input ANI0 to ANI3 Input INTP1 to INTP4 Input INTP0 4-bit input-only port. P30 to P33 I/O Port 3. 4-bit I/O port. Input/output can be specified in 1-bit units. Use of an on-chip pull-up resistor can be specified by a software setting. P120 I/O Port 12. 1-bit I/O port. Use of an on-chip pull-up resistor can be specified by a software setting. P130 Output Port 13. Output 1-bit output-only port. Note TxD0 and RxD0 are available only in the PD780102, 780103, and 78F0103. 4.2 Port Configuration A port includes the following hardware. Table 4-3. Port Configuration Item Control registers Configuration Port mode register (PM0, PM1, PM3, PM12) Port register (P0 to P3, P12, P13) Pull-up resistor option register (PU0, PU1, PU3, PU12) Port Total: 22 (CMOS I/O: 17, CMOS input: 4, CMOS output: 1) Pull-up resistors Total: 17 (software control only) 72 User's Manual U15836EJ5V0UD - CHAPTER 4 PORT FUNCTIONS 4.2.1 Port 0 Port 0 is a 4-bit I/O port with an output latch. Port 0 can be set to the input mode or output mode in 1-bit units using port mode register 0 (PM0). When the P00 to P03 pins are used as an input port, use of an on-chip pull-up resistor can be specified in 1-bit units by pull-up resistor option register 0 (PU0). This port can also be used for timer I/O. RESET input sets port 0 to input mode. Figures 4-2 to 4-4 show block diagrams of port 0. Figure 4-2. Block Diagram of P00 VDD WRPU PU0 PU00 P-ch Alternate function Selector Internal bus RD WRPORT Output latch (P00) P00/TI000 WRPM PM0 PM00 PU0: Pull-up resistor option register 0 PM0: Port mode register 0 RD: Read signal WRxx: Write signal User's Manual U15836EJ5V0UD 73 CHAPTER 4 PORT FUNCTIONS Figure 4-3. Block Diagram of P01 VDD WRPU PU0 PU01 P-ch Alternate function Selector Internal bus RD WRPORT Output latch (P01) P01/TI010/TO00 WRPM PM0 PM01 Alternate function PU0: Pull-up resistor option register 0 PM0: Port mode register 0 RD: Read signal WRxx: Write signal 74 User's Manual U15836EJ5V0UD CHAPTER 4 PORT FUNCTIONS Figure 4-4. Block Diagram of P02 and P03 VDD WRPU PU0 PU02, PU03 P-ch Selector Internal bus RD WRPORT Output latch (P02, P03) P02, P03 WRPM PM0 PM02, PM03 PU0: Pull-up resistor option register 0 PM0: Port mode register 0 RD: Read signal WRxx: Write signal User's Manual U15836EJ5V0UD 75 CHAPTER 4 PORT FUNCTIONS 4.2.2 Port 1 Port 1 is an 8-bit I/O port with an output latch. Port 1 can be set to the input mode or output mode in 1-bit units using port mode register 1 (PM1). When the P10 to P17 pins are used as an input port, use of an on-chip pull-up resistor can be specified in 1-bit units by pull-up resistor option register 1 (PU1). This port can also be used for external interrupt request input, serial interface data I/O, clock I/O, and timer I/O. RESET input sets port 1 to input mode. Figures 4-5 to 4-9 show block diagrams of port 1. Caution When using P10/SCK10 (/TxD0Note), P11/SI10 (/RxD0Note), and P12/SO10 as general-purpose ports, do not write to serial clock selection register 10 (CSIC10). Figure 4-5. Block Diagram of P10 VDD WRPU PU1 PU10 P-ch Alternate function Selector Internal bus RD WRPORT Output latch (P10) P10/SCK10 (/TxD0Note) WRPM PM1 PM10 Alternate function Note Available only in the PD780102, 780103, and 78F0103. PU1: Pull-up resistor option register 1 PM1: Port mode register 1 RD: Read signal WRxx: Write signal 76 User's Manual U15836EJ5V0UD CHAPTER 4 PORT FUNCTIONS Figure 4-6. Block Diagram of P11 and P14 VDD WRPU PU1 PU11, PU14 P-ch Alternate function Selector Internal bus RD WRPORT Output latch (P11, P14) P11/SI10 (/RxD0Note), P14/RxD6 WRPM PM1 PM11, PM14 Note Available only in the PD780102, 780103, and 78F0103. PU1: Pull-up resistor option register 1 PM1: Port mode register 1 RD: Read signal WRxx: Write signal User's Manual U15836EJ5V0UD 77 CHAPTER 4 PORT FUNCTIONS Figure 4-7. Block Diagram of P12 and P15 VDD WRPU PU1 PU12, PU15 P-ch Internal bus Selector RD WRPORT Output latch (P12, P15) P12/SO10, P15/TOH0 WRPM PM1 PM12, PM15 Alternate function PU1: Pull-up resistor option register 1 PM1: Port mode register 1 RD: Read signal WRxx: Write signal 78 User's Manual U15836EJ5V0UD CHAPTER 4 PORT FUNCTIONS Figure 4-8. Block Diagram of P13 VDD WRPU PU1 PU13 P-ch Selector Internal bus RD WRPORT Output latch (P13) P13/TxD6 WRPM PM1 PM13 Alternate function PU1: Pull-up resistor option register 1 PM1: Port mode register 1 RD: Read signal WRxx: Write signal User's Manual U15836EJ5V0UD 79 CHAPTER 4 PORT FUNCTIONS Figure 4-9. Block Diagram of P16 and P17 VDD WRPU PU1 PU16, PU17 P-ch Alternate function Selector Internal bus RD WRPORT Output latch (P16, P17) P16/TOH1/INTP5, P17/TI50/TO50 WRPM PM1 PM16, PM17 Alternate function PU1: Pull-up resistor option register 1 PM1: Port mode register 1 RD: Read signal WRxx: Write signal 80 User's Manual U15836EJ5V0UD CHAPTER 4 PORT FUNCTIONS 4.2.3 Port 2 Port 2 is a 4-bit input-only port. This port can also be used for A/D converter analog input. Figure 4-10 shows a block diagram of port 2. Figure 4-10. Block Diagram of P20 to P23 Internal bus RD A/D converter RD: P20/ANI0 to P23/ANI3 Read signal User's Manual U15836EJ5V0UD 81 CHAPTER 4 PORT FUNCTIONS 4.2.4 Port 3 Port 3 is a 4-bit I/O port with an output latch. Port 3 can be set to the input mode or output mode in 1-bit units using port mode register 3 (PM3). When the P30 to P33 pins are used as an input port, use of an on-chip pull-up resistor can be specified in 1-bit units by pull-up resistor option register 3 (PU3). This port can also be used for external interrupt request input. RESET input sets port 3 to input mode. Figure 4-11 shows a block diagram of port 3. Figure 4-11. Block Diagram of P30 to P33 VDD WRPU PU3 PU30 to PU33 P-ch Alternate function Selector Internal bus RD WRPORT Output latch (P30 to P33) P30/INTP1 to P33/INTP4 WRPM PM3 PM30 to PM33 PU3: Pull-up resistor option register 3 PM3: Port mode register 3 RD: Read signal WRxx: Write signal 82 User's Manual U15836EJ5V0UD CHAPTER 4 PORT FUNCTIONS 4.2.5 Port 12 Port 12 is a 1-bit I/O port with an output latch. Port 12 can be set to the input mode or output mode in 1-bit units using port mode register 12 (PM12). When the P120 pin is used as an input port, use of an on-chip pull-up resistor can be specified by pull-up resistor option register 12 (PU12). This port can also be used for external interrupt request input. RESET input sets port 12 to input mode. Figure 4-12 shows a block diagram of port 12. Figure 4-12. Block Diagram of P120 VDD WRPU PU12 PU120 P-ch Alternate function Selector Internal bus RD WRPORT Output latch (P120) P120/INTP0 WRPM PM12 PM120 PU12: Pull-up resistor option register 12 PM12: Port mode register 12 RD: Read signal WRxx: Write signal User's Manual U15836EJ5V0UD 83 CHAPTER 4 PORT FUNCTIONS 4.2.6 Port 13 Port 13 is a 1-bit output-only port. Figure 4-13 shows a block diagram of port 13. Figure 4-13. Block Diagram of P130 Internal bus RD WRPORT Output latch (P130) RD: P130 Read signal WRxx: Write signal 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. 4.3 Registers Controlling Port Function Port functions are controlled by the following three types of registers. * Port mode registers (PM0, PM1, PM3, PM12) * Port registers (P0 to P3, P12, P13) * Pull-up resistor option registers (PU0, PU1, PU3, PU12) (1) Port mode registers (PM0, PM1, PM3, and PM12) These registers specify input or output mode for the port in 1-bit units. These registers can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input sets these registers to FFH. When port pins are used as alternate-function pins, set the port mode register and output latch as shown in Table 4-4. 84 User's Manual U15836EJ5V0UD CHAPTER 4 PORT FUNCTIONS Figure 4-14. Format of Port Mode Register Symbol 7 6 5 4 3 2 1 0 Address After reset R/W PM0 1 1 1 1 PM03 PM02 PM01 PM00 FF20H FFH R/W PM1 PM17 PM16 PM15 PM14 PM13 PM12 PM11 PM10 FF21H FFH R/W PM3 1 1 1 1 PM33 PM32 PM31 PM30 FF23H FFH R/W PM12 1 1 1 1 1 1 1 PM120 FF2CH FFH R/W Pmn pin I/O mode selection PMmn (m = 0, 1, 3, 12; n = 0 to 7) 0 Output mode (output buffer on) 1 Input mode (output buffer off) Table 4-4. Settings of Port Mode Register and Output Latch When Alternate Function Is Used Pin Name Alternate Function Name PMxx Pxx x I/O P00 TI000 Input 1 P01 TI010 Input 1 x TO00 Output 0 0 SCK10 Input 1 x Output 0 1 Output 0 1 Input 1 x RxD0 Input 1 x P12 SO10 Output 0 0 P13 TxD6 Output 0 1 P14 RxD6 Input 1 x P15 TOH0 Output 0 0 P16 TOH1 Output 0 0 INTP5 Input 1 x TI50 Input 1 x TO50 Output 0 0 P30 to P33 INTP1 to INTP4 Input 1 x P120 INTP0 Input 1 x P10 TxD0 P11 Note SI10 Note P17 Note TxD0 and RxD0 are available only in the PD780102, 780103, and 78F0103. Remark x: Don't care PMxx: Port mode register Pxx: Port output latch User's Manual U15836EJ5V0UD 85 CHAPTER 4 PORT FUNCTIONS (2) Port registers (P0 to P3, P12, P13) These registers write the data that is output from the chip when data is output from a port. If the data is read in the input mode, the pin level is read. If it is read in the output mode, the value of the output latch is read. These registers can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears these registers to 00H (but P2 is undefined). Figure 4-15. Format of Port Register Symbol 7 6 5 4 3 2 1 0 Address After reset R/W P0 0 0 0 0 P03 P02 P01 P00 FF00H 00H (output latch) R/W 7 6 5 4 3 2 1 0 P1 P17 P16 P15 P14 P13 P12 P11 P10 FF01H 00H (output latch) R/W 7 6 5 4 3 2 1 0 0 0 0 0 P23 P22 P21 P20 FF02H Undefined R 7 6 5 4 3 2 1 0 0 0 0 0 P33 P32 P31 P30 FF03H 00H (output latch) R/W 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 P120 FF0CH 00H (output latch) R/W 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 P130 FF0DH 00H (output latch) R/W P2 P3 P12 P13 m = 0 to 3, 12, 13; n = 0 to 7 Pmn Output data control (in output mode) 86 Input data read (in input mode) 0 Output 0 Input low level 1 Output 1 Input high level User's Manual U15836EJ5V0UD CHAPTER 4 PORT FUNCTIONS (3) Pull-up resistor option registers (PU0, PU1, PU3, and PU12) These registers specify whether the on-chip pull-up resistors of P00 to P03, P10 to P17, P30 to P33, or P120 is to be used or not. An on-chip pull-up resistors can be used in 1-bit units only for the bits set to input mode of the pins to which the use of an on-chip pull-up resistor has been specified. On-chip pull-up resistor cannot be connected for bits set to output mode and bits used as alternate-function output pins, regardless of the settings of PU0, PU1, PU3 and PU12. These registers can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears these registers to 00H. Figure 4-16. Format of Pull-up Resistor Option Register Symbol 7 6 5 4 3 2 1 0 PU0 0 0 0 0 PU03 PU02 PU01 PU00 7 6 5 4 3 2 1 0 PU17 PU16 PU15 PU14 PU13 PU12 PU11 PU10 7 6 5 4 3 2 1 0 0 0 0 0 PU33 PU32 PU31 PU30 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 PU120 PU1 PU3 PU12 PUmn Address After reset R/W FF30H 00H R/W FF31H 00H R/W FF33H 00H R/W FF3CH 00H R/W Pmn pin on-chip pull-up resistor selection (m = 0, 1, 3, 12; n = 0 to 7) 0 On-chip pull-up resistor not connected 1 On-chip pull-up resistor connected User's Manual U15836EJ5V0UD 87 CHAPTER 4 PORT FUNCTIONS 4.4 Port Function Operations Port operations differ depending on whether the input or output mode is set, as shown below. Caution In the case of a 1-bit memory manipulation instruction, although a single bit is manipulated, the port is accessed as an 8-bit unit. Therefore, on a port with a mixture of input and output pins, the output latch contents for pins specified as input are undefined, even for bits other than the manipulated bit. 4.4.1 Writing to I/O port (1) Output mode A value is written to the output latch by a transfer instruction, and the output latch contents are output from the pin. Once data is written to the output latch, it is retained until data is written to the output latch again. The data of the output latch is cleared by reset. (2) Input mode A value is written to the output latch by a transfer instruction, but since the output buffer is off, the pin status does not change. Once data is written to the output latch, it is retained until data is written to the output latch again. 4.4.2 Reading from I/O port (1) Output mode The output latch contents are read by a transfer instruction. The output latch contents do not change. (2) Input mode The pin status is read by a transfer instruction. The output latch contents do not change. 4.4.3 Operations on I/O port (1) Output mode An operation is performed on the output latch contents, and the result is written to the output latch. The output latch contents are output from the pins. Once data is written to the output latch, it is retained until data is written to the output latch again. The data of the output latch is cleared by reset. (2) Input mode The pin level is read and an operation is performed on its contents. The result of the operation is written to the output latch, but since the output buffer is off, the pin status does not change. 88 User's Manual U15836EJ5V0UD CHAPTER 5 CLOCK GENERATOR 5.1 Functions of Clock Generator The clock generator generates the clock to be supplied to the CPU and peripheral hardware. The following two system clock oscillators are available. * X1 oscillator The X1 oscillator oscillates a clock of fXP = 2.0 to 12.0 MHzNote. Oscillation can be stopped by executing the STOP instruction or setting the main OSC control register (MOC). * Ring-OSC oscillator The Ring-OSC oscillator oscillates a clock of fR = 240 kHz (TYP.). Oscillation can be stopped by setting the Ring-OSC mode register (RCM) when "Can be stopped by software" is set by a mask option and the X1 input clock is used as the CPU clock. Note Expanded-specification products of standard products and (A) grade products: fXP = 2.0 to 12.0 MHz Conventional products of standard products and (A) grade products, (A1) grade products: fXP = 2.0 to 10.0 MHz (A2) grade products: fXP = 2.0 to 8.38 MHz Remarks 1. fXP: X1 input clock oscillation frequency 2. fR: Ring-OSC clock oscillation frequency 5.2 Configuration of Clock Generator The clock generator includes the following hardware. Table 5-1. Configuration of Clock Generator Item Control registers Configuration Processor clock control register (PCC) Ring-OSC mode register (RCM) Main clock mode register (MCM) Main OSC control register (MOC) Oscillation stabilization time counter status register (OSTC) Oscillation stabilization time select register (OSTS) Oscillator X1 oscillator Ring-OSC oscillator User's Manual U15836EJ5V0UD 89 CHAPTER 5 CLOCK GENERATOR Figure 5-1. Block Diagram of Clock Generator Internal bus STOP Oscillation stabilization time select register (OSTS) Main clock mode register (MCM) Main OSC control register (MOC) MSTOP OSTS2 OSTS1 OSTS0 MCS MCM0 Processor clock control register (PCC) PCC2 PCC1 PCC0 3 Control signal X1 oscillation stabilization time counter Controller Oscillation MOST MOST MOST MOST MOST stabilization 11 13 14 15 16 time counter status register (OSTC) X1 X1 oscillator X2 fXP 3 fX Prescaler Operation clock switch fX 22 fX 23 fX 24 Selector fX 2 Ring-OSC oscillator fR Prescaler Clock to peripheral hardware Mask option 1: Cannot be stopped 0. Can be stopped Prescaler 8-bit timer H1, watchdog timer RSTOP Ring-OSC mode register (RCM) Internal bus 90 C P U User's Manual U15836EJ5V0UD fCPU CPU clock (fCPU) CHAPTER 5 CLOCK GENERATOR 5.3 Registers Controlling Clock Generator The following six registers are used to control the clock generator. * Processor clock control register (PCC) * Ring-OSC mode register (RCM) * Main clock mode register (MCM) * Main OSC control register (MOC) * Oscillation stabilization time counter status register (OSTC) * Oscillation stabilization time select register (OSTS) (1) Processor clock control register (PCC) This register sets the division ratio of the CPU clock. PCC can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 5-2. Format of Processor Clock Control Register (PCC) Address: FFFBH After reset: 00H R/W Symbol 7 6 5 4 3 2 1 0 PCC 0 0 0 0 0 PCC2 PCC1 PCC0 PCC2 PCC1 PCC0 CPU clock selection (fCPU) MCM0 = 0 0 0 0 0 0 1 0 1 0 fX fR fX/2 fR/2 fXP Note fXP/2 fX/2 2 Setting prohibited fXP/2 2 Setting prohibited fXP/2 3 Setting prohibited fXP/2 4 0 1 1 fX/2 3 1 0 0 fX/2 4 Other than above MCM0 = 1 Setting prohibited Note The setting of (A1) grade products and (A2) grade products is prohibited. Remarks 1. MCM0: Bit 0 of the main clock mode register (MCM) 2. fX: Main system clock oscillation frequency (X1 input clock oscillation frequency or Ring-OSC clock oscillation frequency) 3. fR: Ring-OSC clock oscillation frequency 4. fXP: X1 input clock oscillation frequency User's Manual U15836EJ5V0UD 91 CHAPTER 5 CLOCK GENERATOR The fastest instruction can be executed in 2 clocks of the CPU clock in the 78K0/KB1. Therefore, the relationship between the CPU clock (fCPU) and minimum instruction execution time is as shown in the Table 5-2. Table 5-2. Relationship Between CPU Clock and Minimum Instruction Execution Time CPU Clock (fCPU) Note 1 Minimum Instruction Execution Time: 2/fCPU Ring-OSC Clock X1 Input Clock At 10 MHz (at 240 kHz (TYP.) Operation) At 12 MHz Operation Operation Note 2 fX 0.2 s 0.166 s 8.3 s (TYP.) fX/2 0.4 s 0.333 s 16.6 s (TYP.) Note 3 fX/2 2 0.8 s 0.666 s Setting prohibited fX/2 3 1.6 s 1.333 s Setting prohibited fX/2 4 3.2 s 2.666 s Setting prohibited Notes 1. The main clock mode register (MCM) is used to set the CPU clock (X1 input clock/Ring-OSC clock) (see Figure 5-4). 2. Expanded-specification products of standard products and (A) grade products only 3. The setting of (A1) grade products and (A2) grade products is prohibited. (2) Ring-OSC mode register (RCM) This register sets the operation mode of Ring-OSC. This register is valid when "Can be stopped by software" is set for Ring-OSC by a mask option, and the X1 input clock is input to the CPU clock. If "Cannot be stopped" is selected for Ring-OSC by a mask option, settings for this register are invalid. RCM can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 5-3. Format of Ring-OSC Mode Register (RCM) Address: FFA0H After reset: 00H R/W Symbol 7 6 5 4 3 2 1 <0> RCM 0 0 0 0 0 0 0 RSTOP RSTOP Ring-OSC oscillating/stopped 0 Ring-OSC oscillating 1 Ring-OSC stopped Caution Make sure that bit 1 (MCS) of the main clock mode register (MCM) is 1 before setting RSTOP. 92 User's Manual U15836EJ5V0UD CHAPTER 5 CLOCK GENERATOR (3) Main clock mode register (MCM) This register sets the CPU clock (X1 input clock/Ring-OSC clock). MCM can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 5-4. Format of Main Clock Mode Register (MCM) Address: FFA1H After reset: 00H R/W Note Symbol 7 6 5 4 3 2 <1> <0> MCM 0 0 0 0 0 0 MCS MCM0 MCS CPU clock status 0 Operates with Ring-OSC clock 1 Operates with X1 input clock MCM0 Selection of clock supplied to CPU 0 Ring-OSC clock 1 X1 input clock Note Bit 1 is read-only. Caution When the Ring-OSC clock is selected as the clock to be supplied to the CPU, the divided clock of the Ring-OSC oscillator output (fX) is supplied to the peripheral hardware (fX = 240 kHz (TYP.)). Operation of the peripheral hardware with the Ring-OSC clock cannot be guaranteed. Therefore, when the Ring-OSC clock is selected as the clock supplied to the CPU, do not use peripheral hardware. In addition, stop the peripheral hardware before switching the clock supplied to the CPU from the X1 input clock to the Ring-OSC clock. Note, however, that the following peripheral hardware can be used when the CPU operates on the Ring-OSC clock. * Watchdog timer * Clock monitor * 8-bit timer H1 when fR/27 is selected as the count clock * Peripheral hardware with an external clock selected as the clock source (Except when the external count clock of TM00 is selected (TI000 valid edge)) User's Manual U15836EJ5V0UD 93 CHAPTER 5 CLOCK GENERATOR (4) Main OSC control register (MOC) This register selects the operation mode of the X1 input clock. This register is used to stop the X1 oscillator operation when the CPU is operating with the Ring-OSC clock. Therefore, this register is valid only when the CPU is operating with the Ring-OSC clock. MOC can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 5-5. Format of Main OSC Control Register (MOC) Address: FFA2H After reset: 00H R/W Symbol <7> 6 5 4 3 2 1 0 MOC MSTOP 0 0 0 0 0 0 0 MSTOP Control of X1 oscillator operation 0 X1 oscillator operating 1 X1 oscillator stopped Caution Make sure that bit 1 (MCS) of the main clock mode register (MCM) is 0 before setting MSTOP. 94 User's Manual U15836EJ5V0UD CHAPTER 5 CLOCK GENERATOR (5) Oscillation stabilization time counter status register (OSTC) This is the status register of the X1 input clock oscillation stabilization time counter. If the Ring-OSC clock is used as the CPU clock, the X1 input clock oscillation stabilization time can be checked. OSTC can be read by a 1-bit or 8-bit memory manipulation instruction. When reset is released (reset by RESET input, POC, LVI, clock monitor, and WDT), the STOP instruction, MSTOP = 1 clear OSTC to 00H. Figure 5-6. Format of Oscillation Stabilization Time Counter Status Register (OSTC) Address: FFA3H After reset: 00H R Symbol 7 6 5 4 3 2 1 0 OSTC 0 0 0 MOST11 MOST13 MOST14 MOST15 MOST16 MOST11 MOST13 MOST14 MOST15 MOST16 Oscillation stabilization time status fXP = 10 MHz fXP = 12 MHz 11 204.8 s min. 170.7 s min. 13 819.2 s min. 682.7 s min. 14 1.64 ms min. 1.37 ms min. 15 3.27 ms min. 2.73 ms min. 16 6.55 ms min. 5.46 ms min. 1 0 0 0 0 2 /fXP min. 1 1 0 0 0 2 /fXP min. 1 1 1 0 0 2 /fXP min. 1 1 1 1 0 2 /fXP min. 1 1 1 1 1 2 /fXP min. Note Note Expanded-specification products of standard products and (A) grade products only Cautions 1. After the above time has elapsed, the bits are set to 1 in order from MOST11 and remain 1. 2. If the STOP mode is entered and then released while the Ring-OSC clock is being used as the CPU clock, set the oscillation stabilization time as follows. * Desired OSTC oscillation stabilization time Oscillation stabilization time set by OSTS The X1 oscillation stabilization time counter counts up to the oscillation stabilization time set by OSTS. Note, therefore, that only the status up to the oscillation stabilization time set by OSTS is set to OSTC after STOP mode is released. 3. The wait time when STOP mode is released does not include the time after STOP mode release until clock oscillation starts ("a" below) regardless of whether STOP mode is released by RESET input or interrupt generation. STOP mode release X1 pin voltage waveform a Remark fXP: X1 input clock oscillation frequency User's Manual U15836EJ5V0UD 95 CHAPTER 5 CLOCK GENERATOR (6) Oscillation stabilization time select register (OSTS) This register is used to select the X1 oscillation stabilization wait time when STOP mode is released. The wait time set by OSTS is valid only after STOP mode is released with the X1 input clock selected as the CPU clock. After STOP mode is released with Ring-OSC selected as the CPU clock, the oscillation stabilization time must be confirmed by OSTC. OSTS can be set by an 8-bit memory manipulation instruction. RESET input sets OSTS to 05H. Figure 5-7. Format of Oscillation Stabilization Time Select Register (OSTS) Address: FFA4H After reset: 05H R/W Symbol 7 6 5 4 3 2 1 0 OSTS 0 0 0 0 0 OSTS2 OSTS1 OSTS0 OSTS2 OSTS1 OSTS0 Oscillation stabilization time selection fXP = 10 MHz 0 0 0 1 1 11 204.8 s 170.7 s 13 819.2 s 682.7 s 14 1.64 ms 1.37 ms 15 3.27 ms 2.73 ms 16 6.55 ms 5.46 ms 2 /fXP 0 2 /fXP 0 1 1 2 /fXP 1 0 0 2 /fXP 1 0 1 2 /fXP Other than above fXP = 12 MHz Note Setting prohibited Note Expanded-specification products of standard products and (A) grade products only Cautions 1. To set the STOP mode when the X1 input clock is used as the CPU clock, set OSTS before executing the STOP instruction. 2. Execute the OSTS setting after confirming that the oscillation stabilization time has elapsed as expected in the OSTC. 3. If the STOP mode is entered and then released while the Ring-OSC clock is being used as the CPU clock, set the oscillation stabilization time as follows. * Desired OSTC oscillation stabilization time Oscillation stabilization time set by OSTS The X1 oscillation stabilization time counter counts up to the oscillation stabilization time set by OSTS. Note, therefore, that only the status up to the oscillation stabilization time set by OSTS is set to OSTC after STOP mode is released. 4. The wait time when STOP mode is released does not include the time after STOP mode release until clock oscillation starts ("a" below) regardless of whether STOP mode is released by RESET input or interrupt generation. STOP mode release X1 pin voltage waveform a Remark 96 fXP: X1 input clock oscillation frequency User's Manual U15836EJ5V0UD CHAPTER 5 CLOCK GENERATOR 5.4 System Clock Oscillator 5.4.1 X1 oscillator The X1 oscillator oscillates with a crystal resonator or ceramic resonator connected to the X1 and X2 pins. An external clock can be input to the X1 oscillator. In this case, input the clock signal to the X1 pin and input the inverse signal to the X2 pin. Figure 5-8 shows the external circuit of the X1 oscillator. Figure 5-8. External Circuit of X1 Oscillator (a) Crystal, ceramic oscillation VSS X1 (b) External clock External clock X1 X2 X2 Crystal resonator or ceramic resonator Caution When using the X1 oscillator, wire as follows in the area enclosed by the broken lines in the Figure 5-8 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. Figure 5-9 shows examples of incorrect resonator connection. User's Manual U15836EJ5V0UD 97 CHAPTER 5 CLOCK GENERATOR Figure 5-9. Examples of Incorrect Resonator Connection (a) Too long wiring (b) Crossed signal line PORT VSS X1 X2 (c) Wiring near high alternating current VSS X1 X2 (d) Current flowing through ground line of oscillator (potential at points A, B, and C fluctuates) VDD Pmn X1 X2 High current VSS VSS A X1 B High current (e) Signals are fetched VSS 98 X1 X2 User's Manual U15836EJ5V0UD X2 C CHAPTER 5 CLOCK GENERATOR 5.4.2 Ring-OSC oscillator A Ring-OSC oscillator is incorporated in the 78K0/KB1. "Can be stopped by software" or "Cannot be stopped" can be selected by a mask option. The Ring-OSC clock always oscillates after RESET release (240 kHz (TYP.)). 5.4.3 Prescaler The prescaler generates various clocks by dividing the X1 oscillator output when the X1 input clock is selected as the clock to be supplied to the CPU. Caution When the Ring-OSC clock is selected as the clock supplied to the CPU, the prescaler generates various clocks by dividing the Ring-OSC oscillator output (fX = 240 kHz (TYP.)). User's Manual U15836EJ5V0UD 99 CHAPTER 5 CLOCK GENERATOR 5.5 Clock Generator Operation The clock generator generates the following clocks and controls the operation modes of the CPU, such as standby mode. * X1 input clock fXP * Ring-OSC clock fR * CPU clock fCPU * Clock to peripheral hardware The CPU starts operation when the on-chip Ring-OSC oscillator starts outputting after reset release in the 78K0/KB1, thus enabling the following. (1) Enhancement of security function When the X1 input clock is set as the CPU clock by the default setting, the device cannot operate if the X1 input clock is damaged or badly connected and therefore does not operate after reset is released. However, the start clock of the CPU is the on-chip Ring-OSC clock, so the device can be started by the Ring-OSC clock after reset release by the clock monitor (detection of X1 input clock stop). Consequently, the system can be safely shut down by performing a minimum operation, such as acknowledging a reset source by software or performing safety processing when there is a malfunction. 100 User's Manual U15836EJ5V0UD CHAPTER 5 CLOCK GENERATOR (2) Improvement of performance Because the CPU can be started without waiting for the X1 input clock oscillation stabilization time, the total performance can be improved. A timing diagram of the CPU default start using Ring-OSC is shown in Figure 5-10. Figure 5-10. Timing Diagram of CPU Default Start Using Ring-OSC X1 input clock (fXP) Ring-OSC clock (fR) RESET Switched by software Ring-OSC clock CPU clock X1 input clock Operation stopped: 17/fR X1 oscillation stabilization time: 211/fXP to 216/fXPNote Note Check using the oscillation stabilization time counter status register (OSTC). (a) When the RESET signal is generated, bit 0 of the main clock mode register (MCM) is set to 0 and the RingOSC clock is set as the CPU clock. However, a clock is supplied to the CPU after 17 clocks of the Ring-OSC clock have elapsed after RESET release (or clock supply to the CPU stops for 17 clocks). During the RESET period, oscillation of the X1 input clock and Ring-OSC clock is stopped. (b) After RESET release, the CPU clock can be switched from the Ring-OSC clock to the X1 input clock using bit 0 (MCM0) of the main clock mode register (MCM) after the X1 input clock oscillation stabilization time has elapsed. At this time, check the oscillation stabilization time using the oscillation stabilization time counter status register (OSTC) before switching the CPU clock. The CPU clock status can be checked using bit 1 (MCS) of MCM. (c) Ring-OSC can be set to stopped/oscillating using the Ring-OSC mode register (RCM) when "Can be stopped by software" is selected for the Ring-OSC by a mask option, if the X1 input is used as the CPU clock. Make sure that MCS is 1 at this time. (d) When Ring-OSC is used as the CPU clock, the X1 input clock can be set to stopped/oscillating using the main OSC control register (MOC). Make sure that MCS is 0 at this time. (e) Select the X1 input clock oscillation stabilization time (211/fXP, 213/fXP, 214/fXP, 215/fXP, 216/fXP) using the oscillation stabilization time select register (OSTS) when releasing STOP mode while the X1 input clock is being used as the CPU clock. In addition, when releasing STOP mode while RESET is released and the Ring-OSC clock is being used as the CPU clock, check the X1 input clock oscillation stabilization time using the oscillation stabilization time counter status register (OSTC). User's Manual U15836EJ5V0UD 101 CHAPTER 5 CLOCK GENERATOR A status transition diagram of this product is shown in Figure 5-11, and the relationship between the operation clocks in each operation status and between the oscillation control flag and oscillation status of each clock are shown in Tables 5-3 and 5-4, respectively. Figure 5-11. Status Transition Diagram (1/2) (1) When "Ring-OSC can be stopped by software" is selected by mask option HALTNote 4 HALT instruction Interrupt Interrupt HALT instruction Status 4 RSTOP = 0 CPU clock: fXP fXP: Oscillating fR: Oscillation stopped RSTOP = 1Note 1 Interrupt Interrupt HALT instruction Status 3 CPU clock: fXP fXP: Oscillating fR: Oscillating STOP instruction MCM0 = 0 MCM0 = 1Note 2 Interrupt STOP instruction HALT instruction Interrupt MSTOP = 1Note 3 Status 1 CPU clock: fR fXP: Oscillation stopped fR: Oscillating MSTOP = 0 Status 2 CPU clock: fR fXP: Oscillating fR: Oscillating STOP instruction Interrupt Interrupt STOP instruction STOPNote 4 Reset release ResetNote 5 Notes 1. When shifting from status 3 to status 4, make sure that bit 1 (MCS) of the main clock mode register (MCM) is 1. 2. Before shifting from status 2 to status 3 after reset and STOP are released, check the X1 input clock oscillation stabilization time status using the oscillation stabilization time counter status register (OSTC). 3. 4. When shifting from status 2 to status 1, make sure that MCS is 0. When "Ring-OSC can be stopped by software" is selected by a mask option, the watchdog timer stops operating in the HALT and STOP modes, regardless of the source clock of the watchdog timer. However, oscillation of Ring-OSC does not stop even in the HALT and STOP modes if RSTOP = 0. 5. 102 All reset sources (RESET input, POC, LVI, clock monitor, and WDT) User's Manual U15836EJ5V0UD CHAPTER 5 CLOCK GENERATOR Figure 5-11. Status Transition Diagram (2/2) (2) When "Ring-OSC cannot be stopped" is selected by mask option HALT Interrupt Interrupt HALT instruction Status 3 CPU clock: fXP fXP: Oscillating fR: Oscillating MCM0 = 0 MCM0 = 1Note 1 Status 2 CPU clock: fR fXP: Oscillating fR: Oscillating HALT instruction MSTOP = 1Note 2 MSTOP = 0 Status 1 CPU clock: fR fXP: Oscillation stopped fR: Oscillating STOP instruction Interrupt STOP instruction HALT instruction Interrupt STOP instruction Interrupt STOPNote 3 Interrupt Reset release ResetNote 4 Notes 1. Before shifting from status 2 to status 3 after reset and STOP are released, check the X1 input clock oscillation stabilization time status using the oscillation stabilization time counter status register (OSTC). 2. When shifting from status 2 to status 1, make sure that MCS is 0. 3. The watchdog timer operates using Ring-OSC even in STOP mode if "Ring-OSC cannot be stopped" is selected by a mask option. Ring-OSC division can be selected as the count source of 8-bit timer H1 (TMH1), so clear the watchdog timer using the TMH1 interrupt request before watchdog timer overflow. If this processing is not performed, an internal reset signal is generated at watchdog timer overflow after STOP instruction execution. 4. All reset sources (RESET input, POC, LVI, clock monitor, and WDT) User's Manual U15836EJ5V0UD 103 CHAPTER 5 CLOCK GENERATOR Table 5-3. Relationship Between Operation Clocks in Each Operation Status Status X1 Oscillator Ring-OSC Oscillator RSTOP = 0 Reset Stopped STOP Oscillating Stopped Oscillating Notes 1. 2. Peripherals MCM0 = 0 MCM0 = 1 RSTOP = 1 Stopped Oscillating HALT Prescaler Clock Supplied to After Release Note 2 Note 1 Operation Mode CPU Clock Ring-OSC Stopped Note 3 Stopped Note 4 Ring-OSC X1 When "Cannot be stopped" is selected for Ring-OSC by a mask option. When "Can be stopped by software" is selected for Ring-OSC by a mask option. 3. Operates using the CPU clock at STOP instruction execution. 4. Operates using the CPU clock at HALT instruction execution. Caution The RSTOP setting is valid only when "Can be stopped by software" is set for Ring-OSC by a mask option. Remark RSTOP: Bit 0 of the Ring-OSC mode register (RCM) MCM0: Bit 0 of the main clock mode register (MCM) Table 5-4. Oscillation Control Flags and Clock Oscillation Status X1 Oscillator MSTOP = 1 MSTOP = 0 RSTOP = 0 Stopped RSTOP = 1 Setting prohibited RSTOP = 0 Oscillating RSTOP = 1 Ring-OSC Oscillator Oscillating Oscillating Stopped Caution The RSTOP setting is valid only when "Can be stopped by software" is set for Ring-OSC by a mask option. Remark MSTOP: Bit 7 of the main OSC control register (MOC) RSTOP: Bit 0 of the Ring-OSC mode register (RCM) 104 User's Manual U15836EJ5V0UD CHAPTER 5 CLOCK GENERATOR 5.6 Time Required to Switch Between Ring-OSC Clock and X1 Input Clock Bit 0 (MCM0) of the main clock mode register (MCM) is used to switch between the Ring-OSC clock and X1 input clock. In the actual switching operation, switching does not occur immediately after MCM0 rewrite; several instructions are executed using the pre-switch over clock after switching MCM0 (see Table 5-5). Bit 1 (MCS) of MCM is used to judge that operation is performed using either the Ring-OSC clock or X1 input clock. To stop the original clock after changing the clock, wait for the number of clocks shown in Table 5-5. Table 5-5. Maximum Time Required to Switch Between Ring-OSC Clock and X1 Input Clock PCC Maximum Time Required for Switching PCC2 PCC1 PCC0 0 0 0 0 0 1 X1Ring-OSC fXP/fR + 1 clock Ring-OSCX1 2 clocks Note fXP/2fR + 1 clock Note 2 clocks Note The setting of (A1) grade products and (A2) grade products is prohibited. Caution To calculate the maximum time, set fR = 120 kHz. Remarks 1. PCC: Processor clock control register 2. fXP: X1 input clock oscillation frequency 3. fR: Ring-OSC clock oscillation frequency 4. The maximum time is the number of clocks of the CPU clock before switching. User's Manual U15836EJ5V0UD 105 CHAPTER 5 CLOCK GENERATOR 5.7 Time Required for CPU Clock Switchover The CPU clock can be switched using bits 0 to 2 (PCC0 to PCC2) of the processor clock control register (PCC). The actual switchover operation is not performed immediately after rewriting to the PCC; operation continues on the pre-switchover clock for several instructions (see Table 5-6). Table 5-6. Maximum Time Required for CPU Clock Switchover Set Value Before Set Value After Switchover Switchover PCC2 PCC1 PCC0 PCC2 PCC1 PCC0 PCC2 PCC1 PCC0 PCC2 PCC1 PCC0 PCC2 PCC1 PCC0 PCC2 PCC1 PCC0 0 0 0 0 0 0 1 0 0 0 0 0 1 8 clocks 0 1 0 4 clocks 4 clocks 0 1 1 2 clocks 2 clocks 2 clocks 1 0 0 1 clock 1 clock 1 clock Remark 16 clocks 1 0 0 1 1 1 0 16 clocks 16 clocks 16 clocks 8 clocks 8 clocks 8 clocks 4 clocks 4 clocks 0 2 clocks 1 clock The maximum time is the number of clocks of the CPU clock before switching. Caution Setting the following values is prohibited when the CPU operates on the Ring-OSC clock. * PCC2, PCC1, PCC0 = 0, 0, 1 (settable only for standard products and (A) grade products) * PCC2, PCC1, PCC0 = 0, 1, 0 * PCC2, PCC1, PCC0 = 0, 1, 1 * PCC2, PCC1, PCC0 = 1, 0, 0 106 User's Manual U15836EJ5V0UD CHAPTER 5 CLOCK GENERATOR 5.8 Clock Switching Flowchart and Register Setting 5.8.1 Switching from Ring-OSC clock to X1 input clock Figure 5-12. Switching from Ring-OSC Clock to X1 Input Clock (Flowchart) After reset release PCC = 00H RCM = 00H MCM = 00H MOC = 00H OSTC = 00H OSTS = 05HNote Register initial value after reset ; fCPU = fR ; Ring-OSC oscillation ; Ring-OSC clock operation ; X1 oscillation ; Oscillation stabilization time status register ; Oscillation stabilization time fXP/216 Each processing OSTC checkNote Ring-OSC clock ; X1 oscillation stabilization time status check X1 oscillation stabilization time has not elapsed operation X1 oscillation stabilization time has elapsed PCC setting Ring-OSC clock operation (dividing set PCC) MCM.0 1 MCM.1 (MCS) is changed from 0 to 1 X1 input clock operation X1 input clock operation Note Check the oscillation stabilization wait time of the X1 oscillator after reset release using the OSTC register and then switch to the X1 input clock operation after the oscillation stabilization wait time has elapsed. The OSTS register setting is valid only after STOP mode is released by interrupt during X1 input clock operation. User's Manual U15836EJ5V0UD 107 CHAPTER 5 CLOCK GENERATOR 5.8.2 Switching from X1 input clock to Ring-OSC clock Figure 5-13. Switching from X1 Input Clock to Ring-OSC Clock (Flowchart) Register setting in X1 input clock operation MCM = 03H ; X1 input clock operation Yes: RSTOP = 1 X1 input clock operation RCM.0Note (RSTOP) = 1? ; Ring-OSC oscillating? No: RSTOP = 0 RSTOP = 0 MCM0 0 ; Ring-OSC clock operation MCM.1 (MCS) is changed from 1 to 0 Ring-OSC clock operation Ring-OSC clock operation Note Required only when "Can be stopped by software" is selected for Ring-OSC by a mask option. 108 User's Manual U15836EJ5V0UD CHAPTER 5 CLOCK GENERATOR 5.8.3 Register settings The table below shows the statuses of the setting flags and status flags when each mode is set. Table 5-7. Clock and Register Settings fCPU Mode Setting Flag MCM Register Note 2 X1 input clock Ring-OSC clock Notes 1. 2. MOC Register Status Flag RCM Register RSTOP Note 1 MCM Register MCM0 MSTOP Ring-OSC oscillating 1 0 0 1 Ring-OSC stopped 1 0 1 1 X1 oscillating 0 0 0 0 X1 stopped 0 1 0 0 MCS This is valid only when "Can be stopped by software" is selected for Ring-OSC by mask option. Do not set MSTOP to 1 during X1 input clock operation (oscillation of X1 is not stopped even when MSTOP = 1). User's Manual U15836EJ5V0UD 109 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. * Interval timer * PPG output * Pulse width measurement * External event counter * Square-wave output * One-shot pulse output (1) Interval timer 16-bit timer/event counter 00 generates an interrupt request at the preset time interval. (2) PPG output 16-bit timer/event counter 00 can output a rectangular wave whose frequency and output pulse width can be set freely. (3) Pulse width measurement 16-bit timer/event counter 00 can measure the pulse width of an externally input signal. (4) External event counter 16-bit timer/event counter 00 can measure the number of pulses of an externally input signal. (5) Square-wave output 16-bit timer/event counter 00 can output a square wave with any selected frequency. (6) One-shot pulse output 16-bit timer/event counter 00 can output a one-shot pulse whose output pulse width can be set freely. 110 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 6.2 Configuration of 16-Bit Timer/Event Counter 00 16-bit timer/event counter 00 includes the following hardware. Table 6-1. Configuration of 16-Bit Timer/Event Counter 00 Item Configuration Timer counter 16 bits (TM00) Register 16-bit timer capture/compare register: 16 bits (CR000, CR010) Timer input TI000, TI010 Timer output TO00, output controller Control registers 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 0 (PM0) Port register 0 (P0) Figure 6-1 shows the block diagram. Figure 6-1. Block Diagram of 16-Bit Timer/Event Counter 00 Internal bus Capture/compare control register 00 (CRC00) Selector CRC002CRC001 CRC000 Noise eliminator TI010/TO00/P01 Selector To CR010 16-bit timer capture/compare register 000 (CR000) INTTM000 Match Noise eliminator 16-bit timer counter 00 (TM00) Output controller TO00/TI010/ P01 Match 2 Output latch (P01) Noise eliminator TI000/P00 Clear PM01 16-bit timer capture/compare register 010 (CR010) Selector fX Selector fX fX/22 fX/28 INTTM010 CRC002 PRM001 PRM000 Prescaler mode register 00 (PRM00) TMC003 TMC002 TMC001 OVF00 OSPT00 OSPE00 TOC004 LVS00 LVR00 TOC001 TOE00 16-bit timer output 16-bit timer mode control register 00 control register 00 (TOC00) (TMC00) Internal bus User's Manual U15836EJ5V0UD 111 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 input clock. Figure 6-2. Format of 16-Bit Timer Counter 00 (TM00) Address: FF10H, FF11H Symbol After reset: 0000H R FF11H FF10H 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 mode in which clear & start occurs when inputting the valid edge of TI000 <4> If TM00 and CR000 match in the mode in which clear & start occurs on a match of TM00 and CR000 <5> OSPT00 is set to 1 in one-shot pulse output mode (2) 16-bit timer capture/compare register 000 (CR000) CR000 is a 16-bit register that has the functions of both a capture register and a compare register. Whether it is used as a capture register or as a compare register is set by bit 0 (CRC000) of capture/compare control register 00 (CRC00). CR000 can be set by a 16-bit memory manipulation instruction. RESET input clears CR000 to 0000H. Figure 6-3. Format of 16-Bit Timer Capture/Compare Register 000 (CR000) Address: FF12H, FF13H Symbol After reset: 0000H R/W FF13H FF12H 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. The set value is held until CR000 is rewritten. * 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. The TI000 or TI010 pin valid edge is set using prescaler mode register 00 (PRM00) (see Table 6-2). 112 User's Manual U15836EJ5V0UD 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 ES001 ES000 Falling edge Rising edge 0 1 Rising edge Falling edge 0 0 No capture operation Both rising and falling edges 1 1 ES101 ES100 (2) TI010 pin valid edge selected as capture trigger (CRC001 = 0, CRC000 = 1) CR000 Capture Trigger TI010 Pin Valid Edge Falling edge Falling edge 0 0 Rising edge Rising edge 0 1 Both rising and falling edges Both rising and falling edges 1 1 Remarks 1. Setting ES001, ES000 = 1, 0 and ES101, ES100 = 1, 0 is prohibited. 2. ES001, ES000: Bits 5 and 4 of prescaler mode register 00 (PRM00) ES101, 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 a value other than 0000H in CR000 in the mode in which clear & start occurs on a match of TM00 and CR000. 2. If CR000 is set to 0000H in the free-running mode and in the clear mode using the valid edge of the TI000 pin, an interrupt request (INTTM000) is generated when the value of CR000 changes from 0000H to 0001H following TM00 overflow (FFFFH). Moreover, INTTM000 is generated after a match of TM00 and CR000 is detected, a valid edge of the TI010 pin is detected, and the timer is cleared by a one-shot trigger. 3. When P01 is used as the valid edge input pin of TI010, it cannot be used as the timer output (TO00). Moreover, when P01 is used as TO00, it cannot be used as the valid edge input pin of TI010. 4. When CR000 is used as a capture register, read data is undefined if the register read time and capture trigger input conflict (the capture data itself is the correct value). If timer count stop and capture trigger input conflict, the captured data is undefined. 5. Do not rewrite CR000 during TM00 operation. User's Manual U15836EJ5V0UD 113 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 (3) 16-bit timer capture/compare register 010 (CR010) CR010 is a 16-bit register that has the functions of both a capture register and a compare register. Whether it is used as a capture register or a compare register is set by bit 2 (CRC002) of capture/compare control register 00 (CRC00). CR010 can be set by a 16-bit memory manipulation instruction. RESET input clears CR010 to 0000H. Figure 6-4. Format of 16-Bit Timer Capture/Compare Register 010 (CR010) Address: FF14H, FF15H Symbol After reset: 0000H R/W FF15H FF14H CR010 * When CR010 is used as a compare register The value set in the CR010 is constantly compared with the 16-bit timer counter 00 (TM00) count value, and an interrupt request (INTTM010) is generated if they match. The set value is held until CR010 is rewritten. * 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 prescaler mode register 00 (PRM00) (see Table 6-3). Table 6-3. CR010 Capture Trigger and Valid Edge of TI000 Pin (CRC002 = 1) CR010 Capture Trigger TI000 Pin Valid Edge ES001 ES000 Falling edge Falling edge 0 0 Rising edge Rising edge 0 1 Both rising and falling edges Both rising and falling edges 1 1 Remarks 1. Setting ES001, ES000 = 1, 0 is prohibited. 2. ES001, ES000: Bits 5 and 4 of prescaler mode register 00 (PRM00) CRC002: Bit 2 of capture/compare control register 00 (CRC00) Cautions 1. If the CR010 register is cleared to 0000H, an interrupt request (INTTM010) is generated when the value of CR010 changes from 0000H to 0001H following TM00 overflow (FFFFH). Moreover, INTTM010 is generated after a match of TM00 and CR010 is detected, a valid edge of the TI000 pin is detected, and the timer is cleared by a one-shot trigger. 2. When CR010 is used as a capture register, read data is undefined if the register read time and capture trigger input conflict (the capture data itself is the correct value). If count stop input and capture trigger input conflict, the captured data is undefined. 3. CR010 can be rewritten during TM00 operation. For details, see Caution 2 in Figure 6-15. 114 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 6.3 Registers Controlling 16-Bit Timer/Event Counter 00 The following six 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 0 (PM0) * Port register 0 (P0) (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 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears TMC00 to 00H. Caution 16-bit timer counter 00 (TM00) starts operation at the moment TMC002 and TMC003 are set to values other than 0, 0 (operation stop mode), respectively. Clear TMC002 and TMC003 to 0, 0 to stop operation. User's Manual U15836EJ5V0UD 115 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-5. Format of 16-Bit Timer Mode Control Register 00 (TMC00) Address FFBAH After reset: 00H R/W Symbol 7 6 5 4 TMC00 0 0 0 0 TMC003 TMC002 TMC001 0 0 3 <0> Operating mode and clear TO00 inversion timing Interrupt request mode selection selection generation 0 Operation stop 0 0 1 0 1 0 Free-running mode 1 1 TMC003 TMC002 TMC001 OVF00 (TM00 cleared to 0) 0 2 1 No change Not generated Match between TM00 and TM00 and CR010 Generated on match Match between TM00 and between TM00 and CR000, CR000, match between or match between TM00 TM00 and CR010 or TI000 and CR010 valid edge Generated by inputting CR000 capture trigger between TM00 and CR000 CR000 or match between TM00 and CR010 1 1 Match between TM00 and 1 CR000, match between TM00 and CR010 or TI000 valid edge OVF00 16-bit timer counter 00 (TM00) overflow detection 0 Overflow not detected 1 Overflow detected Cautions 1. Timer operation must be stopped before writing to bits other than the OVF00 flag. 2. Set the valid edge of the TI000/P00 pin using prescaler mode register 00 (PRM00). 3. If any of the following modes: the mode in which clear & start occurs on match between TM00 and CR000, the mode in which clear & start occurs at the TI000 valid edge, or freerunning 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. Remark TO00: 16-bit timer/event counter 00 output pin TI000: 16-bit timer/event counter 00 input pin TM00: 16-bit timer counter 00 CR000: 16-bit timer capture/compare register 000 CR010: 16-bit timer capture/compare register 010 116 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 (2) Capture/compare control register 00 (CRC00) This register controls the operation of the 16-bit timer capture/compare registers (CR000, CR010). CRC00 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears CRC00 to 00H. Figure 6-6. Format of Capture/Compare Control Register 00 (CRC00) Address: FFBCH After reset: 00H R/W Symbol 7 6 5 4 3 2 1 0 CRC00 0 0 0 0 0 CRC002 CRC001 CRC000 CRC002 CR010 operating mode selection 0 Operates as compare register 1 Operates as capture register CRC001 CR000 capture trigger selection 0 Captures on valid edge of TI010 1 Captures on valid edge of TI000 by reverse phase CRC000 Note CR000 operating mode selection 0 Operates as compare register 1 Operates as capture register Note The capture operation is not performed if both the rising and falling edges are specified as the valid edge of TI000. Cautions 1. Timer operation must be stopped before setting CRC00. 2. When the mode in which clear & start occurs on a match between TM00 and CR000 is selected with 16-bit timer mode control register 00 (TMC00), CR000 should not be specified as a capture register. 3. To ensure that the capture operation is performed properly, the capture trigger requires a pulse two cycles longer than the count clock selected by prescaler mode register 00 (PRM00). (3) 16-bit timer output control register 00 (TOC00) This register controls the operation of the 16-bit timer/event counter 00 output controller. It sets/resets the timer output F/F (LV00), enables/disables output inversion and 16-bit timer/event counter 00 timer output, enables/disables the one-shot pulse output operation, and sets the one-shot pulse output trigger via software. TOC00 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears TOC00 to 00H. User's Manual U15836EJ5V0UD 117 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-7. Format of 16-Bit Timer Output Control Register 00 (TOC00) Address: FFBDH After reset: 00H R/W Symbol 7 <6> <5> 4 <3> <2> 1 <0> TOC00 0 OSPT00 OSPE00 TOC004 LVS00 LVR00 TOC001 TOE00 OSPT00 One-shot pulse output trigger control via software 0 No one-shot pulse output trigger 1 One-shot pulse output trigger OSPE00 One-shot pulse output operation control 0 Successive pulse output mode 1 One-shot pulse output mode TOC004 Timer output F/F control using match of CR010 and TM00 0 Disables inversion operation 1 Enables inversion operation LVS00 Note LVR00 Timer output F/F status setting 0 0 No change 0 1 Timer output F/F reset (0) 1 0 Timer output F/F set (1) 1 1 Setting prohibited TOC001 Timer output F/F control using match of CR000 and TM00 0 Disables inversion operation 1 Enables inversion operation TOE00 Timer output control 0 Disables output (output fixed to level 0) 1 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 valid edge. In the mode in which clear & start occurs on a match between the TM00 register and CR000 register, one-shot pulse output is not possible because an overflow does not occur. Cautions 1. Timer operation must be stopped before setting other than TOC004. 2. LVS00 and LVR00 are 0 when they are 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 to write to OSPT00 successively. 6. Do not set LVS00 to 1 before TOE00, and do not set LVS00 and TOE00 to 1 simultaneously. 7. Do not make settings <1> and <2> below simultaneously. In addition, follow the setting procedure shown below. <1> Setting of TOC001, TOC004, TOE00, and OSPE00: Setting of timer output operation <2> Setting of LVS00 and LVR00: 118 User's Manual U15836EJ5V0UD Setting of timer output F/F 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 TI000 and TI010 input valid edges. PRM00 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears PRM00 to 00H. Figure 6-8. Format of Prescaler Mode Register 00 (PRM00) Address: FFBBH After reset: 00H R/W Symbol 7 6 5 4 3 2 1 0 PRM00 ES101 ES100 ES001 ES000 0 0 PRM001 PRM000 ES101 ES100 0 0 Falling edge 0 1 Rising edge 1 0 Setting prohibited 1 1 Both falling and rising edges ES001 ES000 0 0 Falling edge 0 1 Rising edge TI010 valid edge selection TI000 valid edge selection 1 0 Setting prohibited 1 1 Both falling and rising edges PRM001 PRM000 0 0 fX (10 MHz) 0 1 fX/2 (2.5 MHz) 1 0 fX/2 (39.06 kHz) 1 1 TI000 valid edge Note 1 Count clock selection 2 8 Note 2 Notes 1. Be sure to set the count clock so that the following condition is satisfied. * VDD = 4.0 to 5.5 V: Count clock 10 MHz * VDD = 3.3 to 4.0 V: Count clock 8.38 MHz * VDD = 2.7 to 3.3 V: Count clock 5 MHz * VDD = 2.5 to 2.7 V: Count clock 2.5 MHz 2. The external clock requires a pulse two cycles longer than the internal clock (fX). Cautions 1. When the Ring-OSC clock is selected as the clock to be supplied to the CPU, the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the count clock is the Ring-OSC clock, the operation of 16-bit timer/event counter 00 is not guaranteed. When an external clock is used and when the Ring-OSC clock is selected and supplied to the CPU, the operation of 16-bit timer/event counter 00 is not guaranteed, either, because the Ring-OSC clock is supplied as the sampling clock to eliminate noise. 2. Always set data to PRM00 after stopping the timer operation. 3. If the valid edge of TI000 is to be set for the count clock, do not set the clear & start mode using the valid edge of TI000 and the capture trigger. User's Manual U15836EJ5V0UD 119 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Cautions 4. If the TI000 or TI010 pin is high level immediately after system reset, the rising edge is immediately detected after the rising edge or both the rising and falling edges are set as the valid edge(s) of the TI000 pin or TI010 pin to enable the operation of 16-bit timer counter 00 (TM00). Care is therefore required when pulling up the TI000 or TI010 pin. However, when the TI000 or TI010 pin is high level and re-enabling operation after the operation has been stopped, the rising edge is not detected. 5. When P01 is used as the TI010 valid edge input pin, it cannot be used as the timer output (TO00), and when used as TO00, it cannot be used as the TI010 valid edge input pin. Remarks 1. fX: X1 input clock oscillation frequency 2. TI000, TI010: 16-bit timer/event counter 00 input pin 3. Figures in parentheses are for operation with fX = 10 MHz. (5) Port mode register 0 (PM0) This register sets port 0 input/output in 1-bit units. When using the P01/TO00/TI010 pin for timer output, set PM01 and the output latch of P01 to 0. When using the P01/TO00/TI010 pin for timer input, set PM01 to 1. The output latch of P01 at this time may be 0 or 1. PM0 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input sets PM0 to FFH. Figure 6-9. Format of Port Mode Register 0 (PM0) Address: FF20H Symbol 7 6 5 4 PM0 1 1 1 1 PM0n 120 After reset: FFH R/W 3 2 1 0 PM03 PM02 PM01 PM00 P0n pin I/O mode selection (n = 0 to 3) 0 Output mode (output buffer on) 1 Input mode (output buffer off) User's Manual U15836EJ5V0UD 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 PRM000 register. <4> Set the TMC00 register to start the operation (see Figure 6-10 for the set value). Caution Do not rewrite CR000 during TM00 operation. Remark For how to enable the INTTM000 interrupt, see CHAPTER 14 INTERRUPT FUNCTIONS. Interrupt requests are generated repeatedly using the count value preset in 16-bit timer capture/compare register 000 (CR000) as the interval. When the count value of 16-bit timer counter 00 (TM00) matches the value set in CR000, counting continues with the TM00 value cleared to 0 and the interrupt request signal (INTTM000) is generated. The count clock of 16-bit timer/event counter 00 can be selected with bits 0 and 1 (PRM000, PRM001) of prescaler mode register 00 (PRM00). User's Manual U15836EJ5V0UD 121 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-10. Control Register Settings for Interval Timer Operation (a) 16-bit timer mode control register 00 (TMC00) TMC00 7 6 5 4 0 0 0 0 TMC003 TMC002 TMC001 OVF00 1 1 0/1 0 Clears and starts on match between TM00 and CR000. (b) Capture/compare control register 00 (CRC00) CRC00 7 6 5 4 3 0 0 0 0 0 CRC002 CRC001 CRC000 0/1 0/1 0 CR000 used as compare register (c) Prescaler mode register 00 (PRM00) ES101 ES100 ES001 ES000 PRM00 0/1 0/1 0/1 0/1 3 2 0 0 PRM001 PRM000 0/1 0/1 Selects count clock. Setting invalid (setting "10" is prohibited.) Setting invalid (setting "10" is prohibited.) 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. 122 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-11. Interval Timer Configuration Diagram 16-bit timer capture/compare register 000 (CR000) INTTM000 Selector fX fX/22 fX/28 TI000/P00 16-bit timer counter 00 (TM00) Note OVF00 Noise eliminator Clear circuit fX Note OVF00 is set to 1 only when CR000 is set to FFFFH. Figure 6-12. Timing of Interval Timer Operation t Count clock TM00 count value 0000H 0001H N Timer operation enabled CR000 0000H 0001H Clear N N N 0000H 0001H N Clear N N INTTM000 Interrupt acknowledged Remark Interrupt acknowledged Interval time = (N + 1) x t N = 0001H to FFFFH (settable range) User's Manual U15836EJ5V0UD 123 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 6.4.2 PPG output operations Setting 16-bit timer mode control register 00 (TMC00) and capture/compare control register 00 (CRC00) as shown in Figure 6-13 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-13 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-13 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-13 for the set value). Caution To change the value of the duty factor (the value of the CR010 register) during operation, see Caution 2 in Figure 6-15 PPG Output Operation Timing. Remarks 1. For the setting of the TO00 pin, see 6.3 (5) Port mode register 0 (PM0). 2. For how to enable the INTTM000 interrupt, see CHAPTER 14 INTERRUPT FUNCTIONS. 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. 124 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-13. Control Register Settings for PPG Output Operation (a) 16-bit timer mode control register 00 (TMC00) TMC00 7 6 5 4 0 0 0 0 TMC003 TMC002 TMC001 OVF00 1 1 0 0 Clears and starts on match between TM00 and CR000. (b) Capture/compare control register 00 (CRC00) CRC00 7 6 5 4 3 0 0 0 0 0 CRC002 CRC001 CRC000 x 0 0 CR000 used as compare register CR010 used as compare register (c) 16-bit timer output control register 00 (TOC00) 7 TOC00 0 OSPT00 OSPE00 TOC004 LVS00 LVR00 TOC001 TOE00 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 (d) Prescaler mode register 00 (PRM00) ES101 ES100 ES001 ES000 PRM00 0/1 0/1 0/1 0/1 3 2 0 0 PRM001 PRM000 0/1 0/1 Selects count clock. Setting invalid (setting "10" is prohibited.) Setting invalid (setting "10" is prohibited.) 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 x: Don't care User's Manual U15836EJ5V0UD 125 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-14. Configuration of PPG Output 16-bit timer capture/compare register 000 (CR000) Selector fX fX/22 fX/28 Noise eliminator Output controller TI000/P00 Clear circuit 16-bit timer counter 00 (TM00) fX TO00/TI010/P01 16-bit timer capture/compare register 010 (CR010) Figure 6-15. PPG Output Operation Timing t Count clock TM00 count value N 0000H 0001H M-1 M Clear N-1 N 0000H 0001H Clear CR000 capture value N CR010 capture value M TO00 Pulse width: (M + 1) x t 1 cycle: (N + 1) x t Cautions 1. Do not rewrite CR000 during TM00 operation. 2. In the PPG output operation, change the pulse width (rewrite CR010) during TM00 operation using the following procedure. <1> Remark 126 Disable the timer output inversion operation by match of TM00 and CR010 (TOC004 = 0) <2> Disable the INTTM010 interrupt (TMMK010 = 1) <3> Rewrite CR010 <4> Wait for 1 cycle of the TM00 count clock <5> Enable the timer output inversion operation by match of TM00 and CR010 (TOC004 = 1) <6> Clear the interrupt request flag of INTTM010 (TMIF010 = 0) <7> Enable the INTTM010 interrupt (TMMK010 = 0) 0000H M < N FFFFH User's Manual U15836EJ5V0UD 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-16. 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-17, 6-20, 6-22, and 6-24 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-17, 6-20, 6-22, and 6-24 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 0 (PM0). 2. For how to enable the INTTM000 (or INTTM010) interrupt, see CHAPTER 14 INTERRUPT FUNCTIONS. User's Manual U15836EJ5V0UD 127 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 (1) Pulse width measurement with free-running counter and one capture register When 16-bit timer counter 00 (TM00) is operated in free-running mode, and the edge specified by prescaler mode register 00 (PRM00) is input to the TI000 pin, the value of TM00 is taken into 16-bit timer capture/compare register 010 (CR010) and an external interrupt request signal (INTTM010) is set. Specify both the rising and falling edges of the TI000 pin by using bits 4 and 5 (ES000 and ES001) of PRM00. Sampling is performed using the count clock selected by PRM00, and a capture operation is only performed when the valid level of the TI000 pin is detected twice, thus eliminating noise with a short pulse width. Figure 6-17. Control Register Settings for Pulse Width Measurement with Free-Running Counter and One Capture Register (When TI000 and CR010 Are Used) (a) 16-bit timer mode control register 00 (TMC00) TMC00 7 6 5 4 0 0 0 0 TMC003 TMC002 TMC001 OVF00 0 1 0/1 0 Free-running mode (b) Capture/compare control register 00 (CRC00) CRC00 7 6 5 4 3 0 0 0 0 0 CRC002 CRC001 CRC000 1 0/1 0 CR000 used as compare register CR010 used as capture register (c) Prescaler mode register 00 (PRM00) ES101 ES100 ES001 ES000 PRM00 0/1 0/1 1 1 3 2 0 0 PRM001 PRM000 0/1 0/1 Selects count clock (setting "11" is prohibited). Specifies both edges for pulse width detection. Setting invalid (setting "10" is prohibited.) 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. 128 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-18. Configuration Diagram for Pulse Width Measurement with Free-Running Counter fX/22 fX/28 Selector fX 16-bit timer counter 00 (TM00) OVF00 16-bit timer capture/compare register 010 (CR010) TI000 INTTM010 Internal bus Figure 6-19. Timing of Pulse Width Measurement Operation with Free-Running Counter and One Capture Register (with Both Edges Specified) t Count clock TM00 count value 0000H 0001H D0 D0 + 1 D1 D1 + 1 FFFFH 0000H D2 D3 TI000 pin input CR010 capture value D0 D1 D2 D3 INTTM010 Note OVF00 (D1 - D0) x t (10000H - D1 + D2) x t (D3 - D2) x t Note Clear OVF00 by software. User's Manual U15836EJ5V0UD 129 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 (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. When the edge specified by bits 4 and 5 (ES000 and ES001) of prescaler mode register 00 (PRM00) is input to the TI000 pin, the value of TM00 is taken into 16-bit timer capture/compare register 010 (CR010) and an interrupt request signal (INTTM010) is set. Also, when the edge specified by bits 6 and 7 (ES100 and ES101) 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. Specify both the rising and falling edges as the edges of the TI000 and TI010 pins, by using bits 4 and 5 (ES000 and ES001) and bits 6 and 7 (ES100 and ES101) of PRM00. Sampling is performed at the interval selected by prescaler mode register 00 (PRM00), and a capture operation is only performed when the valid level of the TI000 pin or TI010 pin is detected twice, thus eliminating noise with a short pulse width. Figure 6-20. Control Register Settings for Measurement of Two Pulse Widths with Free-Running Counter (a) 16-bit timer mode control register 00 (TMC00) TMC00 7 6 5 4 0 0 0 0 TMC003 TMC002 TMC001 OVF00 0 1 0/1 0 Free-running mode (b) Capture/compare control register 00 (CRC00) CRC00 7 6 5 4 3 0 0 0 0 0 CRC002 CRC001 CRC000 1 0 1 CR000 used as capture register Captures valid edge of TI010 pin to CR000 CR010 used as capture register (c) Prescaler mode register 00 (PRM00) ES101 ES100 ES001 ES000 PRM00 1 1 1 1 3 2 0 0 PRM001 PRM000 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. 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. 130 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-21. Timing of Pulse Width Measurement Operation with Free-Running Counter (with Both Edges Specified) t Count clock TM00 count value 0000H 0001H D0 D0 + 1 D1 D1 + 1 FFFFH 0000H D2 D2 + 1 D2 + 2 D3 TI000 pin input D0 CR010 capture value D2 D1 INTTM010 TI010 pin input CR000 capture value D1 D2 + 1 INTTM000 Note OVF00 (D1 - D0) x t (10000H - D1 + D2) x t (D3 - D2) x t (10000H - D1 + (D2 + 1)) x t Note Clear OVF00 by software. User's Manual U15836EJ5V0UD 131 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 (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. When the rising or falling edge specified by bits 4 and 5 (ES000 and ES001) of prescaler mode register 00 (PRM00) is input to the TI000 pin, the value of TM00 is taken into 16-bit timer capture/compare register 010 (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 at the interval selected by prescaler mode register 00 (PRM00), and a capture operation is only performed when the valid level of the TI000 pin is detected twice, thus eliminating noise with a short pulse width. Figure 6-22. Control Register Settings for Pulse Width Measurement with Free-Running Counter and Two Capture Registers (with Rising Edge Specified) (a) 16-bit timer mode control register 00 (TMC00) TMC00 7 6 5 4 0 0 0 0 TMC003 TMC002 TMC001 OVF00 0 1 0/1 0 Free-running mode (b) Capture/compare control register 00 (CRC00) CRC00 7 6 5 4 3 0 0 0 0 0 CRC002 CRC001 CRC000 1 1 1 CR000 used as capture register Captures to CR000 at inverse edge to valid edge of TI000. CR010 used as capture register (c) Prescaler mode register 00 (PRM00) ES101 ES100 ES001 ES000 PRM00 0/1 0/1 0 1 3 2 0 0 PRM001 PRM000 0/1 0/1 Selects count clock (setting "11" is prohibited). Specifies rising edge for pulse width detection. Setting invalid (setting "10" is prohibited.) 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. 132 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-23. Timing of Pulse Width Measurement Operation with Free-Running Counter and Two Capture Registers (with Rising Edge Specified) t Count clock TM00 count value 0000H 0001H D0 D0 + 1 D1 D1 + 1 FFFFH 0000H D2 D2 + 1 D3 TI000 pin input CR010 capture value D0 CR000 capture value D2 D1 D3 INTTM010 Note OVF00 (D1 - D0) x t (10000H - D1 + D2) x t (D3 - D2) x t Note Clear OVF00 by software. (4) Pulse width measurement by means of restart When input of a valid edge to 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 operation. Either of two edgesrising or fallingcan be selected using bits 4 and 5 (ES000 and ES001) of prescaler mode register 00 (PRM00). Sampling is performed using the count clock cycle selected by prescaler mode register 00 (PRM00) and a capture operation is only performed when the valid level of the TI000 pin is detected twice, thus eliminating noise with a short pulse width. User's Manual U15836EJ5V0UD 133 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-24. Control Register Settings for Pulse Width Measurement by Means of Restart (with Rising Edge Specified) (a) 16-bit timer mode control register 00 (TMC00) TMC00 7 6 5 4 0 0 0 0 TMC003 TMC002 TMC001 OVF00 1 0 0/1 0 Clears and starts at valid edge of TI000 pin. (b) Capture/compare control register 00 (CRC00) CRC00 7 6 5 4 3 0 0 0 0 0 CRC002 CRC001 CRC000 1 1 1 CR000 used as capture register Captures to CR000 at inverse edge to valid edge of TI000. CR010 used as capture register (c) Prescaler mode register 00 (PRM00) ES101 ES100 ES001 ES000 PRM00 0/1 0/1 0 1 3 2 0 0 PRM001 PRM000 0/1 0/1 Selects count clock (setting "11" is prohibited). Specifies rising edge for pulse width detection. Setting invalid (setting "10" is prohibited.) Figure 6-25. Timing of Pulse Width Measurement Operation by Means of Restart (with Rising Edge Specified) t Count clock TM00 count value 0000H 0001H D0 0000H 0001H D2 0000H 0001H D1 TI000 pin input CR010 capture value D0 D2 D1 CR000 capture value INTTM010 D1 x t D2 x t 134 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 6.4.4 External event counter operation Setting The basic operation setting procedure is as follows. <1> Set the CRC00 register (see Figure 6-26 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-26 for the set value). Remarks 1. For the setting of the TI000 pin, see 6.3 (5) Port mode register 0 (PM0). 2. For how to enable the INTTM000 interrupt, see CHAPTER 14 INTERRUPT FUNCTIONS. The external event counter counts the number of external clock pulses input to the TI000 pin 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 1-bit pulse cannot be carried out). Any of three edgesrising, falling, or both edgescan be selected using bits 4 and 5 (ES000 and ES001) of prescaler mode register 00 (PRM00). Sampling is performed using the internal clock (fX) and an operation is only performed when the valid level of the TI000 pin is detected twice, thus eliminating noise with a short pulse width. User's Manual U15836EJ5V0UD 135 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-26. Control Register Settings in External Event Counter Mode (with Rising Edge Specified) (a) 16-bit timer mode control register 00 (TMC00) TMC00 7 6 5 4 0 0 0 0 TMC003 TMC002 TMC001 OVF00 1 1 0/1 0 Clears and starts on match between TM00 and CR000. (b) Capture/compare control register 00 (CRC00) CRC00 7 6 5 4 3 0 0 0 0 0 CRC002 CRC001 CRC000 0/1 0/1 0 CR000 used as compare register (c) Prescaler mode register 00 (PRM00) ES101 ES100 ES001 ES000 PRM00 0/1 0/1 0 1 3 2 0 0 PRM001 PRM000 1 1 Selects external clock. Specifies rising edge for pulse width detection. Setting invalid (setting "10" is prohibited.) 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. 136 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-27. Configuration Diagram of External Event Counter Internal bus 16-bit timer capture/compare register 000 (CR000) Match INTTM000 Clear Noise eliminator fX 16-bit timer counter 00 (TM00) OVF00Note Valid edge of TI000 Note OVF00 is set to 1 only when CR000 is set to FFFFH. Figure 6-28. External Event Counter Operation Timing (with Rising Edge Specified) TI000 pin input TM00 count value CR000 0000H 0001H 0002H 0003H 0004H 0005H N-1 N 0000H 0001H 0002H 0003H N INTTM000 Caution When reading the external event counter count value, TM00 should be read. User's Manual U15836EJ5V0UD 137 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 6.4.5 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-29 for the set value). <3> Set the TOC00 register (see Figure 6-29 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-29 for the set value). Caution Do not rewrite CR000 during TM00 operation. Remarks 1. For the setting of the TO00 pin, see 6.3 (5) Port mode register 0 (PM0). 2. For how to enable the INTTM000 interrupt, see CHAPTER 14 INTERRUPT FUNCTIONS. A square wave with any selected frequency can be output at intervals determined by the count value preset to 16bit 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-29. Control Register Settings in Square-Wave Output Mode (1/2) (a) 16-bit timer mode control register 00 (TMC00) TMC00 7 6 5 4 0 0 0 0 TMC003 TMC002 TMC001 OVF00 1 1 0 0 Clears and starts on match between TM00 and CR000. (b) Capture/compare control register 00 (CRC00) CRC00 7 6 5 4 3 0 0 0 0 0 CRC002 CRC001 CRC000 0/1 0/1 0 CR000 used as compare register 138 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-29. Control Register Settings in Square-Wave Output Mode (2/2) (c) 16-bit timer output control register 00 (TOC00) 7 TOC00 OSPT00 OSPE00 TOC004 LVS00 LVR00 TOC001 TOE00 0 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) Prescaler mode register 00 (PRM00) ES101 ES100 ES001 ES000 PRM00 0/1 0/1 0/1 0/1 3 2 0 0 PRM001 PRM000 0/1 0/1 Selects count clock. Setting invalid (setting "10" is prohibited.) Setting invalid (setting "10" is prohibited.) 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-30. 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 User's Manual U15836EJ5V0UD 139 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-31 and 6-33 for the set value). <3> Set the TOC00 register (see Figures 6-31 and 6-33 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-31 and 6-33 for the set value). Remarks 1. For the setting of the TO00 pin, see 6.3 (5) Port mode register 0 (PM0). 2. For how to enable the INTTM000 (if necessary, INTTM010) interrupt, see CHAPTER 14 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-31, 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 set 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 while the one-shot pulse is being output. To output the oneshot 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. 140 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-31. Control Register Settings for One-Shot Pulse Output with Software Trigger (a) 16-bit timer mode control register 00 (TMC00) TMC00 7 6 5 4 TMC003 0 0 0 0 0 TMC002 TMC001 1 OVF00 0 0 Free-running mode (b) Capture/compare control register 00 (CRC00) CRC00 7 6 5 4 3 0 0 0 0 0 CRC002 CRC001 CRC000 0 0/1 0 CR000 as compare register CR010 as compare register (c) 16-bit timer output control register 00 (TOC00) 7 TOC00 0 OSPT00 OSPE00 TOC004 0 1 1 LVS00 LVR00 TOC001 TOE00 0/1 0/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) Prescaler mode register 00 (PRM00) PRM00 ES101 ES100 ES001 ES000 3 2 0/1 0/1 0/1 0/1 0 0 PRM001 PRM000 0/1 0/1 Selects count clock. Setting invalid (setting "10" is prohibited.) Setting invalid (setting "10" is prohibited.) Caution Do not set the CR000 and CR010 registers to 0000H. User's Manual U15836EJ5V0UD 141 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-32. Timing of One-Shot Pulse Output Operation with Software Trigger Set TMC00 to 04H (TM00 count starts) Count clock TM00 count 0000H 0001H N N+1 0000H N-1 N M-1 M M+1 M+2 CR010 set value N N N N CR000 set value M M M M OSPT00 INTTM010 INTTM000 TO00 pin output Caution 16-bit timer counter 00 starts operating as soon as the TMC003 and TMC002 bits are set to a value other than 00 (operation stop mode). Remark N M, the output becomes active with the CR000 register and inactive with the CR010 register. Do not set N to M. Caution Even if the external trigger is generated again while the one-shot pulse is being output, it is ignored. 142 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-33. Control Register Settings for One-Shot Pulse Output with External Trigger (with Rising Edge Specified) (a) 16-bit timer mode control register 00 (TMC00) TMC00 7 6 5 4 TMC003 0 0 0 0 1 TMC002 TMC001 0 OVF00 0 0 Clears and starts at valid edge of TI000 pin (b) Capture/compare control register 00 (CRC00) CRC00 7 6 5 4 3 0 0 0 0 0 CRC002 CRC001 0 CRC000 0/1 0 CR000 used as compare register CR010 used as compare register (c) 16-bit timer output control register 00 (TOC00) 7 TOC00 0 OSPT00 OSPE00 TOC004 0 1 1 LVS00 LVR00 TOC001 TOE00 0/1 0/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) Prescaler mode register 00 (PRM00) PRM00 ES101 ES100 ES001 ES000 3 2 0/1 0/1 0 1 0 0 PRM001 PRM000 0/1 0/1 Selects count clock (setting "11" is prohibited). Specifies the rising edge for pulse width detection. Setting invalid (setting "10" is prohibited.) Caution Do not set the CR000 and CR010 registers to 0000H. User's Manual U15836EJ5V0UD 143 CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 Figure 6-34. 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 0000H 0001H 0000H N N+1 N+2 M-2 M-1 M M+1 M+2 CR010 set value N N N N CR000 set value M M M M TI000 pin input INTTM010 INTTM000 TO00 pin output Caution 16-bit timer counter 00 starts operating as soon as the TMC002 and TMC003 bits are set to a value other than 00 (operation stop mode). Remark 144 N The OVF00 flag is also set to 1 in the following case. If any of the following modes: the mode in which clear & start occurs on a match between TM00 and CR000, the mode in which clear & start occurs on a TI000 valid edge, or the free-running mode, is selected CR000 is set to FFFFH. TM00 is counted up from FFFFH to 0000H. Figure 6-36. Operation Timing of OVF00 Flag Count clock CR000 FFFFH TM00 FFFEH FFFFH 0000H 0001H OVF00 INTTM000 <2> Even if the OVF00 flag is cleared before the next count clock (before TM00 becomes 0001H) after the occurrence of TM00 overflow, the OVF00 flag is re-set newly and clear is disabled. (7) Conflicting operations When the read period of the 16-bit timer capture/compare register (CR000/CR010) and capture trigger input (CR000/CR010 used as capture register) conflict, capture trigger input has priority. The data read from CR000/CR010 is undefined. Figure 6-37. Capture Register Data Retention Timing Count clock TM00 count value N N+1 N+2 M M+1 M+2 Edge input INTTM010 Capture read signal CR010 capture value X N+2 Capture 146 User's Manual U15836EJ5V0UD M+1 Capture, but read value is not guaranteed CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 (8) Timer operation <1> Even if 16-bit timer counter 00 (TM00) is read, the value is not captured by 16-bit timer capture/compare register 010 (CR010). <2> Regardless of the CPU's operation mode, when the timer stops, the input signals to the TI000/TI010 pins are not acknowledged. <3> 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 valid edge. In the mode in which clear & start occurs on a match between the TM00 register and CR000 register, one-shot pulse output is not possible because an overflow does not occur. (9) Capture operation <1> If TI000 valid edge is specified as the count clock, a capture operation by the capture register specified as the trigger for TI000 is not possible. <2> To ensure the reliability of the capture operation, the capture trigger requires a pulse two cycles longer than the count clock selected by prescaler mode register 00 (PRM00). <3> The capture operation is performed at the falling edge of the count clock. An interrupt request input (INTTM000/INTTM010), however, is generated at the rise of the next count clock. (10) Compare operation A capture operation may not be performed for CR000/CR010 set in compare mode even if a capture trigger has been input. (11) Edge detection <1> If the TI000 or TI010 pin is high level immediately after system reset and the rising edge or both the rising and falling edges are specified as the valid edge of the TI000 or TI010 pin to enable the 16-bit timer counter 00 (TM00) operation, a rising edge is detected immediately after the operation is enabled. Be careful therefore when pulling up the TI000 or TI010 pin. However, when the TI000 or TI010 pin is high level, the rising edge is not detected at restart after the operation has been stopped. <2> The sampling clock used to eliminate noise differs when the 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 fX, and in the latter case the count clock is selected by prescaler mode register 00 (PRM00). The capture operation is started only after a valid level is detected twice by sampling the valid edge, thus eliminating noise with a short pulse width. User's Manual U15836EJ5V0UD 147 CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 7.1 Functions of 8-Bit Timer/Event Counter 50 8-bit timer/event counter 50 has the following functions. * Interval timer * External event counter * Square-wave output * PWM output Figure 7-1 shows the block diagram of 8-bit timer/event counter 50. Figure 7-1. Block Diagram of 8-Bit Timer/Event Counter 50 Internal bus Selector Note 1 S Q INV 8-bit timer OVF counter 50 (TM50) R Clear Selector TCL502 TCL501 TCL500 Timer clock selection register 50 (TCL50) Note 2 S 3 R Invert level TCE50 TMC506 LVS50 LVR50 TMC501 TOE50 8-bit timer mode control register 50 (TMC50) Internal bus Notes 1. Timer output F/F 2. PWM output F/F 148 INTTM50 Selector Match Selector TI50/TO50/P17 fX fX/2 fX/22 fX/26 fX/28 fX/213 Mask circuit 8-bit timer compare register 50 (CR50) User's Manual U15836EJ5V0UD To TMH0 To UART0 To UART6 TO50/ TI50/P17 Output latch (P17) PM17 CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 7.2 Configuration of 8-Bit Timer/Event Counter 50 8-bit timer/event counter 50 includes the following hardware. Table 7-1. Configuration of 8-Bit Timer/Event Counter 50 Item Configuration Timer register 8-bit timer counter 50 (TM50) Register 8-bit timer compare register 50 (CR50) Timer input TI50 Timer output TO50 Control registers Timer clock selection register 50 (TCL50) 8-bit timer mode control register 50 (TMC50) Port mode register 1 (PM1) Port register 1 (P1) (1) 8-bit timer counter 50 (TM50) TM50 is an 8-bit register that counts the count pulses and is read-only. The counter is incremented is synchronization with the rising edge of the count clock. Figure 7-2. Format of 8-Bit Timer Counter 50 (TM50) Address: FF16H After reset: 00H R Symbol TM50 In the following situations, the count value is cleared to 00H. <1> RESET input <2> When TCE50 is cleared <3> When TM50 and CR50 match in clear & start mode if this mode was entered upon a match of TM50 and CR50 values. User's Manual U15836EJ5V0UD 149 CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 (2) 8-bit timer compare register 50 (CR50) CR50 can be read and written by an 8-bit memory manipulation instruction. Except in PWM mode, the value set in CR50 is constantly compared with the 8-bit timer counter 50 (TM50) count value, and an interrupt request (INTTM50) is generated if they match. In PWM mode, when the TO50 pin becomes high level due to a TM50 overflow and the values of TM50 and CR50 match, the TO50 pin becomes inactive. The value of CR50 can be set within 00H to FFH. RESET input clears this register to 00H. Figure 7-3. Format of 8-Bit Timer Compare Register 50 (CR50) Address: FF17H After reset: 00H R/W Symbol CR50 Cautions 1. In the clear & start mode entered on a match of TM50 and CR50 (TMC506 = 0), do not write other values to CR50 during operation. 2. In PWM mode, make the CR50 rewrite period 3 count clocks of the count clock (clock selected by TCL50) or more. 150 User's Manual U15836EJ5V0UD CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 7.3 Registers Controlling 8-Bit Timer/Event Counter 50 The following four registers are used to control 8-bit timer/event counter 50. * Timer clock selection register 50 (TCL50) * 8-bit timer mode control register 50 (TMC50) * Port mode register 1 (PM1) * Port register 1 (P1) (1) Timer clock selection register 50 (TCL50) This register sets the count clock of 8-bit timer/event counter 50 and the valid edge of TI50 input. TCL50 can be set by an 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 7-4. Format of Timer Clock Selection Register 50 (TCL50) Address: FF6AH After reset: 00H R/W Symbol 7 6 5 4 3 2 1 0 TCL50 0 0 0 0 0 TCL502 TCL501 TCL500 TCL502 TCL501 TCL500 0 0 0 TI50 falling edge 0 0 1 TI50 rising edge 0 1 0 fX (10 MHz) 0 1 1 fX/2 (5 MHz) 1 0 0 fX/2 (2.5 MHz) 1 0 1 fX/2 (156.25 kHz) 1 1 0 fX/2 (39.06 kHz) 1 1 1 fX/2 (1.22 kHz) Note Count clock selection 2 6 8 13 Note Be sure to set the count clock so that the following condition is satisfied. * VDD = 4.0 to 5.5 V: Count clock 10 MHz * VDD = 3.3 to 4.0 V: Count clock 8.38 MHz * VDD = 2.7 to 3.3 V: Count clock 5 MHz * VDD = 2.5 to 2.7 V: Count clock 2.5 MHz Cautions 1. When the Ring-OSC clock is selected as the clock to be supplied to the CPU, the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the count clock is the Ring-OSC clock, the operation of 8-bit timer/event counter 50 is not guaranteed. 2. When rewriting TCL50 to other than the same data, stop the timer operation beforehand. 3. Be sure to clear bits 3 to 7 to 0. Remarks 1. fX: X1 input clock oscillation frequency 2. Figures in parentheses apply to operation at fX = 10 MHz. User's Manual U15836EJ5V0UD 151 CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 (2) 8-bit timer mode control register 50 (TMC50) TMC50 is a register that performs the following five types of settings. <1> 8-bit timer counter 50 (TM50) count operation control <2> 8-bit timer counter 50 (TM50) operating mode selection <3> Timer output F/F (flip-flop) status setting <4> Active level selection in timer F/F control or PWM (free-running) mode <5> Timer output control TMC50 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 7-5 shows the TMC50 format. Figure 7-5. Format of 8-Bit Timer Mode Control Register 50 (TMC50) Address: FF6BH After reset: 00H R/W Note Symbol <7> 6 5 4 <3> <2> 1 <0> TMC50 TCE50 TMC506 0 0 LVS50 LVR50 TMC501 TOE50 TCE50 TM50 count operation control 0 After clearing to 0, count operation disabled (counter stopped) 1 Count operation start TMC506 TM50 operating mode selection 0 Clear & start mode by match between TM50 and CR50 1 PWM (free-running) mode LVS50 LVR50 0 0 No change 0 1 Timer output F/F reset (0) 1 0 Timer output F/F set (1) 1 1 Setting prohibited TMC501 Timer output F/F status setting In other modes (TMC506 = 0) In PWM mode (TMC506 = 1) Timer F/F control Active level selection 0 Inversion operation disabled Active high 1 Inversion operation enabled Active low TOE50 Timer output control 0 Output disabled (TM50 outputs the low level) 1 Output enabled Note Bits 2 and 3 are write-only. 152 User's Manual U15836EJ5V0UD CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 Cautions 1. The settings of LVS50 and LVR50 are valid in other than PWM mode. 2. Do not make settings <1> to <4> below simultaneously. In addition, follow the setting procedure shown below. <1> Setting of TMC501 and TMC506: Setting of operation mode <2> Setting of TOE50 if enabling output: Enabling timer output <3> Setting of LVS50 and LVR50 (see Caution 1): Setting of timer F/F <4> Setting of TCE50 3. Stop operation before rewriting TMC506. Remarks 1. In PWM mode, PWM output is made inactive by setting TCE50 to 0. 2. If LVS50 and LVR50 are read, 0 is read. 3. The values of the TMC506, LVS50, LVR50, TMC501, and TOE50 bits are reflected at the TO50 pin regardless of the value of TCE50. (3) Port mode register 1 (PM1) This register sets port 1 input/output in 1-bit units. When using the P17/TO50/TI50 pin for timer output, clear PM17 and the output latch of P17 to 0. When using the P17/TO50/TI50 pin for timer input, set PM17 to 1. The output latch of P17 at this time may be 0 or 1. PM1 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input sets this register to FFH. Figure 7-6. Format of Port Mode Register 1 (PM1) Address: FF21H Symbol PM1 After reset: FFH R/W 7 6 5 4 3 2 1 0 PM17 PM16 PM15 PM14 PM13 PM12 PM11 PM10 PM1n P1n pin I/O mode selection (n = 0 to 7) 0 Output mode (output buffer on) 1 Input mode (output buffer off) User's Manual U15836EJ5V0UD 153 CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 7.4 Operations of 8-Bit Timer/Event Counter 50 7.4.1 Operation as interval timer 8-bit timer/event counter 50 operates as an interval timer that generates interrupt requests repeatedly at intervals of the count value preset to 8-bit timer compare register 50 (CR50). When the count value of 8-bit timer counter 50 (TM50) matches the value set to CR50, counting continues with the TM50 value cleared to 0 and an interrupt request signal (INTTM50) is generated. The count clock of TM50 can be selected with bits 0 to 2 (TCL500 to TCL502) of timer clock selection register 50 (TCL50). Setting <1> Set the registers. * TCL50: Select the count clock. * CR50: Compare value * TMC50: Stop the count operation, select clear & start mode entered on a match of TM50 and CR50. (TMC50 = 0000xxx0B x = Don't care) <2> After TCE50 = 1 is set, the count operation starts. <3> If the values of TM50 and CR50 match, INTTM50 is generated (TM50 is cleared to 00H). <4> INTTM50 is generated repeatedly at the same interval. Set TCE50 to 0 to stop the count operation. Caution Do not write other values to CR50 during operation. Figure 7-7. Interval Timer Operation Timing (1/2) (a) Basic operation t Count clock TM50 count value 00H 01H Count start CR50 N N 00H 01H Clear N 00H 01H Clear N N N TCE50 INTTM50 Interrupt acknowledged Interval time Remark Interval time = (N + 1) x t N = 01H to FEH 154 N User's Manual U15836EJ5V0UD Interrupt acknowledged Interval time CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 Figure 7-7. Interval Timer Operation Timing (2/2) (b) When CR50 = 00H t Count clock TM50 00H 00H 00H CR50 00H 00H TCE50 INTTM50 Interval time (c) When CR50 = FFH t Count clock TM50 CR50 01H FFH FEH FFH 00H FEH FFH FFH 00H FFH TCE50 INTTM50 Interrupt acknowledged Interrupt acknowledged Interval time User's Manual U15836EJ5V0UD 155 CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 7.4.2 Operation as external event counter The external event counter counts the number of external clock pulses to be input to TI50 by 8-bit timer counter 50 (TM50). TM50 is incremented each time the valid edge specified by timer clock selection register 50 (TCL50) is input. Either the rising or falling edge can be selected. When the TM50 count value matches the value of 8-bit timer compare register 50 (CR50), TM50 is cleared to 0 and an interrupt request signal (INTTM50) is generated. Whenever the TM50 count value matches the value of CR50, INTTM50 is generated. Setting <1> Set each register. * Set port mode register 1 (PM17) to 1. * TCL50: Select TI50 edge. TI50 falling edge TCL50 = 00H TI50 rising edge TCL50 = 01H * CR50: Compare value * TMC50: Stop the count operation, select clear & start mode entered on match of TM50 and CR50, disable the timer F/F inversion operation, disable timer output. (TMC50 = 0000xx00B x = Don't care) <2> When TCE50 = 1 is set, the number of pulses input from TI50 is counted. <3> When the values of TM50 and CR50 match, INTTM50 is generated (TM50 is cleared to 00H). <4> After these settings, INTTM50 is generated each time the values of TM50 and CR50 match. Figure 7-8. External Event Counter Operation Timing (with Rising Edge Specified) TI50 Count start TM50 count value 00H 01H 02H 03H 04H 05H CR50 N 00H N INTTM50 N = 00H to FFH 156 N-1 User's Manual U15836EJ5V0UD 01H 02H 03H CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 7.4.3 Operation as square-wave output A square wave with any selected frequency is output at intervals determined by the value preset to 8-bit timer compare register 50 (CR50). The TO50 pin output status is inverted at intervals determined by the count value preset to CR50 by setting bit 0 (TOE50) of 8-bit timer mode control register 50 (TMC50) to 1. This enables a square wave with any selected frequency to be output (duty = 50%). Setting <1> Set each register. * Set the port output latch (P17) and port mode register 1 (PM17) to 0. * TCL50: Select the count clock. * CR50: Compare value * TMC50: Stop the count operation, select clear & start mode entered on a match of TM50 and CR50. LVS50 LVR50 Timer Output F/F Status Setting 1 0 High-level output 0 1 Low-level output Timer output F/F inversion enabled Timer output enabled (TMC50 = 00001011B or 00000111B) <2> After TCE50 = 1 is set, the count operation starts. <3> The timer output F/F is inverted by a match of TM50 and CR50. After INTTM50 is generated, TM50 is cleared to 00H. <4> After these settings, the timer output F/F is inverted at the same interval and a square wave is output from TO50. The frequency is as follows. Frequency = 1/2t (N + 1) (N: 00H to FFH) Caution Do not write other values to CR50 during operation. Figure 7-9. Square-Wave Output Operation Timing t Count clock TM50 count value 00H 01H 02H N-1 N 00H 01H 02H N-1 N 00H Count start CR50 N TO50Note Note The initial value of TO50 output can be set by bits 2 and 3 (LVR50, LVS50) of 8-bit timer mode control register 50 (TMC50). User's Manual U15836EJ5V0UD 157 CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 7.4.4 Operation as PWM output 8-bit timer/event counter 50 operates as a PWM output when bit 6 (TMC506) of 8-bit timer mode control register 50 (TMC50) is set to 1. The duty pulse is determined by the value set to 8-bit timer compare register 50 (CR50). Set the active level width of the PWM pulse to CR50; the active level can be selected with bit 1 of TMC50 (TMC501). The count clock can be selected with bits 0 to 2 (TCL500 to TCL502) of timer clock selection register 50 (TCL50). PWM output can be enabled/disabled with bit 0 of TMC50 (TOE50). Caution In PWM mode, make the CR50 rewrite period 3 count clocks of the count clock (clock selected by TCL50) or more. (1) PWM output basic operation Setting <1> Set each register. * Set the port output latch (P17) and port mode register 1 (PM17) to 0. * TCL50: Select the count clock. * CR50: Compare value * TMC50: Stop the count operation, select PWM mode. The timer output F/F is not changed, timer output is enabled. TMC501 Active Level Selection 0 Active-high 1 Active-low (TMC50 = 01000001B or 01000011B) <2> The count operation starts when TCE50 = 1. Set TCE50 to 0 to stop the count operation. PWM output operation <1> PWM output (output from TO50) outputs an inactive level until an overflow occurs. <2> When an overflow occurs, the active level is output. The active level is output until CR50 matches the count value of 8-bit timer counter 50 (TM50). <3> After the CR50 matches the count value, the inactive level is output until an overflow occurs again. <4> Operations <2> and <3> are repeated until the count operation stops. <5> When the count operation is stopped with TCE50 = 0, PWM output becomes inactive. For details of timing, see Figures 7-10 and 7-11. The cycle, active-level width, and duty are as follows. * Cycle = 28t * Active-level width = Nt * Duty = N/28 (N = 00H to FFH) 158 User's Manual U15836EJ5V0UD CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 Figure 7-10. PWM Output Operation Timing (a) Basic operation (active level = H) t Count clock TM50 00H 01H CR50 N FFH 00H 01H 02H N N+1 FFH 00H 01H 02H M 00H TCE50 INTTM50 TO50 <1> <2> Active level <3> Inactive level Active level <5> (b) CR50 = 00H t Count clock TM50 00H 01H CR50 00H FFH 00H 01H 02H N N+1 N+2 FFH 00H 01H 02H M 00H TCE50 INTTM50 TO50 L Inactive level Inactive level (c) CR50 = FFH t Count clock TM50 00H 01H CR50 FFH FFH 00H 01H 02H N N+1 N+2 FFH 00H 01H 02H M 00H TCE50 INTTM50 TO50 Inactive level Remark Active level Active level Inactive level Inactive level <1> to <3> and <5> in Figure 7-10 (a) correspond to <1> to <3> and <5> in PWM output operation in 7.4.4 (1) PWM output basic operation. User's Manual U15836EJ5V0UD 159 CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50 (2) Operation with CR50 changed Figure 7-11. Timing of Operation with CR50 Changed (a) CR50 value is changed from N to M before clock rising edge of FFH Value is transferred to CR50 at overflow immediately after change. t Count clock TM50 N N+1 N+2 CR50 N TCE50 INTTM50 FFH 00H 01H 02H M M+1 M+2 FFH 00H 01H 02H M M+1 M+2 M H TO50 <1> CR50 change (N M) <2> (b) CR50 value is changed from N to M after clock rising edge of FFH Value is transferred to CR50 at second overflow. t Count clock TM50 N N+1 N+2 CR50 TCE50 INTTM50 FFH 00H 01H 02H N N N+1 N+2 FFH 00H 01H 02H N M M+1 M+2 M H TO50 <1> CR50 change (N M) <2> Caution When reading from CR50 between <1> and <2> in Figure 7-11, the value read differs from the actual value (read value: M, actual value of CR50: N). 7.5 Cautions for 8-Bit Timer/Event Counter 50 (1) Timer start error An error of up to one clock may occur in the time required for a match signal to be generated after timer start. This is because 8-bit timer counter 50 (TM50) is started asynchronously to the count clock. Figure 7-12. 8-Bit Timer Counter 50 Start Timing Count clock TM50 count value 00H 01H 02H Timer start 160 User's Manual U15836EJ5V0UD 03H 04H CHAPTER 8 8-BIT TIMERS H0 AND H1 8.1 Functions of 8-Bit Timers H0 and H1 8-bit timers H0 and H1 have the following functions. * Interval timer * PWM output mode * Square-wave output 8.2 Configuration of 8-Bit Timers H0 and H1 8-bit timers H0 and H1 include the following hardware. Table 8-1. Configuration of 8-Bit Timers H0 and H1 Item Configuration Timer register 8-bit timer counter Hn Registers 8-bit timer H compare register 0n (CMP0n) 8-bit timer H compare register 1n (CMP1n) Timer outputs TOHn Control registers 8-bit timer H mode register n (TMHMDn) Port mode register 1 (PM1) Port register 1 (P1) Remark n = 0, 1 Figures 8-1 and 8-2 show the block diagrams. User's Manual U15836EJ5V0UD 161 162 Figure 8-1. Block Diagram of 8-Bit Timer H0 Internal bus 8-bit timer H mode control register 0 (TMHMD0) TMHE0 CKS02 CKS01 CKS00 TMMD01TMMD00 TOLEV0 TOEN0 3 8-bit timer H compare register 10 (CMP10) 8-bit timer H compare register 00 (CMP00) 2 TOH0/P15 Decoder Selector Selector F/F R Output controller Level inversion Output latch (P15) PM15 8-bit timer counter H0 Clear PWM mode signal Timer H enable signal 1 0 INTTMH0 CHAPTER 8 8-BIT TIMERS H0 AND H1 User's Manual U15836EJ5V0UD fX fX/2 fX/22 fX/26 fX/210 8-bit timer/ event counter 50 output Match Interrupt generator Figure 8-2. Block Diagram of 8-Bit Timer H1 Internal bus 8-bit timer H mode control register 1 (TMHMD1) TMHE1 CKS12 CKS11 CKS10 TMMD11TMMD10 TOLEV1 TOEN1 3 8-bit timer H compare register 11 (CMP11) 8-bit timer H compare register 01 (CMP01) 2 TOH1/ INTP5/ P16 Decoder Selector User's Manual U15836EJ5V0UD fX fX/22 fX/24 fX/26 fX/212 fR/27 Match Interrupt generator F/F R Output controller Level inversion Output latch (P16) PM16 8-bit timer counter H1 Clear PWM mode signal Timer H enable signal 1 0 INTTMH1 CHAPTER 8 8-BIT TIMERS H0 AND H1 Selector 163 CHAPTER 8 8-BIT TIMERS H0 AND H1 (1) 8-bit timer H compare register 0n (CMP0n) This register can be read/written by an 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 8-3. Format of 8-Bit Timer H Compare Register 0n (CMP0n) Address: FF18H (CMP00), FF1AH (CMP01) Symbol CMP0n (n = 0, 1) 7 6 5 After reset: 00H 4 3 R/W 2 1 0 Caution CMP0n cannot be rewritten during timer count operation. (2) 8-bit timer H compare register 1n (CMP1n) This register can be read/written by an 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 8-4. Format of 8-Bit Timer H Compare Register 1n (CMP1n) Address: FF19H (CMP10), FF1BH (CMP11) Symbol CMP1n (n = 0, 1) 7 6 5 After reset: 00H 4 3 R/W 2 1 0 CMP1n can be rewritten during timer count operation. If the CMP1n value is rewritten during timer operation, transfer is performed at the timing at which the count value and CMP1n value match. If the transfer timing and writing from CPU to CMP1n conflict, transfer is not performed. Caution In the PWM output mode be sure to set CMP1n when starting the timer count operation (TMHEn = 1) after the timer count operation was stopped (TMHEn = 0) (be sure to set again even if setting the same value to CMP1n). Remark 164 n = 0, 1 User's Manual U15836EJ5V0UD CHAPTER 8 8-BIT TIMERS H0 AND H1 8.3 Registers Controlling 8-Bit Timers H0 and H1 The following three registers are used to control 8-bit timers H0 and H1. * 8-bit timer H mode register n (TMHMDn) * Port mode register 1 (PM1) * Port register 1 (P1) (1) 8-bit timer H mode register n (TMHMDn) This register controls the mode of timer H. This register can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Remark n = 0, 1 User's Manual U15836EJ5V0UD 165 CHAPTER 8 8-BIT TIMERS H0 AND H1 Figure 8-5. Format of 8-Bit Timer H Mode Register 0 (TMHMD0) Address: FF69H Symbol TMHMD0 After reset: 00H R/W <7> 6 5 4 TMHE0 CKS02 CKS01 CKS00 TMHE0 3 <1> TMMD01 TMMD00 TOLEV0 <0> TOEN0 Timer operation enable 0 Stops timer count operation (counter is cleared to 0) 1 Enables timer count operation (count operation started by inputting clock) Count clock (fCNT) selectionNote 1 CKS02 CKS01 CKS00 0 0 0 fX 0 0 1 fX/2 0 1 0 0 1 1 1 0 0 fX/210 1 0 1 TM50 outputNote 2 Other than above (10 MHz) (5 MHz) fX/2 2 (2.5 MHz) fX/2 6 (156.25 kHz) Timer operation mode 0 0 Interval timer mode 1 0 PWM output mode Other than above (9.77 kHz) Setting prohibited TMMD01 TMMD00 Setting prohibited TOLEV0 Timer output level control (in default mode) 0 Low level 1 High level TOEN0 Notes 1. 2 Timer output control 0 Disables output 1 Enables output Be sure to set the count clock so that the following condition is satisfied. * VDD = 4.0 to 5.5 V: Count clock 10 MHz * VDD = 3.3 to 4.0 V: Count clock 8.38 MHz * VDD = 2.7 to 3.3 V: Count clock 5 MHz * VDD = 2.5 to 2.7 V: Count clock 2.5 MHz 2. Note the following points when selecting the TM50 output as the count clock. * PWM mode (TMC506 = 1) Start the operation of 8-bit timer/event counter 50 first and then set the count clock to make the duty = 50%. * Mode in which the count clock is cleared and started upon a match of TM50 and CR50 (TMC506 = 0) Start the operation of 8-bit timer/event counter 50 first and then enable the timer F/F inversion operation (TMC501 = 1). It is not necessary to enable the TO50 pin as a timer output pin in any mode. 166 User's Manual U15836EJ5V0UD CHAPTER 8 8-BIT TIMERS H0 AND H1 Cautions 1. When the Ring-OSC clock is selected as the clock to be supplied to the CPU, the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the count clock is the Ring-OSC clock, the operation of 8-bit timer H0 is not guaranteed. 2. When TMHE0 = 1, setting the other bits of TMHMD0 is prohibited. 3. In the PWM output mode, be sure to set 8-bit timer H compare register 10 (CMP10) when starting the timer count operation (TMHE0 = 1) after the timer count operation was stopped (TMHE0 = 0) (be sure to set again even if setting the same value to CMP10). Remarks 1. fX: X1 input clock oscillation frequency 2. Figures in parentheses apply to operation at fX = 10 MHz Figure 8-6. Format of 8-Bit Timer H Mode Register 1 (TMHMD1) Address: FF6CH Symbol TMHMD1 After reset: 00H R/W <7> 6 5 4 TMHE1 CKS12 CKS11 CKS10 TMHE1 3 2 <1> TMMD11 TMMD10 TOLEV1 <0> TOEN1 Timer operation enable 0 Stops timer count operation (counter is cleared to 0) 1 Enables timer count operation (count operation started by inputting clock) Count clock selectionNote CKS12 CKS11 CKS10 0 0 0 fX 0 0 1 fX/22 (2.5 MHz) 0 1 0 4 (625 kHz) 0 1 1 6 (156.25 kHz) 1 0 0 12 fX/2 (2.44 kHz) 1 0 1 fR/27 (1.88 kHz (TYP.)) Other than above (10 MHz) fX/2 fX/2 Setting prohibited TMMD11 TMMD10 Timer operation mode 0 0 Interval timer mode 1 0 PWM output mode Other than above TOLEV1 Setting prohibited Timer output level control (in default mode) 0 Low level 1 High level TOEN1 Timer output control 0 Disables output 1 Enables output User's Manual U15836EJ5V0UD 167 CHAPTER 8 8-BIT TIMERS H0 AND H1 Note Be sure to set the count clock so that the following condition is satisfied. * VDD = 4.0 to 5.5 V: Count clock 10 MHz * VDD = 3.3 to 4.0 V: Count clock 8.38 MHz * VDD = 2.7 to 3.3 V: Count clock 5 MHz * VDD = 2.5 to 2.7 V: Count clock 2.5 MHz Cautions 1. When the Ring-OSC clock is selected as the clock to be supplied to the CPU, the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the count clock is the Ring-OSC clock, the operation of 8-bit timer H1 is not guaranteed (except when CKS12, CKS11, CKS10 = 1, 0, 1 (fR/27)). 2. When TMHE1 = 1, setting the other bits of TMHMD1 is prohibited. 3. 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 CMP11). Remarks 1. fX: X1 input clock oscillation frequency 2. fR: Ring-OSC clock oscillation frequency 3. Figures in parentheses apply to operation at fX = 10 MHz, fR = 240 kHz (TYP.). (2) Port mode register 1 (PM1) This register sets port 1 input/output in 1-bit units. When using the P15/TOH0 and P16/TOH1/INTP5 pins for timer output, clear PM15 and PM16 and the output latches of P15 and P16 to 0. PM1 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input sets this register to FFH. Figure 8-7. Format of Port Mode Register 1 (PM1) Address: FF21H Symbol PM1 R/W 7 6 5 4 3 2 1 0 PM17 PM16 PM15 PM14 PM13 PM12 PM11 PM10 PM1n 168 After reset: FFH P1n pin I/O mode selection (n = 0 to 7) 0 Output mode (output buffer on) 1 Input mode (output buffer off) User's Manual U15836EJ5V0UD CHAPTER 8 8-BIT TIMERS H0 AND H1 8.4 Operation of 8-Bit Timers H0 and H1 8.4.1 Operation as interval timer/square-wave output When 8-bit timer counter Hn and compare register 0n (CMP0n) match, an interrupt request signal (INTTMHn) is generated and 8-bit timer counter Hn is cleared to 00H. Compare register 1n (CMP1n) is not used in interval timer mode. Since a match of 8-bit timer counter Hn and the CMP1n register is not detected even if the CMP1n register is set, timer output is not affected. By setting bit 0 (TOENn) of timer H mode register n (TMHMDn) to 1, a square wave of any frequency (duty = 50%) is output from TOHn. (1) Usage Generates the INTTMHn signal repeatedly at the same interval. <1> Set each register. Figure 8-8. Register Setting During Interval Timer/Square-Wave Output Operation (i) TMHMDn Setting timer H mode register n (TMHMDn) TMHEn CKSn2 CKSn1 CKSn0 0 0/1 0/1 0/1 TMMDn1 TMMDn0 TOLEVn 0 0 0/1 TOENn 0/1 Timer output setting Timer output level inversion setting Interval timer mode setting Count clock (fCNT) selection Count operation stopped (ii) CMP0n register setting * Compare value (N) <2> Count operation starts when TMHEn = 1. <3> When the values of 8-bit timer counter Hn and the CMP0n register match, the INTTMHn signal is generated and 8-bit timer counter Hn is cleared to 00H. Interval time = (N +1)/fCNT <4> Subsequently, the INTTMHn signal is generated at the same interval. To stop the count operation, set TMHEn to 0. Remark n = 0, 1 User's Manual U15836EJ5V0UD 169 CHAPTER 8 8-BIT TIMERS H0 AND H1 (2) Timing chart The timing of the interval timer/square-wave output operation is shown below. Figure 8-9. Timing of Interval Timer/Square-Wave Output Operation (1/2) (a) Basic operation Count clock Count start 8-bit timer counter Hn 00H 01H N 00H 01H N Clear 00H 01H 00H Clear N CMP0n TMHEn INTTMHn Interval time TOHn <2> Level inversion, match interrupt occurrence, 8-bit timer counter Hn clear <1> <3> <2> Level inversion, match interrupt occurrence, 8-bit timer counter Hn clear <1> The count operation is enabled by setting the TMHEn 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 Hn and the CMP0n register match, the value of 8-bit timer counter Hn is cleared, the TOHn output level is inverted, and the INTTMHn signal is output. <3> The INTTMHn signal and TOHn output become inactive by setting the TMHEn bit to 0 during timer Hn operation. If these are inactive from the first, the level is retained. Remark n = 0, 1 N = 01H to FEH 170 User's Manual U15836EJ5V0UD CHAPTER 8 8-BIT TIMERS H0 AND H1 Figure 8-9. Timing of Interval Timer/Square-Wave Output Operation (2/2) (b) Operation when CMP0n = FFH Count clock Count start 8-bit timer counter Hn 00H 01H FEH FFH 00H FEH Clear FFH 00H Clear FFH CMP0n TMHEn INTTMHn TOHn Interval time (c) Operation when CMP0n = 00H Count clock Count start 8-bit timer counter Hn 00H CMP0n 00H TMHEn INTTMHn TOHn Interval time Remark n = 0, 1 User's Manual U15836EJ5V0UD 171 CHAPTER 8 8-BIT TIMERS H0 AND 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 0n (CMP0n) controls the cycle of timer output (TOHn). Rewriting the CMP0n register during timer operation is prohibited. 8-bit timer compare register 1n (CMP1n) controls the duty of timer output (TOHn). Rewriting the CMP1n register during timer operation is possible. The operation in PWM output mode is as follows. TOHn output becomes active and 8-bit timer counter Hn is cleared to 0 when 8-bit timer counter Hn and the CMP0n register match after the timer count is started. TOHn output becomes inactive when 8-bit timer counter Hn and the CMP1n 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-10. Register Setting in PWM Output Mode (i) TMHMDn Setting timer H mode register n (TMHMDn) TMHEn CKSn2 CKSn1 CKSn0 0 0/1 0/1 0/1 TMMDn1 TMMDn0 TOLEVn 1 0 0/1 TOENn 1 Timer output enabled Timer output level inversion setting PWM output mode selection Count clock (fCNT) selection Count operation stopped (ii) Setting CMP0n register * Compare value (N): Cycle setting (iii) Setting CMP1n register * Compare value (M): Duty setting Remarks 1. n = 0, 1 2. 00H CMP1n (M) < CMP0n (N) FFH <2> The count operation starts when TMHEn = 1. <3> The CMP0n register is the compare register that is to be compared first after counter operation is enabled. When the values of 8-bit timer counter Hn and the CMP0n register match, 8-bit timer counter Hn is cleared, an interrupt request signal (INTTMHn) is generated, and TOHn output becomes active. At the same time, the compare register to be compared with 8-bit timer counter Hn is changed from the CMP0n register to the CMP1n register. 172 User's Manual U15836EJ5V0UD CHAPTER 8 8-BIT TIMERS H0 AND H1 <4> When 8-bit timer counter Hn and the CMP1n register match, TOHn output becomes inactive and the compare register to be compared with 8-bit timer counter Hn is changed from the CMP1n register to the CMP0n register. At this time, 8-bit timer counter Hn is not cleared and the INTTMHn 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 TMHEn = 0. If the setting value of the CMP0n register is N, the setting value of the CMP1n 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, three operation clocks (signal selected using the CKSn2 to CKSn0 bits of the TMHMDn register) are required to transfer the CMP1n register value after rewriting the register. 2. Be sure to set the CMP1n register when starting the timer count operation (TMHEn = 1) after the timer count operation was stopped (TMHEn = 0) (be sure to set again even if setting the same value to the CMP1n register). User's Manual U15836EJ5V0UD 173 CHAPTER 8 8-BIT TIMERS H0 AND H1 (2) Timing chart The operation timing in PWM output mode is shown below. Caution Make sure that the CMP1n register setting value (M) and CMP0n register setting value (N) are within the following range. 00H CMP1n (M) < CMP0n (N) FFH Remark n = 0, 1 Figure 8-11. Operation Timing in PWM Output Mode (1/4) (a) Basic operation Count clock 8-bit timer counter Hn 00H 01H A5H 00H 01H 02H CMP0n A5H CMP1n 01H A5H 00H 01H 02H A5H 00H TMHEn INTTMHn TOHn (TOLEVn = 0) <1> <2> <3> <4> TOHn (TOLEVn = 1) <1> The count operation is enabled by setting the TMHEn bit to 1. Start 8-bit timer counter Hn by masking one count clock to count up. At this time, TOHn output remains inactive (when TOLEVn = 0). <2> When the values of 8-bit timer counter Hn and the CMP0n register match, the TOHn output level is inverted, the value of 8-bit timer counter Hn is cleared, and the INTTMHn signal is output. <3> When the values of 8-bit timer counter Hn and the CMP1n register match, the level of the TOHn output is returned. At this time, the 8-bit timer counter value is not cleared and the INTTMHn signal is not output. <4> Setting the TMHEn bit to 0 during timer Hn operation makes the INTTMHn signal and TOHn output inactive. Remark n = 0, 1 174 User's Manual U15836EJ5V0UD CHAPTER 8 8-BIT TIMERS H0 AND H1 Figure 8-11. Operation Timing in PWM Output Mode (2/4) (b) Operation when CMP0n = FFH, CMP1n = 00H Count clock 8-bit timer counter Hn 00H 01H FFH 00H 01H 02H FFH 00H 01H 02H CMP0n FFH CMP1n 00H FFH 00H TMHEn INTTMHn TOHn (TOLEVn = 0) (c) Operation when CMP0n = FFH, CMP1n = FEH Count clock 8-bit timer counter Hn 00H 01H FEH FFH 00H 01H FEH FFH 00H 01H CMP0n FFH CMP1n FEH FEH FFH 00H TMHEn INTTMHn TOHn (TOLEVn = 0) Remark n = 0, 1 User's Manual U15836EJ5V0UD 175 CHAPTER 8 8-BIT TIMERS H0 AND H1 Figure 8-11. Operation Timing in PWM Output Mode (3/4) (d) Operation when CMP0n = 01H, CMP1n = 00H Count clock 8-bit timer counter Hn 00H 01H 00H 01H 00H 00H 01H 00H 01H CMP0n 01H CMP1n 00H TMHEn INTTMHn TOHn (TOLEVn = 0) Remark 176 n = 0, 1 User's Manual U15836EJ5V0UD CHAPTER 8 8-BIT TIMERS H0 AND H1 Figure 8-11. Operation Timing in PWM Output Mode (4/4) (e) Operation by changing CMP1n (CMP1n = 01H 03H, CMP0n = A5H) Count clock 8-bit timer counter Hn 00H 01H 02H A5H 00H 01H 02H 03H A5H 00H 01H 02H 03H A5H 00H A5H CMP0n 01H CMP1n 01H (03H) <2> 03H <2>' TMHEn INTTMHn TOHn (TOLEVn = 0) <1> <3> <4> <5> <6> <1> The count operation is enabled by setting TMHEn = 1. Start 8-bit timer counter Hn by masking one count clock to count up. At this time, the TOHn output remains inactive (when TOLEVn = 0). <2> The CMP1n 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 Hn and the CMP0n register match, the value of 8-bit timer counter Hn is cleared, the TOHn output becomes active, and the INTTMHn signal is output. <4> If the CMP1n register value is changed, the value is latched and not transferred to the register. When the values of 8-bit timer counter Hn and the CMP1n register before the change match, the value is transferred to the CMP1n register and the CMP1n register value is changed (<2>'). However, three count clocks or more are required from when the CMP1n 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 Hn and the CMP1n register after the change match, the TOHn output becomes inactive. 8-bit timer counter Hn is not cleared and the INTTMHn signal is not generated. <6> Setting the TMHEn bit to 0 during timer Hn operation makes the INTTMHn signal and TOHn output inactive. Remark n = 0, 1 User's Manual U15836EJ5V0UD 177 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 16 RESET FUNCTION. Table 9-1. Loop Detection Time of Watchdog Timer Loop Detection Time During Ring-OSC Clock Operation During X1 Input Clock Operation 11 2 /fXP (819.2 s) 12 2 /fXP (1.64 ms) 13 2 /fXP (3.28 ms) 14 2 /fXP (6.55 ms) 15 2 /fXP (13.11 ms) 16 2 /fXP (26.21 ms) 17 2 /fXP (52.43 ms) 18 2 /fXP (104.86 ms) 2 /fR (4.27 ms) 2 /fR (8.53 ms) 2 /fR (17.07 ms) 2 /fR (34.13 ms) 2 /fR (68.27 ms) 2 /fR (136.53 ms) 2 /fR (273.07 ms) 2 /fR (546.13 ms) 13 14 15 16 17 18 19 20 Remarks 1. fR: Ring-OSC clock oscillation frequency 2. fXP: X1 input clock oscillation frequency 3. Figures in parentheses apply to operation at fR = 480 kHz (MAX.) (for standard products and (A) grade products), fXP = 10 MHz The operation mode of the watchdog timer (WDT) is switched according to the mask option setting of the on-chip Ring-OSC as shown in Table 9-2. 178 User's Manual U15836EJ5V0UD CHAPTER 9 WATCHDOG TIMER Table 9-2. Mask Option Setting and Watchdog Timer Operation Mode Mask Option Ring-OSC Cannot Be Stopped Watchdog timer clock Fixed to fR Note 1 . source Ring-OSC Can Be Stopped by Software * Selectable by software (fXP, fR or stopped) * When reset is released: fR Operation after reset Operation starts with the maximum 18 Operation mode selection Features Notes 1. Operation starts with maximum 18 interval (2 /fR). interval (2 /fR). The interval can be changed only The clock selection/interval can be once. changed only once. The watchdog timer cannot be The watchdog timer can be stopped in stopped. standby mode Note 2 . As long as power is being supplied, Ring-OSC oscillation 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 fXP, clock supply to the watchdog timer is stopped under the following conditions. * When fXP is stopped * In HALT/STOP mode * During oscillation stabilization time <2> If the clock source is fR, clock supply to the watchdog timer is stopped under the following conditions. * If the CPU clock is fXP and if fR is stopped by software before execution of the STOP instruction * In HALT/STOP mode Remarks 1. fR: Ring-OSC clock oscillation frequency 2. fXP: X1 input clock oscillation frequency User's Manual U15836EJ5V0UD 179 CHAPTER 9 WATCHDOG TIMER 9.2 Configuration of Watchdog Timer The watchdog timer includes 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 fR/22 fXP/2 4 211/fR to 218/fR Clock input controller 16-bit counter 2 Watchdog timer enable register (WDTE) Selector or 213/fXP to 220/fXP 1 1 WDCS4 WDCS3 WDCS2 WDCS1 WDCS0 Watchdog timer mode register (WDTM) Internal bus 180 Internal reset signal 3 Clear 0 Output controller User's Manual U15836EJ5V0UD Mask option (to set "Ring-OSC cannot be stopped" or "Ring-OSC can be stopped by software") 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 input sets this register to 67H. Figure 9-2. Format of Watchdog Timer Mode Register (WDTM) Address: FF98H After reset: 67H R/W Symbol 7 6 5 4 3 2 1 0 WDTM 0 1 1 WDCS4 WDCS3 WDCS2 WDCS1 WDCS0 WDCS4 Note 1 WDCS3 Note 1 Operation clock selection 0 0 Ring-OSC clock (fR) 0 1 X1 input clock (fXP) 1 x Watchdog timer operation stopped WDCS2 Note 2 WDCS1 Note 2 WDCS0 Note 2 Overflow time setting During Ring-OSC clock During X1 input clock operation operation 11 2 /fXP (819.2 s) 12 2 /fXP (1.64 ms) 13 2 /fXP (3.28 ms) 14 2 /fXP (6.55 ms) 15 2 /fXP (13.11 ms) 16 2 /fXP (26.21 ms) 17 2 /fXP (52.43 ms) 18 2 /fXP (104.86 ms) 0 0 0 2 /fR (4.27 ms) 0 0 1 2 /fR (8.53 ms) 0 1 0 2 /fR (17.07 ms) 0 1 1 2 /fR (34.13 ms) 1 0 0 2 /fR (68.27 ms) 1 0 1 2 /fR (136.53 ms) 1 1 0 2 /fR (273.07 ms) 1 1 1 2 /fR (546.13 ms) Notes 1. 13 14 15 16 17 18 19 20 If "Ring-OSC cannot be stopped" is specified by a mask option, this cannot be set. The RingOSC clock will be selected no matter what value is written. 2. Reset is released at the maximum cycle (WDCS2, 1, 0 = 1, 1, 1). Cautions 1. If data is written to WDTM, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. 2. Set bits 7, 6, and 5 to 0, 1, and 1, respectively (when "Ring-OSC cannot be stopped" is selected by a mask option, other values are ignored). User's Manual U15836EJ5V0UD 181 CHAPTER 9 WATCHDOG TIMER Cautions 3. 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. If the source clock to the watchdog timer is stopped, however, an internal reset signal is generated when the source clock to the watchdog timer resumes operation. 4. WDTM cannot be set by a 1-bit memory manipulation instruction. 5. If "Ring-OSC can be stopped by software" is selected by the mask option and the watchdog timer is stopped by setting WDCS4 to 1, the watchdog timer does not resume operation even if WDCS4 is cleared to 0. In addition, the internal reset signal is not generated. Remarks 1. fR: Ring-OSC clock oscillation frequency 2. fXP: X1 input clock oscillation frequency 3. x: Don't care 4. Figures in parentheses apply to operation at fR = 480 kHz (MAX.) (for standard products and (A) grade products), fXP = 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 input sets this register to 9AH. Figure 9-3. Format of Watchdog Timer Enable Register (WDTE) Address: FF99H Symbol 7 After reset: 9AH 6 R/W 5 4 3 2 1 0 WDTE Cautions 1. If a value other than ACH is written to WDTE, an internal reset signal is generated. If the source clock to the watchdog timer is stopped, however, an internal reset signal is generated when the source clock to the watchdog timer resumes operation. 2. If a 1-bit memory manipulation instruction is executed for WDTE, an internal reset signal is generated. If the source clock to the watchdog timer is stopped, however, an internal reset signal is generated when the source clock to the watchdog timer resumes operation. 3. The value read from WDTE is 9AH (this differs from the written value (ACH)). 182 User's Manual U15836EJ5V0UD CHAPTER 9 WATCHDOG TIMER The relationship between the watchdog timer operation and the internal reset signal generated by the watchdog timer is shown below. Table 9-4. Relationship Between Watchdog Timer Operation and Internal Reset Signal Generated by Watchdog Timer Watchdog Timer Operation Internal Reset Signal Generation Cause "Ring-OSC Cannot Be "Ring-OSC Can Be Stopped by Software" Is Selected by Mask Option Stopped" Is Selected by Watchdog Timer Is Mask Option Operating Watchdog Timer Stopped WDCS4 Is Set to 1 (Watchdog Timer Is Source Clock to Watchdog Timer Is Always Operating) Stopped - - Watchdog timer Internal reset signal is Internal reset signal is overflows generated. generated. Write to WDTM for the Internal reset signal is Internal reset signal is Internal reset signal is Internal reset signal is second time generated. generated. not generated and the generated when the watchdog timer does source clock to the not resume operation. watchdog timer resumes operation. Write other than "ACH" Internal reset signal is Internal reset signal is Internal reset signal is Internal reset signal is to WDTE generated. generated. not generated. generated when the Access WDTE by 1-bit source clock to the memory manipulation watchdog timer instruction resumes operation. User's Manual U15836EJ5V0UD 183 CHAPTER 9 WATCHDOG TIMER 9.4 Operation of Watchdog Timer 9.4.1 Watchdog timer operation when "Ring-OSC cannot be stopped" is selected by mask option The operation clock of watchdog timer is fixed to Ring-OSC. 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: Ring-OSC clock * Cycle: 218/fR (546.13 ms: At operation with fR = 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 (Ring-OSC 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 absolutely cannot be stopped even during STOP instruction execution. For 8-bit timer H1 (TMH1), a division of the Ring-OSC can be selected as the count source, so after STOP instruction execution, clear the watchdog timer using the interrupt request of TMH1 before the watchdog timer overflows. If this processing is not performed, an internal reset signal is generated when the watchdog timer overflows after STOP instruction execution. 184 User's Manual U15836EJ5V0UD CHAPTER 9 WATCHDOG TIMER 9.4.2 Watchdog timer operation when "Ring-OSC can be stopped by software" is selected by mask option The operation clock of the watchdog timer can be selected as either the Ring-OSC clock or the X1 input 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) of the Ring-OSC clock. The following shows the watchdog timer operation after reset release. 1. The status after reset release is as follows. * Operation clock: Ring-OSC clock * Cycle: 218/fR (546.13 ms: At operation with fR = 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). Ring-OSC clock (fR) X1 input clock (fXP) 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. These bits must not be set to other values. 3. If the watchdog timer is stopped by setting WDCS4 and WDCS3 to 1 and x, 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. User's Manual U15836EJ5V0UD 185 CHAPTER 9 WATCHDOG TIMER 9.4.3 Watchdog timer operation in STOP mode (when "Ring-OSC can be stopped by software" is selected by mask option) The watchdog timer stops counting during STOP instruction execution regardless of whether the X1 input clock or Ring-OSC clock is being used. (1) When the CPU clock and the watchdog timer operation clock are the X1 input clock (fXP) when the STOP instruction is executed When STOP instruction is executed, operation of the watchdog timer is stopped. After STOP mode is released, counting stops for the oscillation stabilization time set by the oscillation stabilization time select register (OSTS) 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-4. Operation in STOP Mode (CPU Clock and WDT Operation Clock: X1 Input Clock) CPU operation Normal operation Oscillation stabilization time STOP Normal operation fXP Oscillation stopped Oscillation stabilization time (set by OSTS register) fR Watchdog timer Operating Operation stopped Operating (2) When the CPU clock is the X1 input clock (fXP) and the watchdog timer operation clock is the Ring-OSC clock (fR) when the STOP instruction is executed When the STOP instruction is executed, operation of the watchdog timer is stopped. After STOP 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-5. Operation in STOP Mode (CPU Clock: X1 Input Clock, WDT Operation Clock: Ring-OSC Clock) CPU operation Normal operation Oscillation stabilization time STOP fXP Oscillation stabilization time (set by OSTS register) Oscillation stopped fR Watchdog timer 186 Operating Operation stopped Operating User's Manual U15836EJ5V0UD Normal operation CHAPTER 9 WATCHDOG TIMER (3) When the CPU clock is the Ring-OSC clock (fR) and the watchdog timer operation clock is the X1 input clock (fXP) when the STOP instruction is executed When the STOP instruction is executed, operation of the watchdog timer is stopped. After STOP mode is released, counting is stopped until the timing of <1> or <2>, whichever is earlier, and then counting is started using the operation clock before the operation was stopped. At this time, the counter is not cleared to 0 but holds its value. <1> The oscillation stabilization time set by the oscillation stabilization time select register (OSTS) elapses. <2> The CPU clock is switched to the X1 input clock (fXP). Figure 9-6. Operation in STOP Mode (CPU Clock: Ring-OSC Clock, WDT Operation Clock: X1 Input Clock) <1> Timing when counting is started after the oscillation stabilization time set by the oscillation stabilization time select register (OSTS) has elapsed Normal operation CPU operation (Ring-OSC clock) Clock supply stopped STOP Normal operation (Ring-OSC clock) fXP Oscillation stopped Oscillation stabilization time (set by OSTS register) fR 17 clocks Watchdog timer Operating Operation stopped Operating <2> Timing when counting is started after the CPU clock is switched to the X1 input clock (fXP) Normal operation (Ring-OSC clock) Normal operation CPU operation (Ring-OSC clock) CPU clock fR fXPNote Clock supply stopped STOP Normal operation (X1 input clock) fXP Oscillation stopped Oscillation stabilization time (set by OSTS register) fR 17 clocks Watchdog timer Operating Operation stopped Operating Note Confirm the oscillation stabilization time of fXP using the oscillation stabilization time counter status register (OSTC). User's Manual U15836EJ5V0UD 187 CHAPTER 9 WATCHDOG TIMER (4) When CPU clock and watchdog timer operation clock are the Ring-OSC clocks (fR) during STOP instruction execution When the STOP instruction is executed, operation of the watchdog timer is stopped. After STOP 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-7. Operation in STOP Mode (CPU Clock and WDT Operation Clock: Ring-OSC Clock) Normal operation CPU operation (Ring-OSC clock) Clock supply stopped STOP Normal operation (Ring-OSC clock) fXP Oscillation stopped Oscillation stabilization time (set by OSTS register) fR 17 clocks Watchdog timer 9.4.4 Operating Operation stopped Operating Watchdog timer operation in HALT mode (when "Ring-OSC can be stopped by software" is selected by mask option) The watchdog timer stops counting during HALT instruction execution regardless of whether the CPU clock is the X1 input clock (fXP) or Ring-OSC clock (fR), or whether the operation clock of the watchdog timer is the X1 input clock (fXP) or Ring-OSC clock (fR). 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 CPU operation Normal operation HALT Normal operation fXP fR Watchdog timer Operating Operation stopped 188 User's Manual U15836EJ5V0UD Operating CHAPTER 10 A/D CONVERTER 10.1 Function 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 two functions. (1) 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. (2) Power-fail detection function This function is to detect a voltage drop in a battery. The values of the A/D conversion result (ADCR register value) and power-fail comparison threshold register (PFT) are compared. INTAD is generated only when a comparative condition has been matched. Figure 10-1. Block Diagram of A/D Converter AVREF ADCS bit ANI0/P20 Sample & hold circuit ANI2/P22 Tap selector Voltage comparator Selector ANI1/P21 AVSS ANI3/P23 Successive approximation register (SAR) AVSS INTAD Controller Comparator A/D conversion result register (ADCR) 2 ADS1 Analog input channel specification register (ADS) ADS0 ADCS FR2 FR1 FR0 ADCE Power-fail comparison threshold register (PFT) PFEN PFCM Power-fail comparison mode register (PFM) A/D converter mode register (ADM) Internal bus User's Manual U15836EJ5V0UD 189 CHAPTER 10 A/D CONVERTER 10.2 Configuration of A/D Converter The A/D converter includes the following hardware. Table 10-1. Registers of A/D Converter Used on Software Item Configuration A/D conversion result register (ADCR) Registers A/D converter mode register (ADM) Analog input channel specification register (ADS) Power-fail comparison mode register (PFM) Power-fail comparison threshold register (PFT) (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) Series resistor string The series resistor string is connected between AVREF and AVSS, and generates a voltage to be compared with the analog input signal. Figure 10-2. Circuit Configuration of Series Resistor String AVREF ADCS P-ch Series resistor string AVSS (4) Voltage comparator The voltage comparator compares the sampled analog input voltage and the output voltage of the series resistor string. (5) Successive approximation register (SAR) This register compares the sampled analog voltage and the voltage of the series resistor string, 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). 190 User's Manual U15836EJ5V0UD CHAPTER 10 A/D CONVERTER (6) A/D conversion result register (ADCR) The result of A/D conversion is loaded from the successive approximation register (SAR) to this register each time A/D conversion is completed, and the ADCR register holds the result of A/D conversion in its higher 10 bits (the lower 6 bits are fixed to 0). (7) Controller When A/D conversion has been completed or when the power-fail detection function is used, this controller compares the result of A/D conversion (value of the ADCR register) and the value of the power-fail comparison threshold register (PFT). It generates the interrupt INTAD only if a specified comparison condition is satisfied as a result. (8) AVREF pin This pin inputs an analog power/reference voltage to the A/D converter. Always use this pin at the same potential as that of the VDD pin even when the A/D converter is not used. The signal input to ANI0 to ANI3 is converted into a digital signal, based on the voltage applied across AVREF and AVSS. (9) AVSS pin This is the ground potential pin of the A/D converter. Always use this pin at the same potential as that of the VSS pin even when the A/D converter is not used. (10) 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. (11) 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. (12) Power-fail comparison mode register (PFM) This register is used to set the power-fail monitor mode. (13) Power-fail comparison threshold register (PFT) This register is used to set the threshold value that is to be compared with the value of the A/D conversion result register (ADCR). User's Manual U15836EJ5V0UD 191 CHAPTER 10 A/D CONVERTER 10.3 Registers Used in A/D Converter The A/D converter uses the following five registers. * A/D converter mode register (ADM) * Analog input channel specification register (ADS) * A/D conversion result register (ADCR) * Power-fail comparison mode register (PFM) * Power-fail comparison threshold register (PFT) (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 input clears this register to 00H. Figure 10-3. Format of A/D Converter Mode Register (ADM) Address: FF28H Symbol ADM After reset: 00H R/W <7> 6 5 4 3 2 1 <0> ADCS 0 FR2 FR1 FR0 0 0 ADCE ADCS A/D conversion operation control 0 Stops conversion operation 1 Enables conversion operation FR2 FR1 Conversion time selectionNote 1 FR0 fX = 2 MHz fX = 8.38 MHz fX = 10 MHz 0 0 0 288/fX 144 s 34.3 s 28.8 s 0 0 1 240/fX 120 s 28.6 s 24.0 s 0 1 0 192/fX 96 s 22.9 s 19.2 s 1 0 0 144/fX 72 s 17.2 s 14.4 s 60 s 14.3 s 12.0 s 48 s 11.5 s 9.6 s 1 0 1 120/fX 1 1 0 96/fX Other than above Boost reference voltage generator operation controlNote 2 ADCE Notes 1. Setting prohibited 0 Stops operation of reference voltage generator 1 Enables operation of reference voltage generator Set so that the A/D conversion time is as follows. * Standard products, (A) grade products: 14 s or longer but less than 100 s 192 * (A1) grade products: 14 s or longer but less than 60 s * (A2) grade products: 16 s or longer but less than 48 s User's Manual U15836EJ5V0UD CHAPTER 10 A/D CONVERTER Notes 2. A booster circuit is incorporated to realize low-voltage operation. The operation of the circuit that generates the reference voltage for boosting is controlled by ADCE, and it takes 14 s from operation start to operation stabilization. Therefore, when ADCS is set to 1 after 14 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. Table 10-2. Settings of ADCS and ADCE ADCS ADCE A/D Conversion Operation 0 0 Stop status (DC power consumption path does not exist) 0 1 Conversion waiting mode (only reference voltage generator consumes power) 1 0 Conversion mode (reference voltage generator operation stopped 1 1 Conversion mode (reference voltage generator operates) Note ) Note Data of first conversion cannot be used. Figure 10-4. Timing Chart When Boost Reference Voltage Generator Is Used Boost reference voltage generator: operating ADCE Boost reference voltage Conversion operation Conversion waiting Conversion operation Conversion stopped ADCS Note Note The time from the rising of the ADCE bit to the rising of the ADCS bit must be 14 s or longer to stabilize the reference voltage. Cautions 1. A/D conversion must be stopped before rewriting bits FR0 to FR2 to values other than the identical data. 2. For the sampling time of the A/D converter and the A/D conversion start delay time, see (11) in 10.6 Cautions for A/D Converter. 3. If data is written to ADM, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. Remark fX: X1 input clock oscillation frequency User's Manual U15836EJ5V0UD 193 CHAPTER 10 A/D CONVERTER (2) Analog input channel specification register (ADS) This register specifies the analog voltage input port to be A/D converted. ADS can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 10-5. Format of Analog Input Channel Specification Register (ADS) Address: FF29H After reset: 00H R/W Symbol 7 6 5 4 3 2 1 0 ADS 0 0 0 0 0 0 ADS1 ADS0 ADS1 ADS0 0 0 ANI0 0 1 ANI1 1 0 ANI2 1 1 ANI3 Analog input channel specification Cautions 1. Be sure to clear bits 2 to 7 of ADS to 0. 2. If data is written to ADS, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. (3) A/D conversion result register (ADCR) This register is a 16-bit register that stores the A/D conversion result. The lower 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 the most significant bit (MSB). FF09H indicates the higher 8 bits of the conversion result, and FF08H indicates the lower 2 bits of the conversion result. ADCR can be read by a 16-bit memory manipulation instruction. RESET input makes ADCR undefined. Figure 10-6. Format of A/D Conversion Result Register (ADCR) Address: FF08H, FF09H Symbol After reset: Undefined R FF09H FF08H ADCR 0 0 0 0 0 0 Cautions 1. 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. 2. If data is read from ADCR, a wait cycle is generated. CAUTIONS FOR WAIT. 194 User's Manual U15836EJ5V0UD For details, see CHAPTER 29 CHAPTER 10 A/D CONVERTER (4) Power-fail comparison mode register (PFM) The power-fail comparison mode register (PFM) is used to compare the A/D conversion result (value of the ADCR register) and the value of the power-fail comparison threshold value register (PFT). PFM can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 10-7. Format of Power-Fail Comparison Mode Register (PFM) Address: FF2AH Symbol PFM After reset: 00H R/W <7> <6> 5 4 3 2 1 0 PFEN PFCM 0 0 0 0 0 0 PFEN Power-fail comparison enable 0 Stops power-fail comparison (used as a normal A/D converter) 1 Enables power-fail comparison (used for power-fail detection) PFCM 0 1 Power-fail comparison mode selection Higher 8 bits of ADCR PFT Interrupt request signal (INTAD) generation Higher 8 bits of ADCR < PFT Higher 8 bits of ADCR PFT No INTAD generation Higher 8 bits of ADCR < PFT INTAD generation No INTAD generation Caution If data is written to PFM, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. (5) Power-fail comparison threshold register (PFT) The power-fail comparison threshold register (PFT) is a register that sets the threshold value when comparing the values with the A/D conversion result. 8-bit data in PFT is compared to the higher 8 bits (FF09H) of the 10-bit A/D conversion result. PFT can be set by an 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 10-8. Format of Power-Fail Comparison Threshold Register (PFT) Address: FF2BH Symbol PFT After reset: 00H R/W 7 6 5 4 3 2 1 0 PFT7 PFT6 PFT5 PFT4 PFT3 PFT2 PFT1 PFT0 Caution If data is written to PFT, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. User's Manual U15836EJ5V0UD 195 CHAPTER 10 A/D CONVERTER 10.4 A/D Converter Operations 10.4.1 Basic operations of A/D converter <1> Select one channel for A/D conversion using the analog input channel specification register (ADS). <2> Set ADCE to 1 and wait for 14 s or longer. <3> Set ADCS to 1 and start the conversion operation. (<4> to <10> are operations performed by hardware.) <4> The voltage input to the selected analog input channel is sampled by the sample & hold circuit. <5> 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. <6> Bit 9 of the successive approximation register (SAR) is set. The series resistor string voltage tap is set to (1/2) AVREF by the tap selector. <7> The voltage difference between the series resistor string voltage tap and analog input is compared by the voltage comparator. If the analog input is greater than (1/2) AVREF, the MSB of SAR remains set to 1. If the analog input is smaller than (1/2) AVREF, the MSB is reset to 0. <8> Next, bit 8 of SAR is automatically set to 1, and the operation proceeds to the next comparison. The series resistor string voltage tap is selected according to the preset value of bit 9, as described below. * Bit 9 = 1: (3/4) AVREF * Bit 9 = 0: (1/4) AVREF The voltage tap and analog input voltage are compared and bit 8 of SAR is manipulated as follows. * Analog input voltage Voltage tap: Bit 8 = 1 * Analog input voltage < Voltage tap: Bit 8 = 0 <9> Comparison is continued in this way up to bit 0 of SAR. <10> 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) and then latched. At the same time, the A/D conversion end interrupt request (INTAD) can also be generated. <11> Repeat steps <4> to <10>, 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 <2>. 196 User's Manual U15836EJ5V0UD CHAPTER 10 A/D CONVERTER Figure 10-9. Basic Operation of A/D Converter Conversion time Sampling time A/D converter operation Sampling A/D conversion Conversion result SAR Undefined Conversion result ADCR 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 any of ADM, the analog input channel specification register (ADS), power-fail comparison mode register (PFM), or power-fail comparison threshold register (PFT) is written 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 input makes the A/D conversion result register (ADCR) undefined. User's Manual U15836EJ5V0UD 197 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 A/D conversion result register (ADCR)) is shown by the following expression. SAR = INT ( VAIN AVREF x 1024 + 0.5) ADCR = SAR x 64 or (ADCR - 0.5) x where, INT( ): AVREF 1024 VAIN < (ADCR + 0.5) x AVREF 1024 Function which returns integer part of value in parentheses VAIN: Analog input voltage AVREF: AVREF pin voltage ADCR: A/D conversion result register (ADCR) value SAR: Successive approximation register Figure 10-10 shows the relationship between the analog input voltage and the A/D conversion result. Figure 10-10. Relationship Between Analog Input Voltage and A/D Conversion Result SAR ADCR 1023 FFC0H 1022 FF80H 1021 FF40H 3 00C0H 2 0080H 1 0040H A/D conversion result (ADCR) 0 0000H 1 1 3 2 5 3 2048 1024 2048 1024 2048 1024 2043 1022 2045 1023 2047 1 2048 1024 2048 1024 2048 Input voltage/AVREF 198 User's Manual U15836EJ5V0UD 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 analog input channel is selected from ANI0 to ANI3 by the analog input channel specification register (ADS) and A/D conversion is executed. In addition, the following two functions can be selected by setting bit 7 (PFEN) of the power-fail comparison mode register (PFM). * Normal 10-bit A/D converter (PFEN = 0) * Power-fail detection function (PFEN = 1) (1) A/D conversion operation (when PFEN = 0) By setting bit 7 (ADCS) of the A/D converter mode register (ADM) to 1 and bit 7 (PFEN) of the power-fail comparison mode register (PFM) to 0, A/D conversion of the voltage 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), and an interrupt request signal (INTAD) is generated. Once the next A/D conversion has started and when one A/D conversion has been completed, the A/D conversion operation after that is immediately started. The A/D conversion operations are repeated until new data is written to ADS. If ADM, ADS, the power-fail comparison mode register (PFM), and the power-fail comparison threshold register (PFT) are rewritten 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-11. A/D Conversion Operation Rewriting ADM ADCS = 1 A/D conversion ANIn Rewriting ADS ANIn ANIn ADCS = 0 ANIm ANIm Conversion is stopped Conversion result is not retained ADCR ANIn ANIn Stopped ANIm INTAD (PFEN = 0) Remarks 1. n = 0 to 3 2. m = 0 to 3 User's Manual U15836EJ5V0UD 199 CHAPTER 10 A/D CONVERTER (2) Power-fail detection function (when PFEN = 1) By setting bit 7 (ADCS) of the A/D converter mode register (ADM) to 1 and bit 7 (PFEN) of the power-fail comparison mode register (PFM) to 1, the A/D conversion operation of the voltage applied to the analog input pin specified by the analog input channel specification register (ADS) is started. When the A/D conversion has been completed, the result of the A/D conversion is stored in the A/D conversion result register (ADCR), the values are compared with power-fail comparison threshold register (PFT), and an interrupt request signal (INTAD) is generated under the condition specified by bit 6 (PFCM) of PFM. <1> When PFEN = 1 and PFCM = 0 The higher 8 bits of ADCR and PFT values are compared when A/D conversion ends and INTAD is only generated when the higher 8 bits of ADCR PFT. <2> When PFEN = 1 and PFCM = 1 The higher 8 bits of ADCR and PFT values are compared when A/D conversion ends and INTAD is only generated when the higher 8 bits of ADCR < PFT. Figure 10-12. Power-Fail Detection (When PFEN = 1 and PFCM = 0) A/D conversion ANIn ANIn ANIn ANIn Higher 8 bits of ADCR 80H 7FH 80H PFT 80H INTAD (PFEN = 1) Note First conversion Condition match Note If the conversion result is not read before the end of the next conversion after INTAD is output, the result is replaced by the next conversion result. Remark 200 n = 0 to 3 User's Manual U15836EJ5V0UD CHAPTER 10 A/D CONVERTER The setting methods are described below. * When used as A/D conversion operation <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 and ADS0) of the analog input channel specification register (ADS) and bits 5 to 3 (FR2 to FR0) of ADM. <3> Set bit 7 (ADCS) of ADM to 1. <4> An interrupt request signal (INTAD) is generated. <5> Transfer the A/D conversion data to the A/D conversion result register (ADCR). <6> Change the channel using bits 1 and 0 (ADS1 and ADS0) of ADS. <7> An interrupt request signal (INTAD) is generated. <8> Transfer the A/D conversion data to the A/D conversion result register (ADCR). <9> Clear ADCS to 0. <10> Clear ADCE to 0. Cautions 1. Make sure the period of <1> to <3> is 14 s or more. 2. It is no problem if the order of <1> and <2> is reversed. 3. <1> can be omitted. However, do not use the first conversion result after <3> in this case. 4. The period from <4> to <7> differs from the conversion time set using bits 5 to 3 (FR2 to FR0) of ADM. The period from <6> to <7> is the conversion time set using FR2 to FR0. * When used as power-fail detection function <1> Set bit 7 (PFEN) of the power-fail comparison mode register (PFM) to 1. <2> Set power-fail comparison condition using bit 6 (PFCM) of PFM. <3> Set bit 0 (ADCE) of the A/D converter mode register (ADM) to 1. <4> Select the channel and conversion time using bits 1 and 0 (ADS1 and ADS0) of the analog input channel specification register (ADS) and bits 5 to 3 (FR2 to FR0) of ADM. <5> Set a threshold value to the power-fail comparison threshold register (PFT). <6> Set bit 7 (ADCS) of ADM to 1. <7> Transfer the A/D conversion data to the A/D conversion result register (ADCR). <8> The higher 8 bits of ADCR and PFT are compared and an interrupt request signal (INTAD) is generated if the conditions match. <9> Change the channel using bits 1 and 0 (ADS1 and ADS0) of ADS. <10> Transfer the A/D conversion data to the A/D conversion result register (ADCR). <11> The higher 8 bits of ADCR and the power-fail comparison threshold register (PFT) are compared and an interrupt request signal (INTAD) is generated if the conditions match. <12> Clear ADCS to 0. <13> Clear ADCE to 0. Cautions 1. Make sure the period of <3> to <6> is 14 s or more. 2. It is no problem if the order of <3>, <4>, and <5> is changed. 3. <3> must not be omitted if the power-fail function is used. 4. The period from <7> to <11> differs from the conversion time set using bits 5 to 3 (FR2 to FR0) of ADM. The period from <9> to <11> is the conversion time set using FR2 to FR0. User's Manual U15836EJ5V0UD 201 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 Overall error Digital output Digital output Ideal line 1/2LSB Quantization error 1/2LSB 0......0 AVREF 0 0......0 Analog input 202 User's Manual U15836EJ5V0UD 0 Analog input AVREF CHAPTER 10 A/D CONVERTER (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. (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 Digital output (Lower 3 bits) Digital output (Lower 3 bits) 111 Ideal line 011 010 001 Zero-scale error Full-scale error 111 110 101 Ideal line 000 000 0 1 2 3 0 AVREF 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 Digital output Digital output Ideal line Integral linearity error 0......0 0 Analog input Differential linearity error 0......0 AVREF User's Manual U15836EJ5V0UD 0 Analog input AVREF 203 CHAPTER 10 A/D CONVERTER (8) Conversion time This expresses the time since sampling has been started until 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 10.6 Cautions for A/D Converter (1) Operating current in standby mode The A/D converter stops operating in the standby mode. At this time, the operating current can be reduced by clearing bit 7 (ADCS) of the A/D converter mode register (ADM) to 0 (see Figure 10-2). (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 AVSS 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) write and ADCR read by instruction upon the end of conversion ADCR read has priority. After the read operation, the new conversion result is written to ADCR. <2> Conflict between ADCR 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 write is not performed, nor is the conversion end interrupt signal (INTAD) generated. 204 User's Manual U15836EJ5V0UD CHAPTER 10 A/D CONVERTER (4) Noise countermeasures To maintain the 10-bit resolution, attention must be paid to noise input to the AVREF and ANI0 to ANI3 pins. 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 10-19, to reduce noise. 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 AVSS may enter, clamp with a diode with a small VF value (0.3 V or lower). Reference voltage input AVREF ANI0 to ANI3 C = 100 to 1,000 pF AVSS VSS (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 port 2 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 being 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 for approx. one sixth of the conversion 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 and has no meaning. To perform sufficient sampling, however, it is recommended to make the output impedance of the analog input source 10 k or lower, or attach a capacitor of around 100 pF to the ANI0 to ANI3 pins (see Figure 10-19). (7) AVREF pin input impedance A series resistor string of several tens of k is connected between the AVREF and AVSS pins. Therefore, if the output impedance of the reference voltage source is high, this will result in a series connection to the series resistor string between the AVREF and AVSS pins, resulting in a large reference voltage error. User's Manual U15836EJ5V0UD 205 CHAPTER 10 A/D CONVERTER (8) 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 postchange analog input has not finished. 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) A/D conversion ANIn ADCR ADS rewrite (start of ANIm conversion) ANIn ANIn ADIF is set but ANIm conversion has not finished. ANIm ANIn ANIm ANIm ANIm INTAD Remarks 1. n = 0 to 3 2. m = 0 to 3 (9) 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 14 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. (10) A/D conversion result register (ADCR) 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 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. 206 User's Manual U15836EJ5V0UD CHAPTER 10 A/D CONVERTER (11) A/D converter sampling time and A/D conversion start delay time The A/D converter sampling time differs depending on the set value of the A/D converter mode register (ADM). A delay time exists until actual sampling is started after A/D converter operation is enabled. When using a set in which the A/D conversion time must be strictly observed, care is required regarding the contents shown in Figure 10-21 and Table 10-3. Figure 10-21. Timing of A/D Converter Sampling and A/D Conversion Start Delay ADCS 1 or ADS rewrite ADCS Sampling timing INTAD Wait period A/D Sampling conversion time start delay time Sampling time Conversion time Conversion time Table 10-3. A/D Converter Sampling Time and A/D Conversion Start Delay Time (ADM Set Value) FR2 FR1 FR0 Conversion Time Sampling Time A/D Conversion Start Delay Time MIN. MAX. 0 0 0 288/fX 40/fX 32/fX 36/fX 0 0 1 240/fX 32/fX 28/fX 32/fX 0 1 0 192/fX 24/fX 24/fX 28/fX 1 0 0 144/fX 20/fX 16/fX 18/fX 1 0 1 120/fX 16/fX 14/fX 16/fX 1 1 0 96/fX 12/fX 12/fX 14/fX Other than above - Setting prohibited - Note - Note The A/D conversion start delay time is the time after the wait period. For the wait function, see CHAPTER 29 CAUTIONS FOR WAIT. Remark fX: X1 input clock oscillation frequency User's Manual U15836EJ5V0UD 207 CHAPTER 10 A/D CONVERTER (12) Internal equivalent circuit The equivalent circuit of the analog input block is shown below. Figure 10-22. Internal Equivalent Circuit of ANIn Pin R1 R2 ANIn C1 C2 C3 Table 10-4. Resistance and Capacitance Values of Equivalent Circuit (Reference Values) AVREF R1 R2 C1 C2 C3 2.7 V 12 k 8 k 8 pF 3 pF 2 pF 4.5 V 4 k 2.7 k 8 pF 1.4 pF 2 pF Remarks 1. The resistance and capacitance values shown in Table 10-4 are not guaranteed values. 2. n = 0 to 3 208 User's Manual U15836EJ5V0UD CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) 11.1 Functions of Serial Interface UART0 Serial interface UART0 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 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 TXD0: Transmit data output pin RXD0: Receive data input pin * Length of communication data can be selected from 7 or 8 bits. * Dedicated on-chip 5-bit baud rate generator allowing any baud rate to be set * Transmission and reception can be performed independently. * Four operating clock inputs selectable * Fixed to LSB-first communication Cautions 1. If clock supply to serial interface UART0 is not stopped (e.g., in the HALT mode), normal operation continues. If clock supply to serial interface UART0 is stopped (e.g., in the STOP mode), each register stops operating, and holds the value immediately before clock supply was stopped. The TXD0 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 POWER0 = 0, RXE0 = 0, and TXE0 = 0. 2. Set POWER0 = 1 and then set TXE0 = 1 (transmission) or RXE0 = 1 (reception) to start communication. 3. TXE0 and RXE0 are synchronized by the base clock (fXCLK0) set by BRGC0. To enable transmission or reception again, set TXE0 or RXE0 to 1 at least two clocks of base clock after TXE0 or RXE0 has been cleared to 0. If TXE0 or RXE0 is set within two clocks of base clock, the transmission circuit or reception circuit may not be initialized. User's Manual U15836EJ5V0UD 209 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) 11.2 Configuration of Serial Interface UART0 Serial interface UART0 includes the following hardware. Table 11-1. Configuration of Serial Interface UART0 Item Registers Configuration Receive buffer register 0 (RXB0) Receive shift register 0 (RXS0) Transmit shift register 0 (TXS0) Control registers Asynchronous serial interface operation mode register 0 (ASIM0) Asynchronous serial interface reception error status register 0 (ASIS0) Baud rate generator control register 0 (BRGC0) Port mode register 1 (PM1) Port register 1 (P1) 210 User's Manual U15836EJ5V0UD Figure 11-1. Block Diagram of Serial Interface UART0 Filter RxD0/ SI10/P11 Asynchronous serial interface operation mode register 0 (ASIM0) fX/23 fX/25 Asynchronous serial interface reception error status register 0 (ASIS0) Baud rate generator User's Manual U15836EJ5V0UD INTSR0 Reception control Receive buffer register 0 (RXB0) INTST0 Transmission control Transmit shift register 0 (TXS0) Reception unit Selector fX/2 Internal bus 8-bit timer/ event counter 50 output Baud rate generator control register 0 (BRGC0) 7 Baud rate generator 7 TxD0/ SCK10/P10 Output latch (P10) Registers Transmission unit PM10 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) Receive shift register 0 (RXS0) 211 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (1) Receive buffer register 0 (RXB0) This 8-bit register stores parallel data converted by receive shift register 0 (RXS0). Each time 1 byte of data has been received, new receive data is transferred to this register from receive shift register 0 (RXS0). If the data length is set to 7 bits the receive data is transferred to bits 0 to 6 of RXB0 and the MSB of RXB0 is always 0. If an overrun error (OVE0) occurs, the receive data is not transferred to RXB0. RXB0 can be read by an 8-bit memory manipulation instruction. No data can be written to this register. RESET input or POWER0 = 0 sets this register to FFH. (2) Receive shift register 0 (RXS0) This register converts the serial data input to the RXD0 pin into parallel data. RXS0 cannot be directly manipulated by a program. (3) Transmit shift register 0 (TXS0) This register is used to set transmit data. Transmission is started when data is written to TXS0, and serial data is transmitted from the TXD0 pin. TXS0 can be written by an 8-bit memory manipulation instruction. This register cannot be read. RESET input, POWER0 = 0, or TXE0 = 0 sets this register to FFH. Caution Do not write the next transmit data to TXS0 before the transmission completion interrupt signal (INTST0) is generated. 212 User's Manual U15836EJ5V0UD CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) 11.3 Registers Controlling Serial Interface UART0 Serial interface UART0 is controlled by the following five registers. * Asynchronous serial interface operation mode register 0 (ASIM0) * Asynchronous serial interface reception error status register 0 (ASIS0) * Baud rate generator control register 0 (BRGC0) * Port mode register 1 (PM1) * Port register 1 (P1) (1) Asynchronous serial interface operation mode register 0 (ASIM0) This 8-bit register controls the serial communication operations of serial interface UART0. This register can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input sets this register to 01H. Figure 11-2. Format of Asynchronous Serial Interface Operation Mode Register 0 (ASIM0) (1/2) Address: FF70H After reset: 01H R/W Symbol <7> <6> <5> 4 3 2 1 0 ASIM0 POWER0 TXE0 RXE0 PS01 PS00 CL0 SL0 1 POWER0 0 Note 1 Enables/disables operation of internal operation clock Disables operation of the internal operation clock (fixes the clock to low level) and asynchronously resets the internal circuit 1 Enables/disables transmission 0 Disables transmission (synchronously resets the transmission circuit). 1 Enables transmission. RXE0 2. . Enables operation of the internal operation clock. TXE0 Notes 1. Note 2 Enables/disables reception 0 Disables reception (synchronously resets the reception circuit). 1 Enables reception. The input from the RXD0 pin is fixed to high level when POWER0 = 0. Asynchronous serial interface reception error status register 0 (ASIS0), transmit shift register 0 (TXS0), and receive buffer register 0 (RXB0) are reset. User's Manual U15836EJ5V0UD 213 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) Figure 11-2. Format of Asynchronous Serial Interface Operation Mode Register 0 (ASIM0) (2/2) PS01 PS00 Transmission operation 0 0 Does not output parity bit. Reception without parity 0 1 Outputs 0 parity. Reception as 0 parity 1 0 Outputs odd parity. Judges as odd parity. 1 1 Outputs even parity. Judges as even parity. CL0 Reception operation Note Specifies character length of transmit/receive data 0 Character length of data = 7 bits 1 Character length of data = 8 bits SL0 Specifies number of stop bits of transmit data 0 Number of stop bits = 1 1 Number of stop bits = 2 Note If "reception as 0 parity" is selected, the parity is not judged. Therefore, bit 2 (PE0) of asynchronous serial interface reception error status register 0 (ASIS0) is not set and the error interrupt does not occur. Cautions 1. At startup, set POWER0 to 1 and then set TXE0 to 1. To stop the operation, clear TXE0 to 0, and then clear POWER0 to 0. 2. At startup, set POWER0 to 1 and then set RXE0 to 1. To stop the operation, clear RXE0 to 0, and then clear POWER0 to 0. 3. Set POWER0 to 1 and then set RXE0 to 1 while a high level is input to the RxD0 pin. If POWER0 is set to 1 and RXE0 is set to 1 while a low level is input, reception is started. 4. TXE0 and RXE0 are synchronized by the base clock (fXCLK0) set by BRGC0. To enable transmission or reception again, set TXE0 or RXE0 to 1 at least two clocks of base clock after TXE0 or RXE0 has been cleared to 0. If TXE0 or RXE0 is set within two clocks of base clock, the transmission circuit or reception circuit may not be initialized. 5. Clear the TXE0 and RXE0 bits to 0 before rewriting the PS01, PS00, and CL0 bits. 6. Make sure that TXE0 = 0 when rewriting the SL0 bit. Reception is always performed with "number of stop bits = 1", and therefore, is not affected by the set value of the SL0 bit. 7. Be sure to set bit 0 to 1. 214 User's Manual U15836EJ5V0UD CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (2) Asynchronous serial interface reception error status register 0 (ASIS0) This register indicates an error status on completion of reception by serial interface UART0. It includes three error flag bits (PE0, FE0, OVE0). This register is read-only by an 8-bit memory manipulation instruction. RESET input clears this register to 00H if bit 7 (POWER0) and bit 5 (RXE0) of ASIM0 = 0. 00H is read when this register is read. Figure 11-3. Format of Asynchronous Serial Interface Reception Error Status Register 0 (ASIS0) Address: FF73H After reset: 00H R Symbol 7 6 5 4 3 2 1 0 ASIS0 0 0 0 0 0 PE0 FE0 OVE0 PE0 Status flag indicating parity error 0 If POWER0 = 0 and RXE0 = 0, or if the ASIS0 register is read. 1 If the parity of transmit data does not match the parity bit on completion of reception. FE0 Status flag indicating framing error 0 If POWER0 = 0 and RXE0 = 0, or if the ASIS0 register is read. 1 If the stop bit is not detected on completion of reception. OVE0 Status flag indicating overrun error 0 If POWER0 = 0 and RXE0 = 0, or if the ASIS0 register is read. 1 If receive data is set to the RXB0 register and the next reception operation is completed before the data is read. Cautions 1. The operation of the PE0 bit differs depending on the set values of the PS01 and PS00 bits of asynchronous serial interface operation mode register 0 (ASIM0). 2. Only 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 0 (RXB0) but discarded. 4. If data is read from ASIS0, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. User's Manual U15836EJ5V0UD 215 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (3) Baud rate generator control register 0 (BRGC0) This register selects the base clock of serial interface UART0 and the division value of the 5-bit counter. BRGC0 can be set by an 8-bit memory manipulation instruction. RESET input sets this register to 1FH. Figure 11-4. Format of Baud Rate Generator Control Register 0 (BRGC0) Address: FF71H After reset: 1FH R/W Symbol 7 6 5 4 3 2 1 0 BRGC0 TPS01 TPS00 0 MDL04 MDL03 MDL02 MDL01 MDL00 TPS01 TPS00 0 0 TM50 output 0 1 fX/2 (5 MHz) 1 0 fX/2 (1.25 MHz) 1 1 fX/2 (312.5 kHz) MDL04 MDL03 Base clock (fXCLK0) selection Note 1 Note 2 3 5 MDL02 MDL01 MDL00 k Selection of 5-bit counter output clock 0 Notes 1. 0 x x x x Setting prohibited 0 1 0 0 0 8 fXCLK0/8 0 1 0 0 1 9 fXCLK0/9 0 1 0 1 0 10 fXCLK0/10 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 1 1 0 1 0 26 fXCLK0/26 1 1 0 1 1 27 fXCLK0/27 1 1 1 0 0 28 fXCLK0/28 1 1 1 0 1 29 fXCLK0/29 1 1 1 1 0 30 fXCLK0/30 1 1 1 1 1 31 fXCLK0/31 Be sure to set the base clock so that the following condition is satisfied. * VDD = 4.0 to 5.5 V: Base clock 10 MHz * VDD = 3.3 to 4.0 V: Base clock 8.38 MHz * VDD = 2.7 to 3.3 V: Base clock 5 MHz * VDD = 2.5 to 2.7 V: Base clock 2.5 MHz 2. Note the following points when selecting the TM50 output as the base clock. * PWM mode (TMC506 = 1) Start the operation of 8-bit timer/event counter 50 first and then set the base clock to make the duty = 50%. * Mode in which the base clock is cleared and started upon a match of TM50 and CR50 (TMC506 = 0) Start the operation of 8-bit timer/event counter 50 first and then enable the timer F/F inversion operation (TMC501 = 1). It is not necessary to enable the TO50 pin as a timer output pin in any mode. 216 User's Manual U15836EJ5V0UD CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) Cautions 1. When the Ring-OSC clock is selected as the clock to be supplied to the CPU, the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the base clock is the RingOSC clock, the operation of serial interface UART0 is not guaranteed. 2. Make sure that bit 6 (TXE0) and bit 5 (RXE0) of the ASIM0 register = 0 when rewriting the MDL04 to MDL00 bits. 3. The baud rate value is the output clock of the 5-bit counter divided by 2. Remarks 1. fXCLK0: Frequency of base clock selected by the TPS01 and TPS00 bits 2. fX: X1 input clock oscillation frequency 3. k: Value set by the MDL04 to MDL00 bits (k = 8, 9, 10, ..., 31) 4. x: Don't care 5. Figures in parentheses apply to operation at fX = 10 MHz 6. TMC506: Bit 6 of 8-bit timer mode control register 50 (TMC50) 7. TMC501: Bit 1 of TMC50 (4) Port mode register 1 (PM1) This register sets port 1 input/output in 1-bit units. When using the P10/TxD0/SCK10 pin for serial interface data output, clear PM10 to 0 and set the output latch of P10 to 1. When using the P11/RxD0/SI10 pin for serial interface data input, set PM11 to 1. The output latch of P11 at this time may be 0 or 1. PM1 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input sets this register to FFH. Figure 11-5. Format of Port Mode Register 1 (PM1) Address: FF21H Symbol PM1 After reset: FFH R/W 7 6 5 4 3 2 1 0 PM17 PM16 PM15 PM14 PM13 PM12 PM11 PM10 PM1n P1n pin I/O mode selection (n = 0 to 7) 0 Output mode (output buffer on) 1 Input mode (output buffer off) User's Manual U15836EJ5V0UD 217 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) 11.4 Operation of Serial Interface UART0 Serial interface UART0 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, thus reducing the power consumption. 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 (POWER0, TXE0, and RXE0) of ASIM0 to 0. (1) Register used The operation stop mode is set by asynchronous serial interface operation mode register 0 (ASIM0). ASIM0 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input sets this register to 01H. Address: FF70H After reset: 01H R/W Symbol <7> <6> <5> 4 3 2 1 0 ASIM0 POWER0 TXE0 RXE0 PS01 PS00 CL0 SL0 1 POWER0 0 Note 1 Enables/disables operation of internal operation clock Disables operation of the internal operation clock (fixes the clock to low level) and asynchronously resets the internal circuit TXE0 0 Notes 1. 2. . Enables/disables transmission Disables transmission (synchronously resets the transmission circuit). RXE0 0 Note 2 Enables/disables reception Disables reception (synchronously resets the reception circuit). The input from the RXD0 pin is fixed to high level when POWER0 = 0. Asynchronous serial interface reception error status register 0 (ASIS0), transmit shift register 0 (TXS0), and receive buffer register 0 (RXB0) are reset. Caution Clear POWER0 to 0 after clearing TXE0 and RXE0 to 0 to set the operation stop mode. To start the operation, set POWER0 to 1, and then set TXE0 and RXE0 to 1. Remark To use the RxD0/SI10/P11 and TxD0/SCK10/P10 pins as general-purpose port pins, see CHAPTER 4 PORT FUNCTIONS. 218 User's Manual U15836EJ5V0UD CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) 11.4.2 Asynchronous serial interface (UART) mode In this mode, 1-byte data 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 0 (ASIM0) * Asynchronous serial interface reception error status register 0 (ASIS0) * Baud rate generator control register 0 (BRGC0) * Port mode register 1 (PM1) * Port register 1 (P1) The basic procedure of setting an operation in the UART mode is as follows. <1> Set the BRGC0 register (see Figure 11-4). <2> Set bits 1 to 4 (SL0, CL0, PS00, and PS01) of the ASIM0 register (see Figure 11-2). <3> Set bit 7 (POWER0) of the ASIM0 register to 1. <4> Set bit 6 (TXE0) of the ASIM0 register to 1. Transmission is enabled. Set bit 5 (RXE0) of the ASIM0 register to 1. Reception is enabled. <5> Write data to the TXS0 register. Data transmission is started. Caution Take relationship with the other party of communication when setting the port mode register and port register. The relationship between the register settings and pins is shown below. Table 11-2. Relationship Between Register Settings and Pins POWER0 0 1 TXE0 0 0 RXE0 0 1 PM10 x Note x Note P10 PM11 Pin Function TxD0/SCK10/P10 RxD0/SI10/P11 Stop SCK10/P10 SI10/P11 x x Note 1 x Reception SCK10/P10 RxD0 Note Note Transmission TxD0 SI10/P11 x Transmission/ TxD0 RxD0 1 0 0 1 1 1 0 1 x 1 x x Note UART0 Operation Note x Note P11 reception Note Can be set as port function. Remark x: don't care POWER0: Bit 7 of asynchronous serial interface operation mode register 0 (ASIM0) TXE0: Bit 6 of ASIM0 RXE0: Bit 5 of ASIM0 PM1x: Port mode register P1x: Port output latch User's Manual U15836EJ5V0UD 219 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (2) Communication operation (a) Format and waveform example of normal transmit/receive data Figures 11-6 and 11-7 show the format and waveform example of the normal transmit/receive data. Figure 11-6. Format of Normal UART Transmit/Receive Data 1 data frame Start bit D0 D1 D2 D3 D4 D5 D6 D7 Parity bit Stop bit Character bits One data frame consists of the following bits. * Start bit ... 1 bit * Character bits ... 7 or 8 bits (LSB first) * 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 0 (ASIM0). Figure 11-7. Example of Normal UART Transmit/Receive Data Waveform 1. Data length: 8 bits, 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: 7 bits, Parity: Odd parity, Stop bit: 2 bits, Communication data: 36H 1 data frame Start D0 D1 D2 D3 D4 D5 D6 Parity Stop 3. Data length: 8 bits, Parity: None, Stop bit: 1 bit, Communication data: 87H 1 data frame Start 220 D0 D1 D2 D3 D4 D5 User's Manual U15836EJ5V0UD D6 D7 Stop Stop CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (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. (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. User's Manual U15836EJ5V0UD 221 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (c) Transmission The TXD0 pin outputs a high level when bit 7 (POWER0) of asynchronous serial interface operation mode register 0 (ASIM0) is set to 1. If bit 6 (TXE0) of ASIM0 is then set to 1, transmission is enabled. Transmission can be started by writing transmit data to transmit shift register 0 (TXS0). The start bit, parity bit, and stop bit are automatically appended to the data. When transmission is started, the start bit is output from the TXD0 pin, followed by the rest of the data in order starting from the LSB. When transmission is completed, the parity and stop bits set by ASIM0 are appended and a transmission completion interrupt request (INTST0) is generated. Transmission is stopped until the data to be transmitted next is written to TXS0. Figure 11-8 shows the timing of the transmission completion interrupt request (INTST0). This interrupt occurs as soon as the last stop bit has been output. Caution After transmit data is written to TXS0, do not write the next transmit data before the transmission completion interrupt signal (INTST0) is generated. Figure 11-8. Transmission Completion Interrupt Request Timing 1. Stop bit length: 1 TXD0 (output) Start D0 D1 D2 D6 D7 Parity Start D0 D1 D2 D6 D7 Parity Stop INTST0 2. Stop bit length: 2 TXD0 (output) INTST0 222 User's Manual U15836EJ5V0UD Stop CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (d) Reception Reception is enabled and the RXD0 pin input is sampled when bit 7 (POWER0) of asynchronous serial interface operation mode register 0 (ASIM0) is set to 1 and then bit 5 (RXE0) of ASIM0 is set to 1. The 5-bit counter of the baud rate generator starts counting when the falling edge of the RXD0 pin input is detected. When the set value of baud rate generator control register 0 (BRGC0) has been counted, the RXD0 pin input is sampled again ( in Figure 11-9). If the RXD0 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 receive shift register 0 (RXS0) at the set baud rate. When the stop bit has been received, the reception completion interrupt (INTSR0) is generated and the data of RXS0 is written to receive buffer register 0 (RXB0). If an overrun error (OVE0) occurs, however, the receive data is not written to RXB0. Even if a parity error (PE0) occurs while reception is in progress, reception continues to the reception position of the stop bit, and an error interrupt (INTSR0) is generated after completion of reception. Figure 11-9. Reception Completion Interrupt Request Timing RXD0 (input) Start D0 D1 D2 D3 D4 D5 D6 D7 Parity Stop INTSR0 RXB0 Cautions 1. Be sure to read receive buffer register 0 (RXB0) 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 0 (ASIS0) before reading RXB0. User's Manual U15836EJ5V0UD 223 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (e) 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 0 (ASIS0) is set as a result of data reception, a reception error interrupt request (INTSR0) is generated. Which error has occurred during reception can be identified by reading the contents of ASIS0 in the reception error interrupt servicing (INTSR0) (see Figure 11-3). The contents of ASIS0 are reset to 0 when ASIS0 is read. Table 11-3. Cause of Reception Error Reception Error Cause The parity specified for transmission does not match the parity of the Parity error receive data. Framing error Stop bit is not detected. Overrun error Reception of the next data is completed before data is read from receive buffer register 0 (RXB0). (f) Noise filter of receive data The RXD0 signal is sampled using 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-10, the internal processing of the reception operation is delayed by two clocks from the external signal status. Figure 11-10. Noise Filter Circuit Base clock RXD0/SI10/P11 In Q Internal signal A Match detector 224 User's Manual U15836EJ5V0UD In LD_EN Q Internal signal B CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) 11.4.3 Dedicated baud rate generator The dedicated baud rate generator consists of a source clock selector and a 5-bit programmable counter, and generates a serial clock for transmission/reception of UART0. Separate 5-bit counters are provided for transmission and reception. (1) Configuration of baud rate generator * Base clock The clock selected by bits 7 and 6 (TPS01 and TPS00) of baud rate generator control register 0 (BRGC0) is supplied to each module when bit 7 (POWER0) of asynchronous serial interface operation mode register 0 (ASIM0) is 1. This clock is called the base clock and its frequency is called fXCLK0. The base clock is fixed to low level when POWER0 = 0. * Transmission counter This counter stops, cleared to 0, when bit 7 (POWER0) or bit 6 (TXE0) of asynchronous serial interface operation mode register 0 (ASIM0) is 0. It starts counting when POWER0 = 1 and TXE0 = 1. The counter is cleared to 0 when the first data transmitted is written to transmit shift register 0 (TXS0). * Reception counter This counter stops operation, cleared to 0, when bit 7 (POWER0) or bit 5 (RXE0) of asynchronous serial interface operation mode register 0 (ASIM0) 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. Figure 11-11. Configuration of Baud Rate Generator POWER0 Baud rate generator fX/2 POWER0, TXE0 (or RXE0) fX/23 Selector 5-bit counter fXCLK0 fX/25 8-bit timer/ event counter 50 output Match detector BRGC0: TPS01, TPS00 Remark 1/2 Baud rate BRGC0: MDL04 to MDL00 POWER0: Bit 7 of asynchronous serial interface operation mode register 0 (ASIM0) TXE0: Bit 6 of ASIM0 RXE0: Bit 5 of ASIM0 BRGC0: Baud rate generator control register 0 User's Manual U15836EJ5V0UD 225 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (2) Generation of serial clock A serial clock can be generated by using baud rate generator control register 0 (BRGC0). Select the clock to be input to the 5-bit counter by using bits 7 and 6 (TPS01 and TPS00) of BRGC0. Bits 4 to 0 (MDL04 to MDL00) of BRGC0 can be used to select the division value of the 5-bit counter. (a) Baud rate The baud rate can be calculated by the following expression. * Baud rate = fXCLK0: k: fXCLK0 2xk [bps] Frequency of base clock selected by the TPS01 and TPS00 bits of the BRGC0 register Value set by the MDL04 to MDL00 bits of the BRGC0 register (k = 8, 9, 10, ..., 31) (b) Error of baud rate The baud rate error can be calculated by the following expression. * Error (%) = Actual baud rate (baud rate with error) Desired baud rate (correct baud rate) - 1 x 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 = 2.5 MHz = 2,500,000 Hz Set value of MDL04 to MDL00 bits of BRGC0 register = 10000B (k = 16) Target baud rate = 76,800 bps Baud rate = 2.5 M/(2 x 16) = 2,500,000/(2 x 16) = 78125 [bps] Error = (78,125/76,800 - 1) x 100 = 1.725 [%] 226 User's Manual U15836EJ5V0UD CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (3) Example of setting baud rate Table 11-4. Set Data of Baud Rate Generator Baud Rate [bps] fX = 10.0 MHz TPS01, k TPS00 fX = 8.38 MHz Calculated ERR[%] Value TPS01, k TPS00 fX = 4.19 MHz Calculated ERR[%] Value TPS01, k TPS00 Calculated ERR[%] Value 2400 - - - - - - - - 3 27 2425 1.03 4800 - - - - 3 27 4850 1.03 3 14 4676 -2.58 9600 3 16 9766 1.73 3 14 9353 -2.58 2 27 9699 1.03 10400 3 15 10417 0.16 3 13 10072 -3.15 2 25 10475 0.72 19200 3 8 19531 1.73 2 27 19398 1.03 2 14 18705 -2.58 31250 2 20 31250 0 2 17 30809 -1.41 - - - - 38400 2 16 39063 1.73 2 14 38796 -2.58 2 27 38796 1.03 76800 2 8 78125 1.73 1 27 77593 1.03 1 14 74821 -2.58 115200 1 22 113636 -1.36 1 18 116389 1.03 1 9 116389 1.03 153600 1 16 156250 1.73 1 14 149643 -2.58 - - - - 230400 1 11 227273 -1.36 1 9 232778 1.03 - - - - Remark TPS01, TPS00: Bits 7 and 6 of baud rate generator control register 0 (BRGC0) (setting of base clock (fXCLK0)) k: Value set by the MDL04 to MDL00 bits of BRGC0 (k = 8, 9, 10, ..., 31) fX: X1 input clock oscillation frequency ERR: Baud rate error User's Manual U15836EJ5V0UD 227 CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) (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-12. Permissible Baud Rate Range During Reception Latch timing Data frame length of UART0 Start bit Bit 0 Bit 1 Bit 7 Stop bit Parity bit FL 1 data frame (11 x FL) Minimum permissible data frame length Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit FLmin Maximum permissible data frame length Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit FLmax As shown in Figure 11-12, the latch timing of the receive data is determined by the counter set by baud rate generator control register 0 (BRGC0) 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. FL = (Brate)-1 Brate: Baud rate of UART0 k: Set value of BRGC0 FL: 1-bit data length Margin of latch timing: 2 clocks 228 User's Manual U15836EJ5V0UD CHAPTER 11 SERIAL INTERFACE UART0 (PD780102, 780103, 78F0103 ONLY) Minimum permissible data frame length: FLmin = 11 x FL - k-2 2k x FL = 21k + 2 2k FL Therefore, the maximum receivable baud rate at the transmission destination is as follows. BRmax = (FLmin/11)-1 = 22k 21k + 2 Brate Similarly, the maximum permissible data frame length can be calculated as follows. 10 11 x FLmax = 11 x FL - FLmax = 21k - 2 20k k+2 2xk x FL = 21k - 2 2xk FL FL x 11 Therefore, the minimum receivable baud rate at the transmission destination is as follows. BRmin = (FLmax/11)-1 = 20k 21k - 2 Brate The permissible baud rate error between UART0 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% -3.61% 16 +4.14% -4.19% 24 +4.34% -4.38% 31 +4.44% -4.47% Remarks 1. The permissible reception error 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 reception error. 2. k: Set value of BRGC0 User's Manual U15836EJ5V0UD 229 CHAPTER 12 SERIAL INTERFACE UART6 12.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 12.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 12.4.2 Asynchronous serial interface (UART) mode and 12.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. * Twelve operating clock inputs selectable * MSB- or LSB-first communication selectable * Inverted transmission operation * 13-bit length output for synchronous break field transmission * 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. 230 User's Manual U15836EJ5V0UD CHAPTER 12 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 12-1 and 12-2 outline the transmission and reception operations of LIN. Figure 12-1. LIN Transmission Operation Wakeup signal frame Synchronous break field Synchronous field Ident field Data field Data field Checksum field Sleep bus Note 1 8 bits 13-bitNote 2 SBF transmission 55H Data Data Data Data transmission transmission transmission transmission transmission TX6 Note 3 INTST6 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 adjusted by baud rate 3. INTST6 is output on completion of each transmission. It is also output when SBF is transmitted. generator control register 6 (BRGC6) (see 12.4.2 (2) (h) SBF transmission). Remark The interval between each field is controlled by software. User's Manual U15836EJ5V0UD 231 CHAPTER 12 SERIAL INTERFACE UART6 Figure 12-2. LIN Reception Operation Wakeup signal frame Synchronous break field Synchronous field Ident field Data field Data field Checksum field 13 bitsNote 2 SF reception ID reception Data reception Data Data reception receptionNote 5 Sleep bus RX6 Disable Enable SBF reception Note 3 Reception interrupt (INTSR6) Edge detection Note 1 (INTP0) Note 4 Capture timer Notes 1. Disable Enable 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 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 signal is not output and the SBF reception mode is restored. 3. If SBF reception has been completed correctly, an interrupt signal is output. This SBF reception completion interrupt enables the capture timer. 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 length 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. To perform a LIN receive operation, use a configuration like the one shown in Figure 12-3. 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. 232 User's Manual U15836EJ5V0UD CHAPTER 12 SERIAL INTERFACE UART6 Figure 12-3. Port Configuration for LIN Reception Operation Selector P14/RxD6 RXD6 input Port mode (PM14) Output latch (P14) Selector Selector P120/INTP0 INTP0 input Port mode (PM120) Output latch (P120) Port input switch control (ISC0) 0: Select INTP0 (P120) 1: Select RxD6 (P14) Selector Selector P00/TI000 TI000 input Port mode (PM00) Output latch (P00) Remark Port input switch control (ISC1) 0: Select TI000 (P00) 1: Select RxD6 (P14) ISC0, ISC1: Bits 0 and 1 of the input switch control register (ISC) (see Figure 12-11) The peripheral functions used in the LIN communication operation are shown below. * 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 sync field (SF) length and divides it by the number of bits. * Serial interface UART6 User's Manual U15836EJ5V0UD 233 CHAPTER 12 SERIAL INTERFACE UART6 12.2 Configuration of Serial Interface UART6 Serial interface UART6 includes the following hardware. Table 12-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 1 (PM1) Port register 1 (P1) 234 User's Manual U15836EJ5V0UD Figure 12-4. Block Diagram of Serial Interface UART6 TI000, INTP0Note Filter INTSR6 Reception control INTSRE6 Selector Asynchronous serial interface operation mode register 6 (ASIM6) Asynchronous serial interface reception error status register 6 (ASIS6) Baud rate generator Receive shift register 6 (RXS6) Asynchronous serial interface control register 6 (ASICL6) Receive buffer register 6 (RXB6) Asynchronous serial interface control register 6 (ASICL6) Transmit buffer register 6 (TXB6) Transmission control Transmit shift register 6 (TXS6) Reception unit Internal bus Baud rate generator control register 6 (BRGC6) 8 Asynchronous serial Clock selection interface transmission register 6 (CKSR6) status register 6 (ASIF6) Baud rate generator 8 INTST6 TXD6/ P13 Registers Output latch (P13) Transmission unit Note Selectable with input switch control register (ISC). PM13 CHAPTER 12 SERIAL INTERFACE UART6 User's Manual U15836EJ5V0UD fX fX/2 fX/22 fX/23 fX/24 fX/25 fX/26 fX/27 fX/28 fX/29 fX/210 8-bit timer/ event counter 50 output RXD6/ P14 235 CHAPTER 12 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 1 to 7 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 input 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. This register can be read or written by an 8-bit memory manipulation instruction. RESET input 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. 236 User's Manual U15836EJ5V0UD CHAPTER 12 SERIAL INTERFACE UART6 12.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 1 (PM1) * Port register 1 (P1) (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 input 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 12-5. Format of Asynchronous Serial Interface Operation Mode Register 6 (ASIM6) (1/2) Address: FF50H After reset: 01H R/W Symbol <7> <6> <5> 4 3 2 1 0 ASIM6 POWER6 TXE6 RXE6 PS61 PS60 CL6 SL6 ISRM6 POWER6 0 Note 1 Enables/disables operation of internal operation clock Disables operation of the internal operation clock (fixes the clock to low level) and asynchronously resets the internal circuit 1 Note 3 . Enables operation of the internal operation clock TXE6 Notes 1. Note 2 Enables/disables transmission 0 Disables transmission (synchronously resets the transmission circuit). 1 Enables transmission The output of the TXD6 pin goes high and the input from the RXD6 pin is fixed to the high level when POWER6 = 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. User's Manual U15836EJ5V0UD 237 CHAPTER 12 SERIAL INTERFACE UART6 Figure 12-5. Format of Asynchronous Serial Interface Operation Mode Register 6 (ASIM6) (2/2) RXE6 Enables/disables reception 0 Disables reception (synchronously resets the reception circuit). 1 Enables reception PS61 PS60 Transmission operation Reception operation 0 0 Does not output parity bit. Reception without parity 0 1 Outputs 0 parity. Reception as 0 parity 1 0 Outputs odd parity. Judges as odd parity. 1 1 Outputs even parity. Judges as even parity. CL6 Specifies character length of transmit/receive data 0 Character length of data = 7 bits 1 Character length of data = 8 bits SL6 Specifies number of stop bits of transmit data 0 Number of stop bits = 1 1 Number of stop bits = 2 ISRM6 Note Enables/disables occurrence of reception completion interrupt in case of error 0 "INTSRE6" occurs in case of error (at this time, INTSR6 does not occur). 1 "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. 238 User's Manual U15836EJ5V0UD CHAPTER 12 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 input 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 12-6. Format of Asynchronous Serial Interface Reception Error Status Register 6 (ASIS6) Address: FF53H After reset: 00H R Symbol 7 6 5 4 3 2 1 0 ASIS6 0 0 0 0 0 PE6 FE6 OVE6 PE6 Status flag indicating parity error 0 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 Status flag indicating framing error 0 If POWER6 = 0 and RXE6 = 0, or if ASIS6 register is read 1 If the stop bit is not detected on completion of reception OVE6 Status flag indicating overrun error 0 If POWER6 = 0 and RXE6 = 0, or if ASIS6 register is read 1 If receive data is set to the RXB6 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. If data is read from ASIS6, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. User's Manual U15836EJ5V0UD 239 CHAPTER 12 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 input clears this register to 00H if bit 7 (POWER6) and bit 6 (TXE6) of ASIM6 = 0. Figure 12-7. Format of Asynchronous Serial Interface Transmission Status Register 6 (ASIF6) Address: FF55H After reset: 00H R Symbol 7 6 5 4 3 2 1 0 ASIF6 0 0 0 0 0 0 TXBF6 TXSF6 TXBF6 Transmit buffer data flag 0 If POWER6 = 0 or TXE6 = 0, or if data is transferred to transmit shift register 6 (TXS6) 1 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. 240 User's Manual U15836EJ5V0UD CHAPTER 12 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 input 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 12-8. Format of Clock Selection Register 6 (CKSR6) Address: FF56H After reset: 00H R/W Symbol 7 6 5 4 3 2 1 0 CKSR6 0 0 0 0 TPS63 TPS62 TPS61 TPS60 TPS63 TPS62 TPS61 TPS60 0 0 0 0 fX (10 MHz) 0 0 0 1 fX/2 (5 MHz) 0 0 1 0 fX/2 (2.5 MHz) 0 0 1 1 fX/2 (1.25 MHz) 0 1 0 0 fX/2 (625 kHz) 0 1 0 1 fX/2 (312.5 kHz) 0 1 1 0 fX/2 (156.25 kHz) 0 1 1 1 fX/2 (78.13 kHz) 1 0 0 0 fX/2 (39.06 kHz) 1 0 0 1 fX/2 (19.53 kHz) 1 0 1 0 fX/2 (9.77 kHz) 1 0 1 1 TM50 output Other Notes 1. Base clock (fXCLK6) selection Note 1 2 3 4 5 6 7 8 9 10 Note 2 Setting prohibited Be sure to set the base clock so that the following condition is satisfied. * VDD = 4.0 to 5.5 V: Base clock 10 MHz * VDD = 3.3 to 4.0 V: Base clock 8.38 MHz * VDD = 2.7 to 3.3 V: Base clock 5 MHz * VDD = 2.5 to 2.7 V: Base clock 2.5 MHz 2. Note the following points when selecting the TM50 output as the base clock. * PWM mode (TMC506 = 1) Start the operation of 8-bit timer/event counter 50 first and then set the base clock to make the duty = 50%. * Mode in which the base clock is cleared and started upon a match of TM50 and CR50 (TMC506 = 0) Start the operation of 8-bit timer/event counter 50 first and then enable the timer F/F inversion operation (TMC501 = 1). It is not necessary to enable the TO50 pin as a timer output pin in any mode. Cautions 1. When the Ring-OSC clock is selected as the clock to be supplied to the CPU, the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the base clock is the RingOSC clock, the operation of serial interface UART6 is not guaranteed. 2. Make sure POWER6 = 0 when rewriting TPS63 to TPS60. Remarks 1. Figures in parentheses are for operation with fX = 10 MHz 2. fX: X1 input clock oscillation frequency User's Manual U15836EJ5V0UD 241 CHAPTER 12 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 input 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 12-9. Format of Baud Rate Generator Control Register 6 (BRGC6) Address: FF57H After reset: FFH R/W Symbol 7 6 5 4 3 2 1 0 BRGC6 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 x x x x Setting prohibited 0 0 0 0 1 0 0 0 8 fXCLK6/8 0 0 0 0 1 0 0 1 9 fXCLK6/9 0 0 0 0 1 0 1 0 10 fXCLK6/10 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 1 1 1 1 1 1 0 0 252 fXCLK6/252 1 1 1 1 1 1 0 1 253 fXCLK6/253 1 1 1 1 1 1 1 0 254 fXCLK6/254 1 1 1 1 1 1 1 1 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 value 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 242 2. k: Value set by MDL67 to MDL60 bits (k = 8, 9, 10, ..., 255) 3. x: Don't care User's Manual U15836EJ5V0UD CHAPTER 12 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 input 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). Note, however, that communication is started by the refresh operation because bit 6 (SBRT6) of ASICL6 is cleared to 0 when communication is completed (when an interrupt signal is generated). Figure 12-10. Format of Asynchronous Serial Interface Control Register 6 (ASICL6) Address: FF58H After reset: 16H R/W Note Symbol <7> <6> 5 4 3 2 1 0 ASICL6 SBRF6 SBRT6 0 1 0 1 DIR6 TXDLV6 SBRF6 SBF reception status flag 0 If POWER6 = 0 and RXE6 = 0 or if SBF reception has been completed correctly 1 SBF reception in progress SBRT6 SBF reception trigger - 0 1 SBF reception trigger DIR6 First bit specification 0 MSB 1 LSB TXDLV6 Enables/disables inverting TXD6 output 0 Normal output of TXD6 1 Inverted output of TXD6 Note Bits 2 to 5 and 7 are read-only. Cautions 1. In the case of an SBF reception error, return the mode to the SBF reception mode again. The status of the SBRF6 flag is held (1). 2. Before setting the SBRT6 bit, make sure that bit 7 (POWER6) and bit 5 (RXE6) of ASIM6 = 1. 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 rewriting the DIR6 and TXDLV6 bits, clear the TXE6 and RXE6 bits to 0. User's Manual U15836EJ5V0UD 243 CHAPTER 12 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. The input signal is switched by setting ISC. This register can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 12-11. Format of Input Switch Control Register (ISC) Address: FF4FH After reset: 00H R/W Symbol 7 6 5 4 3 2 1 0 ISC 0 0 0 0 0 0 ISC1 ISC0 ISC1 TI000 input source selection 0 TI000 (P00) 1 RxD6 (P14) ISC0 INTP0 input source selection 0 INTP0 (P120) 1 RxD6 (P14) (8) Port mode register 1 (PM1) This register sets port 1 input/output in 1-bit units. When using the P13/TxD6 pin for serial interface data output, clear PM13 to 0 and set the output latch of P13 to 1. When using the P14/RxD6 pin for serial interface data input, set PM14 to 1. The output latch of P14 at this time may be 0 or 1. PM1 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input sets this register to FFH. Figure 12-12. Format of Port Mode Register 1 (PM1) Address: FF21H Symbol PM1 R/W 7 6 5 4 3 2 1 0 PM17 PM16 PM15 PM14 PM13 PM12 PM11 PM10 PM1n 244 After reset: FFH P1n pin I/O mode selection (n = 0 to 7) 0 Output mode (output buffer on) 1 Input mode (output buffer off) User's Manual U15836EJ5V0UD CHAPTER 12 SERIAL INTERFACE UART6 12.4 Operation of Serial Interface UART6 Serial interface UART6 has the following two modes. * Operation stop mode * Asynchronous serial interface (UART) mode 12.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 input sets this register to 01H. Address: FF50H After reset: 01H R/W Symbol <7> <6> <5> 4 3 2 1 0 ASIM6 POWER6 TXE6 RXE6 PS61 PS60 CL6 SL6 ISRM6 POWER6 0 Note 1 Enables/disables operation of internal operation clock Disables operation of the internal operation clock (fixes the clock to low level) and asynchronously resets the internal circuit TXE6 0 Notes 1. . Enables/disables transmission Disables transmission operation (synchronously resets the transmission circuit). RXE6 0 Note 2 Enables/disables reception Disables reception (synchronously resets the reception circuit). The output of the TXD6 pin goes high and the input from the RXD6 pin is fixed to high level when POWER6 = 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. 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/P14 and TxD6/P13 pins as general-purpose port pins, see CHAPTER 4 PORT FUNCTIONS. User's Manual U15836EJ5V0UD 245 CHAPTER 12 SERIAL INTERFACE UART6 12.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 1 (PM1) * Port register 1 (P1) The basic procedure of setting an operation in the UART mode is as follows. <1> Set the CKSR6 register (see Figure 12-8). <2> Set the BRGC6 register (see Figure 12-9). <3> Set bits 0 to 4 (ISRM6, SL6, CL6, PS60, PS61) of the ASIM6 register (see Figure 12-5). <4> Set bits 0 and 1 (TXDLV6, DIR6) of the ASICL6 register (see Figure 12-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 when setting the port mode register and port register. The relationship between the register settings and pins is shown below. Table 12-2. Relationship Between Register Settings and Pins POWER6 TXE6 RXE6 PM13 P13 0 0 0 x Note x Note 1 0 1 x Note x Note 1 0 0 1 1 1 0 1 PM14 x Note 1 x Note 1 P14 x Note UART6 Operation Pin Function TxD6/P13 Stop P13 P14 Reception P13 RxD6 Note Transmission TxD6 P14 x Transmission/ reception TxD6 RxD6 x x Note Can be set as port function. Remark x: don't care POWER6: Bit 7 of asynchronous serial interface operation mode register 6 (ASIM6) TXE6: 246 Bit 6 of ASIM6 RXE6: Bit 5 of ASIM6 PM1x: Port mode register P1x: Port output latch RxD6/P14 User's Manual U15836EJ5V0UD CHAPTER 12 SERIAL INTERFACE UART6 (2) Communication operation (a) Format and waveform example of normal transmit/receive data Figures 12-13 and 12-14 show the format and waveform example of the normal transmit/receive data. Figure 12-13. Format of Normal UART Transmit/Receive Data 1. LSB-first transmission/reception 1 data frame Start bit D0 D1 D2 D3 D4 D5 D6 D7 Parity bit Stop bit D1 D0 Parity bit Stop bit Character bits 2. MSB-first transmission/reception 1 data frame Start bit D7 D6 D5 D4 D3 D2 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. User's Manual U15836EJ5V0UD 247 CHAPTER 12 SERIAL INTERFACE UART6 Figure 12-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 5. Data length: 8 bits, LSB first, Parity: None, Stop bit: 1 bit, Communication data: 87H 1 data frame Start 248 D0 D1 D2 D3 D4 D5 User's Manual U15836EJ5V0UD D6 D7 Stop Stop CHAPTER 12 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. User's Manual U15836EJ5V0UD 249 CHAPTER 12 SERIAL INTERFACE UART6 (c) Normal transmission The TXD6 pin outputs a high level when bit 7 (POWER6) of asynchronous serial interface operation mode register 6 (ASIM6) is set to 1. If bit 6 (TXE6) of ASIM6 is then 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 bit and stop bit set by ASIM6 are added and a transmission completion interrupt request (INTST6) is generated. Transmission is stopped until the data to be transmitted next is written to TXB6. Figure 12-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 12-15. Normal Transmission Completion Interrupt Request Timing 1. Stop bit length: 1 TXD6 (output) Start D0 D1 D2 D6 D7 Parity Start D0 D1 D2 D6 D7 Parity Stop INTST6 2. Stop bit length: 2 TXD6 (output) INTST6 250 User's Manual U15836EJ5V0UD Stop CHAPTER 12 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. Read only the TXBF6 flag when executing continuous transmission. 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 Writing enabled 1 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 Transmission is completed. 1 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 overrun error may occur, which means that the next transmission was completed before execution of INTST6 interrupt servicing after transmission of one data frame. An overrun error can be detected by developing a program that can count the number of transmit data and by referencing the TXSF6 flag. User's Manual U15836EJ5V0UD 251 CHAPTER 12 SERIAL INTERFACE UART6 Figure 12-16 shows an example of the continuous transmission processing flow. Figure 12-16. Example of Continuous Transmission Processing Flow Set registers. Write TXB6. Transfer executed necessary number of times? Yes No Read ASIF6 TXBF6 = 0? No Yes Write TXB6. Transmission completion interrupt occurs? No Yes Transfer executed necessary number of times? Yes No Read ASIF6 TXSF6 = 0? Yes Yes of Completion 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) 252 User's Manual U15836EJ5V0UD No CHAPTER 12 SERIAL INTERFACE UART6 Figure 12-17 shows the timing of starting continuous transmission, and Figure 12-18 shows the timing of ending continuous transmission. Figure 12-17. Timing of Starting Continuous Transmission Start TXD6 Data (1) Parity Stop Start Data (2) Parity Stop Start INTST6 TXB6 FF TXS6 FF Data (1) Data (2) Data (1) Data (3) Data (2) Data (3) TXBF6 Note TXSF6 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: Transmit buffer register 6 TXS6: Transmit shift register 6 ASIF6: Asynchronous serial interface transmission status register 6 TXBF6: Bit 1 of ASIF6 TXSF6: Bit 0 of ASIF6 User's Manual U15836EJ5V0UD 253 CHAPTER 12 SERIAL INTERFACE UART6 Figure 12-18. Timing of Ending Continuous Transmission TXD6 Stop Start Data (n - 1) Parity Stop Start Data (n) Parity Stop INTST6 TXB6 Data (n - 1) Data (n) Data (n - 1) TXS6 Data (n) TXBF6 TXSF6 POWER6 or TXE6 Remark TXD6: TXD6 pin (output) INTST6: Interrupt request signal TXB6: Transmit buffer register 6 TXS6: Transmit shift register 6 ASIF6: Asynchronous serial interface transmission status register 6 TXBF6: Bit 1 of ASIF6 TXSF6: Bit 0 of ASIF6 POWER6: Bit 7 of asynchronous serial interface operation mode register (ASIM6) TXE6: 254 Bit 6 of asynchronous serial interface operation mode register (ASIM6) User's Manual U15836EJ5V0UD FF CHAPTER 12 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 12-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 12-19. Reception Completion Interrupt Request Timing RXD6 (input) Start D0 D1 D2 D3 D4 D5 D6 D7 Parity Stop 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. User's Manual U15836EJ5V0UD 255 CHAPTER 12 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 12-6). The contents of ASIS6 are reset to 0 when ASIS6 is read. Table 12-3. Cause of Reception Error Reception Error Parity error Cause The parity specified for transmission does not match the parity of the receive data. Framing error Stop bit is not detected. 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 12-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 (b) Error during reception INTSR6 INTSR6 INTSRE6 INTSRE6 2. If ISRM6 is set to 1 (error interrupt is included in INTSR6) (a) No error during reception 256 (b) Error during reception INTSR6 INTSR6 INTSRE6 INTSRE6 User's Manual U15836EJ5V0UD CHAPTER 12 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 12-21, the internal processing of the reception operation is delayed by two clocks from the external signal status. Figure 12-21. Noise Filter Circuit Base clock RXD6/P14 In Internal signal A Q Match detector In Q Internal signal B LD_EN (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 12-1 LIN Transmission Operation. SBF transmission is used to transmit an SBF length that is a low-level width of 13 bits or more by adjusting the baud rate value of the ordinary UART transmission function. [Setting method] Transmit 00H by setting the number of character bits of the data to 8 bits and the parity bit to 0 parity or even parity. This enables a low-level transmission of a data frame consisting of 10 bits (1 bit (start bit) + 8 bits (character bits) + 1 bit (parity bit)). Adjust the baud rate value to adjust this 10-bit low level to the targeted SBF length. Example If LIN is to be transmitted under the following conditions * Base clock of UART6 = 5 MHz (set by clock selection register 6 (CKSR6)) * Target baud rate value = 19200 bps To realize the above baud rate value, the length of a 13-bit SBF is as follows if the baud rate generator control register 6 (BRGC6) is set to 130. * 13-bit SBF length = 0.2 s x 130 x 2 x 13 = 676 s To realize a 13-bit SBF length in 10 bits, set a value 1.3 times the targeted baud rate to BRGC6. In this example, set 169 to BRGC6. The transmission length of a 10-bit low level in this case is as follows, and matches the 13-bit SBF length. * 10-bit low-level transmission length = 0.2 s x 169 x 2 x 10 = 676 s User's Manual U15836EJ5V0UD 257 CHAPTER 12 SERIAL INTERFACE UART6 If the number of bits set by BRGC6 runs short, adjust the number of bits by setting the base clock of UART6. Figure 12-22. Example of Setting Procedure of SBF Transmission (Flowchart) Start Read BRGC6 register and save current set value of BRGC6 register to generalpurpose register. Clear TXE6 and RXE6 bits of ASIM6 register to 0 (to disable transmission/ reception). Set value to BRGC6 register to realize desired SBF length. Clear TXE6 and RXE6 bits of ASIM6 register to 0. Set character length of data to 8 bits and parity to 0 or even using ASIM6 register. Rewrite saved BRGC6 value to BRGC6 register. Set TXE6 bit of ASIM6 register to 1 to enable transmission. Re-set PS61 bit, PS60 bit, and CL6 bit of ASIM6 register to desired value. Set TXB6 register to "00H" and start transmission. Set TXE6 bit of ASIM6 register to 1 to enable transmission. End No INTST6 occurred? Yes Figure 12-23. SBF Transmission 1 TXD6 2 3 4 5 6 7 8 9 INTST6 Remark TXD6: TXD6 pin (output) INTST6: Transmission completion interrupt request 258 User's Manual U15836EJ5V0UD 10 11 12 13 Stop CHAPTER 12 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 12-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 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 12-24. SBF Reception 1. Normal SBF reception (stop bit is detected with a width of more than 10.5 bits) 1 RXD6 2 3 4 5 6 7 8 9 10 11 SBRT6 /SBRF6 INTSR6 2. SBF reception error (stop bit is detected with a width of 10.5 bits or less) 1 RXD6 2 3 4 5 6 7 8 9 10 SBRT6 /SBRF6 INTSR6 Remark RXD6: "0" RXD6 pin (input) SBRT6: Bit 6 of asynchronous serial interface control register 6 (ASICL6) SBRF6: Bit 7 of ASICL6 INTSR6: Reception completion interrupt request User's Manual U15836EJ5V0UD 259 CHAPTER 12 SERIAL INTERFACE UART6 12.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, 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. 260 User's Manual U15836EJ5V0UD CHAPTER 12 SERIAL INTERFACE UART6 Figure 12-25. Configuration of Baud Rate Generator POWER6 fX Baud rate generator fX/2 fX/22 POWER6, TXE6 (or RXE6) fX/23 fX/24 fX/25 Selector fX/26 8-bit counter fXCLK6 fX/27 fX/28 fX/29 fX/210 8-bit timer/ event counter 50 output Match detector CKSR6: TPS63 to TPS60 Remark 1/2 Baud rate BRGC6: MDL67 to MDL60 POWER6: Bit 7 of asynchronous serial interface operation mode register 6 (ASIM6) TXE6: Bit 6 of ASIM6 RXE6: Bit 5 of ASIM6 CKSR6: Clock selection register 6 BRGC6: Baud rate generator control register 6 User's Manual U15836EJ5V0UD 261 CHAPTER 12 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. * Baud rate = fXCLK6 2xk [bps] 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. * Error (%) = Actual baud rate (baud rate with error) Desired baud rate (correct baud rate) - 1 x 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 x 33) = 10000000/(2 x 33) = 151515 [bps] Error = (151515/153600 - 1) x 100 = -1.357 [%] 262 User's Manual U15836EJ5V0UD CHAPTER 12 SERIAL INTERFACE UART6 (3) Example of setting baud rate Table 12-4. Set Data of Baud Rate Generator Baud Rate [bps] fX = 10.0 MHz TPS63 to k TPS60 fX = 8.38 MHz Calculated ERR[%] TPS63 to Value TPS60 k fX = 4.19 MHz Calculated ERR[%] TPS63 to Value TPS60 k Calculated ERR[%] Value 600 6H 130 601 0.16 6H 109 601 0.11 5H 109 601 0.11 1200 5H 130 1202 0.16 5H 109 1201 0.11 4H 109 1201 0.11 2400 4H 130 2404 0.16 4H 109 2403 0.11 3H 109 2403 0.11 4800 3H 130 4808 0.16 3H 109 4805 0.11 2H 109 4805 0.11 9600 2H 130 9615 0.16 2H 109 9610 0.11 1H 109 9610 0.11 10400 2H 120 10417 0.16 2H 101 10371 0.28 1H 101 10475 -0.28 19200 1H 130 19231 0.16 1H 109 19220 0.11 0H 109 19220 0.11 31250 1H 80 31250 0.00 0H 134 31268 0.06 0H 67 31268 0.06 38400 0H 130 38462 0.16 0H 109 38440 0.11 0H 55 38090 -0.80 76800 0H 65 76923 0.16 0H 55 76182 -0.80 0H 27 77593 1.03 115200 0H 43 116279 0.94 0H 36 116389 1.03 0H 18 116389 1.03 153600 0H 33 151515 -1.36 0H 27 155185 1.03 0H 14 149643 -2.58 230400 0H 22 227272 -1.36 0H 18 232778 1.03 0H 9 232778 1.03 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) fX: X1 input clock oscillation frequency ERR: Baud rate error User's Manual U15836EJ5V0UD 263 CHAPTER 12 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 12-26. Permissible Baud Rate Range During Reception Latch timing Data frame length of UART6 Start bit Bit 0 Bit 1 Bit 7 Stop bit Parity bit FL 1 data frame (11 x FL) Minimum permissible data frame length Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit FLmin Maximum permissible data frame length Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit FLmax As shown in Figure 12-26, 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. FL = (Brate)-1 Brate: Baud rate of UART6 k: Set value of BRGC6 FL: 1-bit data length Margin of latch timing: 2 clocks Minimum permissible data frame length: FLmin = 11 x FL - 264 k-2 2k User's Manual U15836EJ5V0UD x FL = 21k + 2 2k FL CHAPTER 12 SERIAL INTERFACE UART6 Therefore, the maximum receivable baud rate at the transmission destination is as follows. BRmax = (FLmin/11)-1 = 22k 21k + 2 Brate Similarly, the maximum permissible data frame length can be calculated as follows. 10 11 x FLmax = 11 x FL - FLmax = 21k - 2 20k k+2 2xk x FL = 21k - 2 2xk FL FL x 11 Therefore, the minimum receivable baud rate at the transmission destination is as follows. BRmin = (FLmax/11)-1 = 20k 21k - 2 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 12-5. Maximum/Minimum Permissible Baud Rate Error Division Ratio (k) Maximum Permissible Baud Rate Error Minimum Permissible Baud Rate Error 8 +3.53% -3.61% 20 +4.26% -4.31% 50 +4.56% -4.58% 100 +4.66% -4.67% 255 +4.72% -4.73% 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 User's Manual U15836EJ5V0UD 265 CHAPTER 12 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 12-27. Data Frame Length During Continuous Transmission Start bit of second byte 1 data frame Start bit FL Bit 0 Bit 1 Bit 7 FL FL FL Parity bit FL Stop bit FLstp Start bit FL Bit 0 FL 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 x FL + 2/fXCLK6 266 User's Manual U15836EJ5V0UD CHAPTER 13 SERIAL INTERFACE CSI10 13.1 Functions of Serial Interface CSI10 Serial interface CSI10 has the following two modes. * Operation stop mode * 3-wire serial I/O mode (1) Operation stop mode This mode is used when serial communication is not performed and can enable a reduction in the power consumption. For details, see 13.4.1 Operation stop mode. (2) 3-wire serial I/O mode (MSB/LSB-first selectable) This mode is used to communicate 8-bit data using three lines: a serial clock line (SCK10) and two serial data lines (SI10 and SO10). The processing time of data communication can be shortened in the 3-wire serial I/O mode because transmission and reception can be simultaneously executed. In addition, whether 8-bit data is communicated with the MSB or LSB first can be specified, so this interface can be connected to any device. The 3-wire serial I/O mode can be used connecting peripheral ICs and display controllers with a clocked serial interface. For details, see 13.4.2 3-wire serial I/O mode. 13.2 Configuration of Serial Interface CSI10 Serial interface CSI10 includes the following hardware. Table 13-1. Configuration of Serial Interface CSI10 Item Registers Configuration Transmit buffer register 10 (SOTB10) Serial I/O shift register 10 (SIO10) Control registers Serial operation mode register 10 (CSIM10) Serial clock selection register 10 (CSIC10) Port mode register 1 (PM1) Port register 1 (P1) User's Manual U15836EJ5V0UD 267 CHAPTER 13 SERIAL INTERFACE CSI10 Figure 13-1. Block Diagram of Serial Interface CSI10 Internal bus 8 8 Serial I/O shift register 10 (SIO10) SI10/P11(/RxD0Note) Transmit buffer register 10 (SOTB10) Output selector SO10/P12 Output latch (P12) Output latch Transmit data controller PM12 fX/2 fX/22 fX/23 fX/24 fX/25 fX/26 fX/27 SCK10/P10 (/TxD0Note) Selector Transmit controller Clock start/stop controller & clock phase controller INTCSI10 Note PD780102, 780103, 78F0103 only. (1) Transmit buffer register 10 (SOTB10) This register sets the transmit data. Transmission/reception is started by writing data to SOTB10 when bit 7 (CSIE10) and bit 6 (TRMD10) of serial operation mode register 10 (CSIM10) are 1. The data written to SOTB10 is converted from parallel data into serial data by serial I/O shift register 10, and output to the serial output pin (SO10). SOTB10 can be written or read by an 8-bit memory manipulation instruction. RESET input makes this register undefined. Caution Do not access SOTB10 when CSOT10 = 1 (during serial communication). (2) Serial I/O shift register 10 (SIO10) This is an 8-bit register that converts data from parallel data into serial data and vice versa. This register can be read by an 8-bit memory manipulation instruction. Reception is started by reading data from SIO10 if bit 6 (TRMD10) of serial operation mode register 10 (CSIM10) is 0. During reception, the data is read from the serial input pin (SI10) to SIO10. RESET input clears this register to 00H. Caution Do not access SIO10 when CSOT10 = 1 (during serial communication). 268 User's Manual U15836EJ5V0UD CHAPTER 13 SERIAL INTERFACE CSI10 13.3 Registers Controlling Serial Interface CSI10 Serial interface CSI10 is controlled by the following four registers. * Serial operation mode register 10 (CSIM10) * Serial clock selection register 10 (CSIC10) * Port mode register 1 (PM1) * Port register 1 (P1) (1) Serial operation mode register 10 (CSIM10) CSIM10 is used to select the operation mode and enable or disable operation. CSIM10 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 13-2. Format of Serial Operation Mode Register 10 (CSIM10) Address: FF80H After reset: 00H R/W Note 1 Symbol <7> 6 5 4 3 2 1 0 CSIM10 CSIE10 TRMD10 0 DIR10 0 0 0 CSOT10 CSIE10 Operation control in 3-wire serial I/O mode Note 2 0 Disables operation 1 Enables operation and asynchronously resets the internal circuit Note 4 TRMD10 0 Note 5 1 DIR10 2. . Transmit/receive mode control Receive mode (transmission disabled). Transmit/receive mode Note 6 First bit specification 0 MSB 1 LSB CSOT10 Notes 1. Note 3 Communication status flag 0 Communication is stopped. 1 Communication is in progress. Bit 0 is a read-only bit. When using P10/SCK10(/TxD0Note 7), P11/SI10(/RxD0Note 7), or P12/SO10 as a general-purpose port, see CHAPTER 4 PORT FUNCTIONS and Caution 3 of Figure 13-3. 3. Bit 0 (CSOT10) of CSIM10 and serial I/O shift register 10 (SIO10) are reset. 4. Do not rewrite TRMD10 when CSOT10 = 1 (during serial communication). 5. The SO10 output is fixed to the low level when TRMD10 is 0. Reception is started when data is read from SIO10. 6. Do not rewrite DIR10 when CSOT10 = 1 (during serial communication). 7. PD780102, 780103, and 78F0103 only. Caution Be sure to clear bit 5 to 0. User's Manual U15836EJ5V0UD 269 CHAPTER 13 SERIAL INTERFACE CSI10 (2) Serial clock selection register 10 (CSIC10) This register specifies the timing of the data transmission/reception and sets the serial clock. CSIC10 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 13-3. Format of Serial Clock Selection Register 10 (CSIC10) Address: FF81H After reset: 00H R/W Symbol 7 6 5 4 3 2 1 0 CSIC10 0 0 0 CKP10 DAP10 CKS102 CKS101 CKS100 CKP10 DAP10 0 0 Specification of data transmission/reception timing Type 1 SCK10 D7 D6 D5 D4 D3 D2 D1 D0 SO10 SI10 input timing 0 1 2 SCK10 SO10 D7 D6 D5 D4 D3 D2 D1 D0 SI10 input timing 1 0 3 SCK10 D7 D6 D5 D4 D3 D2 D1 D0 SO10 SI10 input timing 1 1 4 SCK10 SO10 D7 D6 D5 D4 D3 D2 D1 D0 SI10 input timing CKS102 CKS101 CKS100 0 0 0 0 0 0 1 1 0 1 1 0 0 CSI10 serial clock selection fX/2 (5 MHz) 1 Master mode Master mode 4 Master mode 5 Master mode 6 Master mode fX/2 (625 kHz) 0 fX/2 (312.5 kHz) 1 fX/2 (156.25 kHz) 7 1 1 0 fX/2 (78.13 kHz) Master mode 1 1 1 External clock input to SCK10 Slave mode Note Be sure to set the serial clock so that the following condition is satisfied. * VDD = 4.0 to 5.5 V: Serial clock 5 MHz * VDD = 3.3 to 4.0 V: Serial clock 4.19 MHz * VDD = 2.7 to 3.3 V: Serial clock 2.5 MHz * VDD = 2.5 to 2.7 V: Serial clock 1.25 MHz 270 Master mode 3 fX/2 (1.25 MHz) 1 Mode 2 fX/2 (2.5 MHz) 0 Note User's Manual U15836EJ5V0UD CHAPTER 13 SERIAL INTERFACE CSI10 Cautions 1. When the Ring-OSC clock is selected as the clock supplied to the CPU, the clock of the RingOSC oscillator is divided and supplied as the serial clock. At this time, the operation of serial interface CSI10 is not guaranteed. 2. Do not write to CSIC10 while CSIE10 = 1 (operation enabled). 3. Clear CKP10 to 0 to use P10/SCK10 (/TxD0Note), P11/SI10 (/RxD0Note), and P12/SO10 as generalpurpose port pins. 4. The phase type of the data clock is type 1 after reset. Note PD780102, 780103, 78F0103 only. Remarks 1. Figures in parentheses are for operation with fX = 10 MHz 2. fX: X1 input clock oscillation frequency (3) Port mode register 1 (PM1) This register sets port 1 input/output in 1-bit units. When using P10/SCK10(/TxD0Note) as the clock output pin of the serial interface, clear PM10 to 0 and set the output latch of P10 to 1. When using P12/SO10 as the data output pin of the serial interface, clear PM12 and the output latch of P12 to 0. When using P10/SCK10(/TxD0Note) as the clock input pin of the serial interface, and P11/SI10(/RxD0Note) as the data input pin, set PM10 and PM11 to 1. At this time, the output latches of P10 and P11 may be 0 or 1. PM1 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input sets this register to FFH. Note PD780102, 780103, 78F0103 only. Figure 13-4. Format of Port Mode Register 1 (PM1) Address: FF21H Symbol PM1 After reset: FFH R/W 7 6 5 4 3 2 1 0 PM17 PM16 PM15 PM14 PM13 PM12 PM11 PM10 PM1n P1n pin I/O mode selection (n = 0 to 7) 0 Output mode (output buffer on) 1 Input mode (output buffer off) User's Manual U15836EJ5V0UD 271 CHAPTER 13 SERIAL INTERFACE CSI10 13.4 Operation of Serial Interface CSI10 Serial interface CSI10 can be used in the following two modes. * Operation stop mode * 3-wire serial I/O mode 13.4.1 Operation stop mode Serial communication is not executed in this mode. Therefore, the power consumption can be reduced. In addition, the P10/SCK10(/TXD0Note), P11/SI10(/RXD0Note), and P12/SO10 pins can be used as ordinary I/O port pins in this mode. Note PD780102, 780103, and 78F0103 only. (1) Register used The operation stop mode is set by serial operation mode register 10 (CSIM10). To set the operation stop mode, clear bit 7 (CSIE10) of CSIM10 to 0. (a) Serial operation mode register 10 (CSIM10) CSIM10 can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears CSIM10 to 00H. Address: FF80H After reset: 00H R/W Symbol <7> 6 5 4 3 2 1 0 CSIM10 CSIE10 TRMD10 0 DIR10 0 0 0 CSOT10 CSIE10 0 Notes 1. Operation control in 3-wire serial I/O mode Note 1 Disables operation and asynchronously resets the internal circuit Note 2 . When using P10/SCK10(/TxD0Note 3), P11/SI10(RxD0Note 3), or P12/SO10 as general-purpose port pins, see CHAPTER 4 PORT FUNCTIONS, Caution 3 of Figure 13-3, and Table 13-2. 272 2. Bit 0 (CSOT10) of CSIM10 and serial I/O shift register 10 (SIO10) are reset. 3. PD780102, 780103, and 78F0103 only. User's Manual U15836EJ5V0UD CHAPTER 13 SERIAL INTERFACE CSI10 13.4.2 3-wire serial I/O mode The 3-wire serial I/O mode can be used for connecting peripheral ICs and display controllers that have a clocked serial interface. In this mode, communication is executed by using three lines: the serial clock (SCK10), serial output (SO10), and serial input (SI10) lines. (1) Registers used * Serial operation mode register 10 (CSIM10) * Serial clock selection register 10 (CSIC10) * Port mode register 1 (PM1) * Port register 1 (P1) The basic procedure of setting an operation in the 3-wire serial I/O mode is as follows. <1> Set the CSIC10 register (see Figure 13-3). <2> Set bits 0, 4, and 6 (CSOT10, DIR10, and TRMD10) of the CSIM10 register (see Figure 13-2). <3> Set bit 7 (CSIE10) of the CSIM10 register to 1. Transmission/reception is enabled. <4> Write data to transmit buffer register 10 (SOTB10). Data transmission/reception is started. Read data from serial I/O shift register 10 (SIO10). Data reception is started. Caution Take relationship with the other party of communication when setting the port mode register and port register. User's Manual U15836EJ5V0UD 273 CHAPTER 13 SERIAL INTERFACE CSI10 The relationship between the register settings and pins is shown below. Table 13-2. Relationship Between Register Settings and Pins CSIE10 TRMD10 PM11 P11 PM12 P12 PM10 CSI10 P10 Pin Function Operation P11/SI10 (/RxD0 0 x x Note 1 x Note 1 x Note 1 x Note 1 x Note 1 x Note 1 1 0 1 x x x Note 1 1 Slave x reception 1 1 x Note 1 x Note 1 0 0 1 1 x 0 0 1 Slave x reception 1 0 1 x x x Note 1 0 P12 Note 3 (/RxD0 SO10 Note 4 1 x Note 1 x Note 1 0 0 0 (input) SO10 transmission 1 1 1 x 0 0 0 Master 1 Note 3 SI10 P12 P11 (/RxD0 SO10 Note 4 SI10 ) SO10 Notes 1. Can be set as port function. 2. To use P10/SCK10(/TxD0Note 4) as port pins, clear CKP10 to 0. 3. To use the slave mode, set CKS102, CKS101, and CKS100 to 1, 1, 1. 4. PD780102, 780103, and 78F0103 only. x: don't care CSIE10: Bit 7 of serial operation mode register 10 (CSIM10) TRMD10: Bit 6 of CSIM10 CKP10: Bit 4 of serial clock selection register 10 (CSIC10) 274 PM1x: Port mode register P1x: Port output latch User's Manual U15836EJ5V0UD SCK10 (output) reception CKS102, CKS101, CKS100: Bits 2 to 0 of CSIC10 SCK10 (output) transmission/ Remark SCK10 (input) Note 3 Master 1 SCK10 Note 3 ) reception 1 ) SCK10 (input) SI10 Master 1 P10 (/TxD0 transmission/ Note 1 ) Note4 Note2 ) P11 Note 3 1 P12 Note 4 Note 3 transmission 1 (/TxD0 SI10 Slave x P10/SCK10 Note 4 ) P11 Stop (/RxD0 Note 1 P12/SO10 Note 4 SCK10 (output) CHAPTER 13 SERIAL INTERFACE CSI10 (2) Communication operation In the 3-wire serial I/O mode, data is transmitted or received in 8-bit units. Each bit of the data is transmitted or received in synchronization with the serial clock. Data can be transmitted or received if bit 6 (TRMD10) of serial operation mode register 10 (CSIM10) is 1. Transmission/reception is started when a value is written to transmit buffer register 10 (SOTB10). In addition, data can be received when bit 6 (TRMD10) of serial operation mode register 10 (CSIM10) is 0. Reception is started when data is read from serial I/O shift register 10 (SIO10). After communication has been started, bit 0 (CSOT10) of CSIM10 is set to 1. When communication of 8-bit data has been completed, a communication completion interrupt request flag (CSIIF10) is set, and CSOT10 is cleared to 0. Then the next communication is enabled. Caution Do not access the control register and data register when CSOT10 = 1 (during serial communication). Figure 13-5. Timing in 3-Wire Serial I/O Mode (1/2) (1) Transmission/reception timing (Type 1; TRMD10 = 1, DIR10 = 0, CKP10 = 0, DAP10 = 0) SCK10 Read/write trigger SOTB10 SIO10 55H (communication data) ABH 56H ADH 5AH B5H 6AH D5H AAH CSOT10 INTCSI10 CSIIF10 SI10 (receive AAH) SO10 55H is written to SOTB10. User's Manual U15836EJ5V0UD 275 CHAPTER 13 SERIAL INTERFACE CSI10 Figure 13-5. Timing in 3-Wire Serial I/O Mode (2/2) (2) Transmission/reception timing (Type 2; TRMD10 = 1, DIR10 = 0, CKP10 = 0, DAP10 = 1) SCK10 Read/write trigger SOTB10 SIO10 55H (communication data) ABH 56H ADH 5AH CSOT10 INTCSI10 CSIIF10 SI10 (input AAH) SO10 55H is written to SOTB10. 276 User's Manual U15836EJ5V0UD B5H 6AH D5H AAH CHAPTER 13 SERIAL INTERFACE CSI10 Figure 13-6. Timing of Clock/Data Phase (a) Type 1; CKP10 = 0, DAP10 = 0 SCK10 SI10 capture SO10 Writing to SOTB10 or reading from SIO10 CSIIF10 D7 D6 D5 D4 D3 D2 D1 D0 CSOT10 (b) Type 2; CKP10 = 0, DAP10 = 1 SCK10 SI10 capture SO10 Writing to SOTB10 or reading from SIO10 CSIIF10 D7 D6 D5 D4 D3 D2 D1 D0 CSOT10 (c) Type 3; CKP10 = 1, DAP10 = 0 SCK10 SI10 capture SO10 Writing to SOTB10 or reading from SIO10 CSIIF10 D7 D6 D5 D4 D3 D2 D1 D0 CSOT10 (d) Type 4; CKP10 = 1, DAP10 = 1 SCK10 SI10 capture SO10 Writing to SOTB10 or reading from SIO10 CSIIF10 D7 D6 D5 D4 D3 D2 D1 D0 CSOT10 User's Manual U15836EJ5V0UD 277 CHAPTER 13 SERIAL INTERFACE CSI10 (3) Timing of output to SO10 pin (first bit) When communication is started, the value of transmit buffer register 10 (SOTB10) is output from the SO10 pin. The output operation of the first bit at this time is described below. Figure 13-7. Output Operation of First Bit (1) When CKP10 = 0, DAP10 = 0 (or CKP10 = 1, DAP10 = 0) SCK10 Writing to SOTB10 or reading from SIO10 SOTB10 SIO10 Output latch First bit SO10 2nd bit The first bit is directly latched by the SOTB10 register to the output latch at the falling (or rising) edge of SCK10, and output from the SO10 pin via an output selector. Then, the value of the SOTB10 register is transferred to the SIO10 register at the next rising (or falling) edge of SCK10, and shifted one bit. At the same time, the first bit of the receive data is stored in the SIO10 register via the SI10 pin. The second and subsequent bits are latched by the SIO10 register to the output latch at the next falling (or rising) edge of SCK10, and the data is output from the SO10 pin. (2) When CKP10 = 0, DAP10 = 1 (or CKP10 = 1, DAP10 = 1) SCK10 Writing to SOTB10 or reading from SIO10 SOTB10 SIO10 Output latch SO10 First bit 2nd bit 3rd bit The first bit is directly latched by the SOTB10 register at the falling edge of the write signal of the SOTB10 register or the read signal of the SIO10 register, and output from the SO10 pin via an output selector. Then, the value of the SOTB10 register is transferred to the SIO10 register at the next falling (or rising) edge of SCK10, and shifted one bit. At the same time, the first bit of the receive data is stored in the SIO10 register via the SI10 pin. The second and subsequent bits are latched by the SIO10 register to the output latch at the next rising (or falling) edge of SCK10, and the data is output from the SO10 pin. 278 User's Manual U15836EJ5V0UD CHAPTER 13 SERIAL INTERFACE CSI10 (4) Output value of SO10 pin (last bit) After communication has been completed, the SO10 pin holds the output value of the last bit. Figure 13-8. Output Value of SO10 Pin (Last Bit) (1) Type 1; when CKP10 = 0 and DAP10 = 0 (or CKP10 = 1, DAP10 = 0) SCK10 ( Next request is issued.) Writing to SOTB10 or reading from SIO10 SOTB10 SIO10 Output latch Last bit SO10 (2) Type 2; when CKP10 = 0 and DAP10 = 1 (or CKP10 = 1, DAP10 = 1) SCK10 Writing to SOTB10 or reading from SIO10 ( Next request is issued.) SOTB10 SIO10 Output latch SO10 Last bit (5) SO10 output The status of the SO10 output is as follows if bit 7 (CSIE10) of serial operation mode register 10 (CSIM10) is cleared to 0. Table 13-3. SO10 Output Status TRMD10 TRMD10 = 0 TRMD10 = 1 DAP10 DIR10 - - Outputs low level DAP10 = 0 - Value of SO10 latch Note SO10 Output Note . (low-level output) DAP10 = 1 DIR10 = 0 Value of bit 7 of SOTB10 DIR10 = 1 Value of bit 0 of SOTB10 Note Status after reset Caution If a value is written to TRMD10, DAP10, and DIR10, the output value of SO10 changes. User's Manual U15836EJ5V0UD 279 CHAPTER 14 INTERRUPT FUNCTIONS 14.1 Interrupt Function Types The following two types of interrupt functions are used. (1) Maskable interrupts These interrupts undergo mask control. Maskable interrupts can be divided into a high interrupt priority group and a low interrupt priority group by setting the priority specification flag registers (PR0L, PR0H, PR1L). Multiple interrupt servicing of high-priority interrupts can be applied to low priority interrupts. If two or more interrupts with the same priority are simultaneously generated, each interrupt is serviced according to its predetermined priority (see Table 14-1). A standby release signal is generated and the STOP mode and HALT mode are released by maskable interrupts. Six external interrupt requests and 12 internal interrupt requests are provided as maskable interrupts. (2) Software interrupt This is a vectored interrupt generated by executing the BRK instruction. It is acknowledged even when interrupts are disabled. The software interrupt does not undergo interrupt priority control. 14.2 Interrupt Sources and Configuration A total of 19 interrupt sources exist for maskable and software interrupts. In addition, maximum total of 5 reset sources are also provided (see Table 14-1). 280 User's Manual U15836EJ5V0UD CHAPTER 14 INTERRUPT FUNCTIONS Table 14-1. Interrupt Source List Interrupt Default Interrupt Source Note 1 Type Priority Name Trigger Internal/ Vector Basic External Table Configuration Address Maskable Note 3 0 INTLVI Low-voltage detection 1 INTP0 Pin input edge detection 2 INTP1 0008H 3 INTP2 000AH 4 INTP3 000CH 5 INTP4 000EH 6 INTP5 0010H 7 INTSRE6 UART6 reception error generation 8 INTSR6 End of UART6 reception 0014H 9 INTST6 End of UART6 transmission 0016H 10 INTCSI10/ End of CSI10 communication/end of UART0 0018H INTST0 11 Note 4 INTTMH1 Type Note 2 Internal 0004H (A) External 0006H (B) Internal 0012H (A) transmission Match between TMH1 and CMP01 001AH (when compare register is specified) 12 INTTMH0 Match between TMH0 and CMP00 001CH (when compare register is specified) 13 INTTM50 Match between TM50 and CR50 001EH (when compare register is specified) 14 INTTM000 Match between TM00 and CR000 0020H (when compare register is specified) 15 INTTM010 Match between TM00 and CR010 0022H (when compare register is specified) 16 INTAD End of A/D conversion Note 4 0024H 17 INTSR0 Software - BRK BRK instruction execution - 003EH (C) Reset - RESET Reset input - 0000H - End of UART0 reception 0026H Note 5 POC Power-on-clear LVI Low-voltage detection Clock X1 input clock stop detection Note 6 monitor WDT Notes 1. WDT overflow The default priority is the priority applicable when two or more maskable interrupts are generated simultaneously. 0 is the highest priority, and 17 is the lowest. 2. Basic configuration types (A) to (C) correspond to (A) to (C) in Figure 14-1. 3. When bit 1 (LVIMD) = 0 is selected for the low-voltage detection register (LVIM). 4. The interrupt sources INTST0 and INTSR0 are available only in the PD780102, 780103, and 78F0103. 5. When "POC used" is selected by mask option. 6. When LVIMD = 1 is selected. User's Manual U15836EJ5V0UD 281 CHAPTER 14 INTERRUPT FUNCTIONS Figure 14-1. Basic Configuration of Interrupt Function (A) Internal maskable interrupt Internal bus MK Interrupt request IE PR ISP Priority controller IF Vector table address generator Standby release signal (B) External maskable interrupt (INTP0 to INTP5) Internal bus External interrupt edge enable register (EGP, EGN) Interrupt request Edge detector MK IF IE PR ISP Vector table address generator Priority controller Standby release signal (C) Software interrupt Internal bus Interrupt request 282 IF: Interrupt request flag IE: Interrupt enable flag ISP: In-service priority flag MK: Interrupt mask flag PR: Priority specification flag Priority controller User's Manual U15836EJ5V0UD Vector table address generator CHAPTER 14 INTERRUPT FUNCTIONS 14.3 Registers Controlling Interrupt Function The following 6 types of registers are used to control the interrupt functions. * Interrupt request flag register (IF0L, IF0H, IF1L) * Interrupt mask flag register (MK0L, MK0H, MK1L) * Priority specification flag register (PR0L, PR0H, PR1L) * External interrupt rising edge enable register (EGP) * External interrupt falling edge enable register (EGN) * Program status word (PSW) Table 14-2 shows a list of interrupt request flags, interrupt mask flags, and priority specification flags corresponding to interrupt request sources. Table 14-2. Flags Corresponding to Interrupt Request Sources Interrupt Interrupt Request Flag Request Interrupt Mask Flag Register IF0L Priority Specification Flag Register INTLVI LVIIF INTP0 PIF0 PMK0 PPR0 INTP1 PIF1 PMK1 PPR1 INTP2 PIF2 PMK2 PPR2 INTP3 PIF3 PMK3 PPR3 INTP4 PIF4 PMK4 PPR4 INTP5 PIF5 PMK5 PPR5 INTSRE6 SREIF6 SREMK6 SREPR6 INTSR6 SRIF6 INTST6 STIF6 INTST0 Note 1 LVIMK IF0H MK0L Register SRMK6 MK0H STMK6 DUALIF0 Note 2 PR0L SRPR6 PR0H STPR6 Note 4 DUALMK0 Note 3 LVIPR DUALPR0 Note 3 Note 3 INTCSI10 CSIIF10 CSIMK10 INTTMH1 TMIFH1 TMMKH1 TMPRH1 INTTMH0 TMIFH0 TMMKH0 TMPRH0 INTTM50 TMIF50 TMMK50 TMPR50 INTTM000 TMIF000 TMMK000 TMPR000 INTTM010 TMIF010 INTAD ADIF INTSR0 Note 1 SRIF0 CSIPR10 TMMK010 IF1L ADMK Note 1 SRMK0 Note 4 TMPR010 MK1L Note 1 ADPR SRPR0 PR1L Note 1 2. PD780102, 780103, and 78F0103 only. Flag name in the PD780102, 780103, and 78F0103. If either of the two types of interrupt sources is 3. Flag name in the PD780101 4. These are the flag names in the PD780102, 780103, and 78F0103. These flags support two types Notes 1. generated, these flags are set (1). of interrupt sources. User's Manual U15836EJ5V0UD 283 CHAPTER 14 INTERRUPT FUNCTIONS (1) Interrupt request flag registers (IF0L, IF0H, IF1L) The interrupt request flags are set to 1 when the corresponding interrupt request is generated or an instruction is executed. They are cleared to 0 when an instruction is executed upon acknowledgment of an interrupt request or upon application of RESET input. When an interrupt is acknowledged, the interrupt request flag is automatically cleared and then the interrupt routine is entered. IF0L, IF0H, and IF1L are set by a 1-bit or 8-bit memory manipulation instruction. When IF0L and IF0H are combined to form 16-bit register IF0, they are set by a 16-bit memory manipulation instruction. RESET input clears these registers to 00H. Figure 14-2. Format of Interrupt Request Flag Register (IF0L, IF0H, IF1L) Address: FFE0H After reset: 00H R/W Symbol IF0L <7> <6> <5> <4> <3> <2> <1> <0> SREIF6 PIF5 PIF4 PIF3 PIF2 PIF1 PIF0 LVIIF <5> <4> <3> <2> <1> <0> STIF6 SRIF6 <1> <0> Address: FFE1H Symbol After reset: 00H <7> IF0H TMIF010 Address: FFE2H Symbol <6> TMIF000 After reset: 00H 7 IF1L R/W 6 0 0 TMIF50 TMIFH0 TMIFH1 4 3 R/W 5 0 0 XXIFX Notes 1. 2. DUALIF0 Note 1 0 2 0 Note 2 SRIF0 ADIF Interrupt request flag 0 No interrupt request signal is generated 1 Interrupt request is generated, interrupt request status This is CSIIF10 in the PD780101. PD780102, 780103, and 78F0103 only. Cautions 1. Be sure to clear bits 2 to 7 of IF1L to 0. 2. When operating a timer, serial interface, or A/D converter after standby release, operate it once after clearing the interrupt request flag. An interrupt request flag may be set by noise. 3. When manipulating a flag of the interrupt request flag register, use a 1-bit memory manipulation instruction (CLR1). When describing in C language, use a bit manipulation instruction such as ``IF0L.0 = 0;'' or ``_asm(``clr1 IF0L, 0'');'' because the compiled assembler must be a 1-bit memory manipulation instruction (CLR1). If a program is described in C language using an 8-bit memory manipulation instruction such as ``IF0L &= 0xfe;'' and compiled, it becomes the assembler of three instructions. mov a, IF0L and a, #0FEH mov IF0L, a In this case, even if the request flag of another bit of the same interrupt request flag register (IF0L) is set to 1 at the timing between ``mov a, IF0L'' and ``mov IF0L, a'', the flag is cleared to 0 at ``mov IF0L, a''. Therefore, care must be exercised when using an 8-bit memory manipulation instruction in C language. 284 User's Manual U15836EJ5V0UD CHAPTER 14 INTERRUPT FUNCTIONS (2) Interrupt mask flag registers (MK0L, MK0H, MK1L) The interrupt mask flags are used to enable/disable the corresponding maskable interrupt servicing. MK0L, MK0H, and MK1L are set by a 1-bit or 8-bit memory manipulation instruction. When MK0L and MK0H are combined to form a 16-bit register MK0, they are set with a 16-bit memory manipulation instruction. RESET input sets these registers to FFH. Figure 14-3. Format of Interrupt Mask Flag Register (MK0L, MK0H, MK1L) Address: FFE4H Symbol MK0L After reset: FFH <7> <6> <5> <4> <3> <2> <1> <0> SREMK6 PMK5 PMK4 PMK3 PMK2 PMK1 PMK0 LVIMK <4> <3> <2> <1> <0> STMK6 SRMK6 <1> <0> Address: FFE5H Symbol After reset: FFH <7> MK0H TMMK010 Address: FFE6H Symbol 1 R/W <6> TMMK000 After reset: FFH 7 MK1L R/W 6 1 <5> TMMK50 TMMKH0 TMMKH1 4 3 2. DUALMK0 R/W 5 1 XXMKX Notes 1. Note 1 1 1 2 1 SRMK0 Note 2 ADMK Interrupt servicing control 0 Interrupt servicing enabled 1 Interrupt servicing disabled This is CSIMK10 in the PD780101. PD780102, 780103, and 78F0103 only. Caution Be sure to set bits 2 to 7 of MK1L to 1. User's Manual U15836EJ5V0UD 285 CHAPTER 14 INTERRUPT FUNCTIONS (3) Priority specification flag registers (PR0L, PR0H, PR1L) The priority specification flag registers are used to set the corresponding maskable interrupt priority order. PR0L, PR0H, and PR1L are set by a 1-bit or 8-bit memory manipulation instruction. If PR0L and PR0H are combined to form 16-bit register PR0, they are set with a 16-bit memory manipulation instruction. RESET input sets these registers to FFH. Figure 14-4. Format of Priority Specification Flag Register (PR0L, PR0H, PR1L) Address: FFE8H Symbol PR0L After reset: FFH <7> <6> <5> <4> <3> <2> <1> <0> SREPR6 PPR5 PPR4 PPR3 PPR2 PPR1 PPR0 LVIPR <4> <3> <2> <1> <0> STPR6 SRPR6 <1> <0> Address: FFE9H Symbol After reset: FFH <7> PR0H TMPR010 Address: FFEAH Symbol 1 R/W <6> TMPR000 After reset: FFH 7 PR1L R/W <5> TMPR50 TMPRH0 TMPRH1 4 3 2. 6 1 5 1 1 1 Priority level selection 0 High priority level 1 Low priority level This is CSIPR10 in the PD780101. PD780102, 780103, and 78F0103 only. Caution Be sure to set bits 2 to 7 of PR1L to 1. 286 DUALPR0 R/W XXPRX Notes 1. Note1 User's Manual U15836EJ5V0UD 2 1 SRPR0 Note 2 ADPR CHAPTER 14 INTERRUPT FUNCTIONS (4) External interrupt rising edge enable register (EGP), external interrupt falling edge enable register (EGN) These registers specify the valid edge for INTP0 to INTP5. EGP and EGN are set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears these registers to 00H. Figure 14-5. Format of External Interrupt Rising Edge Enable Register (EGP) and External Interrupt Falling Edge Enable Register (EGN) Address: FF48H After reset: 00H R/W Symbol 7 6 5 4 3 2 1 0 EGP 0 0 EGP5 EGP4 EGP3 EGP2 EGP1 EGP0 Address: FF49H After reset: 00H Symbol 7 6 R/W 5 4 3 2 1 0 EGN 0 0 EGN5 EGN4 EGN3 EGN2 EGN1 EGN0 EGPn EGNn 0 0 Edge detection disabled 0 1 Falling edge 1 0 Rising edge 1 1 Both rising and falling edges INTPn pin valid edge selection (n = 0 to 5) Table 14-3 shows the ports corresponding to EGPn and EGNn. Table 14-3. Ports Corresponding to EGPn and EGNn Detection Enable Register Edge Detection Port Interrupt Request Signal EGP0 EGN0 P120 INTP0 EGP1 EGN1 P30 INTP1 EGP2 EGN2 P31 INTP2 EGP3 EGN3 P32 INTP3 EGP4 EGN4 P33 INTP4 EGP5 EGN5 P16 INTP5 Caution Select the port mode by clearing EGPn and EGNn to 0 because an edge may be detected when the external interrupt function is switched to the port function. Remark n = 0 to 5 User's Manual U15836EJ5V0UD 287 CHAPTER 14 INTERRUPT FUNCTIONS (5) Program status word (PSW) The program status word is a register used to hold the instruction execution result and the current status for an interrupt request. The IE flag that sets maskable interrupt enable/disable and the ISP flag that controls multiple interrupt servicing are mapped to the PSW. Besides 8-bit read/write, this register can carry out operations using bit manipulation instructions and dedicated instructions (EI and DI). When a vectored interrupt request is acknowledged, if the BRK instruction is executed, the contents of the PSW are automatically saved into a stack and the IE flag is reset to 0. If a maskable interrupt request is acknowledged, the contents of the priority specification flag of the acknowledged interrupt are transferred to the ISP flag. The PSW contents are also saved into the stack with the PUSH PSW instruction. They are restored from the stack with the RETI, RETB, and POP PSW instructions. RESET input sets PSW to 02H. Figure 14-6. Format of Program Status Word PSW <7> <6> <5> <4> <3> 2 <1> 0 After reset IE Z RBS1 AC RBS0 0 ISP CY 02H Used when normal instruction is executed ISP 288 Priority of interrupt currently being serviced 0 High-priority interrupt servicing (low-priority interrupt disabled) 1 Interrupt request not acknowledged, or lowpriority interrupt servicing (all maskable interrupts enabled) IE Interrupt request acknowledgment enable/disable 0 Disabled 1 Enabled User's Manual U15836EJ5V0UD CHAPTER 14 INTERRUPT FUNCTIONS 14.4 Interrupt Servicing Operations 14.4.1 Maskable interrupt request acknowledgment A maskable interrupt request becomes acknowledgeable when the interrupt request flag is set to 1 and the mask (MK) flag corresponding to that interrupt request is cleared to 0. A vectored interrupt request is acknowledged if interrupts are in the interrupt enabled state (when the IE flag is set to 1). However, a low-priority interrupt request is not acknowledged during servicing of a higher priority interrupt request (when the ISP flag is reset to 0). The times from generation of a maskable interrupt request until interrupt servicing is performed are listed in Table 14-4 below. For the interrupt request acknowledgment timing, see Figures 14-8 and 14-9. Table 14-4. Time from Generation of Maskable Interrupt Request Until Servicing Note Minimum Time Maximum Time When xxPR = 0 7 clocks 32 clocks When xxPR = 1 8 clocks 33 clocks Note If an interrupt request is generated just before a divide instruction, the wait time becomes longer. Remark 1 clock: 1/fCPU (fCPU: CPU clock) If two or more maskable interrupt requests are generated simultaneously, the request with a higher priority level specified in the priority specification flag is acknowledged first. If two or more interrupt requests have the same priority level, the request with the highest default priority is acknowledged first. An interrupt request that is held pending is acknowledged when it becomes acknowledgeable. Figure 14-7 shows the interrupt request acknowledgment algorithm. If a maskable interrupt request is acknowledged, the contents are saved into the stacks in the order of PSW, then PC, the IE flag is reset (0), and the contents of the priority specification flag corresponding to the acknowledged interrupt are transferred to the ISP flag. The vector table data determined for each interrupt request is loaded into the PC and branched. Restoring from an interrupt is possible by using the RETI instruction. User's Manual U15836EJ5V0UD 289 CHAPTER 14 INTERRUPT FUNCTIONS Figure 14-7. Interrupt Request Acknowledgment Processing Algorithm Start No xxIF = 1? Yes (interrupt request generation) No xxMK = 0? Yes Interrupt request held pending Yes (High priority) xxPR = 0? No (Low priority) Yes Any high-priority interrupt request among those simultaneously generated with xxPR = 0? Interrupt request held pending Any high-priority interrupt request among those simultaneously generated with xxPR = 0? No No No IE = 1? Yes Interrupt request held pending Interrupt request held pending Any high-priority interrupt request among those simultaneously generated? No IE = 1? Vectored interrupt servicing Yes ISP = 1? Yes Yes Yes Interrupt request held pending No Interrupt request held pending No Interrupt request held pending Vectored interrupt servicing xxIF: Interrupt request flag xxMK: Interrupt mask flag xxPR: Priority specification flag IE: Flag that controls acknowledgment of maskable interrupt request (1 = Enable, 0 = Disable) ISP: Flag that indicates the priority level of the interrupt currently being serviced (0 = High-priority interrupt servicing, 1 = No interrupt request acknowledged, or low-priority interrupt servicing) 290 User's Manual U15836EJ5V0UD CHAPTER 14 INTERRUPT FUNCTIONS Figure 14-8. Interrupt Request Acknowledgment Timing (Minimum Time) 6 clocks CPU processing Instruction PSW and PC saved, jump to interrupt servicing Instruction Interrupt servicing program xxIF (xxPR = 1) 8 clocks xxIF (xxPR = 0) 7 clocks Remark 1 clock: 1/fCPU (fCPU: CPU clock) Figure 14-9. Interrupt Request Acknowledgment Timing (Maximum Time) CPU processing Instruction 25 clocks 6 clocks Divide instruction PSW and PC saved, jump to interrupt servicing Interrupt servicing program xxIF (xxPR = 1) 33 clocks xxIF (xxPR = 0) 32 clocks Remark 1 clock: 1/fCPU (fCPU: CPU clock) 14.4.2 Software interrupt request acknowledgment A software interrupt request is acknowledged by BRK instruction execution. Software interrupts cannot be disabled. If a software interrupt request is acknowledged, the contents are saved into the stacks in the order of the program status word (PSW), then program counter (PC), the IE flag is reset (0), and the contents of the vector table (003EH, 003FH) are loaded into the PC and branched. Restoring from a software interrupt is possible by using the RETB instruction. Caution Do not use the RETI instruction for restoring from the software interrupt. User's Manual U15836EJ5V0UD 291 CHAPTER 14 INTERRUPT FUNCTIONS 14.4.3 Multiple interrupt servicing Multiple interrupt servicing occurs when another interrupt request is acknowledged during execution of an interrupt. Multiple interrupt servicing does not occur unless the interrupt request acknowledgment enabled state is selected (IE = 1). When an interrupt request is acknowledged, interrupt request acknowledgment becomes disabled (IE = 0). Therefore, to enable multiple interrupt servicing, it is necessary to set (1) the IE flag with the EI instruction during interrupt servicing to enable interrupt acknowledgment. Moreover, even if interrupts are enabled, multiple interrupt servicing may not be enabled, this being subject to interrupt priority control. Two types of priority control are available: default priority control and programmable priority control. Programmable priority control is used for multiple interrupt servicing. In the interrupt enabled state, if an interrupt request with a priority equal to or higher than that of the interrupt currently being serviced is generated, it is acknowledged for multiple interrupt servicing. If an interrupt with a priority lower than that of the interrupt currently being serviced is generated during interrupt servicing, it is not acknowledged for multiple interrupt servicing. Interrupt requests that are not enabled because interrupts are in the interrupt disabled state or because they have a lower priority are held pending. When servicing of the current interrupt ends, the pending interrupt request is acknowledged following execution of at least one main processing instruction execution. Table 14-5 shows relationship between interrupt requests enabled for multiple interrupt servicing and Figure 14-10 shows multiple interrupt servicing examples. Table 14-5. Relationship Between Interrupt Requests Enabled for Multiple Interrupt Servicing During Interrupt Servicing Multiple Interrupt Request PR = 0 Interrupt Being Serviced Maskable interrupt IE = 1 Interrupt PR = 1 IE = 0 IE = 1 IE = 0 ISP = 0 x x x ISP = 1 x x x x Software interrupt Remarks 1. Software Maskable Interrupt Request Request : Multiple interrupt servicing enabled 2. x: Multiple interrupt servicing disabled 3. The ISP and IE are flags contained in the PSW. ISP = 0: An interrupt with higher priority is being serviced. ISP = 1: No interrupt request has been acknowledged, or an interrupt with a lower priority is being serviced. IE = 0: Interrupt request acknowledgment is disabled. IE = 1: Interrupt request acknowledgment is enabled. 4. PR is a flag contained in PR0L, PR0H, and PR1L. PR = 0: Higher priority level PR = 1: Lower priority level 292 User's Manual U15836EJ5V0UD CHAPTER 14 INTERRUPT FUNCTIONS Figure 14-10. Examples of Multiple Interrupt Servicing (1/2) Example 1. Multiple interrupt servicing occurs twice Main processing INTxx servicing INTyy servicing IE = 0 EI IE = 0 IE = 0 EI INTxx (PR = 1) INTzz servicing EI INTyy (PR = 0) INTzz (PR = 0) RETI IE = 1 RETI IE = 1 RETI IE = 1 During servicing of interrupt INTxx, two interrupt requests, INTyy and INTzz, are acknowledged, and multiple interrupt servicing takes place. Before each interrupt request is acknowledged, the EI instruction must always be issued to enable interrupt request acknowledgment. Example 2. Multiple interrupt servicing does not occur due to priority control Main processing EI INTxx servicing INTyy servicing IE = 0 EI INTxx (PR = 0) INTyy (PR = 1) RETI IE = 1 1 instruction execution IE = 0 RETI IE = 1 Interrupt request INTyy issued during servicing of interrupt INTxx is not acknowledged because its priority is lower than that of INTxx, and multiple interrupt servicing does not take place. The INTyy interrupt request is held pending, and is acknowledged following execution of one main processing instruction. PR = 0: Higher priority level PR = 1: Lower priority level IE = 0: Interrupt request acknowledgment disabled User's Manual U15836EJ5V0UD 293 CHAPTER 14 INTERRUPT FUNCTIONS Figure 14-10. Examples of Multiple Interrupt Servicing (2/2) Example 3. Multiple interrupt servicing does not occur because interrupts are not enabled Main processing INTxx servicing INTyy servicing IE = 0 EI INTyy (PR = 0) INTxx (PR = 0) RETI IE = 1 1 instruction execution IE = 0 RETI IE = 1 Interrupts are not enabled during servicing of interrupt INTxx (EI instruction is not issued), therefore, interrupt request INTyy is not acknowledged and multiple interrupt servicing does not take place. The INTyy interrupt request is held pending, and is acknowledged following execution of one main processing instruction. PR = 0: Higher priority level IE = 0: 294 Interrupt request acknowledgment disabled User's Manual U15836EJ5V0UD CHAPTER 14 INTERRUPT FUNCTIONS 14.4.4 Interrupt request hold There are instructions where, even if an interrupt request is issued for them while another instruction is being executed, request acknowledgment is held pending until the end of execution of the next instruction. These instructions (interrupt request hold instructions) are listed below. * MOV PSW, #byte * MOV A, PSW * MOV PSW, A * MOV1 PSW. bit, CY * MOV1 CY, PSW. bit * AND1 CY, PSW. bit * OR1 CY, PSW. bit * XOR1 CY, PSW. bit * SET1 PSW. bit * CLR1 PSW. bit * RETB * RETI * PUSH PSW * POP PSW * BT PSW. bit, $addr16 * BF PSW. bit, $addr16 * BTCLR PSW. bit, $addr16 * EI * DI * Manipulation instructions for the IF0L, IF0H, IF1L, MK0L, MK0H, MK1L, PR0L, PR0H, and PR1L registers Caution The BRK instruction is not one of the above-listed interrupt request hold instructions. However, the software interrupt activated by executing the BRK instruction causes the IE flag to be cleared to 0. Therefore, even if a maskable interrupt request is generated during execution of the BRK instruction, the interrupt request is not acknowledged. Figure 14-11 shows the timing at which interrupt requests are held pending. Figure 14-11. Interrupt Request Hold CPU processing Instruction N Instruction M PSW and PC saved, jump to interrupt servicing Interrupt servicing program xxIF Remarks 1. Instruction N: Interrupt request hold instruction 2. Instruction M: Instruction other than interrupt request hold instruction 3. The xxPR (priority level) values do not affect the operation of xxIF (interrupt request). User's Manual U15836EJ5V0UD 295 CHAPTER 15 STANDBY FUNCTION 15.1 Standby Function and Configuration 15.1.1 Standby function Table 15-1. Relationship Between Operation Clocks in Each Operation Status Status X1 Oscillator Ring-OSC Oscillator Note 2 Note 1 Operation Mode RSTOP = 0 Reset Stopped HALT Oscillating Stopped Oscillating Notes 1. Prescaler Clock Supplied to After Peripherals Release MCM0 = 0 MCM0 = 1 RSTOP = 1 Stopped Oscillating STOP CPU Clock Ring-OSC Stopped Note 3 Stopped Note 4 Ring-OSC X1 When "Cannot be stopped" is selected for Ring-OSC by a mask option. 2. When "Can be stopped by software" is selected for Ring-OSC by a mask option. 3. Operates using the CPU clock at STOP instruction execution. 4. Operates using the CPU clock at HALT instruction execution. Caution The RSTOP setting is valid only when "Can be stopped by software" is set for Ring-OSC by a mask option. Remark RSTOP: Bit 0 of the Ring-OSC mode register (RCM) MCM0: Bit 0 of the main clock mode register (MCM) The standby function is designed to reduce the operating current consumption of the system. The following two modes are available. 296 User's Manual U15836EJ5V0UD CHAPTER 15 STANDBY FUNCTION (1) HALT mode HALT instruction execution sets the HALT mode. The HALT mode is intended to stop the CPU operation clock. If the X1 input clock and Ring-OSC clock oscillator are operating before the HALT mode is set, oscillation of the X1 input clock and Ring-OSC clock continues. In this mode, operating current is not decreased as much as in the STOP mode. However, the HALT mode is effective for restarting operation immediately upon interrupt request generation and carrying out intermittent operations. (2) STOP mode STOP instruction execution sets the STOP mode. In the STOP mode, the X1 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, because a wait time is required to secure the oscillation stabilization time after the STOP mode is released, select the HALT mode if it is necessary to start processing immediately upon interrupt request generation. 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. 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) 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 Ring-OSC oscillator is operating before the STOP mode is set, oscillation of the RingOSC clock cannot be stopped in the STOP mode. However, when the Ring-OSC clock is used as the CPU clock, the CPU operation is stopped for 17/fR (s) after STOP mode is released. User's Manual U15836EJ5V0UD 297 CHAPTER 15 STANDBY FUNCTION 15.1.2 Registers controlling standby function The standby function is controlled by the following two registers. * Oscillation stabilization time counter status register (OSTC) * Oscillation stabilization time select register (OSTS) Remark For the registers that start, stop, or select the clock, see CHAPTER 5 CLOCK GENERATOR. (1) Oscillation stabilization time counter status register (OSTC) This is the status register of the X1 input clock oscillation stabilization time counter. If the Ring-OSC clock is used as the CPU clock, the X1 input clock oscillation stabilization time can be checked. OSTC can be read by a 1-bit or 8-bit memory manipulation instruction. When reset is released (reset by RESET input, POC, LVI, clock monitor, and WDT), the STOP instruction, and MSTOP (bit 7 of MOC register) = 1 clear OSTC to 00H. Figure 15-1. Format of Oscillation Stabilization Time Counter Status Register (OSTC) Address: FFA3H After reset: 00H R Symbol 7 6 5 4 3 2 1 0 OSTC 0 0 0 MOST11 MOST13 MOST14 MOST15 MOST16 MOST11 MOST13 MOST14 MOST15 MOST16 Oscillation stabilization time status fXP = 10 MHz fXP = 12 MHz 11 204.8 s min. 170.7 s min. 13 819.2 s min. 682.7 s min. 14 1.64 ms min. 1.37 ms min. 15 3.27 ms min. 2.73 ms min. 16 6.55 ms min. 5.46 ms min. 1 0 0 0 0 2 /fXP min. 1 1 0 0 0 2 /fXP min. 1 1 1 0 0 2 /fXP min. 1 1 1 1 0 2 /fXP min. 1 1 1 1 1 2 /fXP min. Note Expanded-specification products of standard products and (A) grade products only 298 User's Manual U15836EJ5V0UD Note CHAPTER 15 STANDBY FUNCTION Cautions 1. After the above time has elapsed, the bits are set to 1 in order from MOST11 and remain 1. 2. If the STOP mode is entered and then released while the Ring-OSC clock is being used as the CPU clock, set the oscillation stabilization time as follows. * Desired OSTC oscillation stabilization time Oscillation stabilization time set by OSTS The X1 oscillation stabilization time counter counts only during the oscillation stabilization time set by OSTS. Therefore, note that only the statuses during the oscillation stabilization time set by OSTS are set to OSTC after STOP mode has been released. 3. The wait time when STOP mode is released does not include the time after STOP mode release until clock oscillation starts ("a" below) regardless of whether STOP mode is released by RESET input or interrupt generation. STOP mode release X1 pin voltage waveform a Remark fX: X1 input clock oscillation frequency User's Manual U15836EJ5V0UD 299 CHAPTER 15 STANDBY FUNCTION (2) Oscillation stabilization time select register (OSTS) This register is used to select the X1 oscillation stabilization wait time when STOP mode is released. The wait time set by OSTS is valid only after STOP mode is released when the X1 input clock is selected as the CPU clock. After STOP mode is released when the Ring-OSC clock is selected as the CPU clock, check the oscillation stabilization time using OSTC. OSTS can be set by an 8-bit memory manipulation instruction. RESET input sets OSTS to 05H. Figure 15-2. Format of Oscillation Stabilization Time Select Register (OSTS) Address: FFA4H After reset: 05H R/W Symbol 7 6 5 4 3 2 1 0 OSTS 0 0 0 0 0 OSTS2 OSTS1 OSTS0 OSTS2 OSTS1 OSTS0 Oscillation stabilization time selection fXP = 10 MHz 0 0 0 1 1 0 1 1 1 170.7 s 819.2 s 682.7 s 14 1.64 ms 1.37 ms 15 3.27 ms 2.73 ms 16 6.55 ms 5.46 ms 2 /fXP 0 0 204.8 s 13 2 /fXP 1 0 11 2 /fXP 0 2 /fXP 1 2 /fXP Other than above fXP = 12 MHz Note Setting prohibited Note Expanded-specification products of standard products and (A) grade products only Cautions 1. To set the STOP mode when the X1 input clock is used as the CPU clock, set OSTS before executing the STOP instruction. 2. Execute the OSTS setting after confirming that the oscillation stabilization time has elapsed as expected in the OSTC. 3. If the STOP mode is entered and then released while the Ring-OSC clock is being used as the CPU clock, set the oscillation stabilization time as follows. * Desired OSTC oscillation stabilization time Oscillation stabilization time set by OSTS The X1 oscillation stabilization time counter counts only during the oscillation stabilization time set by OSTS. Therefore, note that only the statuses during the oscillation stabilization time set by OSTS are set to OSTC after STOP mode has been released. 4. The wait time when STOP mode is released does not include the time after STOP mode release until clock oscillation starts ("a" below) regardless of whether STOP mode is released by RESET input or interrupt generation. STOP mode release X1 pin voltage waveform a Remark 300 fX: X1 input clock oscillation frequency User's Manual U15836EJ5V0UD CHAPTER 15 STANDBY FUNCTION 15.2 Standby Function Operation 15.2.1 HALT mode (1) HALT mode The HALT mode is set by executing the HALT instruction. HALT mode can be set when the CPU clock before the setting was the X1 input clock or Ring-OSC clock. The operating statuses in the HALT mode are shown below. Table 15-2. Operating Statuses in HALT Mode HALT Mode Setting When HALT Instruction Is Executed While When HALT Instruction Is Executed While CPU Is Operating Using X1 Input Clock CPU Is Operating Using Ring-OSC Clock X1 Input Clock X1 Input Clock Oscillation Continues Oscillation Stopped Ring-OSC Oscillation Ring-OSC Oscillation Continues Item Stopped System clock Clock supply to the CPU is stopped CPU Operation stopped Note 1 Port (output latch) Holds the status before HALT mode was set 16-bit timer/event counter 00 Operable Operation not guaranteed 8-bit timer/event counter 50 Operable Operation not guaranteed when count clock other than TI50 is selected 8-bit timer H0 Operable Operation not guaranteed when count clock other than TM50 output is selected during 8-bit timer/event counter 50 operation 8-bit timer H1 Operable Operation not guaranteed when count 7 clock other than fR/2 is selected Watchdog timer Operable Ring-OSC can be Note 2 stopped Operation stopped A/D converter Serial interface UART0 Power-on-clear function Note 3 Operation not guaranteed Operable Operation not guaranteed when serial clock other than TM50 output is selected during 8-bit timer/event counter 50 operation Operable CSI10 Operable Operation not guaranteed when serial clock other than external SCK10 is selected Operable Note 4 Operable Operable UART6 Clock monitor Operation stopped Operable Operation stopped Operable Low-voltage detection function Operable External interrupt Operable Notes 1. - Ring-OSC cannot be Note 2 stopped When "Stopped by software" is selected for Ring-OSC by a mask option and Ring-OSC is stopped by software (for mask options, see CHAPTER 20 MASK OPTIONS). 2. "Ring-OSC cannot be stopped" or "Ring-OSC can be stopped by software" can be selected by a mask 3. PD780102, 780103, and 78F0103 only. 4. When "POC used" is selected by a mask option. option. User's Manual U15836EJ5V0UD 301 CHAPTER 15 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 15-3. HALT Mode Release by Interrupt Request Generation Interrupt request HALT instruction Wait Standby release signal Status of CPU Operating mode HALT mode Wait Operating mode Oscillation X1 input clock or Ring-OSC clock 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: 8 or 9 clocks * When vectored interrupt servicing is not carried out: 2 or 3 clocks 302 User's Manual U15836EJ5V0UD CHAPTER 15 STANDBY FUNCTION (b) Release by RESET input When the RESET signal is input, 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 15-4. HALT Mode Release by RESET Input (1) When X1 input clock is used as CPU clock HALT instruction RESET signal Status of CPU Operating mode HALT mode (X1 input clock) Oscillates X1 input clock Operation Operating mode stopped (17/fR) (Ring-OSC clock) Oscillation Oscillates stopped Reset period Oscillation stabilization time (211/fXP to 216/fXP) (2) When Ring-OSC clock is used as CPU clock HALT instruction RESET signal Status of CPU Operating mode Operation Operating mode stopped (17/f (Ring-OSC clock) R) Oscillation Oscillates stopped Reset period HALT mode (Ring-OSC clock) Ring-OSC clock Oscillates Remarks 1. fXP: X1 input clock oscillation frequency 2. fR: Ring-OSC clock oscillation frequency Table 15-3. Operation in Response to Interrupt Request in HALT Mode Release Source Maskable interrupt MKxx PRxx IE ISP 0 0 0 x request Operation Next address instruction execution 0 0 1 x 0 1 0 1 Next address 0 1 x 0 instruction execution 0 1 1 1 Interrupt servicing Interrupt servicing execution execution RESET input 1 x x x HALT mode held - - x x Reset processing x: Don't care User's Manual U15836EJ5V0UD 303 CHAPTER 15 STANDBY FUNCTION 15.2.2 STOP mode (1) STOP mode setting and operating statuses The STOP mode is set by executing the STOP instruction. It can be set when the CPU clock before the setting was the X1 input clock or Ring-OSC clock. Caution Because the interrupt request signal is used to clear the standby mode, if there is an interrupt source with the interrupt request flag set and the interrupt mask flag reset, the standby mode is immediately cleared if set. Thus, the STOP mode is reset to the HALT mode immediately after execution of the STOP instruction and the system returns to the operating mode as soon as the wait time set using the oscillation stabilization time select register (OSTS) has elapsed. The operating statuses in the STOP mode are shown below. Table 15-4. Operating Statuses in STOP Mode HALT Mode Setting When STOP Instruction Is Executed While When STOP Instruction Is Executed While CPU Is Operating Using X1 Input Clock CPU Is Operating Using Ring-OSC Clock Ring-OSC Oscillation Ring-OSC Oscillation Continues Item Stopped Note 1 System clock Only X1 oscillator oscillation is stopped. Clock supply to the CPU is stopped. CPU Operation stopped Port (output latch) Holds the status before STOP mode was set 16-bit timer/event counter 00 Operation stopped 8-bit timer/event counter 50 Operable only when TI50 is selected as count clock 8-bit timer H0 Operable when TM50 output is selected as count clock during 8-bit timer/event counter 50 operation 8-bit timer H1 Operable Watchdog timer Note 2 - Ring-OSC cannot be Note 3 stopped Operable Ring-OSC can be Note 3 stopped Operation stopped A/D converter Serial interface Operable Note 2 Operable Operation stopped Note 4 UART6 Operable only when TM50 output is selected as serial clock during 8-bit timer/event counter 50 operation CSI10 Operable only when external SCK10 is selected as serial clock UART0 Clock monitor Power-on-clear function Operation stopped Operation stopped Note 5 Operable Low-voltage detection function Operable External interrupt Operable Notes 1. When "Stopped by software" is selected for Ring-OSC by a mask option and Ring-OSC is stopped by software (for mask options, see CHAPTER 20 MASK OPTIONS). 2. Operable only when fR/27 is selected as count clock. 3. "Ring-OSC cannot be stopped" or "Ring-OSC can be stopped by software" can be selected by a mask option. 4. PD780102, 780103, and 78F0103 only. 5. When "POC used" is selected by a mask option. 304 User's Manual U15836EJ5V0UD CHAPTER 15 STANDBY FUNCTION (2) STOP mode release Figure 15-5. Operation Timing When STOP Mode Is Released STOP mode release STOP mode X1 input clock Ring-OSC clock X1 input clock is selected as CPU clock when STOP instruction is executed HALT status (oscillation stabilization time set by OSTS) Ring-OSC clock is selected as CPU clock when STOP instruction is executed Ring-OSC clock Operation stopped (17/fR) X1 input clock X1 input clock Clock switched by software User's Manual U15836EJ5V0UD 305 CHAPTER 15 STANDBY FUNCTION The STOP mode can be released by the following two sources. (a) Release by unmasked interrupt request When an unmasked 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. Figure 15-6. STOP Mode Release by Interrupt Request Generation (1) When X1 input clock is used as CPU clock Wait (set by OSTS) STOP instruction Standby release signal Status of CPU Operating mode X1 input clock (X1 input clock) Oscillates STOP mode Oscillation stabilization wait status Operating mode (HALT mode status) (X1 input clock) Oscillation stopped Oscillates Oscillation stabilization time (set by OSTS) (2) When Ring-OSC clock is used as CPU clock STOP instruction Standby release signal Status of CPU Operating mode STOP mode (Ring-OSC clock) Operation stopped Operating mode (17/fR) (Ring-OSC clock) Oscillates Ring-OSC clock Remarks 1. The broken lines indicate the case when the interrupt request that has released the standby mode is acknowledged. 2. fR: Ring-OSC clock oscillation frequency 306 User's Manual U15836EJ5V0UD CHAPTER 15 STANDBY FUNCTION (b) Release by RESET input When the RESET signal is input, STOP mode is released and a reset operation is performed after the oscillation stabilization time has elapsed. Figure 15-7. STOP Mode Release by RESET Input (1) When X1 input clock is used as CPU clock STOP instruction RESET signal Status of CPU Operating mode X1 input clock (X1 input clock) Oscillates STOP mode Oscillation stopped Reset period Operation Operating mode stopped (17/f R) (Ring-OSC clock) Oscillation Oscillates stopped Oscillation stabilization time (211/fXP to 216/fXP) (2) When Ring-OSC clock is used as CPU clock STOP instruction RESET signal Status of CPU Operating mode Reset period Operation Operating mode stopped (17/f (Ring-OSC clock) R) Oscillation Oscillates stopped STOP mode (Ring-OSC clock) Ring-OSC clock Oscillates Remarks 1. fXP: X1 input clock oscillation frequency 2. fR: Ring-OSC clock oscillation frequency Table 15-5. Operation in Response to Interrupt Request in STOP Mode Release Source Maskable interrupt MKxx PRxx IE ISP 0 0 0 x request Operation Next address instruction execution 0 0 1 x Interrupt servicing execution 0 1 0 1 Next address 0 1 x 0 instruction execution 0 1 1 1 Interrupt servicing execution RESET input 1 x x x STOP mode held - - x x Reset processing x: Don't care User's Manual U15836EJ5V0UD 307 CHAPTER 16 RESET FUNCTION The following five operations are available to generate a reset signal. (1) External reset input via RESET pin (2) Internal reset by watchdog timer program loop detection (3) Internal reset by clock monitor X1 input clock oscillation stop detection (4) Internal reset by comparison of supply voltage and detection voltage of power-on-clear (POC) circuit (5) 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 at the address at 0000H and 0001H when the reset signal is input. A reset is applied when a low level is input to the RESET pin, the watchdog timer overflows, X1 clock oscillation stop is detected by the clock monitor, or by POC and LVI circuit voltage detection, and each item of hardware is set to the status shown in Table 16-1. Each pin is high impedance during reset input or during the oscillation stabilization time just after reset release, except for P130, which is low-level output. When a high level is input to the RESET pin, the reset is released and program execution starts using the RingOSC clock after the CPU clock operation has stopped for 17/fR (s). A reset generated by the watchdog timer and clock monitor sources is automatically released after the reset, and program execution starts using the Ring-OSC clock after the CPU clock operation has stopped for 17/fR (s) (see Figures 16-2 to 16-4). Reset by POC and LVI circuit power supply detection is automatically released when VDD > VPOC or VDD > VLVI after the reset, and program execution starts using the Ring-OSC clock after the CPU clock operation has stopped for 17/fR (s) (see CHAPTER 18 POWER-ON-CLEAR CIRCUIT and CHAPTER 19 LOW-VOLTAGE DETECTOR). Cautions 1. For an external reset, input a low level for 10 s or more to the RESET pin. 2. During reset input, the X1 input clock and Ring-OSC clock stop oscillating. 3. When the STOP mode is released by a reset, the STOP mode contents are held during reset input. However, the port pins become high-impedance, except for P130, which is set to lowlevel output. 308 User's Manual U15836EJ5V0UD Figure 16-1. Block Diagram of Reset Function Internal bus Reset control flag register (RESF) WDTRF CLMRF LVIRF Set Set Set Clear Clear Clear Watchdog timer reset signal User's Manual U15836EJ5V0UD RESET Reset signal to LVIM/LVIS register Power-on-clear circuit reset signal Low-voltage detector reset signal Caution An LVI circuit internal reset does not reset the LVI circuit. Remarks 1. LVIM: Low-voltage detection register 2. LVIS: Low-voltage detection level selection register Reset signal CHAPTER 16 RESET FUNCTION Clock monitor reset signal 309 CHAPTER 16 RESET FUNCTION Figure 16-2. Timing of Reset by RESET Input Ring-OSC clock X1 input clock CPU clock Reset period (Oscillation stop) Normal operation Operation stop (17/fR) Normal operation (Reset processing, Ring-OSC clock) RESET Internal reset signal Delay Delay Port pin (except P130) Hi-Z Note Port pin (P130) Note Set P130 to high-level output by 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. Figure 16-3. Timing of Reset Due to Watchdog Timer Overflow Ring-OSC clock X1 input clock CPU clock Normal operation Reset period (Oscillation stop) Operation stop (17/fR) Normal operation (Reset processing, Ring-OSC clock) Watchdog timer overflow Internal reset signal Hi-Z Port pin (except P130) Note Port pin (P130) Note Set P130 to high-level output by software. Caution A watchdog timer internal reset resets the watchdog timer. Remark When reset is effected, P130 outputs a low level. If P130 is set to output a high level immediately after reset is effected, the output signal of P130 can be dummy-output as the reset signal to the CPU. 310 User's Manual U15836EJ5V0UD CHAPTER 16 RESET FUNCTION Figure 16-4. Timing of Reset in STOP Mode by RESET Input Ring-OSC clock X1 input clock CPU clock STOP instruction execution Operation stop Normal Reset period Stop status operation (Oscillation stop) (Oscillation stop) (17/fR) Normal operation (Reset processing, Ring-OSC clock) RESET Internal reset signal Delay Delay Hi-Z Port pin (except P130) Port pin (P130) Note Note Set P130 to high-level output by software. Remarks 1. When reset is effected, P130 outputs a low level. If P130 is set to output a high level immediately after reset is effected, the output signal of P130 can be dummy-output as the reset signal to the CPU. 2. For the reset timing of the power-on-clear circuit and low-voltage detector, see CHAPTER 18 POWER-ON-CLEAR CIRCUIT and CHAPTER 19 LOW-VOLTAGE DETECTOR. User's Manual U15836EJ5V0UD 311 CHAPTER 16 RESET FUNCTION Table 16-1. Hardware Statuses After Reset Acknowledgment (1/2) Hardware Status After Reset Note 1 Acknowledgment Program counter (PC) The contents of the reset vector table (0000H, 0001H) are set. Stack pointer (SP) Undefined Program status word (PSW) 02H RAM Data memory Undefined Note 2 General-purpose registers Undefined Note 2 Port registers (P0 to P3, P12, P13) (output latches) 00H (undefined only for P2) Port mode registers (PM0, PM1, PM3, PM12) FFH Pull-up resistor option registers (PU0, PU1, PU3, PU12) 00H Input switch control register (ISC) 00H Internal memory size switching register (IMS) CFH Internal expansion RAM size switching register (IXS) 0CH Processor clock control register (PCC) 00H Ring-OSC mode register (RCM) 00H Main clock mode register (MCM) 00H Main OSC control register (MOC) 00H Oscillation stabilization time select register (OSTS) 05H Oscillation stabilization time counter status register (OSTC) 00H 16-bit timer/event counter 00 Timer counter 00 (TM00) 0000H Capture/compare registers 000, 010 (CR000, CR010) 0000H Mode control register 00 (TMC00) 00H Prescaler mode register 00 (PRM00) 00H 8-bit timer/event counter 50 8-bit timer/event counters H0, H1 Watchdog timer A/D converter Notes 1. Capture/compare control register 00 (CRC00) 00H Timer output control register 00 (TOC00) 00H Timer counter 50 (TM50) 00H Compare register 50 (CR50) 00H Timer clock selection register 50 (TCL50) 00H Mode control register 50 (TMC50) 00H Compare registers 00, 10, 01, 11 (CMP00, CMP10, CMP01, CMP11) 00H Mode registers (TMHMD0, TMHMD1) 00H Mode register (WDTM) 67H Enable register (WDTE) 9AH Conversion result register (ADCR) Undefined Mode register (ADM) 00H Analog input channel specification register (ADS) 00H Power-fail comparison mode register (PFM) 00H Power-fail comparison threshold register (PFT) 00H During reset input or oscillation stabilization time wait, only the PC contents among the hardware statuses become undefined. All other hardware statuses remain unchanged after reset. 2. 312 When a reset is executed in the standby mode, the pre-reset status is held even after reset. User's Manual U15836EJ5V0UD CHAPTER 16 RESET FUNCTION Table 16-1. Hardware Statuses After Reset Acknowledgment (2/2) Hardware Note 1 Serial interface UART0 Status After Reset Acknowledgment Receive buffer register 0 (RXB0) FFH Transmit shift register 0 (TXS0) FFH Asynchronous serial interface operation mode register 0 (ASIM0) 01H Baud rate generator control register 0 (BRGC0) 1FH Receive buffer register 6 (RXB6) FFH Transmit buffer register 6 (TXB6) FFH Asynchronous serial interface operation mode register 6 (ASIM6) 01H Asynchronous serial interface reception error status register 6 (ASIS6) 00H Asynchronous serial interface transmission status register 6 (ASIF6) 00H Clock selection register 6 (CKSR6) 00H Baud rate generator control register 6 (BRGC6) FFH Asynchronous serial interface control register 6 (ASICL6) 16H Transmit buffer register 10 (SOTB10) Undefined Serial I/O shift register 10 (SIO10) 00H Serial operation mode register 10 (CSIM10) 00H Serial clock selection register 10 (CSIC10) 00H Clock monitor Mode register (CLM) 00H Reset function Reset control flag register (RESF) 00H Low-voltage detector Low-voltage detection register (LVIM) 00H Low-voltage detection level selection register (LVIS) 00H Request flag registers 0L, 0H, 1L (IF0L, IF0H, IF1L) 00H Mask flag registers 0L, 0H, 1L (MK0L, MK0H, MK1L) FFH Priority specification flag registers 0L, 0H, 1L (PR0L, PR0H, PR1L) FFH External interrupt rising edge enable register (EGP) 00H External interrupt falling edge enable register (EGN) 00H Serial interface UART6 Serial interface CSI10 Interrupt Notes 1. 2. Note 2 Note 2 Note 2 PD780102, 780103, and 78F0103 only. These values vary depending on the reset source. Reset Source RESET Input Reset by POC Reset by WDT Reset by CLM Reset by LVI Register RESF See Table 16-2. LVIM Cleared (00H) Cleared (00H) Cleared (00H) Cleared (00H) Held LVIS User's Manual U15836EJ5V0UD 313 CHAPTER 16 RESET FUNCTION 16.1 Register for Confirming Reset Source Many internal reset generation sources exist in the 78K0/KB1. 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 16-5. Format of Reset Control Flag Register (RESF) Address: FFACH After reset: 00H Note R Symbol 7 6 5 4 3 2 1 0 RESF 0 0 0 WDTRF 0 0 CLMRF LVIRF WDTRF Internal reset request by watchdog timer (WDT) 0 Internal reset request is not generated, or RESF is cleared. 1 Internal reset request is generated. CLMRF Internal reset request by clock monitor (CLM) 0 Internal reset request is not generated, or RESF is cleared. 1 Internal reset request is generated. LVIRF Internal reset request by low-voltage detector (LVI) 0 Internal reset request is not generated, or RESF is cleared. 1 Internal reset request is generated. Note The value after reset varies depending on the reset source. Caution Do not read data via a 1-bit memory manipulation instruction. The status of RESF when a reset request is generated is shown in Table 16-2. Table 16-2. RESF Status When Reset Request Is Generated Reset Source RESET input Reset by POC Reset by WDT Reset by CLM Reset by LVI Flag WDTRF 314 Set (1) Held Held CLMRF Held Set (1) Held LVIRF Held Held Set (1) Cleared (0) Cleared (0) User's Manual U15836EJ5V0UD CHAPTER 17 CLOCK MONITOR 17.1 Functions of Clock Monitor The clock monitor samples the X1 input clock using the on-chip Ring-OSC, and generates an internal reset signal when the X1 input clock is stopped. When a reset signal is generated by the clock monitor, bit 1 (CLMRF) of the reset control flag register (RESF) is set to 1. For details of RESF, see CHAPTER 16 RESET FUNCTION. The clock monitor automatically stops under the following conditions. * Reset is released and during the oscillation stabilization time * In STOP mode and during the oscillation stabilization time * When the X1 input clock is stopped by software (MSTOP = 1) and during the oscillation stabilization time * When the Ring-OSC clock is stopped Remark MSTOP: Bit 7 of the main OSC control register (MOC) 17.2 Configuration of Clock Monitor The clock monitor includes the following hardware. Table 17-1. Configuration of Clock Monitor Item Configuration Control register Clock monitor mode register (CLM) Figure 17-1. Block Diagram of Clock Monitor Internal bus Clock monitor mode register (CLM) CLME X1 oscillation control signal (MSTOP) X1 oscillation stabilization status (OSTC overflow) Operation mode controller X1 oscillation monitor circuit Internal reset signal X1 input clock Ring-OSC clock Remark MSTOP: Bit 7 of the main OSC control register (MOC) OSTC: Oscillation stabilization time counter status register (OSTC) User's Manual U15836EJ5V0UD 315 CHAPTER 17 CLOCK MONITOR 17.3 Register Controlling Clock Monitor The clock monitor is controlled by the clock monitor mode register (CLM). (1) Clock monitor mode register (CLM) This register sets the operation mode of the clock monitor. This register can be set by a 1-bit or 8-bit memory manipulation instruction. RESET input clears this register to 00H. Figure 17-2. Format of Clock Monitor Mode Register (CLM) Address: FFA9H After reset: 00H R/W Symbol 7 6 5 4 3 2 1 <0> CLM 0 0 0 0 0 0 0 CLME Enables/disables clock monitor operation CLME 0 Disables clock monitor operation 1 Enables clock monitor operation Cautions 1. Once bit 0 (CLME) is set to 1, it cannot be cleared to 0 except by RESET input or the internal reset signal. 2. If the reset signal is generated by the clock monitor, CLME is cleared to 0 and bit 1 (CLMRF) of the reset control flag register (RESF) is set to 1. 316 User's Manual U15836EJ5V0UD CHAPTER 17 CLOCK MONITOR 17.4 Operation of Clock Monitor This section explains the functions of the clock monitor. The monitor start and stop conditions are as follows. When bit 0 (CLME) of the clock monitor mode register (CLM) is set to operation enabled (1). < Monitor stop condition> * Reset is released and during the oscillation stabilization time * In STOP mode and during the oscillation stabilization time * When the X1 input clock is stopped by software (MSTOP = 1) and during the oscillation stabilization time * When the Ring-OSC clock is stopped Remark MSTOP: Bit 7 of the main OSC control register (MOC) Table 17-2. Operation Status of Clock Monitor (When CLME = 1) CPU Operation Clock X1 input clock Operation Mode STOP mode X1 Input Clock Status Stopped Ring-OSC Clock Status Oscillating Stopped RESET input Stopped Note Oscillating Stopped Normal operation Clock Monitor Status Oscillating mode Note Oscillating Stopped Note Operating Stopped HALT mode Ring-OSC clock STOP mode Stopped Oscillating Stopped RESET input Normal operation Oscillating Operating mode Stopped Stopped HALT mode Note The Ring-OSC clock is stopped only when the "Ring-OSC can be stopped by software" is selected by a mask option. If "Ring-OSC cannot be stopped" is selected, the Ring-OSC clock cannot be stopped. The clock monitor timing is as shown in Figure 17-3. User's Manual U15836EJ5V0UD 317 CHAPTER 17 CLOCK MONITOR Figure 17-3. Timing of Clock Monitor (1/4) (1) When internal reset is executed by oscillation stop of X1 input clock 4 clocks of Ring-OSC clock X1 input clock Ring-OSC clock Internal reset signal CLME CLMRF (2) Clock monitor status after RESET input (CLME = 1 is set after RESET input and during X1 input clock oscillation stabilization time) CPU operation Normal operation Clock supply stopped Reset Normal operation (Ring-OSC clock) X1 input clock Oscillation stopped Oscillation stabilization time Ring-OSC clock Oscillation stopped 17 clocks RESET Set to 1 by software CLME Clock monitor status Monitoring Monitoring stopped Waiting for end of oscillation stabilization time Monitoring RESET input clears bit 0 (CLME) of the clock monitor mode register (CLM) to 0 and stops the clock monitor operation. Even if CLME is set to 1 by software during the oscillation stabilization time (reset value of OSTS register is 05H (216/fXP)) of the X1 input clock, monitoring is not performed until the oscillation stabilization time of the X1 input clock ends. Monitoring is automatically started at the end of the oscillation stabilization time. 318 User's Manual U15836EJ5V0UD CHAPTER 17 CLOCK MONITOR Figure 17-3. Timing of Clock Monitor (2/4) (3) Clock monitor status after RESET input (CLME = 1 is set after RESET input and at the end of X1 input clock oscillation stabilization time) CPU operation Normal operation Clock supply stopped Reset Normal operation (Ring-OSC clock) X1 input clock Oscillation stabilization time Ring-OSC clock 17 clocks RESET Set to 1 by software CLME Clock monitor status Monitoring Monitoring stopped Monitoring RESET input clears bit 0 (CLME) of the clock monitor mode register (CLM) to 0 and stops the clock monitor operation. When CLME is set to 1 by software at the end of the oscillation stabilization time (reset value of OSTS register is 05H (216/fXP)) of the X1 input clock, monitoring is started. (4) Clock monitor status after STOP mode is released (CLME = 1 is set when CPU clock operates on X1 input clock and before entering STOP mode) CPU operation Normal operation Oscillation stabilization time STOP Normal operation X1 input clock (CPU clock) Oscillation stopped Oscillation stabilization time (time set by OSTS register) Ring-OSC clock CLME Clock monitor status Monitoring Monitoring stopped Monitoring When bit 0 (CLME) of the clock monitor mode register (CLM) is set to 1 before entering STOP mode, monitoring automatically starts at the end of the X1 input clock oscillation stabilization time. Monitoring is stopped in STOP mode and during the oscillation stabilization time. User's Manual U15836EJ5V0UD 319 CHAPTER 17 CLOCK MONITOR Figure 17-3. Timing of Clock Monitor (3/4) (5) Clock monitor status after STOP mode is released (CLME = 1 is set when CPU clock operates on Ring-OSC clock and before entering STOP mode) CPU operation Normal operation Clock supply stopped STOP Normal operation X1 input clock Oscillation stopped Oscillation stabilization time (time set by OSTS register) Ring-OSC clock (CPU clock) 17 clocks CLME Clock monitor status Monitoring Monitoring stopped Monitoring stopped Monitoring When bit 0 (CLME) of the clock monitor mode register (CLM) is set to 1 before entering STOP mode, monitoring automatically starts at the end of the X1 input clock oscillation stabilization time. Monitoring is stopped in STOP mode and during the oscillation stabilization time. (6) Clock monitor status after X1 input clock oscillation is stopped by software Normal operation (Ring-OSC clock or subsystem clockNote) CPU operation X1 input clock Oscillation stopped Oscillation stabilization time (time set by OSTS register) Monitoring stopped Monitoring stopped Ring-OSC clock MSTOP CLME Clock monitor status Monitoring Monitoring When bit 0 (CLME) of the clock monitor mode register (CLM) is set to 1 before or while oscillation of the X1 input clock is stopped, monitoring automatically starts at the end of the X1 input clock oscillation stabilization time. Monitoring is stopped when oscillation of the X1 input clock is stopped and during the oscillation stabilization time. 320 User's Manual U15836EJ5V0UD CHAPTER 17 CLOCK MONITOR Figure 17-3. Timing of Clock Monitor (4/4) (7) Clock monitor status after Ring-OSC clock oscillation is stopped by software Normal operation (X1 input clock or subsystem clock) CPU operation X1 input clock Ring-OSC clock Oscillation stopped Note RSTOP CLME Clock monitor status Monitoring Monitoring stopped Monitoring When bit 0 (CLME) of the clock monitor mode register (CLM) is set to 1 before or while oscillation of the Ring-OSC clock is stopped, monitoring automatically starts after the Ring-OSC clock is stopped. Monitoring is stopped when oscillation of the Ring-OSC clock is stopped. Note If it is specified by a mask option that Ring-OSC cannot be stopped, the setting of bit 0 (RSTOP) of the Ring-OSC mode register (RCM) is invalid. To set RSTOP, be sure to confirm that bit 1 (MCS) of the main clock mode register (MCM) is 1. User's Manual U15836EJ5V0UD 321 CHAPTER 18 POWER-ON-CLEAR CIRCUIT 18.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), and generates internal reset signal when VDD < VPOC. * The following can be selected by a mask option. * POC disabled * POC used (detection voltage: VPOC = 2.85 V 0.15 V)Note * POC used (detection voltage: VPOC = 3.5 V 0.2 V) Note This option cannot be selected in (A1) and (A2) grade products because the supply voltage VDD is 3.3 to 5.5 V. Caution If an internal reset signal is generated in the POC circuit, the reset control flag register (RESF) is cleared to 00H. 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), low-voltage-detection (LVI) circuit, or clock monitor. RESF is not cleared to 00H and the flag is set to 1 when an internal reset signal is generated by WDT, LVI, or the clock monitor. For details of the RESF, see CHAPTER 16 RESET FUNCTION. 322 User's Manual U15836EJ5V0UD CHAPTER 18 POWER-ON-CLEAR CIRCUIT 18.2 Configuration of Power-on-Clear Circuit A block diagram of the power-on-clear circuit is shown in Figure 18-1. Figure 18-1. Block Diagram of Power-on-Clear Circuit VDD VDD Mask option + Internal reset signal - Detection voltage source (VPOC) Note Selected by mask option. 18.3 Operation of Power-on-Clear Circuit In the power-on-clear circuit, the supply voltage (VDD) and detection voltage (VPOC) are compared, and when VDD < VPOC, an internal reset signal is generated. Figure 18-2. Timing of Internal Reset Signal Generation in Power-on-Clear Circuit Supply voltage (VDD) POC detection voltage (VPOC) Time Internal reset signal User's Manual U15836EJ5V0UD 323 CHAPTER 18 POWER-ON-CLEAR CIRCUIT 18.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. 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 18-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 Checking cause of resetNote 2 ; The Ring-OSC clock is set as the CPU clock when the reset signal is generated ; The cause of reset (power-on-clear, WDT, LVI, or clock monitor) can be identified by the RESF register. Power-on-clear Start timer (set to 50 ms) Check stabilization of oscillation Note 1 Change CPU clock No 50 ms has passed? (TMIFH1 = 1?) ; 8-bit timer H1 can operate with the Ring-OSC clock. Source: fR (480 kHz (MAX.))/27 x compare value 200 = 53 ms (fR: Ring-OSC clock oscillation frequency) ; Check the stabilization of oscillation of the X1 input clock by using the OSTC register. ; Change the CPU clock from the Ring-OSC clock to the X1 input clock. ; TMIFH1 = 1: Interrupt request is generated. Yes Initialization processing Notes 1. 2. 324 ; Initialization of ports If reset is generated again during this period, initialization processing is not started. A flowchart is shown on the next page. User's Manual U15836EJ5V0UD CHAPTER 18 POWER-ON-CLEAR CIRCUIT Figure 18-3. Example of Software Processing After Release of Reset (2/2) * Checking reset cause Check reset cause WDTRF of RESF register = 1? Yes No Reset processing by watchdog timer CLMRF of RESF register = 1? Yes No Reset processing by clock monitor LVIRF of RESF register = 1? Yes No Reset processing by low-voltage detector Power-on-clear/external reset generated User's Manual U15836EJ5V0UD 325 CHAPTER 19 LOW-VOLTAGE DETECTOR 19.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 levelsNote of supply voltage can be changed by software. * Interrupt or reset function can be selected by software. * Operable in STOP mode. Note Detection levels of supply voltage differ as follows. Expanded-specification product of standard products and (A) grade products: 8 levels Conventional product of standard products and (A) grade products: 7 levels (A1) grade products and (A2) grade products: 5 levels 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, see CHAPTER 16 RESET FUNCTION. 326 User's Manual U15836EJ5V0UD CHAPTER 19 LOW-VOLTAGE DETECTOR 19.2 Configuration of Low-Voltage Detector A block diagram of the low-voltage detector is shown below. Figure 19-1. Block Diagram of Low-Voltage Detector Low-voltage detection level selector VDD VDD N-ch Selector Internal reset signal + - INTLVI Detection voltage source 3 LVIS2 LVIS1 LVIS0 LVION LVIE Low-voltage detection level selection register (LVIS) LVIMD LVIF Low-voltage detection register (LVIM) Internal bus 19.3 Registers Controlling Low-Voltage Detector The low-voltage detector is controlled by the following registers. * Low-voltage detection register (LVIM) * Low-voltage detection level selection register (LVIS) User's Manual U15836EJ5V0UD 327 CHAPTER 19 LOW-VOLTAGE DETECTOR (1) Low-voltage detection 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 LVIM to 00H. Figure 19-2. Format of Low-Voltage Detection Register (LVIM) Address: FFBEH After reset: 00H R/WNote 1 Symbol <7> 6 5 <4> 3 2 <1> <0> LVIM LVION 0 0 LVIE 0 0 LVIMD LVIF Notes 2, 3 LVION LVIE Enables low-voltage detection operation 0 Disables operation 1 Enables operation Notes 2, 4, 5 Specifies reference voltage generator 0 Disables operation 1 Enables operation Note 2 LVIMD Low-voltage detection operation mode selection 0 Generates interrupt signal when supply voltage (VDD) < detection voltage (VLVI) 1 Generates internal reset signal when supply voltage (VDD) < detection voltage (VLVI) Note 6 LVIF Low-voltage detection flag 0 Supply voltage (VDD) > detection voltage (VLVI), or when operation is disabled 1 Supply voltage (VDD) < detection voltage (VLVI) Notes 1. Bit 0 is read-only. 2. LVION, LVIE, and LVIMD are cleared to 0 in the case of a reset other than an LVI reset. 3. When LVION is set to 1, operation of the comparator in the LVI circuit is started. These are not cleared to 0 in the case of an LVI reset. 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. If "POC cannot be used" is selected by a mask option, wait for 2 ms or more by software from when LVIE is set to 1 until LVION is set to 1. 5. If "POC used" is selected by a mask option, setting of LVIE is invalid because the reference voltage generator in the LVI circuit always operates. 6. The value of LVIF is output as the interrupt request signal INTLVI when LVION = 1 and LVIMD = 0. Caution To stop LVI, follow either of the procedures below. * When using 8-bit memory manipulation instruction: Write 00H to LVIM. * When using 1-bit memory manipulation instruction: Clear LVION to 0 first and then clear LVIE to 0. 328 User's Manual U15836EJ5V0UD CHAPTER 19 LOW-VOLTAGE DETECTOR (2) Low-voltage detection level selection 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 LVIS to 00H. Figure 19-3. Format of Low-Voltage Detection Level Selection Register (LVIS) Address: FFBFH After reset: 00H R/W Symbol 7 6 5 4 3 2 1 0 LVIS 0 0 0 0 0 LVIS2 LVIS1 LVIS0 LVIS2 LVIS1 LVIS0 0 0 0 VLVI0 (4.3 V 0.2 V) 0 0 1 VLVI1 (4.1 V 0.2 V) 0 1 0 VLVI2 (3.9 V 0.2 V) 0 1 1 VLVI3 (3.7 V 0.2 V) 1 0 0 VLVI4 (3.5 V 0.2 V) 1 0 1 VLVI5 (3.3 V 0.15 V) 1 1 0 VLVI6 (3.1 V 0.15 V) 1 1 1 VLVI7 (2.85 V 0.15 V) Detection level Note 1 Notes 1, 2 Notes 1, 2 Notes 1, 3, 4 Notes 1. When the detection voltage of the POC circuit is specified as VPOC = 3.5 V 0.2 V by a mask option, do not select VLVI4 to VLVI7 as the LVI detection voltage. Even if VLVI4 to VLVI7 are selected, the POC circuit has priority. 2. This can be set only with the expanded-specification products and conventional products of standard products and (A) grade products. 3. When the detection voltage of the POC circuit is specified as VPOC = 2.85 V 0.15 V by a mask option, do not select VLVI7 as the LVI detection voltage. Even if VLVI7 is selected, the POC circuit has priority. 4. This can be set only with the expanded-specification products of standard products and (A) grade products. Caution Be sure to clear bits 3 to 7 to 0. User's Manual U15836EJ5V0UD 329 CHAPTER 19 LOW-VOLTAGE DETECTOR 19.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. * 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 2 to 0 (LVIS2 to LVIS0) of the low-voltage detection level selection register (LVIS). <3> Set bit 4 (LVIE) of the low-voltage detection register (LVIM) to 1 (enables reference voltage generator operation). <4> Use software to instigate a wait of at least 2 ms. <5> Set bit 7 (LVION) of LVIM to 1 (enables LVI operation). <6> Use software to instigate a wait of at least 0.2 ms. <7> Wait until it is checked that (supply voltage (VDD) > detection voltage (VLVI)) by bit 0 (LVIF) of LVIM. <8> Set bit 1 (LVIMD) of LVIM to 1 (generates internal reset signal when supply voltage (VDD) < detection voltage (VLVI)). Figure 19-4 shows the timing of the internal reset signal generated by the low-voltage detector. The numbers in this timing chart correspond to <1> to <8> above. Cautions 1. <1> must always be executed. When LVIMK = 0, an interrupt may occur immediately after the processing in <5>. 2. If "POC used" is selected by a mask option, procedures <3> and <4> are not required. 3. 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, LVION to 0, and LVIE to 0 in that order. 330 User's Manual U15836EJ5V0UD CHAPTER 19 LOW-VOLTAGE DETECTOR Figure 19-4. Timing of Low-Voltage Detector Internal Reset Signal Generation Supply voltage (VDD) LVI detection voltage (VLVI) POC detection voltage (VPOC) Time <2> LVIMK flag (set by software) H LVIE flag (set by software) <1>Note 1 Not cleared Not cleared <3> Clear <4> 2 ms or longer LVION flag (set by software) Not cleared Not cleared <5> Clear <6> 0.2 ms or longer LVIF flag <7> LVIMD flag (set by software) Clear Note 2 Not cleared Not cleared <8> Clear 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, see CHAPTER 16 RESET FUNCTION. Remark <1> to <8> in Figure 19-4 above correspond to <1> to <8> in the description of "when starting operation" in 19.4 (1) When used as reset. User's Manual U15836EJ5V0UD 331 CHAPTER 19 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 2 to 0 (LVIS2 to LVIS0) of the low-voltage detection level selection register (LVIS). <3> Set bit 4 (LVIE) of the low-voltage detection register (LVIM) to 1 (enables reference voltage generator operation). <4> Use software to instigate a wait of at least 2 ms. <5> Set bit 7 (LVION) of LVIM to 1 (enables LVI operation). <6> Use software to instigate a wait of at least 0.2 ms. <7> Wait until it is checked that (supply voltage (VDD) > detection voltage (VLVI)) by bit 0 (LVIF) of LVIM. <8> Clear the interrupt request flag of LVI (LVIIF) to 0. <9> Release the interrupt mask flag of LVI (LVIMK). <10> Execute the EI instruction (when vectored interrupts are used). Figure 19-5 shows the timing of the interrupt signal generated by the low-voltage detector. The numbers in this timing chart correspond to <1> to <9> above. Caution If "POC used" is selected by a mask option, procedures <3> and <4> are not required. * 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 first, and then clear LVIE to 0. 332 User's Manual U15836EJ5V0UD CHAPTER 19 LOW-VOLTAGE DETECTOR Figure 19-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 <9> Cleared by software LVIE flag (set by software) <3> <4> 2 ms or longer LVION flag (set by software) <5> <6> 0.2 ms or longer LVIF flag <7> Note 2 INTLVI LVIIF flag Note 2 <8> Cleared by software Internal reset signal Notes 1. 2. Remark The LVIMK flag is set to "1" by RESET input. The LVIF and LVIIF flags may be set (1). <1> to <9> in Figure 19-5 above correspond to <1> to <9> in the description of "when starting operation" in 19.4 (2) When used as interrupt. User's Manual U15836EJ5V0UD 333 CHAPTER 19 LOW-VOLTAGE DETECTOR 19.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 (a) below. (2) When used as interrupt Interrupt requests may be frequently generated. Take action (b) below. In this system, take the following actions. (a) 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. 334 User's Manual U15836EJ5V0UD CHAPTER 19 LOW-VOLTAGE DETECTOR Figure 19-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 Checking cause of resetNote 2 ; The Ring-OSC clock is set as the CPU clock when the reset signal is generated ; The cause of reset (power-on-clear, WDT, LVI, or clock monitor) can be identified by the RESF register. LVI Start timer (set to 50 ms) Check stabilization of oscillation Note 1 Change CPU clock No 50 ms has passed? (TMIFH1 = 1?) ; 8-bit timer H1 can operate with the Ring-OSC clock. Source: fR (480 kHz (MAX.))/27 x compare value 200 = 53 ms (fR: Ring-OSC clock oscillation frequency) ; Check the stabilization of oscillation of the X1 input clock by using the OSTC register. ; Change the CPU clock from the Ring-OSC clock to the X1 input clock. ; TMIFH1 = 1: Interrupt request is generated. Yes Initialization processing Notes 1. 2. ; Initialization of ports If reset is generated again during this period, initialization processing is not started. A flowchart is shown on the next page. User's Manual U15836EJ5V0UD 335 CHAPTER 19 LOW-VOLTAGE DETECTOR Figure 19-6. Example of Software Processing After Release of Reset (2/2) * Checking reset cause Check reset cause WDTRF of RESF register = 1? Yes No Reset processing by watchdog timer CLMRF of RESF register = 1? Yes No Reset processing by clock monitor LVIRF of RESF register = 1? No Yes Power-on-clear/external reset generated Reset processing by low-voltage detector (b) When used as interrupt 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 0 (LVIIF) of interrupt request flag register 0L (IF0L) to 0 and enable interrupts (EI). 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 then enable interrupts (EI). 336 User's Manual U15836EJ5V0UD CHAPTER 20 MASK OPTIONS Mask ROM versions are provided with the following mask options. 1. Power-on-clear (POC) circuit * POC cannot be used * POC used (detection voltage: VPOC = 2.85 V 0.15 V)Note * POC used (detection voltage: VPOC = 3.5 V 0.2 V) 2. Ring-OSC * Cannot be stopped * Can be stopped by software Note This option cannot be selected in (A1) and (A2) grade products because the supply voltage VDD is 3.3 to 5.5 V. Flash memory versions that support the mask options of the mask ROM versions are as follows. Table 20-1. Flash Memory Versions Supporting Mask Options of Mask ROM Versions Mask Option POC Circuit Flash Memory Version Ring-OSC Cannot be stopped PD78F0103M1, 78F0103M1(A), 78F0103M1(A1) Can be stopped by software PD78F0103M2, 78F0103M2(A), 78F0103M2(A1) POC used Cannot be stopped PD78F0103M3, 78F0103M3(A) (VPOC = 2.85 V 0.15 V) Can be stopped by software PD78F0103M4, 78F0103M4(A) POC used Cannot be stopped PD78F0103M5, 78F0103M5(A), 78F0103M5(A1) (VPOC = 3.5 V 0.2 V) Can be stopped by software PD78F0103M6, 78F0103M6(A), 78F0103M6(A1) POC cannot be used User's Manual U15836EJ5V0UD 337 CHAPTER 21 PD78F0103 The PD78F0103 is provided as the flash memory version of the 78K0/KB1. The PD78F0103 replaces the internal mask ROM of the PD780103 with flash memory to which a program can be written, erased, and overwritten while mounted on the board. Table 21-1 lists the differences between the PD78F0103 and the mask ROM versions. Table 21-1. Differences Between PD78F0103 and Mask ROM Versions PD78F0103 Item Internal ROM configuration Flash memory Mask ROM Versions Mask ROM PD780101: 8 KB PD780102: 16 KB PD780103: 24 KB Note Internal ROM capacity 24 KB Internal high-speed RAM capacity 768 bytes PD780101: 512 bytes PD780102: 768 bytes PD780103: 768 bytes IC pin None Available VPP pin Available None Electrical specifications, Refer to the description of electrical specifications and recommended soldering conditions. recommended soldering conditions Note Note The same capacity as the mask ROM versions can be specified by means of the internal memory size switching register (IMS). Caution There are differences in noise immunity and noise radiation between the flash memory and mask ROM versions. When pre-producing an application set with the flash memory version and then mass-producing it with the mask ROM version, be sure to conduct sufficient evaluations for the commercial samples (not engineering samples) of the mask ROM versions. 338 User's Manual U15836EJ5V0UD CHAPTER 21 PD78F0103 21.1 Internal Memory Size Switching Register The PD78F0103 allows users to select the internal memory capacity using the internal memory size switching register (IMS) so that the same memory map as that of the mask ROM versions with a different internal memory capacity can be achieved. IMS is set by an 8-bit memory manipulation instruction. RESET input sets IMS to CFH. Caution The initial value of IMS is "setting prohibited (CFH)". Be sure to set the value of the relevant mask ROM version at initialization. Figure 21-1. Format of Internal Memory Size Switching Register (IMS) Address: FFF0H After reset: CFH Symbol 7 6 5 4 3 2 1 0 RAM2 RAM1 RAM0 0 ROM3 ROM2 ROM1 ROM0 RAM2 RAM1 RAM0 0 0 0 768 bytes 0 1 0 512 bytes IMS R/W Other than above Internal high-speed RAM capacity selection Setting prohibited ROM3 ROM2 ROM1 ROM0 0 0 1 0 8 KB 0 1 0 0 16 KB 0 1 1 0 24 KB Other than above Internal ROM capacity selection Setting prohibited The IMS settings required to obtain the same memory map as mask ROM versions are shown in Table 21-2. Table 21-2. Internal Memory Size Switching Register Settings Target Mask ROM Versions IMS Setting PD780101 42H PD780102 04H PD780103 06H Caution When using a mask ROM version, be sure to set IMS to the value indicated in Table 21-2. User's Manual U15836EJ5V0UD 339 CHAPTER 21 PD78F0103 21.2 Writing with Flash Programmer 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 PD78F0103 has been mounted on the target system. The connectors that connect the dedicated flash programmer must be mounted on the target system. (2) Off-board programming Data can be written to the flash memory with a dedicated program adapter (FA series) before the PD78F0103 is mounted on the target system. Remark The FA series is a product of Naito Densei Machida Mfg. Co., Ltd. Table 21-3. Wiring Between PD78F0103 and Dedicated Flash Programmer (1/2) (1) 3-wire serial I/O (CSI10) Pin Configuration of Dedicated Flash Programmer Signal Name I/O With CSI10 Pin Function Pin Name With CSI10+HS Pin No. Pin Name Pin No. SI/RxD Input Receive signal SO10/P12 17 SO10/P12 17 SO/TxD Output Transmit signal SI10/RxD0/P11 16 SI10/RxD0/P11 16 SCK Output Transfer clock SCK10/TxD0/P10 15 SCK10/TxD0/P10 15 CLK Output Clock to PD78F0103 X1 8 X1 8 X2 Note Note 9 9 X2 /RESET Output Reset signal RESET 10 RESET 10 VPP Output Write voltage VPP 5 VPP 5 H/S Input Handshake signal Not needed HS/P15/TOH0 20 VDD I/O VDD voltage generation/voltage VDD 7 VDD 7 monitor AVREF 28 AVREF 28 Ground VSS 6 VSS 6 AVSS 29 AVSS 29 GND - Not needed Note When using the clock out of the flash programmer, connect CLK of the programmer to X1, and connect its inverse signal to X2. 340 User's Manual U15836EJ5V0UD CHAPTER 21 PD78F0103 Table 21-3. Wiring Between PD78F0103 and Dedicated Flash Programmer (2/2) (2) UART (UART0, UART6) Pin Configuration of Dedicated Flash Programmer Signal Name SI/RxD I/O Input Pin Function Receive signal With UART0 Pin Name TxD0/ Pin No. 15 SCK10/P10 SO/TxD Output Transmit signal RxD0/SI10/ Output Transfer clock Not needed Pin Name TxD0/ 16 RxD0/SI10/ Output Clock to PD78F0103 X1 Not X2 8 Note Pin Name Pin No. 15 TxD6/P13 18 16 RxD6/P14 19 Not Not needed Not P11 Not needed needed CLK Pin No. With UART6 SCK10/P10 P11 SCK With UART0+HS needed X1 9 X2 8 Note needed X1 9 X2 8 Note 9 /RESET Output Reset signal RESET 10 RESET 10 RESET 10 VPP Output Write voltage VPP 5 VPP 5 VPP 5 H/S Input Handshake signal Not needed Not HS/P15/TOH0 20 Not needed Not needed VDD GND I/O - needed VDD voltage generation/voltage VDD monitor AVREF 7 VDD 7 VDD 7 28 AVREF 28 AVREF 28 Ground VSS 6 VSS 6 VSS 6 AVSS 29 AVSS 29 AVSS 29 Note When using the clock out of the flash programmer, connect CLK of the programmer to X1, and connect its inverse signal to X2. User's Manual U15836EJ5V0UD 341 CHAPTER 21 PD78F0103 Examples of the recommended connection when using the adapter for flash memory writing are shown below. Figure 21-2. Example of Wiring Adapter for Flash Memory Writing in 3-Wire Serial I/O (CSI10) Mode VDD (2.7 to 5.5 V)Note GND 1 30 2 29 3 28 4 27 5 26 6 25 7 24 8 23 9 22 10 21 11 20 12 19 13 18 14 17 15 16 GND VDD LVDD FLASH WRITER INTERFACE SI SO SCK CLK /RESET VPP RESERVE/HS Note PD78F0103, 78F0103(A): 2.7 to 5.5 V PD78F0103(A1): 342 3.3 to 5.5 V User's Manual U15836EJ5V0UD CHAPTER 21 PD78F0103 Figure 21-3. Example of Wiring Adapter for Flash Memory Writing in 3-Wire Serial I/O (CSI10 + HS) Mode VDD (2.7 to 5.5 V)Note GND 1 30 2 29 3 28 4 27 5 26 6 25 7 24 8 23 9 22 10 21 11 20 12 19 13 18 14 17 15 16 GND VDD LVDD FLASH WRITER INTERFACE SI SO SCK CLK /RESET VPP RESERVE/HS Note PD78F0103, 78F0103(A): 2.7 to 5.5 V PD78F0103(A1): 3.3 to 5.5 V User's Manual U15836EJ5V0UD 343 CHAPTER 21 PD78F0103 Figure 21-4. Example of Wiring Adapter for Flash Memory Writing in UART (UART0) Mode VDD (2.7 to 5.5 V)Note GND 1 30 2 29 3 28 4 27 5 26 6 25 7 24 8 23 9 22 10 21 11 20 12 19 13 18 14 17 15 16 GND VDD LVDD FLASH WRITER INTERFACE SI SO SCK CLK /RESET VPP RESERVE/HS Note PD78F0103, 78F0103(A): 2.7 to 5.5 V PD78F0103(A1): 344 3.3 to 5.5 V User's Manual U15836EJ5V0UD CHAPTER 21 PD78F0103 Figure 21-5. Example of Wiring Adapter for Flash Memory Writing in UART (UART0 + HS) Mode VDD (2.7 to 5.5 V)Note GND 1 30 2 29 3 28 4 27 5 26 6 25 7 24 8 23 9 22 10 21 11 20 12 19 13 18 14 17 15 16 GND VDD LVDD FLASH WRITER INTERFACE SI SO SCK CLK /RESET VPP RESERVE/HS Note PD78F0103, 78F0103(A): 2.7 to 5.5 V PD78F0103(A1): 3.3 to 5.5 V User's Manual U15836EJ5V0UD 345 CHAPTER 21 PD78F0103 Figure 21-6. Example of Wiring Adapter for Flash Memory Writing in UART (UART6) Mode VDD (2.7 to 5.5 V)Note GND 1 30 2 29 3 28 4 27 5 26 6 25 7 24 8 23 9 22 10 21 11 20 12 19 13 18 14 17 15 16 GND VDD LVDD FLASH WRITER INTERFACE SI SO SCK CLK /RESET VPP RESERVE/HS Note PD78F0103, 78F0103(A): 2.7 to 5.5 V PD78F0103(A1): 346 3.3 to 5.5 V User's Manual U15836EJ5V0UD CHAPTER 21 PD78F0103 21.3 Programming Environment The environment required for writing a program to the flash memory of the PD78F0103 is illustrated below. Figure 21-7. Environment for Writing Program to Flash Memory VPP XXXXXX XXXX Bxxxxx Cxxxxxx STATVE PG-FP4 (Flash Pro4) VSS XXXXX XXXX YYYY Axxxx XXX YYY RS-232C VDD RESET USBNote Dedicated flash programmer CSI10/UART0/UART6 PD78F0103 Host machine Note Flashpro IV only A host machine that controls the dedicated flash programmer is necessary. To interface between the dedicated flash programmer and the PD78F0103, CSI10, UART0, or UART6 is used for manipulation such as writing and erasing. To write the flash memory off-board, a dedicated program adapter (FA series) is necessary. 21.4 Communication Mode Communication between the dedicated flash programmer and the PD78F0103 is established by serial communication via CSI10, UART0, or UART6 of the PD78F0103. (1) CSI10 Transfer rate: 200 kHz to 2 MHz Figure 21-8. Communication with Dedicated Flash Programmer (CSI10) VPP VPP VDD VDD/AVREF GND VSS/AVSS XXXXXX XXXX STATVE PG-FP4 (Flash Pro4) XXXXX XXX YYY XXXX YYYY Axxxx Bxxxxx Cxxxxxx Dedicated flash programmer /RESET RESET SI/RxD SO10 SO/TxD SI10 SCK SCK10 CLK X1 PD78F0103 X2 User's Manual U15836EJ5V0UD 347 CHAPTER 21 PD78F0103 (2) CSI communication mode supporting handshake Transfer rate: 200 kHz to 2 MHz Figure 21-9. Communication with Dedicated Flash Programmer (CSI10 + HS) VPP VPP VDD VDD/AVREF GND XXX YYY VSS/AVSS XXXXXX XXXX STATVE PG-FP4 (Flash Pro4) XXXXX XXXX YYYY Axxxx Bxxxxx Cxxxxxx Dedicated flash programmer /RESET RESET SI/RxD SO10 SO/TxD SI10 SCK SCK10 CLK X1 PD78F0103 X2 H/S HS (3) UART0 Transfer rate: 4800 to 38400 bps Figure 21-10. Communication with Dedicated Flash Programmer (UART0) XXXXXX XXXX Bxxxxx Cxxxxxx STATVE PG-FP4 (Flash Pro4) VPP VDD/AVREF GND VSS/AVSS XXXXX XXX YYY XXXX YYYY Axxxx VPP VDD Dedicated flash programmer /RESET RESET SO/TxD RxD0 SI/RxD TxD0 CLK X1 X2 348 User's Manual U15836EJ5V0UD PD78F0103 CHAPTER 21 PD78F0103 (4) UART communication mode supporting handshake Transfer rate: 4800 to 38400 bps Figure 21-11. Communication with Dedicated Flash Programmer (UART0 + HS) VDD VDD/AVREF VSS/AVSS XXXXXX Axxxx XXXX Bxxxxx STATVE PG-FP4 (Flash Pro4) XXXXX XXXX YYYY VPP GND Cxxxxxx XXX YYY VPP Dedicated flash programmer /RESET RESET SI/RxD TxD0 SO/TxD RxD0 CLK PD78F0103 X1 X2 H/S HS (5) UART6 Transfer rate: 4800 to 76800 bps Figure 21-12. Communication with Dedicated Flash Programmer (UART6) VPP VPP VDD VDD/AVREF GND VSS/AVSS XXXXXX XXXX STATVE PG-FP4 (Flash Pro4) XXXXX XXX YYY XXXX YYYY Axxxx Bxxxxx Cxxxxxx Dedicated flash programmer /RESET RESET SI/RxD TxD6 SO/TxD RxD6 CLK PD78F0103 X1 X2 User's Manual U15836EJ5V0UD 349 CHAPTER 21 PD78F0103 If Flashpro III/Flashpro IV is used as the dedicated flash programmer, Flashpro III/Flashpro IV generates the following signal for the PD78F0103. For details, refer to the Flashpro III/Flashpro IV Manual. Table 21-4. Pin Connection Flashpro III/Flashpro IV Signal Name I/O PD78F0103 Connection Pin Name CSI10 UART0 UART6 Pin Function VPP Output Write voltage VPP VDD I/O VDD voltage generation/voltage monitor VDD, AVREF Ground VSS, AVSS Clock output to PD78F0103 X1, X2 - GND CLK Output Note /RESET Output Reset signal RESET SI/RxD Input Receive signal SO10/TxD0/TxD6 SO/TxD Output Transmit signal SI10/RxD0/RxD6 SCK Output Transfer clock SCK10 H/S Input Handshake signal HS { { { x x x Note When using the clock out of the flash programmer, connect CLK of the programmer to X1, and connect its inverse signal to X2. Remark : Be sure to connect the pin. {: The pin does not have to be connected if the signal is generated on the target board. x: The pin does not have to be connected. : In handshake mode 350 User's Manual U15836EJ5V0UD CHAPTER 21 PD78F0103 21.5 Handling of Pins 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 handled as described below. 21.5.1 VPP pin In the normal operation mode, connect the VPP pin to VSS. In addition, a write voltage of 10.0 V (TYP.) is supplied to the VPP pin in the flash memory programming mode. Perform the following pin handling. (1) Connect pull-down resistor RVPP = 10 k to the VPP pin. (2) Switch the input of the VPP pin to the programmer side by using a jumper on the board or to GND directly. Figure 21-13. Example of Connection of VPP Pin PD78F0103 Dedicated flash programmer connection pin VPP Pull-down resistor (RVPP) 21.5.2 Serial interface pins The pins used by each serial interface are listed below. Table 21-5. Pins Used by Each Serial Interface Serial Interface Pins Used CSI10 SO10, SI10, SCK10 CSI10 + HS SO10, SI10, SCK10, HS/P15 UART0 TxD0, RxD0 UART0 + HS TxD0, RxD0, HS/P15 UART6 TxD6, RxD6 To connect the dedicated flash programmer to the pins of a serial interface that is connected to another device on the board, care must be exercised so that signals do not collide or that the other device does not malfunction. User's Manual U15836EJ5V0UD 351 CHAPTER 21 PD78F0103 (1) Signal collision If the dedicated flash programmer (output) is connected to a pin (input) of a serial interface connected to another device (output), signal collision takes place. To avoid this collision, either isolate the connection with the other device, or make the other device go into an output high-impedance state. Figure 21-14. Signal Collision (Input Pin of Serial Interface) PD78F0103 Signal collision Input pin Dedicated flash programmer connection pin Other device Output pin In the flash memory programming mode, the signal output by the device collides with the signal sent from the dedicated flash programmer. Therefore, isolate the signal of the other device. (2) Malfunction of other device If the dedicated flash programmer (output or input) is connected to a pin (input or output) of a serial interface connected to another device (input), a signal may be output to the other device, causing the device to malfunction. To avoid this malfunction, either isolate the connection with the other device. Figure 21-15. Malfunction of Other Device PD78F0103 Pin Dedicated flash programmer connection pin Other device Input pin If the signal output by the PD78F0103 in the flash memory programming mode affects the other device, isolate the signal of the other device. PD78F0103 Pin Dedicated flash programmer connection pin Other device Input pin If the signal output by the dedicated flash programmer in the flash memory programming mode affects the other device, isolate the signal of the other device. 352 User's Manual U15836EJ5V0UD CHAPTER 21 PD78F0103 21.5.3 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. Figure 21-16. Signal Collision (RESET Pin) PD78F0103 Signal collision RESET Dedicated flash programmer 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. 21.5.4 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. 21.5.5 Other signal pins Connect X1 and X2 in the same status as in the normal operation mode when using the on-board clock. To input the operating clock from the programmer, however, connect the clock out of the programmer to X1, and its inverse signal to X2. 21.5.6 Power supply To use the supply voltage output of the flash programmer, connect the VDD pin to VDD of the flash programmer, and the VSS pin to VSS of the flash programmer. To use the on-board supply voltage, connect in compliance with the normal operation mode. However, be sure to connect the VDD and VSS pins to VDD and GND of the flash programmer to use the power monitor function with the flash programmer. Supply the same other power supplies (AVREF and AVSS) as those in the normal operation mode. User's Manual U15836EJ5V0UD 353 CHAPTER 21 PD78F0103 21.6 Programming Method 21.6.1 Controlling flash memory The following figure illustrates the procedure to manipulate the flash memory. Figure 21-17. Flash Memory Manipulation Procedure Start VPP pulse supply Flash memory programming mode is set Selecting communication mode Manipulate flash memory No End? Yes End 21.6.2 Flash memory programming mode To rewrite the contents of the flash memory by using the dedicated flash programmer, set the PD78F0103 in the flash memory programming mode. To set the mode, set the VPP pin and clear the reset signal. Change the mode by using a jumper when writing the flash memory on-board. Figure 21-18. Flash Memory Programming Mode VPP pulse 1 10.0 V VPP 2 *** n VDD VSS RESET Flash memory programming mode VPP VSS 10.0 V 354 Operation mode Normal operation mode Flash memory programming mode User's Manual U15836EJ5V0UD CHAPTER 21 PD78F0103 21.6.3 Selecting communication mode In the PD78F0103 a communication mode is selected by inputting pulses (up to 11 pulses) to the VPP pin after the dedicated flash memory programming mode is entered. These VPP pulses are generated by the flash programmer. The following table shows the relationship between the number of pulses and communication modes. Table 21-6. Communication Modes Standard (TYPE) SettingNote 1 Communication Mode Pins Used Number Port Speed On Target Frequency Multiply Rate of VPP (COMM PORT) (SIO CLOCK) (CPU CLOCK) (Flashpro Clock) (Multiple Rate) Pulses 3-wire serial I/O SIO-ch0 (CSI10) (SIO ch-0) 3-wire serial I/O with SIO-H/S handshake supported (SIO ch-3 (CSI10 + HS) + handshake) UART UART-ch0 (UART0) (UART ch-0) UART UART-ch1 (UART6) (UART ch-1) UART with UART-ch3 handshake supported (UART ch-3) 200 kHz to 2 MHzNote 2 Arbitrary 2 to 10 MHz 1.0 SO10, SI10, 0 SCK10 200 kHz to 2 MHzNote 2 SO10, SI10, 3 SCK10, HS/P15 Notes 2, 3 4800 to 38400 bps TxD0, RxD0 8 4800 to 76800 bpsNotes 2, 3 TxD6, RxD6 9 4800 to 38400 bpsNotes 2, 3 TxD0, RxD0, 11 HS/P15 (UART0 + HS) Notes 1. Selection items for Standard settings on Flashpro IV (TYPE settings on Flashpro III). 2. The possible setting range differs depending on the voltage. For details, refer to the chapters of electrical specifications. 3. Because factors other than the baud rate error, such as the signal waveform slew, also affect UART communication, thoroughly evaluate the slew as well as the baud rate error. Caution When UART0 or UART6 is selected, the receive clock is calculated based on the reset command sent from the dedicated flash programmer after the VPP pulse has been received. Remark Items enclosed in parentheses in the setting item column are the set value and set item when they differ from those of Flashpro IV. User's Manual U15836EJ5V0UD 355 CHAPTER 21 PD78F0103 21.6.4 Communication commands The PD78F0103 communicates with the dedicated flash programmer by using commands. The signals sent from the flash programmer to the PD78F0103 are called commands, and the commands sent from the PD78F0103 to the dedicated flash programmer are called response commands. Figure 21-19. Communication Commands XXXXXX Command XXXX STATVE PG-FP4 (Flash Pro4) XXXXX XXX YYY XXXX YYYY Axxxx Bxxxxx Cxxxxxx Dedicated flash programmer Response command PD78F0103 The flash memory control commands of the PD78F0103 are listed in the table below. All these commands are issued from the programmer and the PD78F0103 performs processing corresponding to the respective commands. Table 21-7. Flash Memory Control Commands Classification Command Name Verify Function Compares the contents of the entire memory Batch verify command with the input data. Erase Batch erase command Erases the contents of the entire memory. Blank check Batch blank check command Checks the erasure status of the entire memory. Data write High-speed write command Writes data by specifying the write address and number of bytes to be written, and executes a verify check. Writes data from the address following that of Successive write command the high-speed write command executed immediately before, and executes a verify check. System setting, control Status read command Obtains the operation status Oscillation frequency setting command Sets the oscillation frequency Erase time setting command Sets the erase time for batch erase Write time setting command Sets the write time for writing data Baud rate setting command Sets the baud rate when UART is used Silicon signature command Reads the silicon signature information Reset command Escapes from each status The PD78F0103 return a response command for the command issued by the dedicated flash programmer. The response commands sent from the PD78F0103 are listed below. Table 21-8. Response Commands Command Name 356 Function ACK Acknowledges command/data. NAK Acknowledges illegal command/data. User's Manual U15836EJ5V0UD CHAPTER 22 INSTRUCTION SET This chapter lists each instruction set of the 78K0/KB1 in table form. For details of each operation and operation code, refer to the separate document 78K/0 Series Instructions User's Manual (U12326E). 22.1 Conventions Used in Operation List 22.1.1 Operand identifiers and specification methods Operands are written in the "Operand" column of each instruction in accordance with the specification method of the instruction operand identifier (refer to the assembler specifications for details). When there are two or more methods, select one of them. Uppercase letters and the symbols #, !, $ and [ ] are keywords and must be written as they are. Each symbol has the following meaning. * #: Immediate data specification * !: Absolute address specification * $: Relative address specification * [ ]: Indirect address specification In the case of immediate data, describe an appropriate numeric value or a label. When using a label, be sure to write the #, !, $, and [ ] symbols. For operand register identifiers r and rp, either function names (X, A, C, etc.) or absolute names (names in parentheses in the table below, R0, R1, R2, etc.) can be used for specification. Table 22-1. Operand Identifiers and Specification Methods Identifier Specification Method r X (R0), A (R1), C (R2), B (R3), E (R4), D (R5), L (R6), H (R7) rp AX (RP0), BC (RP1), DE (RP2), HL (RP3) sfr Special function register symbol sfrp Special function register symbol (16-bit manipulatable register even addresses only) saddr FE20H to FF1FH Immediate data or labels saddrp FE20H to FF1FH Immediate data or labels (even address only) addr16 0000H to FFFFH Immediate data or labels Note Note (Only even addresses for 16-bit data transfer instructions) addr11 0800H to 0FFFH Immediate data or labels addr5 0040H to 007FH Immediate data or labels (even address only) word 16-bit immediate data or label byte 8-bit immediate data or label bit 3-bit immediate data or label RBn RB0 to RB3 Note Addresses from FFD0H to FFDFH cannot be accessed with these operands. Remark For special function register symbols, see Table 3-5 Special Function Register List. User's Manual U15836EJ5V0UD 357 CHAPTER 22 INSTRUCTION SET 22.1.2 Description of operation column A: A register; 8-bit accumulator X: X register B: B register C: C register D: D register E: E register H: H register L: L register AX: AX register pair; 16-bit accumulator BC: BC register pair DE: DE register pair HL: HL register pair PC: Program counter SP: Stack pointer PSW: Program status word CY: Carry flag AC: Auxiliary carry flag Z: Zero flag RBS: Register bank select flag IE: Interrupt request enable flag ( ): Memory contents indicated by address or register contents in parentheses XH, XL: Higher 8 bits and lower 8 bits of 16-bit register : Logical product (AND) : Logical sum (OR) : Exclusive logical sum (exclusive OR) : Inverted data addr16: 16-bit immediate data or label jdisp8: Signed 8-bit data (displacement value) 22.1.3 Description of flag operation column (Blank): Not affected 0: Cleared to 0 1: Set to 1 x: Set/cleared according to the result R: Previously saved value is restored 358 User's Manual U15836EJ5V0UD CHAPTER 22 INSTRUCTION SET 22.2 Operation List Instruction Group 8-bit data Mnemonic MOV transfer XCH Notes 1. Operands Clocks Bytes Note 2 Z AC CY r, #byte 2 4 - r byte saddr, #byte 3 6 7 (saddr) byte sfr, #byte 3 - 7 sfr byte A, r Note 3 1 2 - Ar r, A Note 3 1 2 - rA A, saddr 2 4 5 A (saddr) saddr, A 2 4 5 (saddr) A A, sfr 2 - 5 A sfr sfr, A 2 - 5 sfr A A, !addr16 3 8 9 A (addr16) !addr16, A 3 8 9 (addr16) A PSW, #byte 3 - 7 PSW byte A, PSW 2 - 5 A PSW PSW, A 2 - 5 PSW A A, [DE] 1 4 5 A (DE) [DE], A 1 4 5 (DE) A A, [HL] 1 4 5 A (HL) [HL], A 1 4 5 (HL) A A, [HL + byte] 2 8 9 A (HL + byte) [HL + byte], A 2 8 9 (HL + byte) A A, [HL + B] 1 6 7 A (HL + B) [HL + B], A 1 6 7 (HL + B) A A, [HL + C] 1 6 7 A (HL + C) [HL + C], A 1 6 7 (HL + C) A 1 2 - Ar A, r Note 3 Flag Operation Note 1 A, saddr 2 4 6 A (saddr) A, sfr 2 - 6 A sfr A, !addr16 3 8 10 A (addr16) A, [DE] 1 4 6 A (DE) A, [HL] 1 4 6 A (HL) A, [HL + byte] 2 8 10 A (HL + byte) A, [HL + B] 2 8 10 A (HL + B) A, [HL + C] 2 8 10 A (HL + C) x x x x x x When the internal high-speed RAM area is accessed or for an instruction with no data access 2. When an area except the internal high-speed RAM area is accessed 3. Except "r = A" Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control register (PCC). 2. This clock cycle applies to the internal ROM program. User's Manual U15836EJ5V0UD 359 CHAPTER 22 INSTRUCTION SET Instruction Group Mnemonic Operands Clocks Bytes Note 1 16-bit data MOVW transfer 3 6 - rp word saddrp, #word 4 8 10 (saddrp) word sfrp, #word 4 - 10 sfrp word AX, saddrp 2 6 8 AX (saddrp) saddrp, AX 2 6 8 (saddrp) AX AX, sfrp 2 - 8 AX sfrp sfrp, AX 2 - 8 sfrp AX 4 - AX rp AX, rp Note 3 1 rp, AX Note 3 1 4 - rp AX 3 10 12 AX (addr16) 3 10 12 (addr16) AX 1 4 - AX rp 2 4 - A, CY A + byte x x x 3 6 8 (saddr), CY (saddr) + byte x x x 2 4 - A, CY A + r x x x 2 4 - r, CY r + A x x x !addr16, AX XCHW AX, rp ADD A, #byte operation Note 3 saddr, #byte A, r Note 4 r, A ADDC A, saddr 2 4 5 A, CY A + (saddr) x x x A, !addr16 3 8 9 A, CY A + (addr16) x x x A, [HL] 1 4 5 A, CY A + (HL) x x x A, [HL + byte] 2 8 9 A, CY A + (HL + byte) x x x A, [HL + B] 2 8 9 A, CY A + (HL + B) x x x A, [HL + C] 2 8 9 A, CY A + (HL + C) x x x A, #byte 2 4 - A, CY A + byte + CY x x x 3 6 8 (saddr), CY (saddr) + byte + CY x x x 2 4 - A, CY A + r + CY x x x 2 4 - r, CY r + A + CY x x x saddr, #byte A, r Note 4 r, A Notes 1. Z AC CY Note 2 rp, #word AX, !addr16 8-bit Flag Operation A, saddr 2 4 5 A, CY A + (saddr) + CY x x x A, !addr16 3 8 9 A, CY A + (addr16) + CY x x x A, [HL] 1 4 5 A, CY A + (HL) + CY x x x A, [HL + byte] 2 8 9 A, CY A + (HL + byte) + CY x x x A, [HL + B] 2 8 9 A, CY A + (HL + B) + CY x x x A, [HL + C] 2 8 9 A, CY A + (HL + C) + CY x x x When the internal high-speed RAM area is accessed or for an instruction with no data access 2. When an area except the internal high-speed RAM area is accessed 3. Only when rp = BC, DE or HL 4. Except "r = A" Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control register (PCC). 2. This clock cycle applies to the internal ROM program. 360 User's Manual U15836EJ5V0UD CHAPTER 22 INSTRUCTION SET Instruction Group Mnemonic Operands Clocks Bytes Note 1 8-bit SUB operation 2 4 - A, CY A - byte x x x saddr, #byte 3 6 8 (saddr), CY (saddr) - byte x x x 2 4 - A, CY A - r x x x r, A 2 4 - r, CY r - A x x x A, saddr 2 4 5 A, CY A - (saddr) x x x Note 3 A, !addr16 3 8 9 A, CY A - (addr16) x x x A, [HL] 1 4 5 A, CY A - (HL) x x x A, [HL + byte] 2 8 9 A, CY A - (HL + byte) x x x A, [HL + B] 2 8 9 A, CY A - (HL + B) x x x A, [HL + C] 2 8 9 A, CY A - (HL + C) x x x A, #byte 2 4 - A, CY A - byte - CY x x x saddr, #byte 3 6 8 (saddr), CY (saddr) - byte - CY x x x 2 4 - A, CY A - r - CY x x x r, A 2 4 - r, CY r - A - CY x x x A, saddr 2 4 5 A, CY A - (saddr) - CY x x x A, !addr16 3 8 9 A, CY A - (addr16) - CY x x x A, [HL] 1 4 5 A, CY A - (HL) - CY x x x A, [HL + byte] 2 8 9 A, CY A - (HL + byte) - CY x x x A, r AND Note 3 A, [HL + B] 2 8 9 A, CY A - (HL + B) - CY x x x A, [HL + C] 2 8 9 A, CY A - (HL + C) - CY x x x A, #byte 2 4 - A A byte x 3 6 8 (saddr) (saddr) byte x 2 4 - AAr x 2 4 - rrA x saddr, #byte A, r r, A Notes 1. Z AC CY Note 2 A, #byte A, r SUBC Flag Operation Note 3 A, saddr 2 4 5 A A (saddr) x A, !addr16 3 8 9 A A (addr16) x A, [HL] 1 4 5 A A (HL) x A, [HL + byte] 2 8 9 A A (HL + byte) x A, [HL + B] 2 8 9 A A (HL + B) x A, [HL + C] 2 8 9 A A (HL + C) x When the internal high-speed RAM area is accessed or for an instruction with no data access 2. When an area except the internal high-speed RAM area is accessed 3. Except "r = A" Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control register (PCC). 2. This clock cycle applies to the internal ROM program. User's Manual U15836EJ5V0UD 361 CHAPTER 22 INSTRUCTION SET Instruction Group Mnemonic Operands Clocks Bytes Note 1 8-bit OR operation 2 4 - A A byte x saddr, #byte 3 6 8 (saddr) (saddr) byte x 2 4 - AAr x r, A 2 4 - rrA x A, saddr 2 4 5 A A (saddr) x Note 3 A, !addr16 3 8 9 A A (addr16) x A, [HL] 1 4 5 A A (HL) x A, [HL + byte] 2 8 9 A A (HL + byte) x A, [HL + B] 2 8 9 A A (HL + B) x A, [HL + C] 2 8 9 A A (HL + C) x A, #byte 2 4 - A A byte x saddr, #byte 3 6 8 (saddr) (saddr) byte x 2 4 - AAr x r, A 2 4 - rrA x A, saddr 2 4 5 A A (saddr) x A, !addr16 3 8 9 A A (addr16) x A, [HL] 1 4 5 A A (HL) x A, [HL + byte] 2 8 9 A A (HL + byte) x A, r CMP Note 3 A, [HL + B] 2 8 9 A A (HL + B) x A, [HL + C] 2 8 9 A A (HL + C) x A, #byte 2 4 - A - byte x x x 3 6 8 (saddr) - byte x x x 2 4 - A-r x x x 2 4 - r-A x x x saddr, #byte A, r r, A Notes 1. Z AC CY Note 2 A, #byte A, r XOR Flag Operation Note 3 A, saddr 2 4 5 A - (saddr) x x x A, !addr16 3 8 9 A - (addr16) x x x A, [HL] 1 4 5 A - (HL) x x x A, [HL + byte] 2 8 9 A - (HL + byte) x x x A, [HL + B] 2 8 9 A - (HL + B) x x x A, [HL + C] 2 8 9 A - (HL + C) x x x When the internal high-speed RAM area is accessed or for an instruction with no data access 2. When an area except the internal high-speed RAM area is accessed 3. Except "r = A" Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control register (PCC). 2. This clock cycle applies to the internal ROM program. 362 User's Manual U15836EJ5V0UD CHAPTER 22 INSTRUCTION SET Instruction Group Mnemonic Operands Clocks Bytes Flag Operation Note 1 Note 2 Z AC CY 16-bit ADDW AX, #word 3 6 - AX, CY AX + word x x x operation SUBW AX, #word 3 6 - AX, CY AX - word x x x CMPW AX, #word 3 6 - AX - word x x x Multiply/ MULU X 2 16 - AX A x X divide DIVUW C 2 25 - AX (Quotient), C (Remainder) AX / C Increment/ INC decrement DEC INCW Rotate r 1 2 - rr+1 x x saddr 2 4 6 (saddr) (saddr) + 1 x x r 1 2 - rr-1 x x saddr 2 4 6 (saddr) (saddr) - 1 x x rp 1 4 - rp rp + 1 DECW rp 1 4 - rp rp - 1 ROR A, 1 1 2 - (CY, A7 A0, Am - 1 Am) x 1 time x ROL A, 1 1 2 - (CY, A0 A7, Am + 1 Am) x 1 time x RORC A, 1 1 2 - (CY A0, A7 CY, Am - 1 Am) x 1 time x ROLC A, 1 1 2 - (CY A7, A0 CY, Am + 1 Am) x 1 time x ROR4 [HL] 2 10 12 A3 - 0 (HL)3 - 0, (HL)7 - 4 A3 - 0, (HL)3 - 0 (HL)7 - 4 ROL4 [HL] 2 10 12 A3 - 0 (HL)7 - 4, (HL)3 - 0 A3 - 0, (HL)7 - 4 (HL)3 - 0 BCD ADJBA adjustment ADJBS Bit MOV1 manipulate Notes 1. 2. 2 4 - Decimal Adjust Accumulator after Addition x x x x x 2 4 - Decimal Adjust Accumulator after Subtract CY, saddr.bit 3 6 7 CY (saddr.bit) x CY, sfr.bit 3 - 7 CY sfr.bit x CY, A.bit 2 4 - CY A.bit x CY, PSW.bit 3 - 7 CY PSW.bit x CY, [HL].bit 2 6 7 CY (HL).bit x saddr.bit, CY 3 6 8 (saddr.bit) CY sfr.bit, CY 3 - 8 sfr.bit CY A.bit, CY 2 4 - A.bit CY PSW.bit, CY 3 - 8 PSW.bit CY [HL].bit, CY 2 6 8 (HL).bit CY x x x When the internal high-speed RAM area is accessed or for an instruction with no data access When an area except the internal high-speed RAM area is accessed Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control register (PCC). 2. This clock cycle applies to the internal ROM program. User's Manual U15836EJ5V0UD 363 CHAPTER 22 INSTRUCTION SET Instruction Group Mnemonic Operands Clocks Bytes Note 1 Bit AND1 manipulate OR1 XOR1 SET1 CLR1 Notes 1. 2. Flag Operation Z AC CY Note 2 CY, saddr.bit 3 6 7 CY CY (saddr.bit) x CY, sfr.bit 3 - 7 CY CY sfr.bit x CY, A.bit 2 4 - CY CY A.bit x CY, PSW.bit 3 - 7 CY CY PSW.bit x CY, [HL].bit 2 6 7 CY CY (HL).bit x CY, saddr.bit 3 6 7 CY CY (saddr.bit) x CY, sfr.bit 3 - 7 CY CY sfr.bit x CY, A.bit 2 4 - CY CY A.bit x CY, PSW.bit 3 - 7 CY CY PSW.bit x CY, [HL].bit 2 6 7 CY CY (HL).bit x CY, saddr.bit 3 6 7 CY CY (saddr.bit) x CY, sfr.bit 3 - 7 CY CY sfr.bit x CY, A.bit 2 4 - CY CY A.bit x CY, PSW.bit 3 - 7 CY CY PSW.bit x CY, [HL].bit 2 6 7 CY CY (HL).bit x saddr.bit 2 4 6 (saddr.bit) 1 sfr.bit 3 - 8 sfr.bit 1 A.bit 2 4 - A.bit 1 PSW.bit 2 - 6 PSW.bit 1 [HL].bit 2 6 8 (HL).bit 1 saddr.bit 2 4 6 (saddr.bit) 0 sfr.bit 3 - 8 sfr.bit 0 A.bit 2 4 - A.bit 0 PSW.bit 2 - 6 PSW.bit 0 x x x x x x [HL].bit 2 6 8 (HL).bit 0 SET1 CY 1 2 - CY 1 1 CLR1 CY 1 2 - CY 0 0 NOT1 CY 1 2 - CY CY x When the internal high-speed RAM area is accessed or for an instruction with no data access When an area except the internal high-speed RAM area is accessed Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control register (PCC). 2. This clock cycle applies to the internal ROM program. 364 User's Manual U15836EJ5V0UD CHAPTER 22 INSTRUCTION SET Instruction Group Call/return Mnemonic Operands Clocks Bytes Operation Note 1 Note 2 Flag Z AC CY CALL !addr16 3 7 - (SP - 1) (PC + 3)H, (SP - 2) (PC + 3)L, CALLF !addr11 2 5 - (SP - 1) (PC + 2)H, (SP - 2) (PC + 2)L, PC addr16, SP SP - 2 PC15 - 11 00001, PC10 - 0 addr11, SP SP - 2 CALLT [addr5] 1 6 - (SP - 1) (PC + 1)H, (SP - 2) (PC + 1)L, PCH (00000000, addr5 + 1), PCL (00000000, addr5), SP SP - 2 BRK 1 6 - (SP - 1) PSW, (SP - 2) (PC + 1)H, (SP - 3) (PC + 1)L, PCH (003FH), PCL (003EH), SP SP - 3, IE 0 RET 1 6 - PCH (SP + 1), PCL (SP), SP SP + 2 RETI 1 6 - PCH (SP + 1), PCL (SP), R R R PSW (SP + 2), SP SP + 3 RETB 1 6 - PCH (SP + 1), PCL (SP), R R R PSW (SP + 2), SP SP + 3 Stack PUSH manipulate PSW 1 2 - (SP - 1) PSW, SP SP - 1 (SP - 1) rpH, (SP - 2) rpL, rp 1 4 - PSW 1 2 - PSW (SP), SP SP + 1 rp 1 4 - rpH (SP + 1), rpL (SP), SP, #word 4 - 10 SP word SP, AX 2 - 8 SP AX SP SP - 2 POP R R R SP SP + 2 MOVW AX, SP 2 - 8 AX SP Unconditional BR !addr16 3 6 - PC addr16 branch $addr16 2 6 - PC PC + 2 + jdisp8 - PCH A, PCL X AX 2 8 Conditional BC $addr16 2 6 - PC PC + 2 + jdisp8 if CY = 1 branch BNC $addr16 2 6 - PC PC + 2 + jdisp8 if CY = 0 BZ $addr16 2 6 - PC PC + 2 + jdisp8 if Z = 1 BNZ $addr16 2 6 - PC PC + 2 + jdisp8 if Z = 0 Notes 1. 2. When the internal high-speed RAM area is accessed or for an instruction with no data access When an area except the internal high-speed RAM area is accessed Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control register (PCC). 2. This clock cycle applies to the internal ROM program. User's Manual U15836EJ5V0UD 365 CHAPTER 22 INSTRUCTION SET Instruction Group Mnemonic Operands Clocks Bytes Note 1 Z AC CY Note 2 Conditional BT saddr.bit, $addr16 3 8 9 PC PC + 3 + jdisp8 if (saddr.bit) = 1 branch sfr.bit, $addr16 4 - 11 PC PC + 4 + jdisp8 if sfr.bit = 1 A.bit, $addr16 3 8 - PC PC + 3 + jdisp8 if A.bit = 1 PSW.bit, $addr16 3 - 9 PC PC + 3 + jdisp8 if PSW.bit = 1 [HL].bit, $addr16 3 10 11 PC PC + 3 + jdisp8 if (HL).bit = 1 saddr.bit, $addr16 4 10 11 PC PC + 4 + jdisp8 if (saddr.bit) = 0 sfr.bit, $addr16 4 - 11 PC PC + 4 + jdisp8 if sfr.bit = 0 A.bit, $addr16 3 8 - PC PC + 3 + jdisp8 if A.bit = 0 BF BTCLR Flag Operation PSW.bit, $addr16 4 - 11 PC PC + 4 + jdisp8 if PSW. bit = 0 [HL].bit, $addr16 3 10 11 PC PC + 3 + jdisp8 if (HL).bit = 0 saddr.bit, $addr16 4 10 12 PC PC + 4 + jdisp8 if (saddr.bit) = 1 then reset (saddr.bit) sfr.bit, $addr16 4 - 12 PC PC + 4 + jdisp8 if sfr.bit = 1 then reset sfr.bit A.bit, $addr16 3 8 - PC PC + 3 + jdisp8 if A.bit = 1 then reset A.bit PSW.bit, $addr16 4 - 12 PC PC + 4 + jdisp8 if PSW.bit = 1 x x x then reset PSW.bit [HL].bit, $addr16 3 10 12 PC PC + 3 + jdisp8 if (HL).bit = 1 then reset (HL).bit DBNZ B, $addr16 2 6 - B B - 1, then PC PC + 2 + jdisp8 if B 0 C, $addr16 2 6 - C C -1, then saddr, $addr16 3 8 10 (saddr) (saddr) - 1, then PC PC + 2 + jdisp8 if C 0 PC PC + 3 + jdisp8 if (saddr) 0 CPU SEL 2 4 - RBS1, 0 n control NOP 1 2 - No Operation EI 2 - 6 IE 1 (Enable Interrupt) DI 2 - 6 IE 0 (Disable Interrupt) HALT 2 6 - Set HALT Mode STOP 2 6 - Set STOP Mode Notes 1. 2. RBn When the internal high-speed RAM area is accessed or for an instruction with no data access When an area except the internal high-speed RAM area is accessed Remarks 1. One instruction clock cycle is one cycle of the CPU clock (fCPU) selected by the processor clock control register (PCC). 2. This clock cycle applies to the internal ROM program. 366 User's Manual U15836EJ5V0UD CHAPTER 22 INSTRUCTION SET 22.3 Instructions Listed by Addressing Type (1) 8-bit instructions MOV, XCH, ADD, ADDC, SUB, SUBC, AND, OR, XOR, CMP, MULU, DIVUW, INC, DEC, ROR, ROL, RORC, ROLC, ROR4, ROL4, PUSH, POP, DBNZ Second Operand #byte A rNote sfr saddr !addr16 PSW [DE] [HL] [HL + byte] $addr16 1 None [HL + B] First Operand A r [HL + C] ADD MOV MOV MOV MOV ADDC XCH XCH XCH XCH SUB ADD ADD ADD SUBC ADDC ADDC ADDC ADDC ADDC AND SUB SUB SUB OR SUBC SUBC SUBC SUBC SUBC XOR AND AND AND AND AND CMP OR OR OR OR OR XOR XOR XOR XOR XOR CMP CMP CMP CMP CMP MOV MOV SUB MOV MOV MOV ROR XCH XCH XCH ROL ADD ADD RORC ROLC SUB MOV INC ADD DEC ADDC SUB SUBC AND OR XOR CMP B, C DBNZ sfr MOV MOV saddr MOV MOV DBNZ ADD INC DEC ADDC SUB SUBC AND OR XOR CMP !addr16 PSW MOV MOV PUSH MOV POP [DE] MOV [HL] MOV ROR4 ROL4 [HL + byte] MOV [HL + B] [HL + C] X MULU C DIVUW Note Except r = A User's Manual U15836EJ5V0UD 367 CHAPTER 22 INSTRUCTION SET (2) 16-bit instructions MOVW, XCHW, ADDW, SUBW, CMPW, PUSH, POP, INCW, DECW Second Operand #word AX rp Note sfrp saddrp !addr16 SP None First Operand AX ADDW MOVW SUBW XCHW MOVW MOVW MOVW MOVW CMPW rp MOVW MOVW Note INCW DECW PUSH POP sfrp MOVW MOVW saddrp MOVW MOVW !addr16 SP MOVW MOVW MOVW Note Only when rp = BC, DE, HL (3) Bit manipulation instructions MOV1, AND1, OR1, XOR1, SET1, CLR1, NOT1, BT, BF, BTCLR Second Operand A.bit sfr.bit saddr.bit PSW.bit [HL].bit CY $addr16 None First Operand A.bit MOV1 BT SET1 BF CLR1 BTCLR sfr.bit MOV1 BT SET1 BF CLR1 BTCLR saddr.bit MOV1 BT SET1 BF CLR1 BTCLR PSW.bit MOV1 BT SET1 BF CLR1 BTCLR [HL].bit MOV1 BT SET1 BF CLR1 BTCLR CY 368 MOV1 MOV1 MOV1 MOV1 MOV1 SET1 AND1 AND1 AND1 AND1 AND1 CLR1 OR1 OR1 OR1 OR1 OR1 NOT1 XOR1 XOR1 XOR1 XOR1 XOR1 User's Manual U15836EJ5V0UD CHAPTER 22 INSTRUCTION SET (4) Call instructions/branch instructions CALL, CALLF, CALLT, BR, BC, BNC, BZ, BNZ, BT, BF, BTCLR, DBNZ Second Operand AX !addr16 !addr11 [addr5] $addr16 First Operand Basic instruction BR CALL CALLF CALLT BR BR BC BNC BZ BNZ Compound BT instruction BF BTCLR DBNZ (5) Other instructions ADJBA, ADJBS, BRK, RET, RETI, RETB, SEL, NOP, EI, DI, HALT, STOP User's Manual U15836EJ5V0UD 369 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) Target products (expanded-specification products): Products with a rankNote E or after * PD780101, 780102, 780103, 780101(A), 780102(A), and 780103(A) for which orders were received on or after mid-March, 2004 * PD78F0103 and 78F0103(A) for which orders were received on or after mid-July, 2004 Note The rank is indicated by the 5th digit from the left in the 3rd column (lot number) marked on the package. x x x x Lot number Year Week code code Rank Absolute Maximum Ratings (TA = 25C) Parameter Supply voltage Symbol Conditions VDD V V Note 1 V -0.3 to +0.3 AVSS VI1 -0.3 to +6.5 -0.3 to VDD + 0.3 AVREF Input voltage Unit -0.3 to +0.3 VSS VPP Ratings PD78F0103, 78F0103(A) only Note 2 P00 to P03, P10 to P17, P20 to P23, V -0.3 to +10.5 -0.3 to VDD + 0.3 V Note 1 V P30 to P33, P120, X1, X2, RESET VI2 VPP in flash programming mode -0.3 to +10.5 V (PD78F0103, 78F0103(A) only) Output voltage Analog input voltage VO -0.3 to VDD + 0.3 VAN AVSS - 0.3 to AVREF + 0.3 Note 1 V Note 1 V and -0.3 to VDD + 0.3 Note 1 Output current, high IOH -10 mA P30 to P33, P120 -30 mA P00 to P03, -30 mA Total of all pins -50 mA Per pin 20 mA P30 to P33, P120 35 mA P00 to P03, 35 mA 60 mA In normal operation mode -40 to +85 C In flash memory programming -10 to +85 PD780101, 780102, 780103, -65 to +150 Per pin Total of pins P10 to P17, P130 Output current, low IOL Total of pins P10 to P17, P130 Total of all pins Operating ambient TA temperature Storage temperature Tstg 780101(A), 780102(A), 780103(A) PD78F0103, 78F0103(A) Note 1. Must be 6.5 V or lower. (Refer to Note 2 on the next page.) 370 User's Manual U15836EJ5V0UD -40 to +125 C CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) Note 2. Make sure that the following conditions of the VPP voltage application timing are satisfied when the flash memory is written. * When supply voltage rises VPP must exceed VDD 10 s or more after VDD has reached the lower-limit value (2.5 V) of the operating voltage range (see a in the figure below). * When supply voltage drops VDD must be lowered 10 s or more after VPP falls below the lower-limit value (2.5 V) of the operating voltage range of VDD (see b in the figure below). VDD 2.5 V 0V a b VPP 2.5 V 0V 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. User's Manual U15836EJ5V0UD 371 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) X1 Oscillator Characteristics (TA = -40 to +85C, 2.5 V VDD 5.5 V, 2.5 V AVREF VDD, VSS = AVSS = 0 V) Resonator Recommended Circuit Ceramic resonator VSS X1 X2 Parameter Oscillation frequency Note (fXP) Crystal resonator VSS X1 X2 Unit 12 MHz 2.0 10 8.38 2.5 V VDD < 3.0 V 2.0 5.0 4.0 V VDD 5.5 V 2.0 12 3.5 V VDD < 4.0 V 2.0 10 3.0 V VDD < 3.5 V 2.0 8.38 2.5 V VDD < 3.0 V 2.0 5.0 4.0 V VDD 5.5 V 2.0 12 3.5 V VDD < 4.0 V 2.0 10 3.0 V VDD < 3.5 V 2.0 8.38 2.5 V VDD < 3.0 V 2.0 5.0 X1 input high-/low- 4.0 V VDD 5.5 V 38 500 level width (tXPH, tXPL) 3.5 V VDD < 4.0 V 46 500 3.0 V VDD < 3.5 V 56 500 2.5 V VDD < 3.0 V 96 500 Oscillation frequency C2 X1 input frequency Note (fXP) X1 2.0 MAX. 2.0 Note External clock TYP. 3.0 V VDD < 3.5 V (fXP) C1 4.0 V VDD 5.5 V MIN. 3.5 V VDD < 4.0 V C2 C1 Conditions X2 MHz MHz ns Note Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time. Cautions 1. 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. 2. Since the CPU is started by the Ring-OSC after reset is released, check the oscillation stabilization time of the X1 input clock using the oscillation stabilization time counter status register (OSTC). Determine the oscillation stabilization time of the OSTC register and oscillation stabilization time select register (OSTS) after sufficiently evaluating the oscillation stabilization time with the resonator to be used. Ring-OSC Oscillator Characteristics (TA = -40 to +85C, 2.5 V VDD 5.5 V, 2.5 V AVREF VDD, VSS = AVSS = 0 V) Resonator On-chip Ring-OSC oscillator 372 Parameter Conditions Oscillation frequency (fR) User's Manual U15836EJ5V0UD MIN. TYP. MAX. Unit 120 240 480 kHz CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) Recommended Oscillator Constants Caution For the resonator selection of the PD780101(A), 780102(A), and 780103(A) and oscillator constants, users are required to either evaluate the oscillation themselves or apply to the resonator manufacturer for evaluation. (a) PD780101, 780102, 780103 X1 oscillation: Ceramic resonator (TA = -40 to +85C) Manufacturer Part Number SMD/Lead Frequency (MHz) Recommended Circuit Constants C1 (pF) Murata Mfg. C2 (pF) CSTCC2M00G56-R0 SMD 2.00 Internal Internal (47) (47) CSTCR4M00G55-R0 SMD 4.00 Internal Internal (39) (39) CSTCR4M00G55U-R0 CSTLS4M00G56-B0 Lead SMD 4.194 CSTCR4M19G55U-R0 CSTLS4M19G56-B0 Lead SMD 4.915 CSTCR4M91G55U-R0 CSTLS4M91G56-B0 Lead SMD 5.00 CSTCR5M00G55U-R0 CSTLS5M00G56-B0 Lead SMD 6.00 CSTCR6M00G55U-R0 CSTLS6M00G56-B0 Lead SMD CSTLS8M00G53-B0 Lead 8.00 SMD CSTLS10M0G53-B0 Lead 10.0 SMD 2.6 2.5 Internal Internal (39) (39) 2.7 2.5 Internal Internal (10) (10) Internal Internal (10) (10) Internal Internal (15) (15) CSTLS10M0G53U-B0 CSTCE12M0G52-R0 2.5 Internal Internal (15) (15) CSTLS8M00G53U-B0 CSTCE10M0G52-R0 2.6 Internal Internal (39) (39) Internal Internal (47) (47) CSTLS6M00G56U-B0 CSTCE8M00G52-R0 5.5 Internal Internal (39) (39) Internal Internal (47) (47) CSTLS5M00G56U-B0 CSTCR6M00G55-R0 2.5 Internal Internal (39) (39) Internal Internal (47) (47) CSTLS4M91G56U-B0 CSTCR5M00G55-R0 MAX. (V) Internal Internal (47) (47) CSTLS4M19G56U-B0 CSTCR4M91G55-R0 MIN. (V) Internal Internal (47) (47) CSTLS4M00G56U-B0 CSTCR4M19G55-R0 Oscillation Voltage Range 12.0 Internal Internal (10) (10) Caution The oscillator constants shown above are reference values based on evaluation in a specific environment by the resonator manufacturer. If it is necessary to optimize the oscillator characteristics in the actual application, apply to the resonator manufacturer for evaluation on the implementation circuit. The oscillation voltage and oscillation frequency only indicate the oscillator characteristic. Use the 78K0/KB1 so that the internal operation conditions are within the specifications of the DC and AC characteristics. User's Manual U15836EJ5V0UD 373 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) (b) PD78F0103 X1 oscillation: Ceramic resonator (TA = -40 to +85C) Manufacturer Part Number SMD/Lead Frequency (MHz) Recommended Circuit Constants C1 (pF) Murata Mfg. C2 (pF) CSTCC2M00G56-R0 SMD 2.00 Internal Internal (47) (47) CSTCC2M45G56-R0 SMD 2.457 Internal Internal (47) (47) CSTCR4M00G53-R0 SMD 4.00 Internal Internal (15) (15) CSTCR4M00G53093-R0 Lead CSTLS4M00G53-B0 SMD 5.00 CSTCR5M00G53093-R0 CSTLS5M00G53-B0 Lead SMD 6.00 CSTCR6M00G53U-R0 CSTLS6M00G53-B0 Lead SMD CSTLS8M38G53-B0 Lead 8.388 SMD CSTLS10M0G53-B0 Lead 10.0 SMD Internal Internal (15) (15) Internal Internal (15) (15) Internal Internal (10) (10) Internal Internal (10) (10) Internal Internal (15) (15) CSTLS10M0G53093-B0 CSTCE12M0G52-R0 5.5 Internal Internal (15) (15) CSTLS8M38G53093-B0 CSTCE10M0G52-R0 2.5 Internal Internal (15) (15) CSTLS6M00G53U-B0 CSTCE8M38G52-R0 MAX. (V) Internal Internal (15) (15) CSTLS5M00G53093-B0 CSTCR6M00G53-R0 MIN. (V) Internal Internal (15) (15) CSTLS4M00G53093-B0 CSTCR5M00G53-R0 Oscillation Voltage Range 12.0 Internal Internal (10) (10) Caution The oscillator constants shown above are reference values based on evaluation in a specific environment by the resonator manufacturer. If it is necessary to optimize the oscillator characteristics in the actual application, apply to the resonator manufacturer for evaluation on the implementation circuit. The oscillation voltage and oscillation frequency only indicate the oscillator characteristic. Use the 78K0/KB1 so that the internal operation conditions are within the specifications of the DC and AC characteristics. 374 User's Manual U15836EJ5V0UD CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) (c) PD78F0103(A) X1 oscillation: Ceramic resonator (TA = -40 to +85C) Manufacturer Part Number SMD/Lead Frequency (MHz) Recommended Circuit Constants C1 (pF) Murata Mfg. CSTCC2M00G56A-R0 SMD C2 (pF) 2.00 Internal Internal (47) (47) CSTCC2M45G56A-R0 2.457 Internal Internal (47) (47) CSTCR4M00G53A-R0 4.00 Internal Internal (15) (15) CSTCR5M00G53A-R0 5.00 Internal Internal (15) (15) CSTCR6M00G53A-R0 6.00 Internal Internal (15) (15) CSTCE8M38G52A-R0 8.388 Internal Internal (10) (10) CSTCE10M0G52A-R0 10.0 Internal Internal (10) (10) CSTCE12M0G52A-R0 12.0 Internal Internal (10) (10) Oscillation Voltage Range MIN. (V) MAX. (V) 2.5 5.5 Caution The oscillator constants shown above are reference values based on evaluation in a specific environment by the resonator manufacturer. If it is necessary to optimize the oscillator characteristics in the actual application, apply to the resonator manufacturer for evaluation on the implementation circuit. The oscillation voltage and oscillation frequency only indicate the oscillator characteristic. Use the 78K0/KB1 so that the internal operation conditions are within the specifications of the DC and AC characteristics. User's Manual U15836EJ5V0UD 375 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) DC Characteristics (TA = -40 to +85C, 2.5 V VDD 5.5 V, 2.5 V AVREF VDD, VSS = AVSS = 0 V) (1/4) Parameter Output current, high Output current, low Symbol IOH IOL Conditions MAX. Unit 4.0 V VDD 5.5 V -5 mA Total of P30 to P33, P120 4.0 V VDD 5.5 V -25 mA Total of P00 to P03, P10 to P17, P130 4.0 V VDD 5.5 V -25 mA Total of all pins 4.0 V VDD 5.5 V -40 mA 2.5 V VDD < 4.0 V -10 mA 4.0 V VDD 5.5 V 10 mA Total of P30 to P33, P120 4.0 V VDD 5.5 V 30 mA Total of P00 to P03, P10 to P17, P130 4.0 V VDD 5.5 V 30 mA 4.0 V VDD 5.5 V 50 mA 2.5 V VDD < 4.0 V 10 mA Per pin Per pin Total of all pins Input voltage, high P12, P13, P15 2.7 V VDD 5.5 V 0.7VDD VDD V 2.5 V VDD < 2.7 V 0.8VDD VDD V VIH2 P00 to P03, P10, P11, P14, P16, P17, P30 to P33, P120, RESET 2.7 V VDD 5.5 V 0.8VDD VDD V VIH3 P20 to P23 Output voltage, low Note X1, X2 2.5 V VDD < 2.7 V 0.85VDD VDD V 2.7 V VDD 5.5 V 0.7AVREF AVREF V 2.5 V VDD < 2.7 V 0.8AVREF AVREF V 2.7 V VDD 5.5 V VDD - 0.5 VDD V 2.5 V VDD < 2.7 V VDD - 0.2 VDD V VIL1 P12, P13, P15 2.7 V VDD 5.5 V 0 0.3VDD V 2.5 V VDD < 2.7 V 0 0.2VDD V VIL2 P00 to P03, P10, P11, P14, P16, P17, P30 to P33, P120, RESET 2.7 V VDD 5.5 V 0 0.2VDD V VIL3 P20 to P23 VIL4 Output voltage, high TYP. VIH1 VIH4 Input voltage, low MIN. VOH VOL Note 2.5 V VDD < 2.7 V 0 0.15VDD V 2.7 V VDD 5.5 V 0 0.3AVREF V 2.5 V VDD < 2.7 V 0 0.2AVREF V 2.7 V VDD 5.5 V 0 0.4 V 2.5 V VDD < 2.7 V 0 0.2 V Total of P30 to P33, P120 pins IOH = -25 mA 4.0 V VDD 5.5 V, IOH = -5 mA VDD - 1.0 V Total of P00 to P03, P10 to P17, P130 pins IOH = -25 mA 4.0 V VDD 5.5 V, IOH = -5 mA VDD - 1.0 V VDD - 0.5 X1, X2 IOH = -100 A 2.5 V VDD < 4.0 V Total of P30 to P33, P120 pins IOL = 30 mA 4.0 V VDD 5.5 V, IOL = 10 mA 1.3 V Total of P00 to P03, P10 to P17, P130 pins IOL = 30 mA 4.0 V VDD 5.5 V, IOL = 10 mA 1.3 V IOL = 400 A 2.5 V VDD < 4.0 V 0.4 V V Note When used as a digital input port, set AVREF = VDD. Remark 376 Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins. User's Manual U15836EJ5V0UD CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) DC Characteristics (TA = -40 to +85C, 2.5 V VDD 5.5 V, 2.5 V AVREF VDD, VSS = AVSS = 0 V) (2/4) Parameter Input leakage current, high Input leakage current, low Symbol ILIH1 Conditions VI = VDD P00 to P03, P10 to P17, P30 to P33, P120, RESET VI = AVREF P20 to P23 ILIH2 VI = VDD X1, X2 ILIL1 VI = 0 V P00 to P03, P10 to P17, P20 to P23, P30 to P33, P120, RESET ILIL2 X1, X2 MIN. TYP. Note Note MAX. Unit 3 A 3 A 20 A -3 A -20 A Output leakage current, high ILOH VO = VDD 3 A Output leakage current, low ILOL VO = 0 V -3 A Pull-up resistance value R VI = 0 V 10 100 k VPP supply voltage (PD78F0103, 78F0103(A) only) VPP1 In normal operation mode 0 0.2VDD V 30 Note When the inverse level of X1 is input to X2. Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins. User's Manual U15836EJ5V0UD 377 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) DC Characteristics (3/4): PD78F0103, 78F0103(A) (TA = -40 to +85C, 2.5 V VDD 5.5 V, 2.5 V AVREF VDD, VSS = AVSS = 0 V) Parameter Supply current Symbol IDD1 Note 1 Conditions MIN. TYP. MAX. Unit X1 crystal fXP = 12 MHz, oscillation VDD = 5.0 V 10% When A/D converter is operating fXP = 10 MHz, When A/D converter is stopped operating mode Note 2 When A/D converter is stopped Note 3 VDD = 5.0 V 10% When A/D converter is operating fXP = 5 MHz, When A/D converter is stopped Note 3 When A/D converter is operating X1 crystal fXP = 12 MHz, When peripheral functions are stopped oscillation VDD = 5.0 V 10% When peripheral functions are operating HALT mode IDD3 Ring-OSC operating mode IDD4 Note 5 Ring-OSC HALT mode IDD5 Note 5 STOP Note 4 fXP = 10 MHz, When peripheral functions are stopped VDD = 5.0 V 10% When peripheral functions are operating fXP = 5 MHz, When peripheral functions are stopped VDD = 3.0 V 10% When peripheral functions are operating 14 23.4 mA 15 25.4 mA 11.6 19.5 mA 12.6 21.5 mA 4 6.4 mA 4.6 7.6 mA 1.6 3.2 mA 6.4 mA 2.8 mA 5.5 mA 0.64 mA 1.9 mA 1.4 0.32 VDD = 5.0 V 10% 0.37 1.51 mA VDD = 3.0 V 10% 0.29 1.16 mA VDD = 5.0 V 10% 0.19 0.76 mA VDD = 3.0 V 10% 0.16 0.64 mA POC: OFF, RING: OFF 0.1 30 A POC: OFF, RING: ON 14 58 A Note 6 3.5 35.5 A Note 6 17.5 63.5 A POC: OFF, RING: OFF 0.05 10 A POC: OFF, RING: ON 7.5 25 A Note 6 3.5 15.5 A Note 6 11 30.5 A VDD = 5.0 V 10% mode POC: ON POC: ON VDD = 3.0 V 10% POC: ON POC: ON Notes 1. Note 4 VDD = 3.0 V 10% Note 3 IDD2 Note 4 , RING: OFF , RING: ON , RING: OFF , RING: ON 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). 2. IDD1 includes peripheral operation current. 3. When PCC = 00H. 4. Total current flowing through VDD and AVREF pins. 5. When X1 oscillator is stopped. 6. Including when LVIE (bit 4 of LVIM) = 1 in the PD78F0103M1, 78F0103M2, 78F0103M1(A), and 78F0103M2(A). 378 User's Manual U15836EJ5V0UD CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) DC Characteristics (4/4): PD780101, 780102, 780103, 780101(A), 780102(A), 780103(A) (TA = -40 to +85C, 2.5 V VDD 5.5 V, 2.5 V AVREF VDD, VSS = AVSS = 0 V) Parameter Supply current Symbol IDD1 Conditions X1 crystal fXP = 12 MHz, When A/D converter is stopped oscillation VDD = 5.0 V 10% Note 1 MIN. TYP. MAX. Unit Note 3 operating mode Note 2 fXP = 10 MHz, When A/D converter is operating When A/D converter is stopped VDD = 5.0 V 10% When A/D converter is operating fXP = 5 MHz, When A/D converter is stopped Note 3 VDD = 3.0 V 10% Note 3 IDD2 oscillation VDD = 5.0 V 10% When peripheral functions are operating fXP = 10 MHz, When peripheral functions are stopped VDD = 5.0 V 10% When peripheral functions are operating fXP = 5 MHz, When peripheral functions are stopped VDD = 3.0 V 10% When peripheral functions are operating 13.1 mA 8.2 15.1 mA 6 10.9 mA 7 12.9 mA 1.7 3.1 mA 2.3 4.3 mA 1.5 3.0 mA 5.5 mA 2.6 mA 4.8 mA 0.5 mA 1.1 mA 1.3 0.25 0.18 0.72 mA 0.11 0.44 mA Ring-OSC VDD = 5.0 V 10% 0.05 0.20 mA 0.03 0.12 mA POC: OFF, RING: OFF 0.1 30 A POC: OFF, RING: ON 14 58 A Note 6 3.5 35.5 A Note 6 17.5 63.5 A POC: OFF, RING: OFF 0.05 10 A POC: OFF, RING: ON 7.5 25 A Note 6 3.5 15.5 A Note 6 11 30.5 A mode Note 5 STOP VDD = 3.0 V 10% VDD = 5.0 V 10% mode POC: ON POC: ON VDD = 3.0 V 10% POC: ON POC: ON Notes 1. 7.2 Ring-OSC VDD = 5.0 V 10% operating Note 5 VDD = 3.0 V 10% mode HALT IDD5 Note 4 When peripheral functions are stopped mode IDD4 When A/D converter is operating Note 4 X1 crystal fXP = 12 MHz, HALT IDD3 Note 4 , RING: OFF , RING: ON , RING: OFF , RING: ON 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). 2. IDD1 includes peripheral operation current. 3. When PCC = 00H. 4. Total current flowing through VDD and AVREF pins. 5. When X1 oscillator is stopped. 6. Including when LVIE (bit 4 of LVIM) = 1 with POC-OFF selected by a mask option. User's Manual U15836EJ5V0UD 379 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) AC Characteristics (1) Basic operation (TA = -40 to +85C, 2.5 V VDD 5.5 V, 2.5 V AVREF VDD, VSS = AVSS = 0 V) Parameter Instruction cycle (minimum instruction execution time) Symbol TCY Conditions X1 input clock MIN. TI50 input frequency Unit 0.166 16 s 3.5 V VDD < 4.0 V 0.2 16 s 3.0 V VDD < 3.5 V 0.238 16 s 16 s 33.3 s 2.5 V VDD < 3.0 V tTIH0, tTIL0 MAX. 4.0 V VDD 5.5 V Ring-OSC clock TI000, TI010 input high-level width, low-level width TYP. 0.4 4.17 8.33 4.0 V VDD 5.5 V 2/fsam+ Note 0.1 s 2.7 V VDD < 4.0 V 2/fsam+ Note 0.2 s 2.5 V VDD < 2.7 V 2/fsam+ Note 0.5 s 4.0 V VDD 5.5 V fTI5 10 MHz 2.7 V VDD < 4.0 V 5 MHz 2.5 V VDD < 2.7 V 2.5 MHz TI50 input high-level width, low- tTIH5, level width tTIL5 4.0 V VDD 5.5 V 50 ns 2.7 V VDD < 4.0 V 100 ns 2.5 V VDD < 2.7 V 200 ns Interrupt input high-level width, low-level width tINTH, tINTL 2.7 V VDD 5.5 V 1 s 2.5 V VDD < 2.7 V 2 s RESET low-level width tRSL 2.7 V VDD 5.5 V 10 s 2.5 V VDD < 2.7 V 20 s Note Selection of fsam = fXP, fXP/4, 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. TCY vs. VDD (X1 Input Clock Operation) 20.0 16.0 Cycle time TCY [ s] 10.0 5.0 Guaranteed operation range 2.0 1.0 0.4 0.238 0.2 0.166 0.1 0 1.0 2.0 2.5 3.0 3.5 4.0 Supply voltage VDD [V] 380 User's Manual U15836EJ5V0UD 5.0 5.5 6.0 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) (2) Serial interface (TA = -40 to +85C, 2.5 V VDD 5.5 V, 2.5 V AVREF VDD, VSS = AVSS = 0 V) (a) UART mode (UART6, dedicated baud rate generator output) Parameter Symbol Conditions MIN. TYP. Transfer rate MAX. Unit 312.5 kbps (b) UART mode (UART0, dedicated baud rate generator output): PD780102, 780103, 78F0103, 780102(A), 780103(A), and 78F0103(A) only Parameter Symbol Conditions MIN. TYP. Transfer rate MAX. Unit 312.5 kbps MAX. Unit (c) 3-wire serial I/O mode (master mode, SCK10... internal clock output) Parameter SCK10 cycle time SCK10 high-/low-level width SI10 setup time (to SCK10) Symbol tKCY1 Conditions MIN. TYP. 4.0 V VDD 5.5 V 200 ns 3.3 V VDD < 4.0 V 240 ns 2.7 V VDD < 3.3 V 400 ns 2.5 V VDD < 2.7 V 800 ns tKH1, 2.7 V VDD 5.5 V tKCY1/2-10 ns tKL1 2.5 V VDD < 2.7 V tKCY1/2-50 ns tSIK1 2.7 V VDD 5.5 V 30 ns 2.5 V VDD < 2.7 V 70 ns ns SI10 hold time (from SCK10) tKSI1 2.7 V VDD 5.5 V 30 2.5 V VDD < 2.7 V 70 Delay time from SCK10 to tKSO1 C = 100 pF Note SO10 output ns 2.7 V VDD 5.5 V 30 ns 2.5 V VDD < 2.7 V 120 ns MAX. Unit Note C is the load capacitance of the SCK10 and SO10 output lines. (d) 3-wire serial I/O mode (slave mode, SCK10... external clock input) Parameter SCK10 cycle time SCK10 high-/low-level width Symbol tKCY2 Conditions MIN. TYP. 2.7 V VDD 5.5 V 400 ns 2.5 V VDD < 2.7 V 800 ns tKCY2/2 ns 80 ns 50 ns tKH2, tKL2 SI10 setup time (to SCK10) tSIK2 SI10 hold time (from SCK10) tKSI2 Delay time from SCK10 to tKSO2 Note C = 100 pF 120 ns SO10 output Note C is the load capacitance of the SO10 output line. User's Manual U15836EJ5V0UD 381 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) AC Timing Test Points (Excluding X1 Input) 0.8VDD 0.8VDD Test points 0.2VDD 0.2VDD Clock Timing 1/fXP tXL tXH VIH4 (MIN.) VIL4 (MAX.) X1 input TI Timing tTIH0 tTIL0 TI000, TI010 1/fTI5 tTIL5 tTIH5 tINTL tINTH TI50 Interrupt Request Input Timing INTP0 to INTP5 RESET Input Timing tRSL RESET 382 User's Manual U15836EJ5V0UD CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) Serial Transfer Timing 3-wire serial I/O mode: tKCYm tKLm tKHm SCK10 tSIKm SI10 tKSIm Input data tKSOm Output data SO10 Remark m = 1, 2 A/D Converter Characteristics (TA = -40 to +85C, 2.5 V VDD 5.5 V, 2.5 V AVREF VDD, VSS = AVSS = 0 V) Parameter Symbol Conditions Resolution MIN. 10 Notes 1, 2 Overall error tCONV Notes 1, 2 Zero-scale error Full-scale error Notes 1, 2 Note 1 Integral non-linearity error Differential non-linearity error Analog input voltage Notes 1. 2. Note 1 MAX. Unit 10 10 bit 4.0 V AVREF 5.5 V 0.2 0.4 %FSR 2.7 V AVREF < 4.0 V 0.3 0.6 %FSR 0.6 1.2 %FSR 4.0 V AVREF 5.5 V 14 100 s 2.7 V AVREF < 4.0 V 17 100 s 2.5 V AVREF < 2.7 V 48 2.5 V AVREF < 2.7 V Conversion time TYP. 100 s 4.0 V AVREF 5.5 V 0.4 %FSR 2.7 V AVREF < 4.0 V 0.6 %FSR 2.5 V AVREF < 2.7 V 1.2 %FSR 4.0 V AVREF 5.5 V 0.4 %FSR 2.7 V AVREF < 4.0 V 0.6 %FSR 2.5 V AVREF < 2.7 V 1.2 %FSR 4.0 V AVREF 5.5 V 2.5 LSB 2.7 V AVREF < 4.0 V 4.5 LSB 2.5 V AVREF < 2.7 V 8.5 LSB 4.0 V AVREF 5.5 V 1.5 LSB 2.7 V AVREF < 4.0 V 2.0 LSB 2.5 V AVREF < 2.7 V 3.5 LSB AVREF V VAIN AVSS Excludes quantization error (1/2 LSB). This value is indicated as a ratio (%FSR) to the full-scale value. User's Manual U15836EJ5V0UD 383 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) POC Circuit Characteristics (TA = -40 to +85C) Parameter Symbol Detection voltage VPOC0 Power supply rise time Response delay time 1 Note 3 Conditions Mask option = 3.5 V Note 1 Note 2 MIN. TYP. MAX. Unit 3.3 3.5 3.7 V 2.7 2.85 3.0 VPOC1 Mask option = 2.85 V tPTH VDD: 0 V 2.7 V 0.0015 ms VDD: 0 V 3.3 V 0.002 ms tPTHD When power supply rises, after reaching V 3.0 ms 1.0 ms detection voltage (MAX.) Response delay time 2 Minimum pulse width Note 4 tPD When VDD falls tPW 0.2 ms Notes 1. When flash memory version PD78F0103M5, 78F0103M6, 78F0103M5(A), or 78F0103M6(A) is used 2. When flash memory version PD78F0103M3, 78F0103M4, 78F0103M3(A), or 78F0103M4(A) is used 3. Time required from voltage detection to reset release. 4. Time required from voltage detection to internal reset output. POC Circuit Timing Supply voltage (VDD) Detection voltage (MAX.) Detection voltage (TYP.) Detection voltage (MIN.) tPW tPTH tPTHD tPD Time 384 User's Manual U15836EJ5V0UD CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) LVI Circuit Characteristics (TA = -40 to +85C) Parameter Symbol Detection voltage Note 1 MIN. TYP. MAX. Unit VLVI0 4.1 4.3 4.5 V VLVI1 3.9 4.1 4.3 V VLVI2 3.7 3.9 4.1 V VLVI3 3.5 3.7 3.9 V VLVI4 3.3 3.5 3.7 V VLVI5 3.15 3.3 3.45 V VLVI6 2.95 3.1 3.25 V VLVI7 2.7 2.85 3.0 V 0.2 2.0 ms 0.5 2.0 ms 0.1 0.2 ms Response time tLD Minimum pulse width tLW Conditions 0.2 Reference voltage stabilization wait tLWAIT0 Note 2 time Operation stabilization wait time Notes 1. 2. Note 3 tLWAIT1 ms Time required from voltage detection to interrupt output or internal reset output. Time required from setting LVIE to 1 to reference voltage stabilization when POC-OFF is selected by mask option (for the flash memory version, when the PD78F0103M1, 78F0103M2, 78F0103M1(A), or 78F0103M2(A) is used). 3. Time required from setting LVION to 1 to operation stabilization. Remarks 1. VLVI0 > VLVI1 > VLVI2 > VLVI3 > VLVI4 > VLVI5 > VLVI6 > VLVI7 2. VPOCn < VLVIm (n = 0 or 1, m = 0 to 7) LVI Circuit Timing Supply voltage (VDD) Detection voltage (MAX.) Detection voltage (TYP.) Detection voltage (MIN.) tLW tLWAIT0 tLWAIT1 tLD LVIE 1 LVION 1 Time Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (TA = -40 to +85C) Parameter Data retention supply voltage Symbol VDDDR Conditions When POC-OFF is selected by mask option Release signal set time MIN. 1.6 TYP. MAX. Unit 5.5 V Note tSREL 0 s Note When flash memory version PD78F0103M1, 78F0103M2, 78F0103M1(A), or 78F0103M2(A) is used User's Manual U15836EJ5V0UD 385 CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) Flash Memory Programming Characteristics: PD78F0103, 78F0103(A) (TA = +10 to +60C, 2.7 V VDD 5.5 V, 2.7 V AVREF VDD, VSS = AVSS = 0 V) (1) Write erase characteristics Parameter Symbol Conditions MIN. TYP. MAX. Unit 9.7 10.0 10.3 V VPP supply voltage VPP2 During flash memory programming VDD supply current IDD When VPP = VPP2, fXP = 10 MHz, VDD = 5.5 V 37 mA VPP supply current IPP VPP = VPP2 100 mA 0.201 s 20 s/chip Step erase time Note 1 Ter Note 2 Overall erase time Writeback time Tera Note 3 Cwb 0.2 When step erase time = 0.2 s Twb Number of writebacks per 1 writeback command 0.199 49.4 50 When writeback time = 50 ms 50.6 ms 60 Times 16 Times 52 s 520 s 20 Times/ Note 4 Number of erases/writebacks Note 5 Step write time Overall write time per word Cerwb Twr Note 6 Twrw 48 When step write time = 50 s (1 word = 1 48 50 byte) Note 7 Number of rewrites per chip Cerwr 1 erase + 1 write after erase = 1 rewrite area Notes 1. The recommended setting value of the step erase time is 0.2 s. 2. The prewrite time before erasure and the erase verify time (writeback time) are not included. 3. The recommended setting value of the writeback time is 50 ms. 4. Writeback is executed once by the issuance of the writeback command. Therefore, the number of retries must be the maximum value minus the number of commands issued. 5. The recommended setting value of the step write time is 50 s. 6. The actual write time per word is 100 s longer. The internal verify time during or after a write is not included. 7. When a product is first written after shipment, "erase write" and "write only" are both taken as one rewrite. Example: P: Write, E: Erase Shipped product P E P E P: 3 rewrites Shipped product E P E P E P: 3 rewrites Remark The range of the operating clock during flash memory programming is the same as the range during normal operation. 386 User's Manual U15836EJ5V0UD CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) (2) Serial write operation characteristics Parameter Symbol Set time from VDD to VPP Conditions MIN. TYP. MAX. Unit s tDP 10 Release time from VPP to RESET tPR 10 s VPP pulse input start time from tRP 2 ms VPP pulse high-/low-level width tPW 8 s VPP pulse input end time from tRPE RESET 14 ms 1.2VDD V 10.3 V RESET VPP pulse low-level input voltage VPPL 0.8VDD VPP pulse high-level input voltage VPPH 9.7 10.0 Flash Write Mode Setting Timing VDD VDD 0V tDP tRP tPW VPPH VPP VPPL tPW 0V tPR tRPE VDD RESET (input) 0V User's Manual U15836EJ5V0UD 387 CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) Target products (conventional products): Products with rankNote I or K * PD780101, 780102, 780103, 780101(A), 780102(A), and 780103(A) for which orders were received on or before mid-March, 2004 * PD78F0103 and 78F0103(A) for which orders were received on or before mid-July, 2004 Note The rank is indicated by the 5th digit from the left in the 3rd column (lot number) marked on the package. x x x x Lot number Year Week code code Rank Absolute Maximum Ratings (TA = 25C) Parameter Supply voltage Symbol Conditions VDD V V Note 1 V -0.3 to +0.3 AVSS VI1 -0.3 to +6.5 -0.3 to VDD + 0.3 AVREF Input voltage Unit -0.3 to +0.3 VSS VPP Ratings PD78F0103, 78F0103(A) only Note 2 P00 to P03, P10 to P17, P20 to P23, V -0.3 to +10.5 -0.3 to VDD + 0.3 V Note 1 V P30 to P33, P120, X1, X2, RESET VI2 VPP in flash programming mode -0.3 to +10.5 V (PD78F0103, 78F0103(A) only) Output voltage Analog input voltage VO -0.3 to VDD + 0.3 VAN AVSS - 0.3 to AVREF + 0.3 Note 1 V Note 1 V and -0.3 to VDD + 0.3 Note 1 Output current, high IOH -10 mA P30 to P33, P120 -30 mA P00 to P03, -30 mA Total of all pins -50 mA Per pin 20 mA P30 to P33, P120 35 mA P00 to P03, 35 mA 60 mA In normal operation mode -40 to +85 C In flash memory programming -10 to +85 PD780101, 780102, 780103, -65 to +150 Per pin Total of pins P10 to P17, P130 Output current, low IOL Total of pins P10 to P17, P130 Total of all pins Operating ambient TA temperature Storage temperature Tstg 780101(A), 780102(A), 780103(A) PD78F0103, 78F0103(A) Note 1. Must be 6.5 V or lower. (Refer to Note 2 on the next page.) 388 User's Manual U15836EJ5V0UD -40 to +125 C CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) Note 2. Make sure that the following conditions of the VPP voltage application timing are satisfied when the flash memory is written. * When supply voltage rises VPP must exceed VDD 10 s or more after VDD has reached the lower-limit value (2.7 V) of the operating voltage range (see a in the figure below). * When supply voltage drops VDD must be lowered 10 s or more after VPP falls below the lower-limit value (2.7 V) of the operating voltage range of VDD (see b in the figure below). VDD 2.7 V 0V a b VPP 2.7 V 0V 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. User's Manual U15836EJ5V0UD 389 CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) X1 Oscillator Characteristics (TA = -40 to +85C, 2.7 V VDD 5.5 V, 2.7 V AVREF VDD, VSS = AVSS = 0 V) Resonator Recommended Circuit Ceramic resonator VSS X1 X2 Parameter Oscillation frequency Note (fXP) Crystal resonator VSS X1 X2 MHz 4.0 V VDD 5.5 V 2.0 10 8.38 5.0 4.0 V VDD 5.5 V 2.0 10 3.3 V VDD < 4.0 V 2.0 8.38 2.7 V VDD < 3.3 V 2.0 5.0 4.0 V VDD 5.5 V 2.0 10 3.3 V VDD < 4.0 V 2.0 8.38 2.7 V VDD < 3.3 V 2.0 5.0 X1 input high-/low- 4.0 V VDD 5.5 V 46 500 level width (tXPH, tXPL) 3.3 V VDD < 4.0 V 56 500 2.7 V VDD < 3.3 V 96 500 Oscillation frequency C2 Note X2 Unit 2.0 X1 input frequency X1 MAX. 2.0 Note External clock TYP. 3.3 V VDD < 4.0 V (fXP) C1 MIN. 2.7 V VDD < 3.3 V C2 C1 Conditions (fXP) MHz MHz ns Note Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time. Cautions 1. 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. 2. Since the CPU is started by the Ring-OSC after reset is released, check the oscillation stabilization time of the X1 input clock using the oscillation stabilization time counter status register (OSTC). Determine the oscillation stabilization time of the OSTC register and oscillation stabilization time select register (OSTS) after sufficiently evaluating the oscillation stabilization time with the resonator to be used. Ring-OSC Oscillator Characteristics (TA = -40 to +85C, 2.7 V VDD 5.5 V, 2.7 V AVREF VDD, VSS = AVSS = 0 V) Resonator On-chip Ring-OSC oscillator 390 Parameter Conditions Oscillation frequency (fR) User's Manual U15836EJ5V0UD MIN. TYP. MAX. Unit 120 240 480 kHz CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) Recommended Oscillator Constants Caution For the resonator selection of the PD780101(A), 780102(A), and 780103(A) and oscillator constants, users are required to either evaluate the oscillation themselves or apply to the resonator manufacturer for evaluation. (a) PD780101, 780102, 780103 X1 oscillation: Ceramic resonator (TA = -40 to +85C) Manufacturer Part Number SMD/Lead Frequency (MHz) Recommended Circuit Constants C1 (pF) Murata Mfg. C2 (pF) CSTCC2M00G56-R0 SMD 2.00 Internal Internal (47) (47) CSTCR4M00G55-R0 SMD 4.00 Internal Internal (39) (39) CSTCR4M00G55U-R0 CSTLS4M00G56-B0 Lead SMD 4.194 CSTCR4M19G55U-R0 CSTLS4M19G56-B0 Lead SMD 4.915 CSTCR4M91G55U-R0 CSTLS4M91G56-B0 Lead SMD 5.00 CSTCR5M00G55U-R0 CSTLS5M00G56-B0 Lead SMD 6.00 CSTCR6M00G55U-R0 CSTLS6M00G56-B0 Lead SMD CSTLS8M00G53-B0 Lead 8.00 SMD CSTLS10M0G53-B0 Lead Internal Internal (39) (39) Internal Internal (39) (39) Internal Internal (39) (39) Internal Internal (10) (10) Internal Internal (15) (15) CSTLS8M00G53U-B0 CSTCE10M0G52-R0 Internal Internal (39) (39) Internal Internal (47) (47) CSTLS6M00G56U-B0 CSTCE8M00G52-R0 5.5 Internal Internal (47) (47) CSTLS5M00G56U-B0 CSTCR6M00G55-R0 2.7 Internal Internal (47) (47) CSTLS4M91G56U-B0 CSTCR5M00G55-R0 MAX. (V) Internal Internal (47) (47) CSTLS4M19G56U-B0 CSTCR4M91G55-R0 MIN. (V) Internal Internal (47) (47) CSTLS4M00G56U-B0 CSTCR4M19G55-R0 Oscillation Voltage Range 10.0 Internal Internal (10) (10) Internal Internal (15) (15) CSTLS10M0G53U-B0 Caution The oscillator constants shown above are reference values based on evaluation in a specific environment by the resonator manufacturer. If it is necessary to optimize the oscillator characteristics in the actual application, apply to the resonator manufacturer for evaluation on the implementation circuit. The oscillation voltage and oscillation frequency only indicate the oscillator characteristic. Use the 78K0/KB1 so that the internal operation conditions are within the specifications of the DC and AC characteristics. User's Manual U15836EJ5V0UD 391 CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) (b) PD78F0103 X1 oscillation: Ceramic resonator (TA = -40 to +85C) Manufacturer Part Number SMD/Lead Frequency (MHz) Recommended Circuit Constants C1 (pF) Murata Mfg. C2 (pF) CSTCC2M00G56-R0 SMD 2.00 Internal Internal (47) (47) CSTCC2M45G56-R0 SMD 2.457 Internal Internal (47) (47) CSTCR4M00G53-R0 SMD 4.00 Internal Internal (15) (15) CSTCR4M00G53093-R0 Lead CSTLS4M00G53-B0 SMD 5.00 CSTCR5M00G53093-R0 CSTLS5M00G53-B0 Lead SMD 6.00 CSTCR6M00G53U-R0 CSTLS6M00G53-B0 Lead SMD CSTLS8M38G53-B0 Lead 8.388 SMD CSTLS10M0G53-B0 Lead 5.5 Internal Internal (15) (15) Internal Internal (15) (15) Internal Internal (10) (10) Internal Internal (15) (15) CSTLS8M38G53093-B0 CSTCE10M0G52-R0 2.7 Internal Internal (15) (15) CSTLS6M00G53U-B0 CSTCE8M38G52-R0 MAX. (V) Internal Internal (15) (15) CSTLS5M00G53093-B0 CSTCR6M00G53-R0 MIN. (V) Internal Internal (15) (15) CSTLS4M00G53093-B0 CSTCR5M00G53-R0 Oscillation Voltage Range 10.0 Internal Internal (10) (10) Internal Internal (15) (15) CSTLS10M0G53093-B0 Caution The oscillator constants shown above are reference values based on evaluation in a specific environment by the resonator manufacturer. If it is necessary to optimize the oscillator characteristics in the actual application, apply to the resonator manufacturer for evaluation on the implementation circuit. The oscillation voltage and oscillation frequency only indicate the oscillator characteristic. Use the 78K0/KB1 so that the internal operation conditions are within the specifications of the DC and AC characteristics. 392 User's Manual U15836EJ5V0UD CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) (c) PD78F0103(A) X1 oscillation: Ceramic resonator (TA = -40 to +85C) Manufacturer Part Number SMD/Lead Frequency (MHz) Recommended Circuit Constants C1 (pF) Murata Mfg. CSTCC2M00G56A-R0 SMD C2 (pF) 2.00 Internal Internal (47) (47) CSTCC2M45G56A-R0 2.457 Internal Internal (47) (47) CSTCR4M00G53A-R0 4.00 Internal Internal (15) (15) CSTCR5M00G53A-R0 5.00 Internal Internal (15) (15) CSTCR6M00G53A-R0 6.00 Internal Internal (15) (15) CSTCE8M38G52A-R0 8.388 Internal Internal (10) (10) CSTCE10M0G52A-R0 10.0 Internal Internal (10) (10) Oscillation Voltage Range MIN. (V) MAX. (V) 2.7 5.5 Caution The oscillator constants shown above are reference values based on evaluation in a specific environment by the resonator manufacturer. If it is necessary to optimize the oscillator characteristics in the actual application, apply to the resonator manufacturer for evaluation on the implementation circuit. The oscillation voltage and oscillation frequency only indicate the oscillator characteristic. Use the 78K0/KB1 so that the internal operation conditions are within the specifications of the DC and AC characteristics. User's Manual U15836EJ5V0UD 393 CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) DC Characteristics (TA = -40 to +85C, 2.7 V VDD 5.5 V, 2.7 V AVREF VDD, VSS = AVSS = 0 V) (1/3) Parameter Output current, high Output current, low Symbol IOH IOL Conditions MIN. TYP. 4.0 V VDD 5.5 V -5 mA Total of P30 to P33, P120 4.0 V VDD 5.5 V -25 mA Total of P00 to P03, P10 to P17, P130 4.0 V VDD 5.5 V -25 mA Total of all pins 4.0 V VDD 5.5 V -40 mA 2.7 V VDD < 4.0 V -10 mA Per pin 4.0 V VDD 5.5 V 10 mA Total of P30 to P33, P120 4.0 V VDD 5.5 V 30 mA Total of P00 to P03, P10 to P17, P130 4.0 V VDD 5.5 V 30 mA 4.0 V VDD 5.5 V 50 mA 2.7 V VDD < 4.0 V Input voltage, low Output voltage, high Output voltage, low Input leakage current, high Input leakage current, low Unit Per pin Total of all pins Input voltage, high MAX. 10 mA VIH1 P12, P13, P15 0.7VDD VDD V VIH2 P00 to P03, P10, P11, P14, P16, P17, P30 to P33, P120, 0.8VDD RESET VDD V VIH3 P20 to P23 0.7AVREF AVREF V VIH4 X1, X2 VDD - 0.5 VDD V VIL1 P12, P13, P15 0 0.3VDD V VIL2 P00 to P03, P10, P11, P14, P16, P17, P30 to P33, P120, RESET 0 0.2VDD V VIL3 P20 to P23 0 0.3AVREF V 0 0.4 Note 1 Note 1 VIL4 X1, X2 VOH Total of P30 to P33, P120 pins IOH = -25 mA 4.0 V VDD 5.5 V, IOH = -5 mA VDD - 1.0 V Total of P00 to P03, P10 to P17, P130 pins IOH = -25 mA 4.0 V VDD 5.5 V, IOH = -5 mA VDD - 1.0 V VDD - 0.5 VOL ILIH1 V IOH = -100 A 2.7 V VDD < 4.0 V Total of P30 to P33, P120 pins IOL = 30 mA 4.0 V VDD 5.5 V, IOL = 10 mA 1.3 V Total of P00 to P03, P10 to P17, P130 pins IOL = 30 mA 4.0 V VDD 5.5 V, IOL = 10 mA 1.3 V IOL = 400 A 2.7 V VDD < 4.0 V V 0.4 V VI = VDD P00 to P03, P10 to P17, P30 to P33, P120, RESET 3 A VI = AVREF P20 to P23 3 A Note 2 ILIH2 VI = VDD X1, X2 ILIL1 VI = 0 V P00 to P03, P10 to P17, P20 to P23, P30 to P33, P120, RESET ILIL2 X1, X2 Note 2 20 A -3 A -20 A Output leakage current, high ILOH VO = VDD 3 A Output leakage current, low ILOL VO = 0 V -3 A Pull-up resistance value R VI = 0 V 10 100 k VPP supply voltage (PD78F0103, 78F0103(A) only) VPP1 In normal operation mode 0 0.2VDD V 30 Notes 1. When used as a digital input port, set AVREF = VDD. 2. When the inverse level of X1 is input to X2. Remark 394 Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins. User's Manual U15836EJ5V0UD CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) DC Characteristics (2/3): PD78F0103, 78F0103(A) (TA = -40 to +85C, 2.7 V VDD 5.5 V, 2.7 V AVREF VDD, VSS = AVSS = 0 V) Parameter Supply current Symbol IDD1 Note 1 Conditions X1 crystal fXP = 10 MHz, oscillation VDD = 5.0 V 10% When A/D converter is operating fXP = 5 MHz, When A/D converter is stopped operating mode IDD2 Note 2 X1 crystal fXP = 10 MHz, When peripheral functions are stopped oscillation VDD = 5.0 V 10% When peripheral functions are operating fXP = 5 MHz, When peripheral functions are stopped VDD = 3.0 V 10% When peripheral functions are operating Ring-OSC mode Note 5 STOP Note 4 11.6 19.5 mA 12.6 21.5 mA 4 6.4 mA 4.6 7.6 mA 1.4 2.8 mA 5.5 mA 0.32 0.64 mA 1.9 mA VDD = 5.0 V 10% 0.37 1.51 mA VDD = 3.0 V 10% 0.29 1.16 mA POC: OFF, RING: OFF 0.1 30 A POC: OFF, RING: ON 14 58 A Note 6 3.5 35.5 A Note 6 17.5 63.5 A POC: OFF, RING: OFF 0.05 10 A POC: OFF, RING: ON 7.5 25 A Note 6 3.5 15.5 A Note 6 11 30.5 A VDD = 5.0 V 10% mode POC: ON POC: ON VDD = 3.0 V 10% POC: ON POC: ON Notes 1. Note 4 When A/D converter is operating Note 3 operating IDD4 When A/D converter is stopped Note 3 VDD = 3.0 V 10% HALT mode IDD3 MIN. TYP. MAX. Unit , RING: OFF , RING: ON , RING: OFF , RING: ON 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). 2. IDD1 includes peripheral operation current. 3. When PCC = 00H. 4. Total current flowing through VDD and AVREF pins. 5. When X1 oscillator is stopped. 6. Including when LVIE (bit 4 of LVIM) = 1 in the PD78F0103M1, 78F0103M2, 78F0103M1(A), and 78F0103M2(A). User's Manual U15836EJ5V0UD 395 CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) DC Characteristics (3/3): PD780101, 780102, 780103, 780101(A), 780102(A), 780103(A) (TA = -40 to +85C, 2.7 V VDD 5.5 V, 2.7 V AVREF VDD, VSS = AVSS = 0 V) Parameter Supply current Symbol IDD1 Conditions X1 crystal fXP = 10 MHz, When A/D converter is stopped oscillation VDD = 5.0 V 10% Note 1 MIN. TYP. MAX. Unit 6 10.9 mA 7 12.9 mA 1.7 3.1 mA 2.3 4.3 mA 1.3 2.6 mA 4.8 mA 0.5 mA 1.1 mA 0.18 0.72 mA 0.11 0.44 mA POC: OFF, RING: OFF 0.1 30 A POC: OFF, RING: ON 14 58 A Note 6 3.5 35.5 A Note 6 17.5 63.5 A POC: OFF, RING: OFF 0.05 10 A POC: OFF, RING: ON 7.5 25 A Note 6 3.5 15.5 A Note 6 11 30.5 A Note 3 operating mode IDD2 Note 2 fXP = 5 MHz, When A/D converter is stopped VDD = 3.0 V 10% Note 3 X1 crystal fXP = 10 MHz, oscillation VDD = 5.0 V 10% HALT mode IDD3 When A/D converter is operating mode When peripheral functions are stopped When peripheral functions are operating fXP = 5 MHz, When peripheral functions are stopped VDD = 3.0 V 10% When peripheral functions are operating Note 5 STOP VDD = 3.0 V 10% VDD = 5.0 V 10% mode POC: ON POC: ON VDD = 3.0 V 10% POC: ON POC: ON Notes 1. Note 4 Ring-OSC VDD = 5.0 V 10% operating IDD4 When A/D converter is operating Note 4 , RING: OFF , RING: ON , RING: OFF , RING: ON 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). 2. 396 0.25 IDD1 includes peripheral operation current. 3. When PCC = 00H. 4. Total current flowing through VDD and AVREF pins. 5. When X1 oscillator is stopped. 6. Including when LVIE (bit 4 of LVIM) = 1 with POC-OFF selected by a mask option. User's Manual U15836EJ5V0UD CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) AC Characteristics (1) Basic operation (TA = -40 to +85C, 2.7 V VDD 5.5 V, 2.7 V AVREF VDD, VSS = AVSS = 0 V) Parameter Instruction cycle (minimum Symbol TCY Conditions X1 input clock instruction execution time) MIN. tTIH0, width, low-level width tTIL0 16 s 3.3 V VDD < 4.0 V 0.238 16 s 2.7 V VDD < 3.3 V 0.4 16 s 16.67 s 4.17 4.0 V VDD 5.5 V 8.33 s 2/fsam+ 0.1 Note s 2/fsam+ 0.2 fTI5 Unit 0.2 2.7 V VDD < 4.0 V TI50 input frequency MAX. 4.0 V VDD 5.5 V Ring-OSC clock TI000, TI010 input high-level TYP. Note 4.0 V VDD 5.5 V 10 MHz 2.7 V VDD < 4.0 V 5 MHz TI50 input high-level width, low- tTIH5, 4.0 V VDD 5.5 V 50 level width tTIL5 2.7 V VDD < 4.0 V 100 ns Interrupt input high-level width, tINTH, 1 s low-level width tINTL RESET low-level width tRSL 10 s ns Note Selection of fsam = fXP, fXP/4, 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. TCY vs. VDD (X1 Input Clock Operation) Cycle time TCY [ s] 20.0 16.0 10.0 5.0 Guaranteed operation range 2.0 1.0 0.4 0.238 0.2 0.1 0 1.0 2.0 3.0 2.7 3.3 4.0 5.0 5.5 6.0 Supply voltage VDD [V] User's Manual U15836EJ5V0UD 397 CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) (2) Serial interface (TA = -40 to +85C, 2.7 V VDD 5.5 V, 2.7 V AVREF VDD, VSS = AVSS = 0 V) (a) UART mode (UART6, dedicated baud rate generator output) Parameter Symbol Conditions MIN. TYP. Transfer rate MAX. Unit 312.5 kbps (b) UART mode (UART0, dedicated baud rate generator output): PD780102, 780103, 78F0103, 780102(A), 780103(A), and 78F0103(A) only Parameter Symbol Conditions MIN. TYP. Transfer rate MAX. Unit 312.5 kbps MAX. Unit (c) 3-wire serial I/O mode (master mode, SCK10... internal clock output) Parameter SCK10 cycle time SCK10 high-/low-level width Symbol tKCY1 Conditions MIN. TYP. 4.0 V VDD 5.5 V 200 ns 3.3 V VDD < 4.0 V 240 ns 2.7 V VDD < 3.3 V 400 ns tKCY1/2-10 ns 30 ns 30 ns tKH1, tKL1 SI10 setup time (to SCK10) tSIK1 SI10 hold time (from SCK10) tKSI1 Delay time from SCK10 to tKSO1 Note C = 100 pF 30 ns MAX. Unit SO10 output Note C is the load capacitance of the SCK10 and SO10 output lines. (d) 3-wire serial I/O mode (slave mode, SCK10... external clock input) Parameter SCK10 cycle time SCK10 high-/low-level width Symbol Conditions MIN. TYP. tKCY2 400 ns tKH2, tKCY2/2 ns 80 ns tKL2 SI10 setup time (to SCK10) tSIK2 SI10 hold time (from SCK10) tKSI2 Delay time from SCK10 to tKSO2 50 Note C = 100 pF SO10 output Note C is the load capacitance of the SO10 output line. 398 User's Manual U15836EJ5V0UD ns 120 ns CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) AC Timing Test Points (Excluding X1 Input) 0.8VDD 0.8VDD Test points 0.2VDD 0.2VDD Clock Timing 1/fXP tXL tXH VIH4 (MIN.) VIL4 (MAX.) X1 input TI Timing tTIH0 tTIL0 TI000, TI010 1/fTI5 tTIL5 tTIH5 tINTL tINTH TI50 Interrupt Request Input Timing INTP0 to INTP5 RESET Input Timing tRSL RESET User's Manual U15836EJ5V0UD 399 CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) Serial Transfer Timing 3-wire serial I/O mode: tKCYm tKLm tKHm SCK10 tSIKm SI10 tKSIm Input data tKSOm Output data SO10 Remark m = 1, 2 A/D Converter Characteristics (TA = -40 to +85C, 2.7 V VDD 5.5 V, 2.7 V AVREF VDD, VSS = AVSS = 0 V) Parameter Symbol Conditions MIN. TYP. MAX. Unit 10 10 10 bit 4.0 V AVREF 5.5 V 0.2 0.4 %FSR 2.7 V AVREF < 4.0 V 0.3 0.6 %FSR Resolution Notes 1, 2 Overall error Conversion time tCONV Notes 1, 2 Zero-scale error Full-scale error Notes 1, 2 Note 1 Integral non-linearity error Differential non-linearity error Analog input voltage Notes 1. 2. 400 Note 1 4.0 V AVREF 5.5 V 14 100 s 2.7 V AVREF < 4.0 V 17 100 s 4.0 V AVREF 5.5 V 0.4 %FSR 2.7 V AVREF < 4.0 V 0.6 %FSR 4.0 V AVREF 5.5 V 0.4 %FSR 2.7 V AVREF < 4.0 V 0.6 %FSR 4.0 V AVREF 5.5 V 2.5 LSB 2.7 V AVREF < 4.0 V 4.5 LSB 4.0 V AVREF 5.5 V 1.5 LSB 2.7 V AVREF < 4.0 V 2.0 LSB AVREF V VAIN AVSS Excludes quantization error (1/2 LSB). This value is indicated as a ratio (%FSR) to the full-scale value. User's Manual U15836EJ5V0UD CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) POC Circuit Characteristics (TA = -40 to +85C) Parameter Symbol Detection voltage VPOC0 Power supply rise time Response delay time 1 Note 3 Conditions Mask option = 3.5 V Note 1 Note 2 MIN. TYP. MAX. Unit 3.3 3.5 3.7 V 2.7 2.85 3.0 VPOC1 Mask option = 2.85 V tPTH VDD: 0 V 2.7 V 0.0015 ms VDD: 0 V 3.3 V 0.002 ms tPTHD When power supply rises, after reaching V 3.0 ms 1.0 ms detection voltage (MAX.) Response delay time 2 Minimum pulse width Note 4 tPD When VDD falls tPW 0.2 ms Notes 1. When flash memory version PD78F0103M5, 78F0103M6, 78F0103M5(A), or 78F0103M6(A) is used 2. When flash memory version PD78F0103M3, 78F0103M4, 78F0103M3(A), or 78F0103M4(A) is used 3. Time required from voltage detection to reset release. 4. Time required from voltage detection to internal reset output. POC Circuit Timing Supply voltage (VDD) Detection voltage (MAX.) Detection voltage (TYP.) Detection voltage (MIN.) tPW tPTH tPTHD tPD Time User's Manual U15836EJ5V0UD 401 CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) LVI Circuit Characteristics (TA = -40 to +85C) Parameter Symbol Detection voltage Note 1 MIN. TYP. MAX. Unit VLVI0 4.1 4.3 4.5 V VLVI1 3.9 4.1 4.3 V VLVI2 3.7 3.9 4.1 V VLVI3 3.5 3.7 3.9 V VLVI4 3.3 3.5 3.7 V VLVI5 3.15 3.3 3.45 V VLVI6 2.95 3.1 3.25 V 0.2 2.0 ms Response time tLD Minimum pulse width tLW Conditions 0.2 Reference voltage stabilization wait tLWAIT0 time ms 0.5 2.0 ms 0.1 0.2 ms Note 2 Operation stabilization wait time Notes 1. 2. Note 3 tLWAIT1 Time required from voltage detection to interrupt output or internal reset output. Time required from setting LVIE to 1 to reference voltage stabilization when POC-OFF is selected by mask option (for the flash memory version, when the PD78F0103M1, 78F0103M2, 78F0103M1(A), or 78F0103M2(A) is used). 3. Time required from setting LVION to 1 to operation stabilization. Remarks 1. VLVI0 > VLVI1 > VLVI2 > VLVI3 > VLVI4 > VLVI5 > VLVI6 2. VPOCn < VLVIm (n = 0 or 1, m = 0 to 6) LVI Circuit Timing Supply voltage (VDD) Detection voltage (MAX.) Detection voltage (TYP.) Detection voltage (MIN.) tLW tLWAIT0 tLWAIT1 tLD LVIE 1 LVION 1 Time Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (TA = -40 to +85C) Parameter Data retention supply voltage Symbol VDDDR Conditions When POC-OFF is selected by mask option Release signal set time MIN. 1.6 TYP. MAX. Unit 5.5 V Note tSREL 0 Note When flash memory version PD78F0103M1, 78F0103M2, 78F0103M1(A), or 78F0103M2(A) is used 402 User's Manual U15836EJ5V0UD s CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) Flash Memory Programming Characteristics: PD78F0103, 78F0103(A) (TA = +10 to +60C, 2.7 V VDD 5.5 V, 2.7 V AVREF VDD, VSS = AVSS = 0 V) (1) Write erase characteristics Parameter Symbol Conditions MIN. TYP. MAX. Unit 9.7 10.0 10.3 V VPP supply voltage VPP2 During flash memory programming VDD supply current IDD When VPP = VPP2, fXP = 10 MHz, VDD = 5.5 V 37 mA VPP supply current IPP VPP = VPP2 100 mA 0.201 s 20 s/chip Step erase time Note 1 Ter Note 2 Overall erase time Writeback time Tera Note 3 Cwb 0.2 When step erase time = 0.2 s Twb Number of writebacks per 1 writeback command 0.199 49.4 50 When writeback time = 50 ms 50.6 ms 60 Times 16 Times 52 s 520 s 20 Times/ Note 4 Number of erases/writebacks Note 5 Step write time Overall write time per word Cerwb Twr Note 6 Twrw 48 When step write time = 50 s (1 word = 1 48 50 byte) Note 7 Number of rewrites per chip Cerwr 1 erase + 1 write after erase = 1 rewrite area Notes 1. The recommended setting value of the step erase time is 0.2 s. 2. The prewrite time before erasure and the erase verify time (writeback time) are not included. 3. The recommended setting value of the writeback time is 50 ms. 4. Writeback is executed once by the issuance of the writeback command. Therefore, the number of retries must be the maximum value minus the number of commands issued. 5. The recommended setting value of the step write time is 50 s. 6. The actual write time per word is 100 s longer. The internal verify time during or after a write is not included. 7. When a product is first written after shipment, "erase write" and "write only" are both taken as one rewrite. Example: P: Write, E: Erase Shipped product P E P E P: 3 rewrites Shipped product E P E P E P: 3 rewrites Remark The range of the operating clock during flash memory programming is the same as the range during normal operation. User's Manual U15836EJ5V0UD 403 CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) (2) Serial write operation characteristics Parameter Symbol Set time from VDD to VPP Conditions MIN. TYP. MAX. Unit s tDP 10 Release time from VPP to RESET tPR 10 s VPP pulse input start time from tRP 2 ms VPP pulse high-/low-level width tPW 8 s VPP pulse input end time from tRPE RESET 14 ms 1.2VDD V 10.3 V RESET VPP pulse low-level input voltage VPPL 0.8VDD VPP pulse high-level input voltage VPPH 9.7 Flash Write Mode Setting Timing VDD VDD 0V tDP tRP tPW VPPH VPP VPPL tPW 0V tPR tRPE VDD RESET (input) 0V 404 User's Manual U15836EJ5V0UD 10.0 CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) Target products: PD780101(A1), 780102(A1), 780103(A1), 78F0103(A1) Absolute Maximum Ratings (TA = 25C) Parameter Supply voltage Symbol Conditions VDD PD78F0103(A1) only Note 2 VI1 P00 to P03, P10 to P17, P20 to P23, P30 to P33, P120, X1, X2, RESET VI2 VPP in flash programming mode (PD78F0103(A1) only) VAN Output current, high IOH IOL -0.3 to VDD + 0.3 V Note 1 V -0.3 to +10.5 V Note 1 V V mA P30 to P33, P120 -24 mA P00 to P03, P10 to P17, P130 -24 mA Total of all pins -40 mA Per pin 16 mA P30 to P33, P120 28 mA P00 to P03, P10 to P17, P130 28 mA 48 mA -40 to +110 C PD780101(A1), 780102(A1), 780103(A1) PD78F0103(A1) Storage temperature -0.3 to +10.5 -8 Per pin Total of all pins TA V AVSS - 0.3 to AVREF + 0.3 Note 1 and -0.3 to VDD + 0.3 Total of pins Operating ambient temperature V Note 1 Total of pins Output current, low V Note 1 -0.3 to VDD + 0.3 VO Analog input voltage V -0.3 to +0.3 AVSS Output voltage -0.3 to +6.5 -0.3 to VDD + 0.3 AVREF Input voltage Unit -0.3 to +0.3 VSS VPP Ratings Tstg In normal operation mode -40 to +105 In flash memory programming -10 to +85 PD780101(A1), 780102(A1), -65 to +150 C 780103(A1) PD78F0103(A1) -40 to +125 Note 1. Must be 6.5 V or lower. (Refer to Note 2 on the next page.) Caution Product quality may suffer if the absolute maximum rating is exceeded even momentarily for any parameter. That is, the absolute maximum ratings are rated values at which the product is on the verge of suffering physical damage, and therefore the product must be used under conditions that ensure that the absolute maximum ratings are not exceeded. Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins. User's Manual U15836EJ5V0UD 405 CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) Note 2. Make sure that the following conditions of the VPP voltage application timing are satisfied when the flash memory is written. * When supply voltage rises VPP must exceed VDD 10 s or more after VDD has reached the lower-limit value (3.3 V) of the operating voltage range (see a in the figure below). * When supply voltage drops VDD must be lowered 10 s or more after VPP falls below the lower-limit value (3.3 V) of the operating voltage range of VDD (see b in the figure below). VDD 3.3 V 0V a b VPP 3.3 V 0V 406 User's Manual U15836EJ5V0UD CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) X1 Oscillator Characteristics (TA = -40 to +110CNote 1, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Resonator Recommended Circuit Ceramic resonator VSS X1 Oscillation frequency Note 2 (fXP) Conditions MIN. TYP. MAX. Unit MHz 4.5 V VDD 5.5 V 2.0 10 4.0 V VDD < 4.5 V 2.0 8.38 3.3 V VDD < 4.0 V 2.0 5.0 4.5 V VDD 5.5 V 2.0 10 4.0 V VDD < 4.5 V 2.0 8.38 3.3 V VDD < 4.0 V 2.0 5.0 4.5 V VDD 5.5 V 2.0 10 4.0 V VDD < 4.5 V 2.0 8.38 3.3 V VDD < 4.0 V 2.0 5.0 4.5 V VDD 5.5 V 46 500 4.0 V VDD < 4.5 V 56 500 3.3 V VDD < 4.0 V 96 500 C2 C1 Crystal resonator X2 Parameter VSS X1 X2 C1 C2 X1 X2 External clock Oscillation frequency Note 2 (fXP) X1 input frequency Note 2 (fXP) X1 input high-/lowlevel width (tXH, tXL) MHz MHz ns Notes 1. TA = -40 to +110C: PD780101(A1), 780102(A1), 780103(A1) TA = -40 to +105C: PD78F0103(A1) 2. Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time. Cautions 1. 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. 2. Since the CPU is started by the Ring-OSC after reset is released, check the oscillation stabilization time of the X1 input clock using the oscillation stabilization time counter status register (OSTC). Determine the oscillation stabilization time of the OSTC register and oscillation stabilization time select register (OSTS) after sufficiently evaluating the oscillation stabilization time with the resonator to be used. 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. Ring-OSC Oscillator Characteristics (TA = -40 to +110CNote, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Resonator On-chip Ring-OSC oscillator Note Parameter Conditions Oscillation frequency (fR) MIN. TYP. MAX. Unit 120 240 490 kHz TA = -40 to +110C: PD780101(A1), 780102(A1), 780103(A1) TA = -40 to +105C: PD78F0103(A1) User's Manual U15836EJ5V0UD 407 CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) DC Characteristics (1/4): PD78F0103(A1) (TA = -40 to +105C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Parameter Output current, high Symbol IOH MAX. Unit Per pin Conditions 4.0 V VDD 5.5 V -4 mA Total of P30 to P33, P120 IOL 4.0 V VDD 5.5 V -20 mA -20 mA 4.0 V VDD 5.5 V -25 mA 3.3 V VDD < 4.0 V -8 mA Per pin 4.0 V VDD 5.5 V 8 mA Total of P30 to P33, P120 4.0 V VDD 5.5 V 24 mA Total of P00 to P03, P10 to P17, P130 4.0 V VDD 5.5 V 24 mA 4.0 V VDD 5.5 V 30 mA 3.3 V VDD < 4.0 V 8 mA Total of all pins Input voltage, high Input voltage, low Output voltage, high Output voltage, low Input leakage current, high Input leakage current, low TYP. Total of P00 to P03, P10 to P17, P130 4.0 V VDD 5.5 V Total of all pins Output current, low MIN. VIH1 P12, P13, P15 0.7VDD VDD V VIH2 P00 to P03, P10, P11, P14, P16, P17, P30 to P33, P120, 0.8VDD RESET VDD V VIH3 P20 to P23 AVREF V Note 1 0.7AVREF VIH4 X1, X2 VDD - 0.5 VDD V VIL1 P12, P13, P15 0 0.3VDD V VIL2 P00 to P03, P10, P11, P14, P16, P17, P30 to P33, P120, RESET 0 0.2VDD V VIL3 P20 to P23 0 0.3AVREF V VIL4 X1, X2 0 0.4 V VOH Total of P30 to P33, P120 pins IOH = -20 mA 4.0 V VDD 5.5 V, IOH = -4 mA VDD - 1.0 V Total of P00 to P03, P10 to P17, P130 pins IOH = -20 mA 4.0 V VDD 5.5 V, IOH = -4 mA VDD - 1.0 V IOH = -100 A 3.3 V VDD < 4.0 V VDD - 0.5 V Total of P30 to P33, P120 pins IOL = 24 mA 4.0 V VDD 5.5 V, IOL = 8 mA 1.3 V Total of P00 to P03, P10 to P17, P130 pins IOL = 24 mA 4.0 V VDD 5.5 V, IOL = 8 mA 1.3 V IOL = 400 A VOL ILIH1 Note 1 3.3 V VDD < 4.0 V 0.4 V VI = VDD P00 to P03, P10 to P17, P30 to P33, P120, RESET 10 A 10 A 20 A -10 A -20 A 10 A VI = AVREF P20 to P23 ILIH2 VI = VDD X1, X2 ILIL1 VI = 0 V P00 to P03, P10 to P17, P20 to P23, P30 to P33, P120, RESET ILIL2 Output leakage current, high ILOH X1, X2 Note 2 Note 2 VO = VDD Output leakage current, low ILOL VO = 0 V Pull-up resistance value R VI = 0 V 10 VPP supply voltage VPP1 In normal operation mode 0 30 -10 A 120 k 0.2VDD V Notes 1. When used as a digital input port, set AVREF = VDD. 2. When the inverse level of X1 is input to X2. Remark 408 Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins. User's Manual U15836EJ5V0UD CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) DC Characteristics (2/4): PD780101(A1), 780102(A1), 780103(A1) (TA = -40 to +110C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Parameter Output current, high Symbol IOH Conditions IOL Input voltage, low Output voltage, high Output voltage, low Input leakage current, high Input leakage current, low MAX. Unit 4.0 V VDD 5.5 V -4 mA Total of P30 to P33, P120 4.0 V VDD 5.5 V -20 mA Total of P00 to P03, P10 to P17, P130 4.0 V VDD 5.5 V -20 mA 4.0 V VDD 5.5 V -32 mA 3.3 V VDD < 4.0 V -8 mA Per pin 4.0 V VDD 5.5 V 8 mA Total of P30 to P33, P120 4.0 V VDD 5.5 V 24 mA Total of P00 to P03, P10 to P17, P130 4.0 V VDD 5.5 V 24 mA 4.0 V VDD 5.5 V 40 mA 3.3 V VDD < 4.0 V 8 mA Total of all pins Input voltage, high TYP. Per pin Total of all pins Output current, low MIN. VIH1 P12, P13, P15 0.7VDD VDD V VIH2 P00 to P03, P10, P11, P14, P16, P17, P30 to P33, P120, 0.8VDD RESET VDD V VIH3 P20 to P23 AVREF V Note 1 0.7AVREF VIH4 X1, X2 VDD - 0.5 VDD V VIL1 P12, P13, P15 0 0.3VDD V VIL2 P00 to P03, P10, P11, P14, P16, P17, P30 to P33, P120, RESET 0 0.2VDD V VIL3 P20 to P23 0 0.3AVREF V 0 0.4 Note 1 VIL4 X1, X2 VOH Total of P30 to P33, P120 pins IOH = -20 mA 4.0 V VDD 5.5 V, IOH = -4 mA VDD - 1.0 V Total of P00 to P03, P10 to P17, P130 pins IOH = -20 mA 4.0 V VDD 5.5 V, IOH = -4 mA VDD - 1.0 V IOH = -100 A 3.3 V VDD < 4.0 V VDD - 0.5 V Total of P30 to P33, P120 pins IOL = 24 mA 4.0 V VDD 5.5 V, IOL = 8 mA 1.3 V Total of P00 to P03, P10 to P17, P130 pins IOL = 24 mA 4.0 V VDD 5.5 V, IOL = 8 mA 1.3 V IOL = 400 A VOL ILIH1 V 3.3 V VDD < 4.0 V 0.4 V VI = VDD P00 to P03, P10 to P17, P30 to P33, P120, RESET 10 A 10 A 20 A -10 A -20 A VI = AVREF P20 to P23 ILIH2 VI = VDD X1, X2 ILIL1 VI = 0 V P00 to P03, P10 to P17, P20 to P23, P30 to P33, P120, RESET ILIL2 X1, X2 Note 2 Note 2 Output leakage current, high ILOH VO = VDD 10 A Output leakage current, low ILOL VO = 0 V -10 A Pull-up resistance value R VI = 0 V 120 k 10 30 Notes 1. When used as a digital input port, set AVREF = VDD. 2. When the inverse level of X1 is input to X2. Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins. User's Manual U15836EJ5V0UD 409 CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) DC Characteristics (3/4): PD78F0103(A1) (TA = -40 to +105C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Parameter Supply current Symbol IDD1 Note 1 Conditions MIN. TYP. MAX. Unit X1 crystal fXP = 10 MHz, oscillation VDD = 5.0 V 10% When A/D converter is operating X1 crystal fXP = 10 MHz, When peripheral functions are stopped oscillation VDD = 5.0 V 10% When peripheral functions are operating When A/D converter is stopped Note 3 Note 4 11.6 20.6 mA 12.6 22.6 mA 1.4 3.9 mA 6.6 mA operating mode IDD2 Note 2 HALT mode IDD3 Ring-OSC VDD = 5.0 V 10% 0.37 2.61 mA VDD = 5.0 V 10% 0.19 1.86 mA POC: OFF, RING: OFF 0.1 1100 A POC: OFF, RING: ON 14 1200 A Note 6 3.5 1100 A 17.5 1200 A operating mode IDD4 Note 5 Ring-OSC HALT mode IDD5 Note 5 STOP VDD = 5.0 V 10% mode POC: ON , RING: OFF Note 6 POC: ON Notes 1. , RING: ON 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). 410 2. IDD1 includes peripheral operation current. 3. When PCC = 00H. 4. Total current flowing through VDD and AVREF pins. 5. When X1 oscillator is stopped. 6. Including when LVIE (bit 4 of LVIM) = 1 in the PD78F0103M1(A1) and 78F0103M2(A1). User's Manual U15836EJ5V0UD CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) DC Characteristics (4/4): PD780101(A1), 780102(A1), 780103(A1) (TA = -40 to +110C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Parameter Supply current Symbol IDD1 Conditions X1 crystal fXP = 10 MHz, When A/D converter is stopped oscillation VDD = 5.0 V 10% Note 1 MIN. TYP. MAX. Unit Note 3 When A/D converter is operating Note 4 6 11.7 mA 7 13.7 mA 1.3 3.4 mA 5.6 mA 0.18 1.52 mA 0.05 1.00 mA 0.1 800 A operating mode IDD2 Note 2 X1 crystal fXP = 10 MHz, When peripheral functions are stopped oscillation VDD = 5.0 V 10% When peripheral functions are operating HALT mode IDD3 Ring-OSC VDD = 5.0 V 10% operating mode IDD4 Note 5 Ring-OSC VDD = 5.0 V 10% HALT mode IDD5 Note 5 STOP VDD = 5.0 V 10% mode POC: OFF, RING: OFF POC: OFF, RING: ON 14 900 A Note 6 3.5 800 A Note 6 17.5 900 A POC: ON POC: ON Notes 1. , RING: OFF , RING: ON 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). 2. IDD1 includes peripheral operation current. 3. When PCC = 00H. 4. Total current flowing through VDD and AVREF pins. 5. When X1 oscillator is stopped. 6. Including when LVIE (bit 4 of LVIM) = 1 with POC-OFF selected by a mask option. User's Manual U15836EJ5V0UD 411 CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) AC Characteristics (1) Basic operation (TA = -40 to +110CNote 1, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Parameter Instruction cycle (minimum instruction execution time) Symbol Conditions TCY X1 input clock MAX. Unit 4.5 V VDD 5.5 V MIN. 0.2 16 s 4.0 V VDD < 4.5 V 0.238 16 s 3.3 V VDD < 4.0 V 0.4 16 s 16.67 s Ring-OSC clock TI000, TI010 input high-level width, low-level width TI50 input frequency tTIH0, tTIL0 fTI5 TI50 input high-level width, low- tTIH5, level width tTIL5 4.09 TYP. 8.33 4.0 V VDD 5.5 V 2/fsam+ Note 2 0.1 s 3.3 V VDD < 4.0 V 2/fsam+ Note 2 0.2 s 4.0 V VDD 5.5 V 10 MHz 3.3 V VDD < 4.0 V 5 MHz 4.0 V VDD 5.5 V 50 ns 3.3 V VDD < 4.0 V 100 ns Interrupt input high-level width, low-level width tINTH, tINTL 1 s RESET low-level width tRSL 10 s Notes 1. TA = -40 to +110C: PD780101(A1), 780102(A1), 780103(A1) TA = -40 to +105C: PD78F0103(A1) 2. Selection of fsam = fXP, fXP/4, 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. TCY vs. VDD (X1 Input Clock Operation) 20.0 16.0 Cycle time TCY [ s] 10.0 5.0 Guaranteed operation range 2.0 1.0 0.4 0.238 0.2 0.1 0 1.0 2.0 3.0 3.3 4.0 4.5 Supply voltage VDD [V] 412 User's Manual U15836EJ5V0UD 5.0 5.5 6.0 CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) (2) Serial interface (TA = -40 to +110CNote, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Note TA = -40 to +110C: PD780101(A1), 780102(A1), 780103(A1) TA = -40 to +105C: PD78F0103(A1) (a) UART mode (UART6, dedicated baud rate generator output) Parameter Symbol Conditions MIN. TYP. Transfer rate MAX. Unit 312.5 kbps MAX. Unit 312.5 kbps MAX. Unit (b) UART mode (UART0, dedicated baud rate generator output): PD780102(A1), 780103(A1), and 78F0103(A1) only Parameter Symbol Conditions MIN. TYP. Transfer rate (c) 3-wire serial I/O mode (master mode, SCK10... internal clock output) Parameter SCK10 cycle time SCK10 high-/low-level width Symbol tKCY1 Conditions MIN. TYP. 4.5 V VDD 5.5 V 200 ns 4.0 V VDD < 4.5 V 240 ns 3.3 V VDD < 4.0 V 400 ns tKCY1/2-10 ns 30 ns tKH1, tKL1 SI10 setup time (to SCK10) tSIK1 SI10 hold time (from SCK10) tKSI1 Delay time from SCK10 to tKSO1 30 ns Note C = 100 pF 30 ns MAX. Unit SO10 output Note C is the load capacitance of the SCK10 and SO10 output lines. (d) 3-wire serial I/O mode (slave mode, SCK10... external clock input) Parameter SCK10 cycle time SCK10 high-/low-level width Symbol Conditions MIN. TYP. tKCY2 400 ns tKH2, tKCY2/2 ns 80 ns 50 ns tKL2 SI10 setup time (to SCK10) tSIK2 SI10 hold time (from SCK10) tKSI2 Delay time from SCK10 to tKSO2 Note C = 100 pF 120 ns SO10 output Note C is the load capacitance of the SO10 output line. User's Manual U15836EJ5V0UD 413 CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) AC Timing Test Points (Excluding X1 Input) 0.8VDD 0.8VDD Test points 0.2VDD 0.2VDD Clock Timing 1/fXP tXL tXH VIH4 (MIN.) VIL4 (MAX.) X1 input TI Timing tTIH0 tTIL0 TI000, TI010 1/fTI5 tTIL5 tTIH5 tINTL tINTH TI50 Interrupt Request Input Timing INTP0 to INTP5 RESET Input Timing tRSL RESET 414 User's Manual U15836EJ5V0UD CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) Serial Transfer Timing 3-wire serial I/O mode: tKCYm tKLm tKHm SCK10 tSIKm SI10 tKSIm Input data tKSOm Output data SO10 Remark m = 1, 2 A/D Converter Characteristics (TA = -40 to +110CNote 1, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Parameter Symbol Conditions MIN. TYP. MAX. Unit 10 10 10 bit 4.0 V AVREF 5.5 V 0.2 0.6 %FSR 3.3 V AVREF < 4.0 V 0.3 0.8 %FSR Resolution Notes 2, 3 Overall error Conversion time tCONV Notes 2, 3 Zero-scale error Full-scale error Notes 2, 3 Note 2 Integral non-linearity error Differential non-linearity error Analog input voltage Note 2 4.0 V AVREF 5.5 V 14 60 s 3.3 V AVREF < 4.0 V 19 60 s 4.0 V AVREF 5.5 V 0.6 %FSR 3.3 V AVREF < 4.0 V 0.8 %FSR 4.0 V AVREF 5.5 V 0.6 %FSR 3.3 V AVREF < 4.0 V 0.8 %FSR 4.0 V AVREF 5.5 V 4.5 LSB 3.3 V AVREF < 4.0 V 6.5 LSB 4.0 V AVREF 5.5 V 2.0 LSB 3.3 V AVREF < 4.0 V 2.5 LSB AVREF V VAIN AVSS Notes 1. TA = -40 to +110C: PD780101(A1), 780102(A1), 780103(A1) TA = -40 to +105C: PD78F0103(A1) 2. Excludes quantization error (1/2 LSB). 3. This value is indicated as a ratio (%FSR) to the full-scale value. User's Manual U15836EJ5V0UD 415 CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) POC Circuit Characteristics (TA = -40 to +110CNote 1) Parameter Symbol Detection voltage VPOC0 Power supply rise time Response delay time 1 Note 3 Conditions Mask option = 3.5 V Note 2 tPTH VDD: 0 V 3.3 V tPTHD When power supply rises, after reaching MIN. TYP. MAX. Unit 3.3 3.5 3.72 V 0.002 ms 3.0 ms 1.0 ms detection voltage (MAX.) Response delay time 2 Minimum pulse width Note 4 tPD When VDD falls tPW 0.2 ms Notes 1. TA = -40 to +110C: PD780101(A1), 780102(A1), 780103(A1) TA = -40 to +105C: PD78F0103(A1) 2. When flash memory version PD78F0103M5(A1) or 78F0103M6(A1) is used 3. Time required from voltage detection to reset release. 4. Time required from voltage detection to internal reset output. POC Circuit Timing Supply voltage (VDD) Detection voltage (MAX.) Detection voltage (TYP.) Detection voltage (MIN.) tPW tPTH tPTHD tPD Time 416 User's Manual U15836EJ5V0UD CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) LVI Circuit Characteristics (TA = -40 to +110CNote 1) Parameter Symbol Detection voltage Note 2 MIN. TYP. MAX. Unit VLVI0 4.1 4.3 4.52 V VLVI1 3.9 4.1 4.32 V VLVI2 3.7 3.9 4.12 V VLVI3 3.5 3.7 3.92 V VLVI4 3.3 3.5 3.72 V 0.2 2.0 ms Response time tLD Minimum pulse width tLW Conditions 0.2 Reference voltage stabilization wait tLWAIT0 Note 3 time Operation stabilization wait time Note 4 tLWAIT1 ms 0.5 2.0 ms 0.1 0.2 ms Notes 1. TA = -40 to +110C: PD780101(A1), 780102(A1), 780103(A1) TA = -40 to +105C: PD78F0103(A1) 2. Time required from voltage detection to interrupt output or internal reset output. 3. Time required from setting LVIE to 1 to reference voltage stabilization when POC-OFF is selected by mask option (for the flash memory version, when the PD78F0103M1(A1) or 78F0103M2(A1) is used). 4. Time required from setting LVION to 1 to operation stabilization. Remarks 1. VLVI0 > VLVI1 > VLVI2 > VLVI3 > VLVI4 2. VPOC0 < VLVIm (m = 0 to 4) LVI Circuit Timing Supply voltage (VDD) Detection voltage (MAX.) Detection voltage (TYP.) Detection voltage (MIN.) tLW tLWAIT0 tLWAIT1 tLD LVIE 1 LVION 1 Time Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (TA = -40 to +110C Note 1 Parameter Data retention supply voltage Symbol VDDDR Conditions When POC-OFF is selected by mask option Release signal set time MIN. 2.0 TYP. ) MAX. Unit 5.5 V Note 2 tSREL 0 s Notes 1. TA = -40 to +110C: PD780101(A1), 780102(A1), 780103(A1) TA = -40 to +105C: PD78F0103(A1) 2. When flash memory version PD78F0103M1(A1) or 78F0103M2(A1) is used User's Manual U15836EJ5V0UD 417 CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) Flash Memory Programming Characteristics: PD78F0103(A1) (TA = +10 to +60C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) (1) Write erase characteristics Parameter Symbol Conditions MIN. TYP. MAX. Unit 9.7 10.0 10.3 V VPP supply voltage VPP2 During flash memory programming VDD supply current IDD When VPP = VPP2, fXP = 10 MHz, VDD = 5.5 V 37 mA VPP supply current IPP VPP = VPP2 100 mA 0.201 s 20 s/chip Step erase time Note 1 Ter Note 2 Overall erase time Writeback time Tera Note 3 Cwb 0.2 When step erase time = 0.2 s Twb Number of writebacks per 1 writeback command 0.199 49.4 50 When writeback time = 50 ms 50.6 ms 60 Times 16 Times 52 s 520 s 20 Times/ Note 4 Number of erases/writebacks Note 5 Step write time Overall write time per word Cerwb Twr Note 6 Twrw 48 When step write time = 50 s (1 word = 1 48 50 byte) Note 7 Number of rewrites per chip Cerwr 1 erase + 1 write after erase = 1 rewrite area Notes 1. 2. The recommended setting value of the step erase time is 0.2 s. The prewrite time before erasure and the erase verify time (writeback time) are not included. 3. The recommended setting value of the writeback time is 50 ms. 4. Writeback is executed once by the issuance of the writeback command. Therefore, the number of retries 5. The recommended setting value of the step write time is 50 s. 6. The actual write time per word is 100 s longer. The internal verify time during or after a write is not must be the maximum value minus the number of commands issued. included. 7. When a product is first written after shipment, "erase write" and "write only" are both taken as one rewrite. Example: P: Write, E: Erase Shipped product P E P E P: 3 rewrites Shipped product E P E P E P: 3 rewrites Remark The range of the operating clock during flash memory programming is the same as the range during normal operation. 418 User's Manual U15836EJ5V0UD CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) (2) Serial write operation characteristics Parameter Symbol Set time from VDD to VPP Conditions MIN. TYP. MAX. Unit s tDP 10 Release time from VPP to RESET tPR 10 s VPP pulse input start time from tRP 2 ms VPP pulse high-/low-level width tPW 8 s VPP pulse input end time from tRPE RESET 14 ms 1.2VDD V 10.3 V RESET VPP pulse low-level input voltage VPPL 0.8VDD VPP pulse high-level input voltage VPPH 9.7 10.0 Flash Write Mode Setting Timing VDD VDD 0V tDP tRP tPW VPPH VPP VPPL tPW 0V tPR tRPE VDD RESET (input) 0V User's Manual U15836EJ5V0UD 419 CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) Target products: PD780101(A2), 780102(A2), 780103(A2) Absolute Maximum Ratings (TA = 25C) Parameter Supply voltage Symbol Conditions VDD Ratings Unit -0.3 to +6.5 V -0.3 to +0.3 VSS -0.3 to VDD + 0.3 AVREF V Note V -0.3 to +0.3 AVSS V -0.3 to VDD + 0.3 Note VO -0.3 to VDD + 0.3 Note Analog input voltage VAN AVSS - 0.3 to AVREF + 0.3 Note and -0.3 to VDD + 0.3 Output current, high IOH Input voltage VI1 Output voltage P00 to P03, P10 to P17, P20 to P23, P30 to P33, P120, X1, X2, RESET IOL mA P30 to P33, P120 -21 mA P00 to P03, P10 to P17, P130 -21 mA Total of all pins -35 mA Per pin 14 mA P30 to P33, P120 24.5 mA P00 to P03, P10 to P17, P130 24.5 mA 42 mA -40 to +125 C -65 to +150 C Total of all pins TA Storage temperature Tstg V -7 Per pin Total of pins Operating ambient temperature V Note Total of pins Output current, low V In normal operation mode 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. 420 User's Manual U15836EJ5V0UD CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) X1 Oscillator Characteristics (TA = -40 to +125C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Resonator Recommended Circuit Ceramic resonator VSS X1 X2 Parameter VSS X1 MAX. Unit MHz 4.0 V VDD 5.5 V 2.0 8.38 3.3 V VDD < 4.0 V 2.0 5.0 X2 Oscillation frequency 4.0 V VDD 5.5 V 2.0 8.38 (fXP) 3.3 V VDD < 4.0 V 2.0 5.0 X1 input frequency Note MHz C2 External clock 4.0 V VDD 5.5 V 2.0 8.38 (fXP) 3.3 V VDD < 4.0 V 2.0 5.0 X1 input high-/low- 4.0 V VDD 5.5 V 56 500 level width (tXH, tXL) 3.3 V VDD < 4.0 V 96 500 Note X1 TYP. C2 C1 C1 MIN. (fXP) Oscillation frequency Note Crystal resonator Conditions X2 MHz ns Note Indicates only oscillator characteristics. Refer to AC Characteristics for instruction execution time. Cautions 1. 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. 2. Since the CPU is started by the Ring-OSC after reset is released, check the oscillation stabilization time of the X1 input clock using the oscillation stabilization time counter status register (OSTC). Determine the oscillation stabilization time of the OSTC register and oscillation stabilization time select register (OSTS) after sufficiently evaluating the oscillation stabilization time with the resonator to be used. 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. Ring-OSC Oscillator Characteristics (TA = -40 to +125C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Resonator On-chip Ring-OSC oscillator Parameter Conditions Oscillation frequency (fR) User's Manual U15836EJ5V0UD MIN. TYP. MAX. Unit 120 240 495 kHz 421 CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) DC Characteristics (1/2) (TA = -40 to +125C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Parameter Output current, high Symbol IOH Conditions IOL Input voltage, low Output voltage, high Output voltage, low Input leakage current, high Input leakage current, low MAX. Unit 4.0 V VDD 5.5 V -3.5 mA Total of P30 to P33, P120 4.0 V VDD 5.5 V -17.5 mA Total of P00 to P03, P10 to P17, P130 4.0 V VDD 5.5 V -17.5 mA 4.0 V VDD 5.5 V -28 mA 3.3 V VDD < 4.0 V -7 mA Per pin 4.0 V VDD 5.5 V 7 mA Total of P30 to P33, P120 4.0 V VDD 5.5 V 21 mA Total of P00 to P03, P10 to P17, P130 4.0 V VDD 5.5 V 21 mA 4.0 V VDD 5.5 V 35 mA 3.3 V VDD < 4.0 V 7 mA Total of all pins Input voltage, high TYP. Per pin Total of all pins Output current, low MIN. VIH1 P12, P13, P15 0.7VDD VDD V VIH2 P00 to P03, P10, P11, P14, P16, P17, P30 to P33, P120, 0.8VDD RESET VDD V VIH3 P20 to P23 AVREF V Note 1 0.7AVREF VIH4 X1, X2 VDD - 0.5 VDD V VIL1 P12, P13, P15 0 0.3VDD V VIL2 P00 to P03, P10, P11, P14, P16, P17, P30 to P33, P120, RESET 0 0.2VDD V VIL3 P20 to P23 0 0.3AVREF V 0 0.4 Note 1 VIL4 X1, X2 VOH Total of P30 to P33, P120 pins IOH = -17.5 mA 4.0 V VDD 5.5 V, IOH = -3.5 mA VDD - 1.0 V Total of P00 to P03, P10 to P17, P130 pins IOH = -17.5 mA 4.0 V VDD 5.5 V, IOH = -3.5 mA VDD - 1.0 V IOH = -100 A 3.3 V VDD < 4.0 V VDD - 0.5 V Total of P30 to P33, P120 pins IOL = 21 mA 4.0 V VDD 5.5 V, IOL = 7 mA 1.3 V Total of P00 to P03, P10 to P17, P130 pins IOL = 21 mA 4.0 V VDD 5.5 V, IOL = 7 mA 1.3 V IOL = 400 A VOL ILIH1 V 3.3 V VDD < 4.0 V 0.4 V VI = VDD P00 to P03, P10 to P17, P30 to P33, P120, RESET 10 A 10 A 20 A -10 A -20 A VI = AVREF P20 to P23 ILIH2 VI = VDD X1, X2 ILIL1 VI = 0 V P00 to P03, P10 to P17, P20 to P23, P30 to P33, P120, RESET ILIL2 X1, X2 Note 2 Note 2 Output leakage current, high ILOH VO = VDD 10 A Output leakage current, low ILOL VO = 0 V -10 A Pull-up resistance value R VI = 0 V 120 k 10 30 Notes 1. When used as a digital input port, set AVREF = VDD. 2. When the inverse level of X1 is input to X2. Remark 422 Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port pins. User's Manual U15836EJ5V0UD CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) DC Characteristics (2/2) (TA = -40 to +125C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Parameter Supply current Symbol IDD1 Conditions X1 crystal fXP = 8.38 MHz, When A/D converter is stopped oscillation VDD = 5.0 V 10% Note 1 MIN. TYP. MAX. Unit Note 3 When A/D converter is operating Note 4 5.2 10.6 mA 6.2 12.6 mA 1.2 3.6 mA 5.5 mA 0.18 1.92 mA 0.05 1.4 mA 0.1 1200 A operating mode IDD2 Note 2 X1 crystal fXP = 8.38 MHz, When peripheral functions are stopped oscillation VDD = 5.0 V 10% When peripheral functions are operating HALT mode IDD3 Ring-OSC VDD = 5.0 V 10% operating mode IDD4 Note 5 Ring-OSC VDD = 5.0 V 10% HALT mode IDD5 Note 5 STOP VDD = 5.0 V 10% mode POC: OFF, RING: OFF POC: OFF, RING: ON 14 1300 A Note 6 3.5 1200 A 17.5 1300 A POC: ON , RING: OFF Note 6 POC: ON , RING: ON Notes 1. 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). 2. IDD1 includes peripheral operation current. 3. When PCC = 00H. 4. Total current flowing through VDD and AVREF pins. 5. When X1 oscillator is stopped. 6. Including when LVIE (bit 4 of LVIM) = 1 with POC-OFF selected by a mask option. User's Manual U15836EJ5V0UD 423 CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) AC Characteristics (1) Basic operation (TA = -40 to +125C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Parameter Instruction cycle (minimum instruction execution time) Symbol TCY Conditions X1 input clock MAX. Unit 4.0 V VDD 5.5 V 0.238 MIN. 16 s 3.3 V VDD < 4.0 V 0.4 16 s 16.67 s Ring-OSC clock TI000, TI010 input high-level width, low-level width TI50 input frequency tTIH0, tTIL0 fTI5 4.04 TYP. 8.33 4.0 V VDD 5.5 V 2/fsam+ Note 0.1 s 3.3 V VDD < 4.0 V 2/fsam+ Note 0.2 s 4.0 V VDD 5.5 V 8.38 MHz 5 MHz 3.3 V VDD < 4.0 V TI50 input high-level width, low- tTIH5, level width tTIL5 4.0 V VDD 5.5 V 59.6 ns 3.3 V VDD < 4.0 V 100 ns Interrupt input high-level width, low-level width tINTH, tINTL 1 s RESET low-level width tRSL 10 s Note Selection of fsam = fXP, fXP/4, 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. TCY vs. VDD (X1 Input Clock Operation) 20.0 16.0 Cycle time TCY [ s] 10.0 5.0 Guaranteed operation range 2.0 1.0 0.4 0.238 0.2 0.1 0 1.0 2.0 3.0 3.3 4.0 Supply voltage VDD [V] 424 User's Manual U15836EJ5V0UD 5.0 5.5 6.0 CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) (2) Serial interface (TA = -40 to +125C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) (a) UART mode (UART6, dedicated baud rate generator output) Parameter Symbol Conditions MIN. TYP. Transfer rate MAX. Unit 261.9 kbps (b) UART mode (UART0, dedicated baud rate generator output): PD780102(A2) and 780103(A2) only Parameter Symbol Conditions MIN. TYP. Transfer rate MAX. Unit 261.9 kbps MAX. Unit (c) 3-wire serial I/O mode (master mode, SCK10... internal clock output) Parameter SCK10 cycle time SCK10 high-/low-level width Symbol tKCY1 Conditions MIN. TYP. 4.0 V VDD 5.5 V 240 ns 3.3 V VDD < 4.0 V 400 ns tKCY1/2-10 ns 30 ns 30 ns tKH1, tKL1 SI10 setup time (to SCK10) tSIK1 SI10 hold time (from SCK10) tKSI1 Delay time from SCK10 to tKSO1 Note C = 100 pF 30 ns MAX. Unit SO10 output Note C is the load capacitance of the SCK10 and SO10 output lines. (d) 3-wire serial I/O mode (slave mode, SCK10... external clock input) Parameter SCK10 cycle time SCK10 high-/low-level width Symbol Conditions MIN. TYP. tKCY2 400 ns tKH2, tKCY2/2 ns 80 ns 50 ns tKL2 SI10 setup time (to SCK10) tSIK2 SI10 hold time (from SCK10) tKSI2 Delay time from SCK10 to tKSO2 Note C = 100 pF 120 ns SO10 output Note C is the load capacitance of the SO10 output line. User's Manual U15836EJ5V0UD 425 CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) AC Timing Test Points (Excluding X1 Input) 0.8VDD 0.8VDD Test points 0.2VDD 0.2VDD Clock Timing 1/fXP tXL tXH VIH4 (MIN.) VIL4 (MAX.) X1 input TI Timing tTIH0 tTIL0 TI000, TI010 1/fTI5 tTIL5 tTIH5 tINTL tINTH TI50 Interrupt Request Input Timing INTP0 to INTP5 RESET Input Timing tRSL RESET 426 User's Manual U15836EJ5V0UD CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) Serial Transfer Timing 3-wire serial I/O mode: tKCYm tKLm tKHm SCK10 tSIKm SI10 tKSIm Input data tKSOm SO10 Remark Output data m = 1, 2 User's Manual U15836EJ5V0UD 427 CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) A/D Converter Characteristics (TA = -40 to +125C, 3.3 V VDD 5.5 V, 3.3 V AVREF VDD, VSS = AVSS = 0 V) Parameter Symbol Conditions MIN. TYP. MAX. Unit 10 10 10 bit 4.0 V AVREF 5.5 V 0.2 0.7 %FSR 3.3 V AVREF < 4.0 V 0.3 0.9 %FSR Resolution Notes 1, 2 Overall error Conversion time tCONV Notes 1, 2 Zero-scale error Full-scale error Notes 1, 2 Note 1 Integral non-linearity error Differential non-linearity error Analog input voltage Notes 1. 2. Note 1 4.0 V AVREF 5.5 V 16 48 s 3.3 V AVREF < 4.0 V 19 48 s 4.0 V AVREF 5.5 V 0.7 %FSR 3.3 V AVREF < 4.0 V 0.9 %FSR 4.0 V AVREF 5.5 V 0.7 %FSR 3.3 V AVREF < 4.0 V 0.9 %FSR 4.0 V AVREF 5.5 V 5.5 LSB 3.3 V AVREF < 4.0 V 7.5 LSB 4.0 V AVREF 5.5 V 2.5 LSB 3.3 V AVREF < 4.0 V 3.0 LSB AVREF V VAIN AVSS Excludes quantization error (1/2 LSB). This value is indicated as a ratio (%FSR) to the full-scale value. POC Circuit Characteristics (TA = -40 to +125C) Parameter Symbol Detection voltage Power supply rise time Response delay time 1 Note 1 Conditions VPOC0 Mask option = 3.5 V tPTH VDD: 0 V 3.3 V tPTHD When power supply rises, after reaching MIN. TYP. MAX. Unit 3.3 3.5 3.76 V 0.002 ms 3.0 ms 1.0 ms detection voltage (MAX.) Response delay time 2 Minimum pulse width Notes 1. 2. Note 2 tPD When VDD falls tPW 0.2 ms Time required from voltage detection to reset release. Time required from voltage detection to internal reset output. POC Circuit Timing Supply voltage (VDD) Detection voltage (MAX.) Detection voltage (TYP.) Detection voltage (MIN.) tPW tPTH tPTHD tPD Time 428 User's Manual U15836EJ5V0UD CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) LVI Circuit Characteristics (TA = -40 to +125C) Parameter Symbol Detection voltage Note 1 MIN. TYP. MAX. Unit VLVI0 4.1 4.3 4.56 V VLVI1 3.9 4.1 4.36 V VLVI2 3.7 3.9 4.16 V VLVI3 3.5 3.7 3.96 V VLVI4 3.3 3.5 3.76 V 0.2 2.0 ms Response time tLD Minimum pulse width tLW Conditions 0.2 Reference voltage stabilization wait tLWAIT0 Note 2 time Operation stabilization wait time Notes 1. 2. Note 3 tLWAIT1 ms 0.5 2.0 ms 0.1 0.2 ms Time required from voltage detection to interrupt output or internal reset output. Time required from setting LVIE to 1 to reference voltage stabilization when POC-OFF is selected by mask option. 3. Time required from setting LVION to 1 to operation stabilization. Remarks 1. VLVI0 > VLVI1 > VLVI2 > VLVI3 > VLVI4 2. VPOC0 < VLVIm (m = 0 to 4) LVI Circuit Timing Supply voltage (VDD) Detection voltage (MAX.) Detection voltage (TYP.) Detection voltage (MIN.) tLW tLWAIT0 tLWAIT1 tLD LVIE 1 LVION 1 Time Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (TA = -40 to +125C) Parameter Data retention supply voltage Symbol VDDDR Conditions When POC-OFF is selected by mask MIN. 2.0 TYP. MAX. Unit 5.5 V option Release signal set time tSREL 0 User's Manual U15836EJ5V0UD s 429 CHAPTER 27 PACKAGE DRAWING 30-PIN PLASTIC SSOP (7.62 mm (300)) 30 16 detail of lead end F G T P 1 L 15 U E A H I J S C D N M S B K M NOTE Each lead centerline is located within 0.13 mm of its true position (T.P.) at maximum material condition. ITEM A MILLIMETERS 9.850.15 B 0.45 MAX. C 0.65 (T.P.) D 0.24 +0.08 -0.07 E 0.10.05 F 1.30.1 G 1.2 H 8.10.2 I 6.10.2 J 1.00.2 K 0.170.03 L 0.5 M 0.13 N 0.10 P +5 3 -3 T 0.25 U 0.60.15 S30MC-65-5A4-2 430 User's Manual U15836EJ5V0UD CHAPTER 28 RECOMMENDED SOLDERING CONDITIONS These products should be soldered and mounted under the following recommended conditions. For soldering methods and conditions other than those recommended below, please contact an NEC Electronics sales representative. For technical information, see the following website. Semiconductor Device Mount Manual (http://www.necel.com/pkg/en/mount/index.html) Table 28-1. Surface Mounting Type Soldering Conditions (1/2) (1) 30-pin plastic SSOP (7.62 mm (300)) PD780101MC-xxx-5A4, 780102MC-xxx-5A4, 780103MC-xxx-5A4, PD780101MC(A)-xxx-5A4, 780102MC(A)-xxx-5A4, 780103MC(A)-xxx-5A4, PD780101MC(A1)-xxx-5A4, 780102MC(A1)-xxx-5A4, 780103MC(A1)-xxx-5A4, PD780101MC(A2)-xxx-5A4, 780102MC(A2)-xxx-5A4, 780103MC(A2)-xxx-5A4 Soldering Method Soldering Conditions Recommended Condition Symbol Infrared reflow Package peak temperature: 235C, Time: 30 seconds max. (at 210C or higher), Note Count: 3 times or less, Exposure limit: 7 days 10 hours) VPS Package peak temperature: 215C, Time: 40 seconds max. (at 200C or higher), Note Count: 3 times or less, Exposure limit: 7 days IR35-107-3 (after that, prebake at 125C for VP15-107-3 (after that, prebake at 125C for 10 hours) Wave soldering Solder bath temperature: 260C max., Time: 10 seconds max., Count: Once, WS60-107-1 Preheating temperature: 120C max. (package surface temperature), Exposure Note limit: 7 days (after that, prebake at 125C for 10 hours) Partial heating Pin temperature: 300C max., Time: 3 seconds max. (per pin row) - Note After opening the dry pack, store it at 25C or less and 65% RH or less for the allowable storage period. Caution Do not use different soldering methods together (except for partial heating). User's Manual U15836EJ5V0UD 431 CHAPTER 28 RECOMMENDED SOLDERING CONDITIONS Table 28-1. Surface Mounting Type Soldering Conditions (2/2) (2) 30-pin plastic SSOP (7.62 mm (300)) PD78F0103M1MC-5A4, 78F0103M2MC-5A4, 78F0103M3MC-5A4, 78F0103M4MC-5A4, PD78F0103M5MC-5A4, 78F0103M6MC-5A4, 78F0103M1MC(A)-5A4, 78F0103M2MC(A)-5A4, PD78F0103M3MC(A)-5A4, 78F0103M4MC(A)-5A4, 78F0103M5MC(A)-5A4, PD78F0103M6MC(A)-5A4, 78F0103M1MC(A1)-5A4, 78F0103M2MC(A1)-5A4, PD78F0103M5MC(A1)-5A4, 78F0103M6MC(A1)-5A4 Soldering Method Soldering Conditions Recommended Condition Symbol Infrared reflow Package peak temperature: 235C, Time: 30 seconds max. (at 210C or higher), Note Count: 2 times or less, Exposure limit: 3 days 10 hours) VPS Package peak temperature: 215C, Time: 40 seconds max. (at 200C or higher), Note Count: 2 times or less, Exposure limit: 3 days IR35-103-2 (after that, prebake at 125C for VP15-103-2 (after that, prebake at 125C for 10 hours) Wave soldering Solder bath temperature: 260C max., Time: 10 seconds max., Count: Once, WS60-103-1 Preheating temperature: 120C Max. (package surface temperature), Exposure Note limit: 3 days (after that, prebake at 125C for 10 hours) Partial heating Pin temperature: 300C max., Time: 3 seconds max. (per pin row) - Note After opening the dry pack, store it at 25C or less and 65% RH or less for the allowable storage period. Caution Do not use different soldering methods together (except for partial heating). 432 User's Manual U15836EJ5V0UD CHAPTER 29 CAUTIONS FOR WAIT 29.1 Cautions for Wait This product has two internal system buses. One is a CPU bus and the other is a peripheral bus that interfaces with the low-speed peripheral hardware. Because the clock of the CPU bus and the clock of the peripheral bus are asynchronous, unexpected illegal data may be passed if an access to the CPU conflicts with an access to the peripheral hardware. When accessing the peripheral hardware that may cause a conflict, therefore, the CPU repeatedly executes processing, until the correct data is passed. As a result, the CPU does not start the next instruction processing but waits. If this happens, the number of execution clocks of an instruction increases by the number of wait clocks (for the number of wait clocks, see Table 291). This must be noted when real-time processing is performed. User's Manual U15836EJ5V0UD 433 CHAPTER 29 CAUTIONS FOR WAIT 29.2 Peripheral Hardware That Generates Wait Table 29-1 lists the registers that issue a wait request when accessed by the CPU, and the number of CPU wait clocks. Table 29-1. Registers That Generate Wait and Number of CPU Wait Clocks Peripheral Hardware Register Access Number of Wait Clocks Watchdog timer WDTM Write 3 clocks (fixed) Serial interface UART0 ASIS0 Read 1 clock (fixed) Serial interface UART6 ASIS6 Read 1 clock (fixed) A/D converter ADM Write 2 to 5 clocks ADS Write (when ADM.5 flag = "1") PFM Write PFT Write ADCR Read Note Note 2 to 9 clocks (when ADM.5 flag = "0") 1 to 5 clocks (when ADM.5 flag = "1") 1 to 9 clocks (when ADM.5 flag = "0") {(1/fMACRO) x 2/(1/fCPU)} + 1 *The result after the decimal point is truncated if it is less than tCPUL after it has been multiplied by (1/fCPU), and is rounded up if it exceeds tCPUL. fMACRO: Macro operating frequency 2 (When bit 5 (FR2) of ADM = "1": fX/2, when bit 5 (FR2) of ADM = "0": fX/2 ) fCPU: CPU clock frequency tCPUL: Low-level width of CPU clock Note No wait cycle is generated for the CPU if the number of wait clocks calculated by the above expression is 1. Remark The clock is the CPU clock (fCPU). 434 User's Manual U15836EJ5V0UD CHAPTER 29 CAUTIONS FOR WAIT 29.3 Example of Wait Occurrence <1> Watchdog timer Number of execution clocks: 8 (5 clocks when data is written to a register that does not issue a wait (MOV sfr, A).) Number of execution clocks: 10 (7 clocks when data is written to a register that does not issue a wait (MOV sfr, #byte).) <2> Serial interface UART6 Number of execution clocks: 6 (5 clocks when data is read from a register that does not issue a wait (MOV A, sfr).) <3> A/D converter Table 29-2. Number of Wait Clocks and Number of Execution Clocks on Occurrence of Wait (A/D Converter) * When fX = 10 MHz, tCPUL = 50 ns Value of Bit 5 (FR2) 0 fX 9 clocks fX/2 1 Number of Wait Clocks fCPU of ADM Register Number of Execution Clocks 14 clocks 5 clocks 10 clocks fX/2 2 3 clocks 8 clocks fX/2 3 2 clocks fX/2 4 fX fX/2 fX/2 2 fX/2 3 fX/2 4 0 clocks (1 clock 7 clocks Note ) Note 5 clocks (6 clocks 5 clocks 10 clocks 3 clocks 8 clocks 2 clocks ) 7 clocks 0 clocks (1 clock Note 0 clocks (1 clock Note ) ) Note 5 clocks (6 clocks ) Note 5 clocks (6 clocks ) Note On execution of MOV A, ADCR Remark The clock is the CPU clock (fCPU). fX: X1 input clock oscillation frequency tCPUL: Low-level width of CPU clock User's Manual U15836EJ5V0UD 435 APPENDIX A DEVELOPMENT TOOLS The following development tools are available for the development of systems that employ the 78K0/KB1. Figure A-1 shows the development tool configuration. * Support for PC98-NX series Unless otherwise specified, products supported by IBM PC/ATTM compatibles are compatible with PC98-NX series computers. When using PC98-NX series computers, refer to the explanation for IBM PC/AT compatibles. * Windows Unless otherwise specified, "Windows" means the following OSs. * Windows 3.1 * Windows 95 * Windows 98 * Windows NTTM Ver. 4.0 * Windows 2000 * Windows XP 436 User's Manual U15836EJ5V0UD APPENDIX A DEVELOPMENT TOOLS Figure A-1. Development Tool Configuration (1/3) (1) When using the in-circuit emulators IE-78K0-NS, IE-78K0-NS-A Software package * Software package Debugging software Language processing software * Assembler package * Integrated debugger * C compiler package * System simulator * Device file * C library source fileNote 1 Control software * Project manager (Windows only)Note 2 Host machine (PC or EWS) Interface adapter, PC card interface, etc. Power supply unit In-circuit emulatorNote 3 Flash memory write environment Emulation board Flash programmer Flash memory write adapter Performance board Flash memory Emulation probe Conversion socket or conversion adapter Target system Notes 1. 2. The C library source file is not included in the software package. The project manager PM plus is included in the assembler package. The PM plus is only used for Windows. 3. Products other than in-circuit emulators IE-78K0-NS and IE-78K0-NS-A are all sold separately. User's Manual U15836EJ5V0UD 437 APPENDIX A DEVELOPMENT TOOLS Figure A-1. Development Tool Configuration (2/3) (2) When using the in-circuit emulator IE-78K0K1-ET Software package * Software package Debugging software Language processing software * Assembler package * Integrated debugger * C compiler package * System simulator * Device file * C library source fileNote 1 Control software * Project manager (Windows only)Note 2 Host machine (PC or EWS) Interface adapter, PC card interface, etc. Power supply unit Flash memory write environment Flash programmer In-circuit emulatorNote 3 Flash memory write adapter Emulation probe Flash memory Conversion socket or conversion adapter Target system Notes 1. 2. The C library source file is not included in the software package. The project manager PM plus is included in the assembler package. The PM plus is only used for Windows. 3. In-circuit emulator IE-78K0K1-ET is supplied with integrated debugger ID78K0-NS, a device file, power supply unit, and PCI bus interface adapter IE-70000-PCI-IF-A. Any other products are sold separately. 438 User's Manual U15836EJ5V0UD APPENDIX A DEVELOPMENT TOOLS Figure A-1. Development Tool Configuration (3/3) (3) When using the in-circuit emulator QB-78K0KX1H Software package * Software package Debugging software Language processing software * Assembler package * Integrated debugger * C compiler package * System simulator * Device file * C library source fileNote 1 Control software * Project manager (Windows only)Note 2 Host machine (PC or EWS) USB interface cable Power supply unit Flash memory write environment Flash programmer In-circuit emulatorNote 3 Flash memory write adapter Emulation probe Flash memory Conversion socket or conversion adapter Target system Notes 1. 2. The C library source file is not included in the software package. The project manager PM plus is included in the assembler package. The PM plus is only used for Windows. 3. In-circuit emulator QB-78K0KX1H is supplied with integrated debugger ID78K0-QB, flash memory programmer PG-FPL (78K0/Kx1 products are not supported), power supply unit, and USB interface cable. Any other products are sold separately. User's Manual U15836EJ5V0UD 439 APPENDIX A DEVELOPMENT TOOLS A.1 Software Package SP78K0 Development tools (software) common to the 78K/0 Series are combined in this package. 78K/0 Series software package Part number: SxxxxSP78K0 Remark xxxx in the part number differs depending on the host machine and OS used. SxxxxSP78K0 xxxx Host Machine OS AB17 PC-9800 series, Windows (Japanese version) BB17 IBM PC/AT compatibles Windows (English version) Supply Medium CD-ROM A.2 Language Processing Software RA78K0 This assembler converts programs written in mnemonics into object codes executable Assembler package with a microcontroller. This assembler is also provided with functions capable of automatically creating symbol tables and branch instruction optimization. This assembler should be used in combination with a device file (DF780103) (sold separately). This assembler package is a DOS-based application. It can also be used in Windows, however, by using the project manager (included in assembler package) on Windows. Part number: SxxxxRA78K0 CC78K0 This compiler converts programs written in C language into object codes executable with C compiler package a microcontroller. This compiler should be used in combination with an assembler package and device file (both sold separately). This C compiler package is a DOS-based application. It can also be used in Windows, however, by using the project manager (included in assembler package) on Windows. Part number: SxxxxCC78K0 Note 1 DF780103 This file contains information peculiar to the device. Device file This device file should be used in combination with a tool (RA78K0, CC78K0, SM78K0, ID78K0-NS, ID78K0, and ID78K0-QB) (all sold separately). The corresponding OS and host machine differ depending on the tool to be used. Part number: SxxxxDF780103 CC78K0-L Note 2 This is a source file of the functions that configure the object library included in the C C library source file compiler package. This file is required to match the object library included in the C compiler package to the user's specifications. Since this is a source file, its working environment does not depend on any particular operating system. Part number: SxxxxCC78K0-L Notes 1. The DF780103 can be used in common with the RA78K0, CC78K0, SM78K0, ID78K0-NS, ID78K0, and ID78K0-QB. 2. 440 The CC78K0-L is not included in the software package (SP78K0). User's Manual U15836EJ5V0UD APPENDIX A DEVELOPMENT TOOLS Remark xxxx in the part number differs depending on the host machine and OS used. SxxxxRA78K0 SxxxxCC78K0 SxxxxCC78K0-L xxxx Host Machine AB17 PC-9800 series, BB17 IBM PC/AT compatibles 3P17 HP9000 series 700 3K17 Windows (Japanese version) TM SPARCstation OS TM Supply Medium CD-ROM Windows (English version) HP-UX TM SunOS TM TM Solaris (Rel. 10.10) (Rel. 4.1.4), (Rel. 2.5.1) SxxxxDF780103 xxxx Host Machine OS AB13 PC-9800 series, Windows (Japanese version) BB13 IBM PC/AT compatibles Windows (English version) Supply Medium 3.5-inch 2HD FD A.3 Control Software PM plus This is control software designed to enable efficient user program development in the Project manager Windows environment. All operations used in development of a user program, such as starting the editor, building, and starting the debugger, can be performed from the PM plus. The PM plus is included in the assembler package (RA78K0). It can only be used in Windows. A.4 Flash Memory Writing Tools Flashpro III Flash programmer dedicated to microcontrollers with on-chip flash memory. (part number: FL-PR3, PG-FP3) Flashpro IV (part number: FL-PR4, PG-FP4) Flash programmer FA-30MC Flash memory writing adapter used connected to the Flashpro III/Flashpro IV. Flash memory writing adapter * FA-30MC: For 30-pin plastic SSOP (MC-5A4 type) Remark FL-PR3, FL-PR4, and FA-30MC are products of Naito Densei Machida Mfg. Co., Ltd. TEL: +81-45-475-4191 Naito Densei Machida Mfg. Co., Ltd. User's Manual U15836EJ5V0UD 441 APPENDIX A DEVELOPMENT TOOLS A.5 Debugging Tools (Hardware) A.5.1 When using in-circuit emulators IE-78K0-NS and IE-78K0-NS-A Remark Operations where the oscillation frequencies exceed 10 MHz can only be supported by the versions of the IE-78K0-NS with post N administrative symbols, IE-78K0-NS-A with post G administrative symbols, and IE-780148-NS-EM1 with post E administrative symbols. IE-78K0-NS The in-circuit emulator serves to debug hardware and software when developing In-circuit emulator application systems using a 78K/0 Series product. It corresponds to the integrated debugger (ID78K0-NS). This emulator should be used in combination with a power supply unit, emulation probe, and the interface adapter required to connect this emulator to the host machine. IE-78K0-NS-PA This board is connected to the IE-78K0-NS to expand its functions. Adding this board Performance board adds a coverage function and enhances debugging functions such as tracer and timer functions. IE-78K0-NS-A Product that combines the IE-78K0-NS and IE-78K0-NS-PA In-circuit emulator IE-70000-MC-PS-B This adapter is used for supplying power from a 100 V to 240 V AC outlet. Power supply unit IE-70000-98-IF-C This adapter is required when using a PC-9800 series computer (except notebook type) Interface adapter as the host machine (C bus compatible). IE-70000-CD-IF-A This is PC card and interface cable required when using a notebook-type computer as PC card interface the host machine (PCMCIA socket compatible). IE-70000-PC-IF-C This adapter is required when using an IBM PC/AT compatible computer as the host Interface adapter machine (ISA bus compatible). IE-70000-PCI-IF-A This adapter is required when using a computer with a PCI bus as the host machine. Interface adapter IE-780148-NS-EM1 This board emulates the operations of the peripheral hardware peculiar to a device. It Emulation board should be used in combination with an in-circuit emulator. NP-30MC This probe is used to connect the in-circuit emulator to the target system and is designed Emulation probe for use with a 30-pin plastic SSOP (MC-5A4 type). NSPACK30BK This conversion socket connects the NP-30MC to a target system board designed to YSPACK30BK mount a 30-pin plastic SSOP (MC-5A4 type). HSPACK30BK * NSPACK30BK: Socket for connecting target YQ-Guide * YSPACK30BK: Socket for connecting emulator Conversion socket * HSPACK30BK: Cover for mounting device * YQ-Guide: Guide pin Remarks 1. NP-30MC is a product of Naito Densei Machida Mfg. Co., Ltd. TEL: +81-45-475-4191 Naito Densei Machida Mfg. Co., Ltd. 2. NSPACK30BK, YSPACK30BK, HSPACK30BK, and YQ-Guide 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) 442 User's Manual U15836EJ5V0UD APPENDIX A DEVELOPMENT TOOLS A.5.2 When using in-circuit emulator IE-78K0K1-ET Remark Operations where the oscillation frequencies exceed 10 MHz can only be supported by the versions of the IE-78K0K1-ET with post C administrative symbols. Note IE-78K0K1-ET The in-circuit emulator serves to debug hardware and software when developing In-circuit emulator application systems using a 78K0/Kx1 product. It corresponds to the integrated debugger (ID78K0-NS). This emulator should be used in combination with a power supply unit, emulation probe, and the interface adapter required to connect this emulator to the host machine. IE-70000-98-IF-C This adapter is required when using a PC-9800 series computer (except notebook type) Interface adapter as the host machine (C bus compatible). IE-70000-CD-IF-A This is PC card and interface cable required when using a notebook-type computer as PC card interface the host machine (PCMCIA socket compatible). IE-70000-PC-IF-C This adapter is required when using an IBM PC/AT compatible computer as the host Interface adapter machine (ISA bus compatible). IE-70000-PCI-IF-A This adapter is required when using a computer with a PCI bus as the host machine. Interface adapter This is supplied with IE-78K0K1-ET. NP-30MC This probe is used to connect the in-circuit emulator to the target system and is designed Emulation probe for use with a 30-pin plastic SSOP (MC-5A4 type). NSPACK30BK This conversion socket connects the NP-30MC to a target system board designed to YSPACK30BK mount a 30-pin plastic SSOP (MC-5A4 type). HSPACK30BK * NSPACK30BK: Socket for connecting target YQ-Guide * YSPACK30BK: Socket for connecting emulator Conversion socket * HSPACK30BK: Cover for mounting device * YQ-Guide: Guide pin Note IE-78K0K1-ET is supplied with a power supply unit and PCI bus interface adapter IE-70000-PCI-IF-A. It is also supplied with integrated debugger ID78K0-NS and a device file as control software. Remarks 1. NP-30MC is a product of Naito Densei Machida Mfg. Co., Ltd. TEL: +81-45-475-4191 Naito Densei Machida Mfg. Co., Ltd. 2. NSPACK30BK, YSPACK30BK, HSPACK30BK, and YQ-Guide 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) User's Manual U15836EJ5V0UD 443 APPENDIX A DEVELOPMENT TOOLS A.5.3 When using in-circuit emulator QB-78K0KX1H Note 1 QB-78K0KX1H This in-circuit emulator serves to debug hardware and software when developing In-circuit emulator application systems using the 78K0/Kx1 and 78K0/Kx1+. It corresponds to the integrated debugger (ID78K0-QB). This emulator should be used in combination with a power supply unit and emulation probe, and the USB is used to connect this emulator to the host machine. Note 2 QB-144-CA-01 This check pin adapter is used in waveform monitoring using the oscilloscope, etc. Check pin adapter QB-80-EP-01T This emulation probe is flexible type and used to connect the in-circuit emulator and Emulation probe target system. QB-30MC-EA-01T This exchange adapter is used to perform pin conversion from the in-circuit emulator to Exchange adapter target connector. QB-30MC-YS-01T This space adapter is used to adjust the height between the target system and in-circuit Space adapter emulator. QB-30MC-YQ-01T This YQ connector is used to connect the target connector and exchange adapter. YQ connector QB-30MC-HQ-01T This mount adapter is used to mount the target device with socket. Mount adapter QB-30MC-NQ-01T This target connector is used to mount on the target system. Target connector Notes 1. The QB-78K0KX1H is supplied with a power supply unit, USB interface cable, and flash memory programmer PG-FPL (78K0/Kx1 products are not supported). As control software, integrated debugger ID78K0-QB is supplied. 2. Remark Under development The packed contents differ depending on the part number, as follows. * QB-78K0KX1H-ZZZ: In-circuit emulator only * QB-78K0KX1H-T30MC: In-circuit emulator and supplied products (emulation probe, exchange adapter, YQ connector, and target connector) 444 User's Manual U15836EJ5V0UD APPENDIX A DEVELOPMENT TOOLS A.6 Debugging Tools (Software) SM78K0 This is a system simulator for the 78K/0 Series. The SM78K0 is Windows-based System simulator software. It is used to perform debugging at the C source level or assembler level while simulating the operation of the target system on a host machine. Use of the SM78K0 allows the execution of application logical testing and performance testing on an independent basis from hardware development, thereby providing higher development efficiency and software quality. The SM78K0 should be used in combination with the device file (DF780103) (sold separately). Part number: SxxxxSM78K0 ID78K0-NS This debugger supports the in-circuit emulators for the 78K/0 Series. The ID78K0-NS (supporting in-circuit emulator and ID78K0-QB are Windows-based software. IE-78K0-NS, IE-78K0-NS-A, It has improved C-compatible debugging functions and can be display the results of IE-78K0K1-ET), tracing with the source program using an integrating window function that associates the ID78K0-QB source program, disassemble display, and memory display with the trace result. It (supporting in-circuit emulator should be used in combination with the device file (sold separately). QB-78K0KX1H) Part number: SxxxxID78K0-NS, SxxxxID78K0-QB Integrated debugger Remark xxxx in the part number differs depending on the host machine and OS used. SxxxxSM78K0 SxxxxID78K0-NS SxxxxID78K0-QB xxxx Host Machine OS AB17 PC-9800 series, Windows (Japanese version) BB17 IBM PC/AT compatibles Windows (English version) User's Manual U15836EJ5V0UD Supply Medium CD-ROM 445 APPENDIX B NOTES ON TARGET SYSTEM DESIGN B.1 When Using IE-78K0-NS, IE-78K0-NS-A, or IE-78K0K1-ET The following show the conditions when connecting the emulation probe to the conversion adapter. 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 and Conversion Adapter In-circuit emulator IE-78K0-NS, IE-78K0-NS-A, or IE-78K0K1-ET Target system Emulation board IE-780148-NS-EM1 150 mm Board on end of NP-30MC CN1 Emulation probe NP-30MC Conversion adapter: YSPACK30BK, NSPACK30BK 78010X PROBE Board Remarks 1. The NP-30MC is a product of Naito Densei Machida Mfg. Co., Ltd. 2. The YSPACK30BK and NSPACK30BK are products of TOKYO ELETECH CORPORATION. 446 User's Manual U15836EJ5V0UD APPENDIX B NOTES ON TARGET SYSTEM DESIGN Figure B-2. Connection Condition of Target System Emulation board IE-780148-NS-EM1 Emulation probe NP-30MC Board on end of NP-30MC Guide pin YQ-Guide 13 mm Conversion adapter YSPACK30BK, NSPACK30BK 5 mm 15 mm 37 mm 20 mm 31 mm Target system Remarks 1. NP-30MC is a product of Naito Densei Machida Mfg. Co., Ltd. 2. YSPACK30BK, NSPACK30BK, and YQ-Guide are products of TOKYO ELETECH CORPORATION. User's Manual U15836EJ5V0UD 447 APPENDIX B NOTES ON TARGET SYSTEM DESIGN B.2 When Using QB-78K0KX1H This section shows areas on the target system where component mounting is prohibited and areas where there are component mounting height restrictions. 12.5 13.375 11.5 10 10 12.5 17.375 : Exchange adapter area: Components up to 17.45 mm in height can be mountedNote : Emulation probe tip area: Components up to 24.45 mm in height can be mountedNote Note 448 11.5 Figure B-3. Restriction Area on Target System Height can be regulated by using space adapters (each adds 2.4 mm) User's Manual U15836EJ5V0UD APPENDIX C REGISTER INDEX C.1 Register Index (In Alphabetical Order with Respect to Register Names) [A] A/D conversion result register (ADCR) .......................................................................................................................194 A/D converter mode register (ADM)............................................................................................................................192 Analog input channel specification register (ADS) ......................................................................................................194 Asynchronous serial interface control register 6 (ASICL6)..........................................................................................243 Asynchronous serial interface operation mode register 0 (ASIM0) .............................................................................213 Asynchronous serial interface operation mode register 6 (ASIM6) .............................................................................237 Asynchronous serial interface reception error status register 0 (ASIS0).....................................................................215 Asynchronous serial interface reception error status register 6 (ASIS6).....................................................................239 Asynchronous serial interface transmission status register 6 (ASIF6) ........................................................................240 [B] Baud rate generator control register 0 (BRGC0).........................................................................................................216 Baud rate generator control register 6 (BRGC6).........................................................................................................242 [C] Capture/compare control register 00 (CRC00)............................................................................................................117 Clock monitor mode register (CLM) ............................................................................................................................316 Clock selection register 6 (CKSR6).............................................................................................................................241 [E] 8-bit timer compare register 50 (CR50).......................................................................................................................150 8-bit timer counter 50 (TM50)......................................................................................................................................149 8-bit timer H compare register 00 (CMP00) ................................................................................................................164 8-bit timer H compare register 01 (CMP01) ................................................................................................................164 8-bit timer H compare register 10 (CMP10) ................................................................................................................164 8-bit timer H compare register 11 (CMP11) ................................................................................................................164 8-bit timer H mode register 0 (TMHMD0)....................................................................................................................165 8-bit timer H mode register 1 (TMHMD1)....................................................................................................................165 8-bit timer mode control register 50 (TMC50) .............................................................................................................152 External interrupt falling edge enable register (EGN)..................................................................................................287 External interrupt rising edge enable register (EGP)...................................................................................................287 [I] Input switch control register (ISC) ...............................................................................................................................244 Internal memory size switching register (IMS) ............................................................................................................339 Interrupt mask flag register 0H (MK0H) ......................................................................................................................285 Interrupt mask flag register 0L (MK0L)........................................................................................................................285 Interrupt mask flag register 1L (MK1L)........................................................................................................................285 Interrupt request flag register 0H (IF0H) .....................................................................................................................284 Interrupt request flag register 0L (IF0L) ......................................................................................................................284 Interrupt request flag register 1L (IF1L) ......................................................................................................................284 User's Manual U15836EJ5V0UD 449 APPENDIX C REGISTER INDEX [L] Low-voltage detection level selection register (LVIS)..................................................................................................329 Low-voltage detection register (LVIM).........................................................................................................................328 [M] Main clock mode register (MCM) ................................................................................................................................. 93 Main OSC control register (MOC) ................................................................................................................................ 94 [O] Oscillation stabilization time counter status register (OSTC).................................................................................95, 298 Oscillation stabilization time select register (OSTS)..............................................................................................96, 300 [P] Port mode register 0 (PM0) ...................................................................................................................................84, 120 Port mode register 1 (PM1) ...................................................................................................84, 153, 168, 217, 244, 271 Port mode register 3 (PM3) .......................................................................................................................................... 84 Port mode register 12 (PM12) ...................................................................................................................................... 84 Port register 0 (P0)....................................................................................................................................................... 86 Port register 1 (P1)....................................................................................................................................................... 86 Port register 2 (P2)....................................................................................................................................................... 86 Port register 3 (P3)....................................................................................................................................................... 86 Port register 12 (P12) ................................................................................................................................................... 86 Port register 13 (P13) ................................................................................................................................................... 86 Power-fail comparison mode register (PFM) ...............................................................................................................195 Power-fail comparison threshold register (PFT) ..........................................................................................................195 Prescaler mode register 00 (PRM00)..........................................................................................................................119 Priority specification flag register 0H (PR0H) ..............................................................................................................286 Priority specification flag register 0L (PR0L) ...............................................................................................................286 Priority specification flag register 1L (PR1L) ...............................................................................................................286 Processor clock control register (PCC) ........................................................................................................................ 91 Pull-up resistor option register 0 (PU0) ........................................................................................................................ 87 Pull-up resistor option register 1 (PU1) ........................................................................................................................ 87 Pull-up resistor option register 3 (PU3) ........................................................................................................................ 87 Pull-up resistor option register 12 (PU12) .................................................................................................................... 87 [R] Receive buffer register 0 (RXB0) ................................................................................................................................212 Receive buffer register 6 (RXB6) ................................................................................................................................236 Reset control flag register (RESF) ..............................................................................................................................314 Ring-OSC mode register (RCM) .................................................................................................................................. 92 [S] Serial clock selection register 10 (CSIC10) .................................................................................................................270 Serial I/O shift register 10 (SIO10) ..............................................................................................................................268 Serial operation mode register 10 (CSIM10) ...............................................................................................................269 16-bit timer capture/compare register 000 (CR000) ....................................................................................................112 16-bit timer capture/compare register 010 (CR010) ....................................................................................................114 16-bit timer counter 00 (TM00)....................................................................................................................................112 16-bit timer mode control register 00 (TMC00)............................................................................................................115 450 User's Manual U15836EJ5V0UD APPENDIX C REGISTER INDEX 16-bit timer output control register 00 (TOC00)...........................................................................................................117 [T] Timer clock selection register 50 (TCL50) ..................................................................................................................151 Transmit buffer register 10 (SOTB10).........................................................................................................................268 Transmit buffer register 6 (TXB6)................................................................................................................................236 Transmit shift register 0 (TXS0) ..................................................................................................................................212 [W] Watchdog timer enable register (WDTE) ....................................................................................................................182 Watchdog timer mode register (WDTM) .....................................................................................................................181 User's Manual U15836EJ5V0UD 451 APPENDIX C REGISTER INDEX C.2 Register Index (In Alphabetical Order with Respect to Register Symbol) [A] ADCR: A/D conversion result register .................................................................................................................194 ADM: A/D converter mode register....................................................................................................................192 ADS: Analog input channel specification register .............................................................................................194 ASICL6: Asynchronous serial interface control register 6......................................................................................243 ASIF6: Asynchronous serial interface transmission status register 6 ..................................................................240 ASIM0: Asynchronous serial interface operation mode register 0........................................................................213 ASIM6: Asynchronous serial interface operation mode register 6........................................................................237 ASIS0: Asynchronous serial interface reception error status register 0...............................................................215 ASIS6: Asynchronous serial interface reception error status register 6...............................................................239 [B] BRGC0: Baud rate generator control register 0 .....................................................................................................216 BRGC6: Baud rate generator control register 6 .....................................................................................................242 [C] CKSR6: Clock selection register 6 ........................................................................................................................241 CLM: Clock monitor mode register....................................................................................................................316 CMP00: 8-bit timer H compare register 00 ............................................................................................................164 CMP01: 8-bit timer H compare register 01 ............................................................................................................164 CMP10: 8-bit timer H compare register 10 ............................................................................................................164 CMP11: 8-bit timer H compare register 11 ............................................................................................................164 CR000: 16-bit timer capture/compare register 000...............................................................................................112 CR010: 16-bit timer capture/compare register 010...............................................................................................114 CR50: 8-bit timer compare register 50................................................................................................................150 CRC00: Capture/compare control register 00 .......................................................................................................117 CSIC10: Serial clock selection register 10 .............................................................................................................270 CSIM10: Serial operation mode register 10............................................................................................................269 [E] EGN: External interrupt falling edge enable register .........................................................................................287 EGP: External interrupt rising edge enable register ..........................................................................................287 [I] IF0H: Interrupt request flag register 0H .............................................................................................................284 IF0L: Interrupt request flag register 0L .............................................................................................................284 IF1L: Interrupt request flag register 1L .............................................................................................................284 IMS: Internal memory size switching register...................................................................................................339 ISC: Input switch control register.....................................................................................................................244 [L] LVIM: Low-voltage detection register.................................................................................................................328 LVIS: Low-voltage detection level selection register .........................................................................................329 [M] MCM: 452 Main clock mode register.......................................................................................................................... 93 User's Manual U15836EJ5V0UD APPENDIX C REGISTER INDEX MK0H: Interrupt mask flag register 0H ................................................................................................................285 MK0L: Interrupt mask flag register 0L.................................................................................................................285 MK1L: Interrupt mask flag register 1L.................................................................................................................285 MOC: Main OSC control register .........................................................................................................................94 [O] OSTC: Oscillation stabilization time counter status register ..........................................................................95, 298 OSTS: Oscillation stabilization time select register .......................................................................................96, 300 [P] P0: Port register 0............................................................................................................................................86 P1: Port register 1............................................................................................................................................86 P2: Port register 2............................................................................................................................................86 P3: Port register 3............................................................................................................................................86 P12: Port register 12..........................................................................................................................................86 P13: Port register 13..........................................................................................................................................86 PCC: Processor clock control register ................................................................................................................91 PFM: Power-fail comparison mode register ......................................................................................................195 PFT: Power-fail comparison threshold register ................................................................................................195 PM0: Port mode register 0..........................................................................................................................84, 120 PM1: Port mode register 1.......................................................................................... 84, 153, 168, 217, 244, 271 PM3: Port mode register 3..................................................................................................................................84 PM12: Port mode register 12................................................................................................................................84 PR0H: Priority specification flag register 0H .......................................................................................................286 PR0L: Priority specification flag register 0L........................................................................................................286 PR1L: Priority specification flag register 1L........................................................................................................286 PRM00: Prescaler mode register 00 .....................................................................................................................119 PU0: Pull-up resistor option register 0................................................................................................................87 PU1: Pull-up resistor option register 1................................................................................................................87 PU3: Pull-up resistor option register 3................................................................................................................87 PU12: Pull-up resistor option register 12..............................................................................................................87 [R] RCM: Ring-OSC mode register ...........................................................................................................................92 RESF: Reset control flag register .......................................................................................................................314 RXB0: Receive buffer register 0 .........................................................................................................................212 RXB6: Receive buffer register 6 .........................................................................................................................236 [S] SIO10: Serial I/O shift register 10........................................................................................................................268 SOTB10: Transmit buffer register 10 ......................................................................................................................268 [T] TCL50: Timer clock selection register 50.............................................................................................................151 TM00: 16-bit timer counter 00 ............................................................................................................................112 TM50: 8-bit timer counter 50 ..............................................................................................................................149 TMC00: 16-bit timer mode control register 00.......................................................................................................115 TMC50: 8-bit timer mode control register 50.........................................................................................................152 TMHMD0: 8-bit timer H mode register 0...................................................................................................................165 User's Manual U15836EJ5V0UD 453 APPENDIX C REGISTER INDEX TMHMD1: 8-bit timer H mode register 1 ...................................................................................................................165 TOC00: 16-bit timer output control register 00 ......................................................................................................117 TXB6: Transmit buffer register 6 ........................................................................................................................236 TXS0: Transmit shift register 0 ...........................................................................................................................212 [W] WDTE: Watchdog timer enable register...............................................................................................................182 WDTM: Watchdog timer mode register ................................................................................................................181 454 User's Manual U15836EJ5V0UD 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 Chapter Chapter 1 Hard Classification (1/20) Function Operating frequency rating Soft Soft Chapter 4 Chapter 5 Soft Chapter 3 Pin processing Memory space Port function Ring-OSC Details of Function Cautions Page Peripheral function: Count clock, base clock The specifications of the peripheral functions (such as the timer, serial interface, and A/D converter) at VDD = 2.7 to 5.5 V remain unchanged. Consequently when selecting the count clock or base clock of a peripheral function, set to satisfy the following conditions. * VDD = 4.0 to 5.5 V: Count clock or base clock 10 MHz * VDD = 3.3 to 4.0 V: Count clock or base clock 8.38 MHz * VDD = 2.7 to 3.3 V: Count clock or base clock 5 MHz * VDD = 2.5 to 2.7 V: Count clock or base clock 2.5 MHz p.17 Flash memory Rewrite the flash memory within the ranges of fX = 2 to 10 MHz and VDD = 2.7 to 5.5 V as before. p.17 Connect the IC (Internally Connected) pin directly to VSS. p.22 Connect the AVSS pin to VSS. p.22 Connect the VPP pin to VSS during normal operation. p.22 IMS: Internal memory size switching register Regardless of the internal memory capacity, the initial values of internal memory size switching register (IMS) of all products in the 78K0/KB1 are fixed (IMS = CFH). Therefore, set the value corresponding to each product as indicated below. PD780101: 42H PD780102: 04H PD780103: 06H PD78F0103: Value corresponding to mask ROM version p.39 SFR area: Special function register Do not access addresses to which SFRs are not assigned. p.45 SP: Stack pointer Since RESET input makes the SP contents undefined, be sure to initialize the SP before use. p.51 P10, P11, P12 When using P10/SCK10 (/TxD0), P11/SI10 (/RxD0), and P12/SO10 as general-purpose ports, do not write to serial clock selection register 10 (CSIC10). p.76 - In the case of a 1-bit memory manipulation instruction, although a single bit is manipulated, the port is accessed as an 8-bit unit. Therefore, on a port with a mixture of input and output pins, the output latch contents for pins specified as input are undefined, even for bits other than the manipulated bit. p.88 RCM: Ring-OSC mode register Make sure that bit 1 (MCS) of the main clock mode register (MCM) is 1 before setting RSTOP. p.92 - User's Manual U15836EJ5V0UD 455 APPENDIX D LIST OF CAUTIONS Chapter Chapter 5 Hard Classification (2/20) Function Details of Cautions Page Function Main clock MCM: Main clock When the Ring-OSC clock is selected as the clock to be supplied to the CPU, mode register the divided clock of the Ring-OSC oscillator output (fX) is supplied to the p.93 peripheral hardware (fX = 240 kHz (TYP.)). Operation of the peripheral hardware with the Ring-OSC clock cannot be guaranteed. Therefore, when the Ring-OSC clock is selected as the clock supplied to the CPU, do not use peripheral hardware. In addition, stop the peripheral hardware before switching the clock supplied to the CPU from the X1 input clock to the RingOSC clock. Note, however, that the following peripheral hardware can be used when the CPU operates on the Ring-OSC clock. * Watchdog timer * Clock monitor * 8-bit timer H1 when fR/2 is selected as the count clock 7 * Peripheral hardware with an external clock selected as the clock source Soft (Except when the external count clock of TM00 is selected (TI000 valid edge)) MOC: Main OSC Make sure that bit 1 (MCS) of the main clock mode register (MCM) is 0 before control register setting MSTOP. OSTC: After the above time has elapsed, the bits are set to 1 in order from MOST11 Oscillation and remain 1. stabilization time If the STOP mode is entered and then released while the Ring-OSC clock is counter status being used as the CPU clock, set the oscillation stabilization time as follows. register * Desired OSTC oscillation stabilization time Oscillation stabilization time set p.94 p.95 p.95 by OSTS The X1 oscillation stabilization time counter counts up to the oscillation stabilization time set by OSTS. Note, therefore, that only the status up to the oscillation stabilization time set by OSTS is set to OSTC after STOP mode is Hard released. The wait time when STOP mode is released does not include the time after p.95 STOP mode release until clock oscillation starts ("a" below) regardless of Soft whether STOP mode is released by RESET input or interrupt generation. OSTS: Oscillation To set the STOP mode when the X1 input clock is used as the CPU clock, set p.96 stabilization time OSTS before executing the STOP instruction. select register Execute the OSTS setting after confirming that the oscillation stabilization time p.96 has elapsed as expected in the OSTC. If the STOP mode is entered and then released while the Ring-OSC clock is p.96 being used as the CPU clock, set the oscillation stabilization time as follows. * Desired OSTC oscillation stabilization time Oscillation stabilization time set by OSTS The X1 oscillation stabilization time counter counts up to the oscillation stabilization time set by OSTS. Note, therefore, that only the status up to the oscillation stabilization time set by OSTS is set to OSTC after STOP mode is Hard released. The wait time when STOP mode is released does not include the time after STOP mode release until clock oscillation starts ("a" below) regardless of whether STOP mode is released by RESET input or interrupt generation. 456 User's Manual U15836EJ5V0UD p.96 APPENDIX D LIST OF CAUTIONS Chapter Chapter 5 Hard Classification (3/20) Details of Function Cautions Page Function - X1 oscillator When using the X1 oscillator, wire as follows in the area enclosed by the p.97 broken lines in the Figure 5-8 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. - Prescaler When the Ring-OSC clock is selected as the clock supplied to the CPU, the p.99 prescaler generates various clocks by dividing the Ring-OSC oscillator output Soft (fX = 240 kHz (TYP.)). - Ring-OSC The RSTOP setting is valid only when "Can be stopped by software" is set for p.104 Ring-OSC by a mask option. - CPU clock To calculate the maximum time, set fR = 120 kHz. p.105 Setting the following values is prohibited when the CPU operates on the Ring- p.106 OSC clock. * PCC2, PCC1, PCC0 = 0, 0, 1 (settable only for standard products and (A) grade products) * PCC2, PCC1, PCC0 = 0, 1, 0 * PCC2, PCC1, PCC0 = 0, 1, 1 Soft 16-bit timer/ CR000: 16-bit Set a value other than 0000H in CR000 in the mode in which clear & start event timer capture/ occurs on a match of TM00 and CR000. counter 00 compare register If CR000 is set to 0000H in the free-running mode and in the clear mode using p.113 (TM00) 000 the valid edge of the TI000 pin, an interrupt request (INTTM000) is generated p.113 when the value of CR000 changes from 0000H to 0001H following TM00 overflow (FFFFH). Moreover, INTTM000 is generated after a match of TM00 and CR000 is detected, a valid edge of the TI010 pin is detected, and the Hard timer is cleared by a one-shot trigger. When P01 is used as the valid edge input pin of TI010, it cannot be used as p.113 the timer output (TO00). Moreover, when P01 is used as TO00, it cannot be used as the valid edge input pin of TI010. When CR000 is used as a capture register, read data is undefined if the p.113 register read time and capture trigger input conflict (the capture data itself is the correct value). If timer count stop and capture trigger input conflict, the captured data is undefined. Soft Chapter 6 * PCC2, PCC1, PCC0 = 1, 0, 0 Do not rewrite CR000 during TM00 operation. pp.113, 121, 126, 138 CR010: 16-bit If the CR010 register is cleared to 0000H, an interrupt request (INTTM010) is timer capture/ generated when the value of CR010 changes from 0000H to 0001H following compare register TM00 overflow (FFFFH). Moreover, INTTM010 is generated after a match of 010 TM00 and CR010 is detected, a valid edge of the TI000 pin is detected, and p.114 the timer is cleared by a one-shot trigger. User's Manual U15836EJ5V0UD 457 APPENDIX D LIST OF CAUTIONS Classification Details of Function Hard 16-bit timer/ event counter 00 (TM00) CR010: 16-bit timer capture/compare register 010 Soft Chapter 6 Chapter (4/20) Function TMC00: 16-bit timer mode control register 00 When CR010 is used as a capture register, read data is undefined if the register read time and capture trigger input conflict (the capture data itself is the correct value). If count stop input and capture trigger input conflict, the captured data is undefined. p.114 CR010 can be rewritten during TM00 operation. For details, see Caution 2 in Figure 6-15. p.114 16-bit timer counter 00 (TM00) starts operation at the moment TMC002 and TMC003 are set to values other than 0, 0 (operation stop mode), respectively. Clear TMC002 and TMC003 to 0, 0 to stop operation. p.115 Timer operation must be stopped before writing to bits other than the OVF00 flag. p.116 Set the valid edge of the TI000/P00 pin using prescaler mode register 00 (PRM00). p.116 If any of the following modes: the mode in which clear & start occurs on match between TM00 and CR000, the mode in which clear & start occurs at the TI000 valid edge, 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.116 Timer operation must be stopped before setting CRC00. p.117 When the mode in which clear & start occurs on a match between TM00 and CR000 is selected with 16-bit timer mode control register 00 (TMC00), CR000 should not be specified as a capture register. p.117 p.118 LVS00 and LVR00 are 0 when they are read. p.118 OSPT00 is automatically cleared after data is set, so 0 is read. p.118 Do not set OSPT00 to 1 other than in one-shot pulse output mode. p.118 Hard To ensure that the capture operation is performed properly, the capture trigger p.117 requires a pulse two cycles longer than the count clock selected by prescaler mode register 00 (PRM00). Timer operation must be stopped before setting other than TOC004. 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. p.118 Do not set LVS00 to 1 before TOE00, and do not set LVS00 and TOE00 to 1 simultaneously. p.118 Do not make settings <1> and <2> below simultaneously. In addition, follow the setting procedure shown below. <1> Setting of TOC001, TOC004, TOE00, and OSPE00: Setting of timer output operation <2> Setting of LVS00 and LVR00: Setting of timer output F/F p.118 Hard 458 Page Soft Soft Hard CRC00: Capture/compare control register 00 Cautions TOC00: 16-bit timer output control register 00 PRM00: Prescaler mode register 00 When the Ring-OSC clock is selected as the clock to be supplied to the CPU, p.119 the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the count clock is the Ring-OSC clock, the operation of 16-bit timer/event counter 00 is not guaranteed. When an external clock is used and when the Ring-OSC clock is selected and supplied to the CPU, the operation of 16-bit timer/event counter 00 is not guaranteed, either, because the Ring-OSC clock is supplied as the sampling clock to eliminate noise. User's Manual U15836EJ5V0UD APPENDIX D LIST OF CAUTIONS Chapter Classification Soft Hard Chapter 6 16-bit timer/ event counter 00 (TM00) Details of Function PRM00: Prescaler mode register 00 Cautions Page Always set data to PRM00 after stopping the timer operation. p.119 If the valid edge of TI000 is to be set for the count clock, do not set the clear & start mode using the valid edge of TI000 and the capture trigger. p.119 If the TI000 or TI010 pin is high level immediately after system reset, the rising p.120 edge is immediately detected after the rising edge or both the rising and falling edges are set as the valid edge(s) of the TI000 pin or TI010 pin to enable the operation of 16-bit timer counter 00 (TM00). Care is therefore required when pulling up the TI000 or TI010 pin. However, when the TI000 or TI010 pin is high level and re-enabling operation after the operation has been stopped, the rising edge is not detected. Hard Soft (5/20) Function When P01 is used as the TI010 valid edge input pin, it cannot be used as the timer output (TO00), and when used as TO00, it cannot be used as the TI010 valid edge input pin. p.120 CR010: 16-bit timer capture/compare register 010 To change the value of the duty factor (the value of the CR010 register) during p.124 operation, see Caution 2 in Figure 6-15 PPG Output Operation Timing. CR000, CR010: 16-bit timer capture/compare registers 000, 010 Values in the following range should be set in CR000 and CR010: 0000H CR010 < CR000 FFFFH p.125 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). p.125 PPG output In the PPG output operation, change the pulse width (rewrite CR010) during TM00 operation using the following procedure. <1> Disable the timer output inversion operation by match of TM00 and CR010 (TOC004 = 0) <2> Disable the INTTM010 interrupt (TMMK010 = 1) <3> Rewrite CR010 <4> Wait for 1 cycle of the TM00 count clock <5> Enable the timer output inversion operation by match of TM00 and CR010 (TOC004 = 1) <6> Clear the interrupt request flag of INTTM010 (TMIF010 = 0) <7> Enable the INTTM010 interrupt (TMMK010 = 0) p.126 Pulse width measurement To use two capture registers, set the TI000 and TI010 pins. p.127 External event counter When reading the external event counter count value, TM00 should be read. p.137 One-shot pulse output: Software trigger Do not set the OSPT00 bit to 1 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. p.140 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 alternatefunction 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. p.140 User's Manual U15836EJ5V0UD 459 APPENDIX D LIST OF CAUTIONS Classification Details of Function Soft 16-bit timer/ event counter 00 (TM00) One-shot pulse output: Software trigger Do not set the CR000 and CR010 registers to 0000H. p.141 16-bit timer counter 00 starts operating as soon as the TMC003 and TMC002 bits are set to a value other than 00 (operation stop mode). p.142 One-shot pulse output: External trigger Even if the external trigger is generated again while the one-shot pulse is being output, it is ignored. p.142 Do not set the CR000 and CR010 registers to 0000H. p.143 16-bit timer counter 00 starts operating as soon as the TMC002 and TMC003 bits are set to a value other than 00 (operation stop mode). p.144 Hard Timer start errors An error of up to one clock may occur in the time required for a match signal to p.145 be generated after timer start. This is because 16-bit timer counter 00 (TM00) is started asynchronously to the count clock. Soft 16-bit timer capture/compare registers 000, 010 setting In the mode in which clear & start occurs on match between TM00 and CR000, set 16-bit timer capture/compare registers 000, 010 (CR000, CR010) to other than 0000H. This means a 1-pulse count operation cannot be performed when 16-bit timer/event counter 00 is used as an external event counter. Capture register data retention timing The values of 16-bit timer capture/compare registers 000 and 010 (CR000 and p.145 CR010) are not guaranteed after 16-bit timer/event counter 00 has been stopped. Valid edge setting Set the valid edge of the TI000 pin after setting bits 2 and 3 (TMC002 and TMC003) of 16-bit timer mode control register 00 (TMC00) to 0, 0, respectively, and then stopping timer operation. The valid edge is set using bits 4 and 5 (ES000 and ES001) of prescaler mode register 00 (PRM00). p.145 One-shot pulse output: Software trigger When a one-shot pulse is output, do not set the OSPT00 bit to 1. Do not output the one-shot pulse again until INTTM000, which occurs upon a match with the CR000 register, or INTTM010, which occurs upon a match with the CR010 register, occurs. p.145 One-shot pulse output: External trigger If the external trigger occurs again while a one-shot pulse is output, it is ignored. p.145 One-shot pulse output function 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. p.145 Operation of OVF00 flag The OVF00 flag is also set to 1 in the following case. p.146 If any of the following modes: the mode in which clear & start occurs on a match between TM00 and CR000, the mode in which clear & start occurs on a TI000 valid edge, or the free-running mode, is selected CR000 is set to FFFFH. TM00 is counted up from FFFFH to 0000H. Even if the OVF00 flag is cleared before the next count clock (before TM00 becomes 0001H) after the occurrence of TM00 overflow, the OVF00 flag is reset newly and clear is disabled. 460 Page Hard Cautions Soft Soft Hard Chapter 6 Chapter (6/20) Function User's Manual U15836EJ5V0UD p.145 p.146 APPENDIX D LIST OF CAUTIONS Chapter Classification Chapter 6 16-bit timer/ event counter 00 (TM00) Details of Function Cautions Page Conflicting operations When the read period of the 16-bit timer capture/compare register (CR000/CR010) and capture trigger input (CR000/CR010 used as capture register) conflict, capture trigger input has priority. The data read from CR000/CR010 is undefined. Timer operation Even if 16-bit timer counter 00 (TM00) is read, the value is not captured by 16- p.147 bit timer capture/compare register 010 (CR010). Hard Soft (7/20) Function Capture operation p.146 Regardless of the CPU's operation mode, when the timer stops, the input signals to the TI000/TI010 pins are not acknowledged. p.147 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 valid edge. In the mode in which clear & start occurs on a match between the TM00 register and CR000 register, one-shot pulse output is not possible because an overflow does not occur. p.147 If TI000 valid edge is specified as the count clock, a capture operation by the capture register specified as the trigger for TI000 is not possible. p.147 Soft Hard Soft Chapter 7 To ensure the reliability of the capture operation, the capture trigger requires a p.147 pulse two cycles longer than the count clock selected by prescaler mode register 00 (PRM00). 8-bit timer/ event counter 50 (TM50) The capture operation is performed at the falling edge of the count clock. An interrupt request input (INTTM000/INTTM010), however, is generated at the rise of the next count clock. p.147 Compare operation A capture operation may not be performed for CR000/CR010 set in compare mode even if a capture trigger has been input. p.147 Edge detection If the TI000 or TI010 pin is high level immediately after system reset and the p.147 rising edge or both the rising and falling edges are specified as the valid edge of the TI000 or TI010 pin to enable the 16-bit timer counter 00 (TM00) operation, a rising edge is detected immediately after the operation is enabled. Be careful therefore when pulling up the TI000 or TI010 pin. However, when the TI000 or TI010 pin is high level, the rising edge is not detected at restart after the operation has been stopped. CR50: 8-bit timer compare register 50 TCL50: Timer clock selection register 50 The sampling clock used to eliminate noise differs when the 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 fX, and in the latter case the count clock is selected by prescaler mode register 00 (PRM00). The capture operation is started only after a valid level is detected twice by sampling the valid edge, thus eliminating noise with a short pulse width. p.147 In the clear & start mode entered on a match of TM50 and CR50 (TMC506 = 0), do not write other values to CR50 during operation. p.150 In PWM mode, make the CR50 rewrite period 3 count clocks of the count clock p.150 (clock selected by TCL50) or more. When the Ring-OSC clock is selected as the clock to be supplied to the CPU, p.151 the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the count clock is the Ring-OSC clock, the operation of 8-bit timer/event counter 50 is not guaranteed. When rewriting TCL50 to other than the same data, stop the timer operation beforehand. User's Manual U15836EJ5V0UD p.151 461 APPENDIX D LIST OF CAUTIONS Classification Soft Chapter 7 Chapter (8/20) Function 8-bit timer/ event counter 50 (TM50) Details of Function Cautions Page TCL50: Timer clock selection register 50 Be sure to clear bits 3 to 7 to 0. p.151 TMC50: 8-bit timer mode control register 50 The settings of LVS50 and LVR50 are valid in other than PWM mode. p.153 Do not make settings <1> to <4> below simultaneously. In addition, follow the setting procedure shown below. <1> Setting of TMC501 and TMC506: Setting of operation mode <2> Setting of TOE50 if enabling output: Enabling timer output <3> Setting of LVS50 and LVR50 (see Caution 1): Setting of timer F/F <4> Setting of TCE50 p.153 Stop operation before rewriting TMC506. p.153 Interval timer/ square-wave output Do not write other values to CR50 during operation. pp.154, PWM output In PWM mode, make the CR50 rewrite period 3 count clocks of the count clock p.158 (clock selected by TCL50) or more. 157 Soft 8-bit timers H0, H1 (TMH0, TMH1) Timer start error An error of up to one clock may occur in the time required for a match signal to p.160 be generated after timer start. This is because 8-bit timer counter 50 (TM50) is started asynchronously to the count clock. CMP0n: 8-bit timer H compare register 0n CMP0n cannot be rewritten during timer count operation. CMP1n: 8-bit timer H compare register 1n In the PWM output mode be sure to set CMP1n when starting the timer count p.164 operation (TMHEn = 1) after the timer count operation was stopped (TMHEn = 0) (be sure to set again even if setting the same value to CMP1n). TMHMD0: 8-bit timer H mode register 0 When the Ring-OSC clock is selected as the clock to be supplied to the CPU, p.167 the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the count clock is the Ring-OSC clock, the operation of 8-bit timer H0 is not guaranteed. Soft Hard Chapter 8 Hard When reading from CR50 between <1> and <2> in Figure 7-11, the value read p.160 differs from the actual value (read value: M, actual value of CR50: N). When TMHE0 = 1, setting the other bits of TMHMD0 is prohibited. p.164 p.167 Soft Hard In the PWM output mode, be sure to set 8-bit timer H compare register 10 p.167 (CMP10) when starting the timer count operation (TMHE0 = 1) after the timer count operation was stopped (TMHE0 = 0) (be sure to set again even if setting the same value to CMP10). TMHMD1: 8-bit timer H mode register 1 When the Ring-OSC clock is selected as the clock to be supplied to the CPU, p.168 the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the count clock is the Ring-OSC clock, the operation of 8-bit timer H1 is not 7 guaranteed (except when CKS12, CKS11, CKS10 = 1, 0, 1 (fR/2 )). When TMHE1 = 1, setting the other bits of TMHMD1 is prohibited. p.168 In the PWM output mode, be sure to set 8-bit timer H compare register 11 p.168 (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). 462 User's Manual U15836EJ5V0UD APPENDIX D LIST OF CAUTIONS Chapter Classification Chapter 8 8-bit timers H0, H1 (TMH0, TMH1) Soft Watchdog timer Details of Function PWM output WDTM: Watchdog timer mode register Cautions Page In PWM output mode, three operation clocks (signal selected using the CKSn2 p.173 to CKSn0 bits of the TMHMDn register) are required to transfer the CMP1n register value after rewriting the register. Be sure to set the CMP1n register when starting the timer count operation (TMHEn = 1) after the timer count operation was stopped (TMHEn = 0) (be sure to set again even if setting the same value to the CMP1n register). p.173 Make sure that the CMP1n register setting value (M) and CMP0n register setting value (N) are within the following range. 00H CMP1n (M) < CMP0n (N) FFH p.174 If data is written to WDTM, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. p.181 Set bits 7, 6, and 5 to 0, 1, and 1, respectively (when "Ring-OSC cannot be stopped" is selected by a mask option, other values are ignored). p.181 After reset is released, WDTM can be written only once by an 8-bit memory p.182 manipulation instruction. If writing is attempted a second time, an internal reset signal is generated. If the source clock to the watchdog timer is stopped, however, an internal reset signal is generated when the source clock to the watchdog timer resumes operation. WDTE: Watchdog timer enable register WDTM cannot be set by a 1-bit memory manipulation instruction. p.182 If "Ring-OSC can be stopped by software" is selected by the mask option and the watchdog timer is stopped by setting WDCS4 to 1, the watchdog timer does not resume operation even if WDCS4 is cleared to 0. In addition, the internal reset signal is not generated. p.182 If a value other than ACH is written to WDTE, an internal reset signal is generated. If the source clock to the watchdog timer is stopped, however, an internal reset signal is generated when the source clock to the watchdog timer resumes operation. p.182 If a 1-bit memory manipulation instruction is executed for WDTE, an internal p.182 reset signal is generated. If the source clock to the watchdog timer is stopped, however, an internal reset signal is generated when the source clock to the watchdog timer resumes operation. The value read from WDTE is 9AH (this differs from the written value (ACH)). Hard Chapter 9 Soft Hard (9/20) Function p.182 Watchdog timer operation when "Ring-OSC cannot be stopped" is selected by mask option In this mode, operation of the watchdog timer absolutely cannot be stopped p.184 even during STOP instruction execution. For 8-bit timer H1 (TMH1), a division of the Ring-OSC can be selected as the count source, so after STOP instruction execution, clear the watchdog timer using the interrupt request of TMH1 before the watchdog timer overflows. If this processing is not performed, an internal reset signal is generated when the watchdog timer overflows after STOP instruction execution. Watchdog timer operation when "Ring-OSC can be stopped by software" is selected by mask option 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. User's Manual U15836EJ5V0UD p.185 463 APPENDIX D LIST OF CAUTIONS Classification Soft Hard A/D converter Details of Function ADM: A/D converter mode register Soft Chapter 10 Chapter (10/20) Function Cautions A/D conversion must be stopped before rewriting bits FR0 to FR2 to values other than the identical data. p.193 For the sampling time of the A/D converter and the A/D conversion start delay time, see (11) in 10.6 Cautions for A/D Converter. p.193 If data is written to ADM, a wait cycle is generated. For details, see CHAPTER p.193 29 CAUTIONS FOR WAIT. ADS: Analog input channel specification register Be sure to clear bits 2 to 7 of ADS to 0. ADCR: A/D conversion result register When writing to the A/D converter mode register (ADM) and analog input p.194 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. p.194 PFM: Power-fail comparison mode register If data is written to PFM, a wait cycle is generated. For details, see CHAPTER p.195 29 CAUTIONS FOR WAIT. PFT: Power-fail comparison threshold register If data is written to PFT, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. p.195 A/D conversion operation Make sure the period of <1> to <3> is 14 s or more. p.201 It is no problem if the order of <1> and <2> is reversed. p.201 <1> can be omitted. However, do not use the first conversion result after <3> in this case. p.201 The period from <4> to <7> differs from the conversion time set using bits 5 to 3 (FR2 to FR0) of ADM. The period from <6> to <7> is the conversion time set using FR2 to FR0. p.201 Make sure the period of <3> to <6> is 14 s or more. p.201 It is no problem if the order of <3>, <4>, and <5> is changed. p.201 <3> must not be omitted if the power-fail function is used. p.201 The period from <7> to <11> differs from the conversion time set using bits 5 to 3 (FR2 to FR0) of ADM. The period from <9> to <11> is the conversion time set using FR2 to FR0. p.201 Operating current in standby mode The A/D converter stops operating in the standby mode. At this time, the operating current can be reduced by clearing bit 7 (ADCS) of the A/D converter mode register (ADM) to 0 (see Figure 10-2). p.204 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 AVSS 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.204 Power-fail detection function Hard p.194 If data is written to ADS, a wait cycle is generated. For details, see CHAPTER p.194 29 CAUTIONS FOR WAIT. If data is read from ADCR, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. 464 Page User's Manual U15836EJ5V0UD APPENDIX D LIST OF CAUTIONS Soft Page Function A/D Conflicting ADCR read has priority. After the read operation, the new conversion result is converter operations written to ADCR. p.204 p.204 conversion end interrupt signal (INTAD) generated. Hard Chapter Cautions ADM or ADS write has priority. ADCR write is not performed, nor is the Noise To maintain the 10-bit resolution, attention must be paid to noise input to the countermeasures AVREF and ANI0 to ANI3 pins. Because the effect increases in proportion to p.205 the output impedance of the analog input source, it is recommended that a capacitor be connected externally, as shown in Figure 10-19, to reduce noise. ANI0/P20 to The analog input pins (ANI0 to ANI3) are also used as input port pins (P20 to ANI3/P23 P23). p.205 When A/D conversion is performed with any of ANI0 to ANI3 selected, do not access port 2 while conversion is in progress; otherwise the conversion resolution may be degraded. If a digital pulse is applied to the pins adjacent to the pins currently being used p.205 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. Input impedance In this A/D converter, the internal sampling capacitor is charged and sampling of ANI0 to ANI3 is performed for approx. one sixth of the conversion time. pins Since only the leakage current flows other than during sampling and the p.205 current for charging the capacitor also flows during sampling, the input impedance fluctuates and has no meaning. To perform sufficient sampling, however, it is recommended to make the output impedance of the analog input source 10 k or lower, or attach a capacitor of around 100 pF to the ANI0 to ANI3 pins (see Figure 10-19). AVREF pin input A series resistor string of several tens of k is connected between the AVREF impedance and AVSS pins. p.205 Therefore, if the output impedance of the reference voltage source is high, this will result in a series connection to the series resistor string between the AVREF and AVSS pins, resulting in a large reference voltage error. Soft Chapter 10 Classification (11/20) Details of Function Interrupt request The interrupt request flag (ADIF) is not cleared even if the analog input flag (ADIF) channel specification register (ADS) is changed. p.206 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 finished. When A/D conversion is stopped and then resumed, clear ADIF before the A/D conversion operation is resumed. Conversion results just after The first A/D conversion value immediately after A/D conversion starts may not p.206 fall within the rating range if the ADCS bit is set to 1 within 14 s after the A/D conversion ADCE bit was set to 1, or if the ADCS bit is set to 1 with the ADCE bit = 0. start Take measures such as polling the A/D conversion end interrupt request (INTAD) and removing the first conversion result. User's Manual U15836EJ5V0UD 465 APPENDIX D LIST OF CAUTIONS Soft Chapter Chapter 10 Classification (12/20) Function Details of Cautions Page Function A/D A/D conversion converter result register When a write operation is performed to the A/D converter mode register (ADM) p.206 and analog input channel specification register (ADS), the contents of ADCR (ADCR) read may become undefined. Read the conversion result following conversion operation completion before writing to ADM and ADS. Using a timing other than the Soft Chapter 11 Hard above may cause an incorrect conversion result to be read. A/D converter Serial The A/D converter sampling time differs depending on the set value of the A/D p.207 sampling time converter mode register (ADM). A delay time exists until actual sampling is and A/D started after A/D converter operation is enabled. conversion start When using a set in which the A/D conversion time must be strictly observed, delay time care is required regarding the contents shown in Figure 10-21 and Table 10-3. UART mode If clock supply to serial interface UART0 is not stopped (e.g., in the HALT interface mode), normal operation continues. If clock supply to serial interface UART0 UART0 is stopped (e.g., in the STOP mode), each register stops operating, and holds p.209 the value immediately before clock supply was stopped. The TXD0 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 POWER0 = 0, RXE0 = 0, and TXE0 = 0. Set POWER0 = 1 and then set TXE0 = 1 (transmission) or RXE0 = 1 p.209 (reception) to start communication. TXE0 and RXE0 are synchronized by the base clock (fXCLK0) set by BRGC0. p.209 To enable transmission or reception again, set TXE0 or RXE0 to 1 at least two clocks of base clock after TXE0 or RXE0 has been cleared to 0. If TXE0 or RXE0 is set within two clocks of base clock, the transmission circuit or reception circuit may not be initialized. TXS0: Transmit Do not write the next transmit data to TXS0 before the transmission shift register 0 completion interrupt signal (INTST0) is generated. ASIM0: At startup, set POWER0 to 1 and then set TXE0 to 1. To stop the operation, Asynchronous clear TXE0 to 0, and then clear POWER0 to 0. serial interface At startup, set POWER0 to 1 and then set RXE0 to 1. To stop the operation, operation mode clear RXE0 to 0, and then clear POWER0 to 0. register 0 Set POWER0 to 1 and then set RXE0 to 1 while a high level is input to the p.212 p.214 p.214 p.214 RxD0 pin. If POWER0 is set to 1 and RXE0 is set to 1 while a low level is input, reception is started. TXE0 and RXE0 are synchronized by the base clock (fXCLK0) set by BRGC0. p.214 To enable transmission or reception again, set TXE0 or RXE0 to 1 at least two clocks of base clock after TXE0 or RXE0 has been cleared to 0. If TXE0 or RXE0 is set within two clocks of base clock, the transmission circuit or reception circuit may not be initialized. Clear the TXE0 and RXE0 bits to 0 before rewriting the PS01, PS00, and CL0 p.214 bits. Make sure that TXE0 = 0 when rewriting the SL0 bit. Reception is always p.214 performed with "number of stop bits = 1", and therefore, is not affected by the set value of the SL0 bit. Be sure to set bit 0 to 1. 466 User's Manual U15836EJ5V0UD p.214 APPENDIX D LIST OF CAUTIONS Soft Serial interface UART0 Chapter Hard Chapter 11 Classification (13/20) Function Details of Function ASIS0: Asynchronous serial interface reception error status register 0 Page The operation of the PE0 bit differs depending on the set values of the PS01 and PS00 bits of asynchronous serial interface operation mode register 0 (ASIM0). p.215 Only the first bit of the receive data is checked as the stop bit, regardless of the number of stop bits. p.215 If an overrun error occurs, the next receive data is not written to receive buffer register 0 (RXB0) but discarded. p.215 If data is read from ASIS0, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. p.215 Make sure that bit 6 (TXE0) and bit 5 (RXE0) of the ASIM0 register = 0 when rewriting the MDL04 to MDL00 bits. p.217 The baud rate value is the output clock of the 5-bit counter divided by 2. p.217 Soft Soft When the Ring-OSC clock is selected as the clock to be supplied to the CPU, p.217 the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the base clock is the Ring-OSC clock, the operation of serial interface UART0 is not guaranteed. H BRGC0: Baud rate generator control register 0 Cautions POWER0, TXE0, Clear POWER0 to 0 after clearing TXE0 and RXE0 to 0 to set the operation RXE0: Bits 7, 6, 5 stop mode. of ASIM0 To start the operation, set POWER0 to 1, and then set TXE0 and RXE0 to 1. p.218 UART mode Take relationship with the other party of communication when setting the port mode register and port register. p.219 UART transmission After transmit data is written to TXS0, do not write the next transmit data before the transmission completion interrupt signal (INTST0) is generated. p.222 UART reception Be sure to read receive buffer register 0 (RXB0) 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. p.223 Reception is always performed with the "number of stop bits = 1". The second p.223 stop bit is ignored. Be sure to read asynchronous serial interface reception error status register 0 (ASIS0) before reading RXB0. p.223 Keep the baud rate error during transmission to within the permissible error range at the reception destination. p.226 Make sure that the baud rate error during reception satisfies the range shown in (4) Permissible baud rate range during reception. p.226 Permissible baud rate range during reception Make sure that the baud rate error during reception is within the permissible error range, by using the calculation expression shown below. p.228 UART mode 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. p.230 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. p.230 Hard Soft Chapter 12 Error of baud rate Serial interface UART6 User's Manual U15836EJ5V0UD 467 APPENDIX D LIST OF CAUTIONS Classification Soft Chapter 12 Chapter (14/20) Function Serial interface UART6 Details of Function Cautions Page UART mode 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. TXB6: Transmit buffer register 6 Do not write data to TXB6 when bit 1 (TXBF6) of asynchronous serial interface p.236 transmission status register 6 (ASIF6) is 1. ASIM6: Asynchronous serial interface operation mode register 6 ASIS6: Asynchronous serial interface reception error status register 6 ASIF6: Asynchronous serial interface transmission status register 6 p.230 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). p.236 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. p.238 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. p.238 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. p.238 Clear the TXE6 and RXE6 bits to 0 before rewriting the PS61, PS60, and CL6 bits. p.238 Fix the PS61 and PS60 bits to 0 when mounting the device on LIN. p.238 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. p.238 Make sure that RXE6 = 0 when rewriting the ISRM6 bit. p.238 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). p.239 The first bit of the receive data is checked as the stop bit, regardless of the number of stop bits. p.239 If an overrun error occurs, the next receive data is not written to receive buffer register 6 (RXB6) but discarded. p.239 If data is read from ASIS6, a wait cycle is generated. For details, see CHAPTER 29 CAUTIONS FOR WAIT. p.239 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. p.240 Hard To initialize the transmission unit upon completion of continuous transmission, p.240 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. 468 CKSR6: Clock When the Ring-OSC clock is selected as the clock to be supplied to the CPU, p.241 selection register 6 the clock of the Ring-OSC oscillator is divided and supplied as the count clock. If the base clock is the Ring-OSC clock, the operation of serial interface UART6 is not guaranteed. User's Manual U15836EJ5V0UD APPENDIX D LIST OF CAUTIONS Soft Hard Soft Chapter Chapter 12 Classification (15/20) Function Serial interface UART6 Details of Function Cautions Page CKSR6: Clock Make sure POWER6 = 0 when rewriting TPS63 to TPS60. selection register 6 p.241 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.242 The baud rate value is the output clock of the 8-bit counter divided by 2. p.242 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). Note, however, that communication is started by the refresh operation because bit 6 (SBRT6) of ASICL6 is cleared to 0 when communication is completed (when an interrupt signal is generated). p.243 In the case of an SBF reception error, return the mode to the SBF reception mode again. The status of the SBRF6 flag is held (1). p.243 Before setting the SBRT6 bit, make sure that bit 7 (POWER6) and bit 5 (RXE6) of ASIM6 = 1. p.243 The read value of the SBRT6 bit is always 0. SBRT6 is automatically cleared to 0 after SBF reception has been correctly completed. p.243 ASICL6: Asynchronous serial interface control register 6 Before rewriting the DIR6 and TXDLV6 bits, clear the TXE6 and RXE6 bits to 0. p.243 POWER6, TXE6, RXE6: Bits 7, 6, 5 of ASIM6 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. p.245 UART mode Take relationship with the other party of communication when setting the port mode register and port register. p.246 Parity types and operation Fix the PS61 and PS60 bits to 0 when the device is incorporated in LIN. p.249 Continuous transmission The TXBF6 and TXSF6 flags of the ASIF6 register change from "10" to "11", p.251 and to "01" during continuous transmission. To check the status, therefore, do not use a combination of the TXBF6 and TXSF6 flags for judgment. Read only the TXBF6 flag when executing continuous transmission. When the device is incorporated in a LIN, the continuous transmission function p.251 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 during continuous transmission: Bit 1 of ASIF6 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. p.251 TXSF6 during continuous transmission: Bit 1 of ASIF6 To initialize the transmission unit upon completion of continuous transmission, p.251 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. During continuous transmission, an overrun error may occur, which means p.251 that the next transmission was completed before execution of INTST6 interrupt servicing after transmission of one data frame. An overrun error can be detected by developing a program that can count the number of transmit data and by referencing the TXSF6 flag. User's Manual U15836EJ5V0UD 469 APPENDIX D LIST OF CAUTIONS Classification Soft Chapter 12 Chapter (16/20) Function Serial Details of Function Normal reception Cautions Be sure to read receive buffer register 6 (RXB6) even if a reception error interface occurs. Otherwise, an overrun error will occur when the next data is received, UART6 and the reception error status will persist. Page p.255 Reception is always performed with the "number of stop bits = 1". The second p.255 stop bit is ignored. Be sure to read asynchronous serial interface reception error status register 6 p.255 (ASIS6) before reading RXB6. Generation of Keep the baud rate error during transmission to within the permissible error serial clock range at the reception destination. Make sure that the baud rate error during reception satisfies the range shown p.262 p.262 in (4) Permissible baud rate range during reception. Permissible baud Make sure that the baud rate error during reception is within the permissible rate range during error range, by using the calculation expression shown below. p.264 Soft Chapter 13 reception Serial SOTB10: interface Transmit buffer CSI10 register 10 Do not access SOTB10 when CSOT10 = 1 (during serial communication). p.268 Do not access SIO10 when CSOT10 = 1 (during serial communication). p.268 Be sure to clear bit 5 to 0. p.269 CSIC10: Serial When the Ring-OSC clock is selected as the clock supplied to the CPU, the p.271 clock selection clock of the Ring-OSC oscillator is divided and supplied as the serial clock. At register 10 this time, the operation of serial interface CSI10 is not guaranteed. SIO10: Serial I/O shift register 10 CSIM10: Serial operation mode Soft Hard register 10 Do not write to CSIC10 while CSIE10 = 1 (operation enabled). p.271 Clear CKP10 to 0 to use P10/SCK10 (/TxD0), P11/SI10 (/RxD0), and p.271 P12/SO10 as general-purpose port pins. The phase type of the data clock is type 1 after reset. p.271 3-wire serial I/O Take relationship with the other party of communication when setting the port p.273 mode mode register and port register. Communication operation Do not access the control register and data register when CSOT10 = 1 (during p.275 serial communication). SO10 output If a value is written to TRMD10, DAP10, and DIR10, the output value of SO10 p.279 470 Soft Chapter 14 changes. Interrupt IF1L: Interrupt Be sure to clear bits 2 to 7 of IF1L to 0. p.284 IF0L, IF0H, IF1L: When operating a timer, serial interface, or A/D converter after standby p.284 Interrupt request release, operate it once after clearing the interrupt request flag. An interrupt flag registers request flag may be set by noise. request flag register User's Manual U15836EJ5V0UD APPENDIX D LIST OF CAUTIONS Soft Chapter Chapter 14 Classification (17/20) Function Details of Cautions Page Function Interrupt IF0L, IF0H, IF1L: When manipulating a flag of the interrupt request flag register, use a 1-bit Interrupt request memory manipulation instruction (CLR1). When describing in C language, use flag registers a bit manipulation instruction such as "IF0L.0 = 0;" or "_asm("clr1 IF0L, 0");" p.284 because the compiled assembler must be a 1-bit memory manipulation instruction (CLR1). If a program is described in C language using an 8-bit memory manipulation instruction such as "IF0L &= 0xfe;" and compiled, it becomes the assembler of three instructions. mov a, IF0L and a, #0FEH mov IF0L, a In this case, even if the request flag of another bit of the same interrupt request flag register (IF0L) is set to 1 at the timing between "mov a, IF0L" and "mov IF0L, a", the flag is cleared to 0 at "mov IF0L, a". Therefore, care must be exercised when using an 8-bit memory manipulation instruction in C language. MK1L: Interrupt Be sure to set bits 2 to 7 of MK1L to 1. p.285 Be sure to set bits 2 to 7 of PR1L to 1. p.286 EGP, EGN: Select the port mode by clearing EGPn and EGNn to 0 because an edge may p.287 External interrupt be detected when the external interrupt function is switched to the port rising, falling function. mask flag register PR1L: Priority specification flag register edge enable register Software interrupt Do not use the RETI instruction for restoring from the software interrupt. p.291 request acknowledgment Interrupt request The BRK instruction is not one of the above-listed interrupt request hold hold instructions. However, the software interrupt activated by executing the BRK p.295 instruction causes the IE flag to be cleared to 0. Therefore, even if a maskable interrupt request is generated during execution of the BRK - function Soft The RSTOP setting is valid only when "Can be stopped by software" is set for p.296 Ring-OSC by a mask option. Hard Soft Standby When shifting to the STOP mode, be sure to stop the peripheral hardware p.297 operation before executing STOP instruction. STOP mode, HALT mode The following sequence is recommended for operating current reduction of the p.297 A/D converter when the standby function is used: First clear bit 7 (ADCS) 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. Hard Chapter 15 instruction, the interrupt request is not acknowledged. STOP mode If the Ring-OSC oscillator is operating before the STOP mode is set, oscillation p.297 of the Ring-OSC clock cannot be stopped in the STOP mode. However, when the Ring-OSC clock is used as the CPU clock, the CPU operation is stopped for 17/fR (s) after STOP mode is released. User's Manual U15836EJ5V0UD 471 APPENDIX D LIST OF CAUTIONS Classification Soft Function Standby function Details of Function OSTC: Oscillation stabilization time counter status register Soft Hard Chapter 15 Chapter (18/20) Hard Soft Hard Chapter 16 Soft Page After the above time has elapsed, the bits are set to 1 in order from MOST11 and remain 1. p.299 If the STOP mode is entered and then released while the Ring-OSC clock is being used as the CPU clock, set the oscillation stabilization time as follows. * Desired OSTC oscillation stabilization time Oscillation stabilization time set by OSTS The X1 oscillation stabilization time counter counts only during the oscillation stabilization time set by OSTS. Therefore, note that only the statuses during the oscillation stabilization time set by OSTS are set to OSTC after STOP mode has been released. p.299 The wait time when STOP mode is released does not include the time after STOP mode release until clock oscillation starts ("a" below) regardless of whether STOP mode is released by RESET input or interrupt generation. p.299 OSTS: Oscillation To set the STOP mode when the X1 input clock is used as the CPU clock, set p.300 stabilization time OSTS before executing the STOP instruction. select register Execute the OSTS setting after confirming that the oscillation stabilization time p.300 has elapsed as expected in the OSTC. STOP mode setting and operating statuses Reset function - LVI circuit internal reset 472 Cautions If the STOP mode is entered and then released while the Ring-OSC clock is being used as the CPU clock, set the oscillation stabilization time as follows. * Desired OSTC oscillation stabilization time Oscillation stabilization time set by OSTS The X1 oscillation stabilization time counter counts only during the oscillation stabilization time set by OSTS. Therefore, note that only the statuses during the oscillation stabilization time set by OSTS are set to OSTC after STOP mode has been released. p.300 The wait time when STOP mode is released does not include the time after STOP mode release until clock oscillation starts ("a" below) regardless of whether STOP mode is released by RESET input or interrupt generation. p.300 p.304 Because the interrupt request signal is used to clear the standby mode, if there is an interrupt source with the interrupt request flag set and the interrupt mask flag reset, the standby mode is immediately cleared if set. Thus, the STOP mode is reset to the HALT mode immediately after execution of the STOP instruction and the system returns to the operating mode as soon as the wait time set using the oscillation stabilization time select register (OSTS) has elapsed. For an external reset, input a low level for 10 s or more to the RESET pin. p.308 During reset input, the X1 input clock and Ring-OSC clock stop oscillating. p.308 When the STOP mode is released by a reset, the STOP mode contents are held during reset input. However, the port pins become high-impedance, except for P130, which is set to low-level output. p.308 An LVI circuit internal reset does not reset the LVI circuit. p.309 Reset timing due A watchdog timer internal reset resets the watchdog timer. to watchdog timer overflow p.310 RESF: Reset control flag register p.314 Do not read data via a 1-bit memory manipulation instruction. User's Manual U15836EJ5V0UD APPENDIX D LIST OF CAUTIONS Soft Soft Chapter Chapter 17 Chapter 18 Soft Hard Soft Chapter 21 Chapter 19 Classification (19/20) Function Clock monitor Power-onclear circuit (POC) Lowvoltage detector (LVI) PD78F0 Details of Function Cautions Page CLM: Clock monitor mode register Once bit 0 (CLME) is set to 1, it cannot be cleared to 0 except by RESET input p.316 or the internal reset signal. If the reset signal is generated by the clock monitor, CLME is cleared to 0 and bit 1 (CLMRF) of the reset control flag register (RESF) is set to 1. p.316 Functions of power-on-clear circuit If an internal reset signal is generated in the POC circuit, the reset control flag register (RESF) is cleared to 00H. p.322 Cautions for power-on-clear circuit p.324 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. LVIM: Low-voltage To stop LVI, follow either of the procedures below. p.328 detection register * When using 8-bit memory manipulation instruction: Write 00H to LVIM. * When using 1-bit memory manipulation instruction: Clear LVION to 0 first and then clear LVIE to 0. LVIS: Low-voltage detection level selection register Be sure to clear bits 3 to 7 to 0. p.329 When used as reset <1> must always be executed. When LVIMK = 0, an interrupt may occur immediately after the processing in <5>. p.330 If "POC used" is selected by a mask option, procedures <3> and <4> are not required. p.330 If supply voltage (VDD) > detection voltage (VLVI) when LVIM is set to 1, an internal reset signal is not generated. p.330 When used as interrupt If "POC used" is selected by a mask option, procedures <3> and <4> are not required. p.332 Cautions for lowvoltage 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 (a) below. (2) When used as interrupt Interrupt requests may be frequently generated. Take action (b) below. p.334 - 103 There are differences in noise immunity and noise radiation between the flash p.338 memory and mask ROM versions. When pre-producing an application set with the flash memory version and then mass-producing it with the mask ROM version, be sure to conduct sufficient evaluations for the commercial samples (not engineering samples) of the mask ROM versions. IMS: Internal memory size switching register The initial value of IMS is "setting prohibited (CFH)". Be sure to set the value of the relevant mask ROM version at initialization. p.339 When using a mask ROM version, be sure to set IMS to the value indicated in Table 21-2. p.339 UART0, UART6 When UART0 or UART6 is selected, the receive clock is calculated based on the reset command sent from the dedicated flash programmer after the VPP pulse has been received. p.355 User's Manual U15836EJ5V0UD 473 APPENDIX D LIST OF CAUTIONS Hard Chapter Chapters 23, 24, 25, 26 Classification (20/20) Function Details of Cautions Page Function Electrical Absolute specifications maximum Product quality may suffer if the absolute maximum rating is exceeded even pp.371, momentarily for any parameter. That is, the absolute maximum ratings are 389, 405, rated values at which the product is on the verge of suffering physical damage, 420 ratings and therefore the product must be used under conditions that ensure that the absolute maximum ratings are not exceeded. X1 oscillator When using the X1 oscillator, wire as follows in the area enclosed by the pp.372, broken lines in the above figures to avoid an adverse effect from wiring 390, 407, capacitance. 421 * 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. Since the CPU is started by the Ring-OSC after reset is released, check the pp.372, oscillation stabilization time of the X1 input clock using the oscillation 390, 407, stabilization time counter status register (OSTC). Determine the oscillation 421 stabilization time of the OSTC register and oscillation stabilization time select register (OSTS) after sufficiently evaluating the oscillation stabilization time with the resonator to be used. Recommended For the resonator selection of the PD780101(A), 780102(A), and 780103(A) pp.373, oscillator and oscillator constants, users are required to either evaluate the oscillation 391 constants themselves or apply to the resonator manufacturer for evaluation. The oscillator constants shown above are reference values based on pp.373, evaluation in a specific environment by the resonator manufacturer. If it is 374, 375, necessary to optimize the oscillator characteristics in the actual application, 391, 392, apply to the resonator manufacturer for evaluation on the implementation 393 circuit. The oscillation voltage and oscillation frequency only indicate the oscillator characteristic. Use the 78K0/KB1 so that the internal operation 474 Hard Chapter 28 conditions are within the specifications of the DC and AC characteristics. Recommended - Do not use different soldering methods together (except for partial heating). soldering pp.431, 432 conditions User's Manual U15836EJ5V0UD APPENDIX E REVISION HISTORY E.1 Major Revisions in This Edition (1/2) Page Description Throughout Addition of description for expanded-specification products of standard products and (A) grade products p. 9 Addition of Differences Between 78K0/KB1 and 78K0/KB1+ to INTRODUCTION p. 17 Addition of 1.1 Expanded-Specification Products and Conventional Products (Standard Products, (A) Grade Products Only) p. 23 Modification of 1.6 Kx1 Series Lineup p. 91 Addition of Note to Figure 5-2 Format of Processor Clock Control Register (PCC) p. 92 Addition of minimum instruction execution time with X1 input clock (at 12 MHz operation) and Notes 2 and 3 to Table 5-2 Relationship Between CPU Clock and Minimum Instruction Execution Time p. 95 Addition of oscillation stabilization time status (fXP = 12 MHz) to Figure 5-6 Format of Oscillation Stabilization Time Counter Status Register (OSTC) p. 96 Addition of oscillation stabilization time (fXP = 12 MHz) and Cautions 1 and 2 to Figure 5-7 Format of p. 105 Modification of Table 5-5 Maximum Time Required to Switch Between Ring-OSC Clock and X1 Input Oscillation Stabilization Time Select Register (OSTS) Clock and addition of Note p. 106 p. 116 Addition of Caution to Table 5-6 Maximum Time Required for CPU Clock Switchover Addition of description of at interrupt request generation to Figure 6-5 Format of 16-Bit Timer Mode Control Register 00 (TMC00) p. 118 Addition of Caution 7 to Figure 6-7 Format of 16-Bit Timer Output Control Register 00 (TOC00) p. 119 Addition of Note 1 to Figure 6-8 Format of Prescaler Mode Register 00 (PRM00) p. 142 Modification of TMC00 set value in Figure 6-32 Timing of One-Shot Pulse Output Operation with Software Trigger p. 151 Addition of Note to Figure 7-4 Format of Timer Clock Selection Register 50 (TCL50) p. 153 Modification of Caution 2 in Figure 7-5 Format of 8-Bit Timer Mode Control Register 50 (TMC50) p. 166 Addition of Note 1 and modification of Note 2 in Figure 8-5 Format of 8-Bit Timer H Mode Register 0 (TMHMD0) p. 168 p. 182 Addition of Note to Figure 8-6 Format of 8-Bit Timer H Mode Register 1 (TMHMD1) Modification of Caution 3 and addition of Caution 5 in Figure 9-2 Format of Watchdog Timer Mode Register (WDTM) p. 182 Modification of Cautions 1 and 2 in Figure 9-3 Format of Watchdog Timer Enable Register (WDTE) p. 183 Addition of Table 9-4 Relationship Between Watchdog Timer Operation and Internal Reset Signal Generated by Watchdog Timer p. 216 Addition of Note 1 and modification of Note 2 in Figure 11-4 Format of Baud Rate Generator Control Register 0 (BRGC0) p. 241 Addition of Note 1 and modification of Note 2 in Figure 12-8 Format of Clock Selection Register 6 (CKSR6) p. 270 Addition of Note to Figure 13-3 Format of Serial Clock Selection Register 10 (CSIC10) p. 284 Modification of Caution 3 in Figure 14-2 Format of Interrupt Request Flag Register (IF0L, IF0H, IF1L) p. 298 Addition of oscillation stabilization time status (fXP = 12 MHz) to Figure 15-1 Format of Oscillation Stabilization Time Counter Status Register (OSTC) p. 300 Addition of oscillation stabilization time (fXP = 12 MHz) and Cautions 1 and 2 to Figure 15-2 Format of Oscillation Stabilization Time Select Register (OSTS) User's Manual U15836EJ5V0UD 475 APPENDIX E REVISION HISTORY (2/2) Page Description p. 310 Modification of Figure 16-2 Timing of Reset by RESET Input p. 310 Modification of Figure 16-3 Timing of Reset Due to Watchdog Timer Overflow p. 311 Modification of Figure 16-4 Timing of Reset in STOP Mode by RESET Input p. 326 Modification of Note in 19.1 Functions of Low-Voltage Detector p. 329 Addition of Notes 3 and 4 to Figure 19-3 Format of Low-Voltage Detection Level Selection Register (LVIS) p. 370 Addition of CHAPTER 23 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (EXPANDED-SPECIFICATION PRODUCTS) CHAPTER 24 ELECTRICAL SPECIFICATIONS (STANDARD PRODUCTS, (A) GRADE PRODUCTS) (CONVENTIONAL PRODUCTS) p. 388 * Modification of description of target products p. 390 * Addition of Caution 2 to X1 Oscillator Characteristics CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A1) GRADE PRODUCTS) p. 407 pp. 410, 411 * Addition of Caution 2 to X1 Oscillator Characteristics * Addition of value of supply current (IDD4) in Ring-OSC, HALT mode to DC Characteristics CHAPTER 26 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) p. 421 * Addition of Caution 2 to X1 Oscillator Characteristics p. 423 * Addition of value of supply current (IDD4) in Ring-OSC, HALT mode to DC Characteristics p. 439 Addition of (3) When using the in-circuit emulator QB-78K0KX1H to Figure A-1 Development Tool Configuration p. 444 Addition of A.5.3 When using in-circuit emulator QB-78K0KX1H p. 448 Addition of B.2 When Using QB-78K0KX1H p. 455 Addition of APPENDIX D LIST OF CAUTIONS 476 User's Manual U15836EJ5V0UD APPENDIX E REVISION HISTORY E.2 Revision History of Previous Editions A history of the revisions up to this edition is shown below. "Applied to:" indicates the chapters to which the revision was applied. (1/9) Edition 2nd Description Applied to: X1 input clock oscillation stabilization time Throughout 2 /fX, 2 /fX, 2 /fX, 2 /fX, 2 /fX 2 /fX, 2 /fX, 2 /fX, 2 /fX, 2 /fX 12 14 15 16 17 11 13 14 15 16 Modification of Figure 4-5 Block Diagram of P10 CHAPTER 4 Modification of Table 4-3 Settings of Port Mode Register and Output Latch PORT FUNCTIONS When Alternate-Function Is Used Modification of Figure 5-6 Format of Oscillation Stabilization Time Counter CHAPTER 5 Status Register (OSTC) CLOCK GENERATOR Modification of Figure 5-7 Format of Oscillation Stabilization Time Select Register (OSTS) Addition of 5.7 Clock Selection Flowchart and Register Settings Addition of Remark to 12.1 Functions of Serial Interface UART6 CHAPTER 12 SERIAL INTERFACE UART6 Addition of Reset to Table 14-1 Interrupt Source List CHAPTER 14 INTERRUPT FUNCTIONS Modification of Figure 15-2 Format of Oscillation Stabilization Time Counter CHAPTER 15 Status Register (OSTC) STANDBY FUNCTION Modification of Figure 15-3 Format of Oscillation Stabilization Time Select Register (OSTS) 2nd Addition of CHAPTER 25 RETRY CHAPTER 25 RETRY Modification of reset value of the following register in Table 3-5 Special Function CHAPTER 3 CPU (corrected Register List edition) ARCHITECTURE * Serial I/O shift register 10 (SIO10) Modification of manipulatable bit unit of the following registers in Table 3-5 Special Function Register List * Oscillation stabilization time counter status register (OSTC) * Interrupt request flag register 1L (IF1L) * Interrupt mask flag register 1L (MK1L) * Priority specification flag register 1L (PR1L) Modification of manipulatable bit unit in 5.3 (5) Oscillation stabilization time CHAPTER 5 CLOCK counter status register (OSTC) GENERATOR Modification of Figure 5-11 Status Transition Diagram Modification of Table 5-3 Relationship Between Operation Clocks in Each Operation Status Modification of Table 5-4 Oscillation Control Flags and Clock Oscillation Status Modification of Table 5-6 Clock and Register Settings Modification of reset value in 6.2 (2) 16-bit timer capture/compare register 000 CHAPTER 6 16-BIT (CR000) and (3) 16-bit timer capture/compare register 010 (CR010) TIMER/EVENT COUNTER 00 Modification of manipulatable bit unit in 6.3 (4) Prescaler mode register 00 (PRM00) Modification of Caution in 9.4.2 Watchdog timer operation when "Ring-OSC can CHAPTER 9 WATCHDOG be stopped by software" is selected by mask option TIMER Modification of 9.4.3 Watchdog timer operation in STOP mode (when "RingOSC can be stopped by software" is selected by mask option) User's Manual U15836EJ5V0UD 477 APPENDIX E REVISION HISTORY (2/9) Edition Description 2nd Addition of 9.4.4 Watchdog timer operation in HALT mode (when "Ring-OSC (corrected can be stopped by software" is selected by mask option) edition) Addition of (11) A/D converter sampling time and A/D conversion start delay time in 10.6 Cautions for A/D Converter Applied to: CHAPTER 9 WATCHDOG TIMER CHAPTER 10 A/D CONVERTER Modification of reset value in 13.2 (2) Serial I/O shift register 10 (SIO10) CHAPTER 13 SERIAL INTERFACE CSI10 Modification of manipulatable bit unit in 15.1.2 (1) Oscillation stabilization time counter status register (OSTC) CHAPTER 15 STANDBY FUNCTION Modification of A/D converter item in Table 15-2 Operating Statuses in HALT mode Addition of 18.4 Cautions for Power-on-Clear Circuit CHAPTER 18 POWER-ONCLEAR CIRCUIT Modification of Figure 19-3 Format of Low-Voltage Detection Level Selection Register (LVIS) CHAPTER 19 LOWVOLTAGE DETECTOR Addition of 19.5 Cautions for Low-Voltage Detector 3rd Modification of the following contents in CHAPTER 23 ELECTRICAL SPECIFICATIONS (TARGET VALUES) * Absolute Maximum Ratings * X1 Oscillator Characteristics * DC Characteristics * A/D Converter Characteristics * POC Circuit Characteristics * LVI Circuit Characteristics * Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (deletion of data retention supply current) * Deletion of Ring-OSC Characteristics * Flash Memory Programming Characteristics CHAPTER 23 ELECTRICAL SPECIFICATIONS (TARGET VALUES) Modification from CHAPTER 25 RETRY to CHAPTER 25 CAUTIONS FOR WAIT CHAPTER 25 CAUTIONS FOR WAIT Deletion of following products. * PD780101(A2), 780102(A2), 780103(A2) * PD78F0103M3MC(A1)-5A4, 78F0103M4MC(A1)-5A4 Throughout Modification of supply voltage range of (A1) product and ambient operating temperature of flash memory version of (A1) product Modification of reset value of A/D conversion result register (ADCR) (0000H undefined) Update of 1.6 78K0/K1 Series Lineup CHAPTER 1 OUTLINE Modification of Figure 3-12 Data to Be Saved to Stack Memory CHAPTER 3 CPU ARCHITECTURE Modification of Figure 3-13 Data to Be Restored from Stack Memory Modification of [Description example] in 3.4.4 Short direct addressing Addition of [Illustration] to 3.4.7 Based addressing, 3.4.8 Based indexed addressing, and 3.4.9 Stack addressing Addition of Remark to Figure 4-13 Block Diagram of P130 CHAPTER 4 PORT FUNCTIONS Addition of condition (set value of MCM0) to Figure 5-2 Format of Processor Clock Control Register (PCC) CHAPTER 5 CLOCK GENERATOR Modification of Figure 4-10 Block Diagram of P20 to P23 Partial modification of description in 5.5 Clock Generator Operation Addition of 5.7 Changing System Clock and CPU Clock Settings 478 User's Manual U15836EJ5V0UD APPENDIX E REVISION HISTORY (3/9) Edition 3rd Description Applied to: Modification of Figure 6-1 Block Diagram of 16-Bit Timer/Event Counter 00 CHAPTER 6 16-BIT Modification of Cautions 1 and 2 in 6.2 (2) 16-bit timer capture/compare register TIMER/EVENT COUNTER 00 000 (CR000), and modification of Caution 1 in (3) 16-bit timer capture/compare register 010 (CR010) Addition of Caution 1 to Figure 6-5 Format of Prescaler Mode Register 00 (PRM00) Addition of Note to Figure 6-8 Interval Timer Configuration Diagram Modification of Caution 1 of Figure 6-10 Control Register Settings for PPG Output Operation Addition of Figure 6-11 Configuration of PPG Output and Figure 6-12 PPG Output Operation Timing Addition of Note to Figure 6-15 Timing of Pulse Width Measurement Operation with Free-Running Counter and One Capture Register (with Both Edges Specified), Figure 6-18 Timing of Pulse Width Measurement Operation with Free-Running Counter (with Both Edges Specified), and Figure 6-20 Timing of Pulse Width Measurement Operation with Free-Running Counter and Two Capture Registers (with Rising Edge Specified) Modification of Figure 6-24 Configuration Diagram of External Event Counter Addition of 6.4.6 One-shot pulse output operation Modification of Figure 6-34 Capture Register Data Retention Timing Addition of description <2> to 6.5 (4) Capture register data retention timing Deletion of 6.5 (7) Conflicting operations from old edition Modification of Figure 7-1 Block Diagram of 8-Bit Timer/Event Counter 50 CHAPTER 7 8-BIT Addition of Caution 1 to Figure 7-2 Format of Timer Clock Selection Register 50 TIMER/EVENT COUNTER 50 (TCL50) Deletion of Caution 1 of old edition and modification of Caution 2 of Figure 7-3 Format of 8-Bit Timer Mode Control Register 50 (TMC50) Addition of Remark to Figure 7-8 PWM Output Operation Timing Addition of square-wave output to 8.1 Functions of 8-Bit Timers H0 and H1, and CHAPTER 8 8-BIT TIMERS modification of PWM pulse generator mode to PWM output H0 AND H1 Modification of Figure 8-1 Block Diagram of 8-Bit Timer H0 Modification of Figure 8-2 Block Diagram of 8-Bit Timer H1 Addition of Note and Caution 1 to Figure 8-3 Format of 8-Bit Timer H Mode Register 0 (TMHMD0) Addition of Figure 8-5 Format of Port Mode Register 1 (PM1) Modification of 8.4.1 Operation as interval timer of old edition to 8.4.1 Operation as interval timer/square-wave output Modification of (a) Basic operation of Figure 8-7 Timing of Interval Timer/SquareWave Output Operation Modification of description of duty ratio in 8.4.2 (1) Usage Addition of description to 10.2 (2) A/D conversion result register (ADCR), CHAPTER 10 A/D modification of description in (3) Sample & hold circuit and (4) Voltage CONVERTER comparator, and partial modification of Caution 2 in (6) ANI0 to ANI3 pins Modification of Note 1 of Figure 10-4 Format of A/D Converter Mode Register (ADM) User's Manual U15836EJ5V0UD 479 APPENDIX E REVISION HISTORY (4/9) Edition 3rd Description Applied to: Modification of Figure 10-6 Format of Analog Input Channel Specification CHAPTER 10 A/D Register (ADS) CONVERTER Addition of description to 10.3 (3) Power-fail comparison mode register (PFM), and modification of Figure 10-7 Format of Power-Fail Comparison Mode Register (PFM) Modification of expressions in 10.4.2 Input voltage and conversion results Partial modification of description in 10.6 (5) ANI0/P20 to ANI3/P23 Addition of description to 10.6 (9) Conversion results just after A/D conversion start Modification of Caution 3 of 11.1 Functions of Serial Interface UART0 CHAPTER 11 SERIAL Modification of Figure 11-1 Block Diagram of Serial Interface UART0 INTERFACE UART0 Modification of Caution 3 in Figure 11-2 Format of Asynchronous Serial Interface Operation Mode Register 0 (ASIM0) and 11.4.2 (1) (a) Asynchronous (PD780102, 780103, 78F0103 ONLY) serial interface operation mode register 0 (ASIM0) Addition of Note and Caution 1 to Figure 11-4 Format of Baud Rate Generator Control Register 0 (BRGC0) and 11.4.3 (2) (a) Baud rate generator control register 0 (BRGC0) Addition of Figure 11-5 Format of Port Mode Register 1 (PM1) and 11.4.2 (1) (c) Port mode register 1 (PM1) Modification of Figure 11-11 Configuration of Baud Rate Generator Modification of term in 11.4.3 (4) Permissible baud rate range during reception and 12.4.3 (4) Permissible baud rate range during reception as follows Transfer rate Data frame length Modification of Remark 1 in Table 11-4 Maximum/Minimum Permissible Baud Rate Error Addition of Figure 12-4 Format of Input Switch Control Register (ISC) CHAPTER 12 SERIAL Modification of Figure 12-5 Block Diagram of Serial Interface UART6 INTERFACE UART6 Addition of Note and Caution 1 to Figure 12-9 Format of Clock Selection Register 6 (CKSR6) and 12.4.3 (2) (a) Clock selection register 6 (CKSR6) Modification of Figure 12-11 Format of Asynchronous Serial Interface Control Register 6 (ASICL6) and 12.4.2 (1) (d) Asynchronous serial interface control register 6 (ASICL6) Addition of Figure 12-12 Format of Port Mode Register 1 (PM1) and 12.4.2 (1) (e) Port mode register 1 (PM1) Modification of description of 12.4.2 (2) (h) SBF transmission and addition of Figure 12-22 Example of Setting Procedure of SBF Transmission (Flowchart) Modification of Figure 12-25 Configuration of Baud Rate Generator Modification of Figure 13-1 Block Diagram of Serial Interface CSI10 CHAPTER 13 SERIAL Addition of Figure 13-4 Format of Port Mode Register 1 (PM1) and 13.4.2 (1) (c) INTERFACE CSI10 Port mode register 1 (PM1) Modification of (C) Software interrupt in Figure 14-1 Basic Configuration of CHAPTER 14 INTERRUPT Interrupt Function FUNCTIONS Addition of Note 4 to Table 14-2 Flag Corresponding to Interrupt Request Sources Deletion of Caution 1 from Figure 14-3 Format of Interrupt Mask Flag Register (MK0L, MK0H, MK1L) of old edition Addition of Table 14-3 Ports Corresponding to EGPn and EGNn 480 User's Manual U15836EJ5V0UD APPENDIX E REVISION HISTORY (5/9) Edition 3rd Description Applied to: Addition of items of software interrupt requests to Table 14-5 Interrupt Request CHAPTER 14 INTERRUPT Enabled for Multiple Interrupt Servicing During Interrupt Servicing FUNCTIONS Modification of Table 15-1 Relationship Between HALT and STOP Modes and CHAPTER 15 STANDBY Clock FUNCTION Modification of following items in Table 15-2 Operating Statuses in HALT Mode and Table 15-4 Operating Statuses in STOP Mode * System clock * 16-bit timer/event counter 00 (Table 15-2 only) * 8-bit timer H0 * Watchdog timer * Serial interface UART0 * Serial interface UART6 Modification of Figure 16-1 Block Diagram of Reset Function CHAPTER 16 RESET FUNCTION Addition of description to (4) and (5) of Figure 17-3 Timing of Clock Monitor CHAPTER 17 CLOCK MONITOR Addition of Note to description of 18.1 Functions of Power-on-Clear Circuit CHAPTER 18 POWER-ON- Modification of Figure 18-1 Block Diagram of Power-on-Clear Circuit CLEAR CIRCUIT Addition of Note to description of 19.1 Functions of Low-Voltage Detector CHAPTER 19 LOW-VOLTAGE Modification of Figure 19-1 Block Diagram of Low-Voltage Detector DETECTOR Addition of Note 2 to Figure 19-3 Format of Low-Voltage Detection Level Selection Register (LVIS) Modification of Figure 19-7 Example of Software Processing of LVI Interrupt Addition of Note to description of CHAPTER 20 MASK OPTIONS CHAPTER 20 MASK OPTIONS Revision of CHAPTER 21 PD78F0103 (no change to 21.1 Internal Memory Size CHAPTER 21 PD78F0103 Switching Register) Revision of CHAPTER 23 ELECTRICAL SPECIFICATIONS CHAPTER 23 ELECTRICAL SPECIFICATIONS Addition of CHAPTER 25 RECOMMENDED SOLDERING CONDITIONS CHAPTER 25 RECOMMENDED SOLDERING CONDITIONS Addition of A.3 Control Software APPENDIX A Deletion of `NP-36GS' and `NGS-30' from A.5 Debugging Tools (Hardware) of old DEVELOPMENT TOOLS edition, and addition of in-circuit emulator `IE-78K0K1-ET' Modification of ordering name of RX78K0 in A.7 Embedded Software Addition of APPENDIX B NOTES ON TARGET SYSTEM DESIGN APPENDIX B NOTES ON TARGET SYSTEM DESIGN 4th Throughout Addition of products PD780101(A2), 780102(A2), 780103(A2) Modification of names of the following special function registers (SFRs) * Ports 0 to 3, 12, and 13 Port registers 0 to 3, 12, and 13 Addition of Caution 3 to 1.4 Pin Configuration (Top View) CHAPTER 1 OUTLINE Modification of 1.5 K1 Family Lineup Modification of outline of timer in 1.7 Outline of Functions Addition of Table 2-1 Pin I/O Buffer Power Supplies CHAPTER 2 PIN FUNCTIONS User's Manual U15836EJ5V0UD 481 APPENDIX E REVISION HISTORY (6/9) Edition 4th Description Addition of Table 4-1 Pin I/O Buffer Power Supplies Modification of Table 4-3 Port Configuration Applied to: CHAPTER 4 PORT FUNCTIONS Deletion of input switch control register (ISC) from and addition of port registers (P0 to P3, P12, and P13) to 4.3 Registers Controlling Port Function Modification of Figure 5-1 Block Diagram of Clock Generator Addition of Cautions 2 and 3 to Figure 5-6 Format of Oscillation Stabilization Time Counter Status Register (OSTC) CHAPTER 5 CLOCK GENERATOR Modification of Figure 5-8 External Circuit of X1 Oscillator and Figure 5-9 Examples of Incorrect Resonator Connection Modification of Note in Figure 5-12 Switching from Ring-OSC Clock to X1 Input Clock (Flowchart) Addition of figures * Figure 6-2 Format of 16-Bit Timer Counter 00 (TM00) * Figure 6-3 Format of 16-Bit Timer Capture/Compare Register 000 (CR000) * Figure 6-4 Format of 16-Bit Timer Capture/Compare Register 010 (CR010) Modification of tables * Table 6-2 CR000 Capture Trigger and Valid Edges of TI000 and TI010 Pins * Table 6-3 CR010 Capture Trigger and Valid Edge of TI000 Pin (CRC002 = 1) Modification of Caution 1 in 6.2 (3) 16-bit timer capture/compare register 010 (CR010) Modification of Caution 3 to Figure 6-6 Format of Capture/Compare Control Register 00 (CRC00) Addition of description to Caution 5 and addition of Caution 6 in Figure 6-7 Format of 16-Bit Timer Output Control Register 00 (TOC00) Addition of register settings * 6.4.1 Interval timer operation * 6.4.2 PPG output operations * 6.4.3 Pulse width measurement operations * 6.4.4 External event counter operation * 6.4.5 Square-wave output operation * 6.4.6 One-shot pulse output operation Addition of setting of prescaler mode register 00 (PRM00) * Figure 6-10 Control Register Settings for Interval Timer Operation * Figure 6-13 Control Register Settings for PPG Output Operation * Figure 6-17 Control Register Settings for Pulse Width Measurement with Free-Running Counter and One Capture Register (When TI000 and CR010 Are Used) * Figure 6-20 Control Register Settings for Measurement of Two Pulse Widths with Free-Running Counter * Figure 6-22 Control Register Settings for Pulse Width Measurement with Free-Running Counter and Two Capture Registers (with Rising Edge Specified) * Figure 6-24 Control Register Settings for Pulse Width Measurement by Means of Restart (with Rising Edge Specified) * Figure 6-26 Control Register Settings in External Event Counter Mode (with Rising Edge Specified) * Figure 6-29 Control Register Settings in Square-Wave Output Mode * Figure 6-31 Control Register Settings for One-Shot Pulse Output with Software Trigger * Figure 6-33 Control Register Settings for One-Shot Pulse Output with External Trigger (with Rising Edge Specified) 482 User's Manual U15836EJ5V0UD CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00 APPENDIX E REVISION HISTORY (7/9) Edition 4th Description Applied to: Modification of figures CHAPTER 6 16-BIT * Figure 6-12 Timing of Interval Timer Operation TIMER/EVENT COUNTER 00 * Figure 6-15 PPG Output Operation Timing * Figure 6-34 Timing of One-Shot Pulse Output Operation with External Trigger (with Rising Edge Specified) Addition of figures CHAPTER 7 8-BIT * Figure 7-2 Format of 8-Bit Timer Counter 50 (TM50) TIMER/EVENT COUNTER 50 * Figure 7-3 Format of 8-Bit Timer Compare Register 50 (CR50) Modification of Figure 7-7 Interval Timer Operation Timing Modification of description of frequency in 7.4.3 Operation as square-wave output Addition of description of cycle, active level width, and duty to 7.4.4 (1) PWM output basic operation Modification of Figure 8-11 Operation Timing in PWM Output Mode CHAPTER 8 8-BIT TIMERS H0 AND H1 Modification of Figure 10-1 Block Diagram of A/D Converter CHAPTER 10 A/D Partial modification of description of 10.2 Configuration of A/D Converter CONVERTER Addition of description of A/D conversion result register (ADCR) to 10.3 Registers Used in A/D Converter Partial modification of description of 10.4.1 Basic operations of A/D converter Addition of description of successive approximation register (SAR) to 10.4.2 Input voltage and conversion results Modification of Caution 3 in "When used as power-fail function" in 10.4.3 A/D converter operation mode Modification of Figure 10-21 Timing of A/D Converter Sampling and A/D Conversion Start Delay Addition of description of (12) Internal equivalent circuit to 10.6 Cautions for A/D Converter Modification of Cautions 1, 2, 4 and addition of Note 2 and Caution 3 to Figure 11- CHAPTER 11 SERIAL 2 Format of Asynchronous Serial Interface Operation Mode Register 0 (ASIM0) INTERFACE UART0 Modification of description of 11.4.1 Operation stop mode Modification of description of 11.4.2 Asynchronous serial interface (UART) mode (PD780102, 780103, 78F0103 ONLY) (1) Registers used Modification of Table 11-3 Cause of Reception Error Modification of figures CHAPTER 12 SERIAL * Figure 12-1 LIN Transmission Operation INTERFACE UART6 * Figure 12-2 LIN Reception Operation * Figure 12-3 Port Configuration for LIN Reception Operation * Figure 12-4 Block Diagram of Serial Interface UART6 Modification of Cautions 1, 2 and addition of Note 2 and Caution 3 to Figure 12-5 Format of Asynchronous Serial Interface Operation Mode Register 6 (ASIM6) Addition of input switch control register (ISC) to 12.3 Registers Controlling Serial Interface UART6 Modification of description of 12.4.1 Operation stop mode Modification of description of 12.4.2 Asynchronous serial interface (UART) mode (1) Registers used Modification of description of 12.4.2 (2) (d) Continuous transmission Modification of Table 12-3 Cause of Reception Error User's Manual U15836EJ5V0UD 483 APPENDIX E REVISION HISTORY (8/9) Edition 4th Description Modification of Figure 13-1 Block Diagram of Serial Interface CSI10 Addition of Notes 2 and 3 to Figure 13-2 Format of Serial Operation Mode Register 10 (CSIM10) Applied to: CHAPTER 13 SERIAL INTERFACE CSI10 Modification of Caution 2 and addition of Caution 3 to Figure 13-3 Format of Serial Clock Selection Register 10 (CSIC10) Modification of description of 13.4.1 Operation stop mode Modification of description of 13.4.2 3-wire serial I/O mode (1) Registers used Addition of (5) SO10 output to 13.4.2 3-wire serial I/O mode Addition of Caution 3 to Figure 14-2 Format of Interrupt Request Flag Register (IF0L, IF0H, IF1L) CHAPTER 14 INTERRUPT FUNCTIONS Modification of Table 15-1 Relationship Between HALT and STOP Modes and Clock in old edition to Table 15-1 Relationship Between Operation Clocks in Each Operation Status CHAPTER 15 STANDBY FUNCTION Addition of Cautions 2 and 3 to Figure 15-1 Format of Oscillation Stabilization Time Counter Status Register (OSTC) Modification of Table 15-2 Operating Statuses in HALT Mode Modification of figures * Figure 16-1 Block Diagram of Reset Function * Figure 16-2 Timing of Reset by RESET Input * Figure 16-3 Timing of Reset Due to Watchdog Timer Overflow * Figure 16-4 Timing of Reset in STOP Mode by RESET Input CHAPTER 16 RESET FUNCTION Modification of Figure 17-1 Block Diagram of Clock Monitor CHAPTER 17 CLOCK MONITOR Addition of normal operation mode to Table 17-2 Operation Status of Clock Monitor (When CLME = 1) Addition of (6) Clock monitor status after X1 input clock oscillation is stopped by software and (7) Clock monitor status after Ring-OSC clock oscillation is stopped by software to Figure 17-3 Timing of Clock Monitor Modification of Figure 18-1 Block Diagram of Power-on-Clear Circuit CHAPTER 18 POWER-ONCLEAR CIRCUIT Modification of Figure 19-1 Block Diagram of Low-Voltage Detector CHAPTER 19 LOW-VOLTAGE DETECTOR Addition of Caution to Figure 19-3 Format of Low-Voltage Detection Level Selection Register (LVIS) Modification of Figure 19-4 Timing of Low-Voltage Detector Internal Reset Signal Generation and Figure 19-5 Timing of Low-Voltage Detector Interrupt Signal Generation Partial modification of description of (2) When used as interrupt under in 19.5 Cautions for Low-Voltage Detector Addition of Note 2 to Table 21-3 Wiring Between PD78F0103 and Dedicated Flash Programmer Addition of Note to Figure 21-7 Environment for Writing Program to Flash Memory Modification of figures * Figure 21-8 Communication with Dedicated Flash Programmer (CSI10) * Figure 21-9 Communication with Dedicated Flash Programmer (CSI10 + HS) * Figure 21-10 Communication with Dedicated Flash Programmer (UART0) * Figure 21-11 Communication with Dedicated Flash Programmer (UART0 + HS) * Figure 21-12 Communication with Dedicated Flash Programmer (UART6) 484 User's Manual U15836EJ5V0UD CHAPTER 21 PD78F0103 APPENDIX E REVISION HISTORY (9/9) Edition 4th Description Partial modification of description of 21.5.2 (2) Malfunction of other device Applied to: CHAPTER 21 PD78F0103 Modification of description of 21.5.4 Port pins Partial modification of Caution to 21.5.6 Power supply Modification of followings CHAPTER 23 ELECTRICAL * Modification of Note 2 of DC Characteristics SPECIFICATIONS * Addition of Notes 1 and 2 to POC Circuit Characteristics (STANDARD PRODUCTS, (A) * Modification of Note 1 of LVI Circuit Characteristics GRADE PRODUCTS) * Addition of condition for data retention supply voltage and Note to Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics Modification of followings CHAPTER 24 ELECTRICAL * Modification of Note 2 of DC Characteristics SPECIFICATIONS ((A1) * Modification of values for overall error and conversion time in A/D Converter GRADE PRODUCTS) Characteristics * Addition of Note 2 to POC Circuit Characteristics * Modification of Note 2 of LVI Circuit Characteristics * Addition of condition for data retention supply voltage and Note 2 to Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics Addition of chapter CHAPTER 25 ELECTRICAL SPECIFICATIONS ((A2) GRADE PRODUCTS) Modification of Table 27-1 Surface Mounting Type Soldering Conditions CHAPTER 27 RECOMMENDED SOLDERING CONDITIONS User's Manual U15836EJ5V0UD 485