Part Number Hot Search : 
C4245 BUZ16 RXXP12D BUL62A MICON TA1286A PFZ180A 14014
Product Description
Full Text Search
 

To Download UPD70F3114 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 User's Manual
V850E/IA2
Hardware
TM
32-Bit Single-Chip Microcontrollers
PD703114 PD70F3114
Document No. U15195EJ3V0UD00 (3rd edition) Date Published December 2002 N CP(K)
2001 Printed in Japan
[MEMO]
2
User's Manual U15195EJ3V0UD
NOTES FOR CMOS DEVICES
1 PRECAUTION AGAINST ESD FOR SEMICONDUCTORS Note: Strong electric field, when exposed to a MOS device, can cause destruction of the gate oxide and ultimately degrade the device operation. Steps must be taken to stop generation of static electricity as much as possible, and quickly dissipate it once, when it has occurred. Environmental control must be adequate. When it is dry, humidifier should be used. It is recommended to avoid using insulators that easily build 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 bench and floor should be grounded. The operator should be grounded using wrist strap. Semiconductor devices must not be touched with bare hands. Similar precautions need to be taken for PW boards with semiconductor devices on it. 2 HANDLING OF UNUSED INPUT PINS FOR CMOS Note: No connection for CMOS device inputs can be cause of malfunction. If no connection is provided to the input pins, it is possible that an internal input level may be generated due to noise, etc., hence causing malfunction. CMOS devices behave differently than Bipolar or NMOS devices. Input levels of CMOS devices must be fixed high or low by using a pull-up or pull-down circuitry. Each unused pin should be connected to VDD or GND with a resistor, if it is considered to have a possibility of being an output pin. All handling related to the unused pins must be judged device by device and related specifications governing the devices. 3 STATUS BEFORE INITIALIZATION OF MOS DEVICES Note: Power-on does not necessarily define initial status of MOS device. Production process of MOS does not define the initial operation status of the device. Immediately after the power source is turned ON, the devices with reset function have not yet been initialized. Hence, power-on does not guarantee out-pin levels, I/O settings or contents of registers. Device is not initialized until the reset signal is received. Reset operation must be executed immediately after power-on for devices having reset function.
V850 Series, V850E/IA1, and V850E/IA2 are trademarks of NEC Electronics Corporation. Windows is either a registered trademark or a trademark of Microsoft Corporation in the United States and/or other countries.
User's Manual U15195EJ3V0UD
3
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.
License not needed:
PD70F3114
The customer must judge the need for license: PD703114
* The information in this document is current as of July, 2002. 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 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 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 NEC Electronics 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 customer's equipment shall be done under the full responsibility of 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 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 NEC Electronics sales representative in advance to determine NEC Electronics's 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
4
User's Manual U15195EJ3V0UD
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.
NEC Electronics America, Inc. (U.S.)
Santa Clara, California Tel: 408-588-6000 800-366-9782 Fax: 408-588-6130 800-729-9288
* Filiale Italiana Milano, Italy Tel: 02-66 75 41 Fax: 02-66 75 42 99 * Branch The Netherlands Eindhoven, The Netherlands Tel: 040-244 58 45 Fax: 040-244 45 80 * Tyskland Filial Taeby, Sweden Tel: 08-63 80 820 Fax: 08-63 80 388 * United Kingdom Branch Milton Keynes, UK Tel: 01908-691-133 Fax: 01908-670-290
NEC Electronics Hong Kong Ltd.
Hong Kong Tel: 2886-9318 Fax: 2886-9022/9044
NEC Electronics Hong Kong Ltd.
Seoul Branch Seoul, Korea Tel: 02-528-0303 Fax: 02-528-4411
NEC Electronics (Europe) GmbH
Duesseldorf, Germany Tel: 0211-65 03 01 Fax: 0211-65 03 327 * Sucursal en Espana Madrid, Spain Tel: 091-504 27 87 Fax: 091-504 28 60 * Succursale Francaise Velizy-Villacoublay, France Tel: 01-30-67 58 00 Fax: 01-30-67 58 99
NEC Electronics Shanghai, Ltd.
Shanghai, P.R. China Tel: 021-6841-1138 Fax: 021-6841-1137
NEC Electronics Taiwan Ltd.
Taipei, Taiwan Tel: 02-2719-2377 Fax: 02-2719-5951
NEC Electronics Singapore Pte. Ltd.
Novena Square, Singapore Tel: 6253-8311 Fax: 6250-3583
J02.11
User's Manual U15195EJ3V0UD
5
Major Revisions in This Edition
Page Throughout p. 26 p. 82 p. 84 p. 101 p. 109 p. 111 p. 114 p. 116 p. 117 p. 117 p. 126 p. 130 p. 130 p. 146 p. 150 p. 168 p. 196 p. 226 p. 227 Description Addition of 100-pin plastic QFP (14 x 20) package Addition of Table 1-2 Differences Between V850E/IA1 and V850E/IA2 Register Setting Values Modification of description in 4.2.1 Pin status during internal ROM, internal RAM, and on-chip peripheral I/O access Addition of Caution to 4.3.1 (1) Chip area select control registers 0, 1 (CSC0, CSC1) Modification and deletion of description in 4.9.1 Program space Addition of description to 6.3.1 (1) DMA source address registers 0H to 3H (DSA0H to DSA3H) Addition of description to 6.3.2 (1) DMA destination address registers 0H to 3H (DDA0H to DDA3H) Addition of description and Caution to 6.3.4 DMA addressing control registers 0 to 3 (DADC0 to DADC3) Addition of description and Caution to and modification of bit description in 6.3.5 DMA channel control registers 0 to 3 (DCHC0 to DCHC3) Addition of description to 6.3.6 DMA disable status register (DDIS) Addition of description to 6.3.7 DMA restart register (DRST) Addition of Caution to 6.6.1 Two-cycle transfer Addition of description to Remark in 6.13 Forcible Termination Modification of description in 6.14 (3) Times related to DMA transfer Addition of Caution to 7.3.4 Interrupt control register (xxICn) Addition of Caution to 7.3.6 In-service priority register (ISPR) Modification of description in Figure 7-14 Pipeline Operation at Interrupt Request Acknowledgement (Outline) Modification of description in Table 9-2 Operation Modes of Timer 0 Modification of description in Table 9-4 Operation Modes Timer 0 (TM0n) Modification of description in Remark in 9.1.6 (2) PWM mode 0: Triangular wave modulation (right-left symmetric waveform control)
pp. 230, 231, 233 to 238, Modification of Figures 9-15, 9-17 to 9-20, 9-22 to 9-30, and 9-32 to 9-35 242, 243, 245 to 260, 264, 265, 267 to 274 p. 395 p. 422 p. 534 p. 589 p. 595 p. 619 p. 621 p. 623 p. 639 p. 643 p. 651 Modification of maximum transfer rate in 10.2.1 Features Addition of description to Table 10-3 Baud Rate Generator Setting Data Addition of Caution to 12.2 (1) Functions of each port Addition of description to 15.2 (2) Off-board programming Addition of CHAPTER 16 ELECTRICAL SPECIFICATIONS Addition of CHAPTER 17 PACKAGE DRAWING Addition of CHAPTER 18 RECOMMENDED SOLDERING CONDITIONS Addition of APPENDIX A NOTES ON TARGET SYSTEM DESIGN Modification of description in C.2 Instruction Set (Alphabetical Order) Addition of APPENDIX D INDEX Addition of APPENDIX E REVISION HISTORY The mark shows major revised points.
6
User's Manual U15195EJ3V0UD
PREFACE
Readers
This manual is intended for users who wish to understand the functions of the V850E/IA2 (PD703114, 70F3114) and design application systems using it.
Purpose
This manual is intended to give users an understanding of the hardware functions of the V850E/IA2 shown in the Organization below.
Organization
This manual is divided into two parts: (V850E1 Architecture User's Manual). Hardware * Pin functions * CPU function * On-chip peripheral functions * Flash memory programming * Electrical specifications
Hardware (this manual) and Architecture
Architecture * Data type * Register set * Instruction format and instruction set * Interrupts and exceptions * Pipeline operation
How to Read This Manual
It is assumed that the readers of this manual have general knowledge in the fields of electrical engineering, logic circuits, and microcontrollers. * To find the details of a register where the name is known Refer to APPENDIX B REGISTER INDEX. * To find the details of a function, etc. where the name is known Refer to APPENDIX D INDEX. * To understand the details of an instruction function Refer to the V850E1 Architecture User's Manual. * To know details of the electrical specifications of the V850E/IA2 Refer to CHAPTER 16 ELECTRICAL SPECIFICATIONS. * To understand the overall functions of the V850E/IA2 Read this manual according to the CONTENTS. * How to read register formats The name of a bit whose number is in angle brackets (<>) is defined as a reserved word in the device file. When the register format of each register describes 0 or 1, other values are prohibited to be specified.
User's Manual U15195EJ3V0UD
7
Conventions
Data significance: Active low representation: Memory map address: Note: Caution: Remark: Numeric representation:
Higher digits on the left and lower digits on the right xxx (overscore over pin or signal name) Top: higher, bottom: lower Footnote for item marked with Note in the text Information requiring particular attention Supplementary information Binary ... xxxx or xxxxB Decimal ... xxxx Hexadecimal ... xxxxH
Prefix indicating power of 2 (address space, memory capacity): K (kilo): 2 = 1,024 M (mega): 2 = 1,024 G (giga): 2 = 1,024 Data type: Word ... 32 bits Halfword ... 16 bits Byte ... 8 bits
30 3 20 2 10
8
User's Manual U15195EJ3V0UD
Related Documents
The related documents indicated in this publication may include preliminary versions. However, preliminary versions are not marked as such. Documents related to V850E/IA2
Document Name V850E1 Architecture User's Manual V850E/IA2 Hardware User's Manual V850E/IA1 , V850E/IA2 AC Motor Inverter Control Using Vector Operation Application Note
TM
Document No. U14559E This manual U14868E
Documents related to development tools (user's manuals)
Document Name IE-V850E-MC, IE-V850E-MC-A (In-Circuit Emulator) IE-703114-MC-EM1 (In-Circuit Emulator Option Board) CA850 Ver.2.40 or Later C Compiler Package Operation C Language Project Manager Assembly Language ID850 Ver.2.40 Integrated Debugger SM850 Ver.2.40 System Simulator SM850 Ver.2.00 or Later System Simulator RX850 Ver.3.13 or Later Real-Time OS Operation Windows Based Operation Windows Based External Part User Open Interface Specifications Basics Installation Technical RX850 Pro Ver.3.13 Real-Time OS Basics Installation Technical RD850 Ver.3.01 Task Debugger RD850 Pro Ver.3.01 Task Debugger AZ850 Ver.3.0 System Performance Analyzer PG-FP3 Flash Memory Programmer PG-FP4 Flash Memory Programmer
TM
Document No. U14487E To be prepared U15024E U15025E U15026E U15027E U15181E U15182E U14873E
U13430E U13410E U13431E U13773E U13774E U13772E U13737E U13916E U14410E U13502E U15260E
User's Manual U15195EJ3V0UD
9
CONTENTS
CHAPTER 1 INTRODUCTION..................................................................................................................25 1.1 Outline ........................................................................................................................................ 25 1.2 Features...................................................................................................................................... 27 1.3 Application Fields ..................................................................................................................... 28 1.4 Ordering Information ................................................................................................................ 28 1.5 Pin Configuration (Top View) ................................................................................................... 29 1.6 Configuration of Function Block ............................................................................................. 32
1.6.1 1.6.2 Internal block diagram ................................................................................................................. 32 Internal units ................................................................................................................................ 33
CHAPTER 2 PIN FUNCTIONS ................................................................................................................35 2.1 List of Pin Functions................................................................................................................. 35 2.2 Pin Status................................................................................................................................... 40 2.3 Description of Pin Functions ................................................................................................... 41 2.4 Types of Pin I/O Circuits and Connection of Unused Pins ................................................... 50 2.5 Pin I/O Circuits........................................................................................................................... 52 CHAPTER 3 CPU FUNCTION .................................................................................................................53 3.1 Features...................................................................................................................................... 53 3.2 CPU Register Set....................................................................................................................... 54
3.2.1 3.2.2 Program register set .................................................................................................................... 55 System register set...................................................................................................................... 56 Operation modes ......................................................................................................................... 58 Operation mode specification ...................................................................................................... 59 CPU address space..................................................................................................................... 60 Image .......................................................................................................................................... 61 Wrap-around of CPU address space........................................................................................... 62 Memory map................................................................................................................................ 63 Area............................................................................................................................................. 64 External memory expansion ........................................................................................................ 68 Recommended use of address space ......................................................................................... 69 On-chip peripheral I/O registers................................................................................................... 71 Specific registers ......................................................................................................................... 81 System wait control register (VSWC) .......................................................................................... 81 Cautions ...................................................................................................................................... 81
3.3
Operation Modes ....................................................................................................................... 58
3.3.1 3.3.2
3.4
Address Space .......................................................................................................................... 60
3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.4.10 3.4.11
CHAPTER 4 BUS CONTROL FUNCTION .............................................................................................82 4.1 Features...................................................................................................................................... 82 4.2 Bus Control Pins ....................................................................................................................... 82
4.2.1 Pin status during internal ROM, internal RAM, and on-chip peripheral I/O access...................... 82 Chip select control function.......................................................................................................... 84
4.3 4.4 10
Memory Block Function............................................................................................................ 83
4.3.1
Bus Cycle Type Control Function ........................................................................................... 87
User's Manual U15195EJ3V0UD
4.5
Bus Access.................................................................................................................................88
4.5.1 4.5.2 4.5.3 Number of access clocks .............................................................................................................88 Bus sizing function .......................................................................................................................89 Bus width......................................................................................................................................90 Programmable wait function.........................................................................................................96 External wait function ...................................................................................................................98 Relationship between programmable wait and external wait........................................................98
4.6
Wait Function .............................................................................................................................96
4.6.1 4.6.2 4.6.3
4.7 4.8 4.9
Idle State Insertion Function.....................................................................................................99 Bus Priority Order ....................................................................................................................100 Boundary Operation Conditions ............................................................................................101
4.9.1 4.9.2 Program space...........................................................................................................................101 Data space .................................................................................................................................101
CHAPTER 5 MEMORY ACCESS CONTROL FUNCTION .................................................................102 5.1 SRAM, External ROM, External I/O Interface.........................................................................102
5.1.1 5.1.2 Features .....................................................................................................................................102 SRAM, external ROM, external I/O access ................................................................................103
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER) ....................................................................107 6.1 Features ....................................................................................................................................107 6.2 Configuration............................................................................................................................108 6.3 Control Registers .....................................................................................................................109
6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 6.3.8 DMA source address registers 0 to 3 (DSA0 to DSA3) ..............................................................109 DMA destination address registers 0 to 3 (DDA0 to DDA3) .......................................................111 DMA byte count registers 0 to 3 (DBC0 to DBC3)......................................................................113 DMA addressing control registers 0 to 3 (DADC0 to DADC3)....................................................114 DMA channel control registers 0 to 3 (DCHC0 to DCHC3) ........................................................116 DMA disable status register (DDIS)............................................................................................117 DMA restart register (DRST) ......................................................................................................117 DMA trigger factor registers 0 to 3 (DTFR0 to DTFR3) ..............................................................118 Types of bus states ....................................................................................................................121 DMAC bus cycle state transition ................................................................................................122 Single transfer mode ..................................................................................................................123 Single-step transfer mode ..........................................................................................................125 Block transfer mode ...................................................................................................................125 Two-cycle transfer ......................................................................................................................126 Transfer type and transfer object ...............................................................................................127 External bus cycles during DMA transfer (two-cycle transfer) ....................................................127
6.4
DMA Bus States .......................................................................................................................121
6.4.1 6.4.2
6.5
Transfer Modes ........................................................................................................................123
6.5.1 6.5.2 6.5.3
6.6 6.7
Transfer Types .........................................................................................................................126
6.6.1 6.7.1 6.7.2
Transfer Object.........................................................................................................................127
6.8 6.9 6.10 6.11 6.12
DMA Channel Priorities ...........................................................................................................128 Next Address Setting Function ..............................................................................................128 DMA Transfer Start Factors ....................................................................................................129 Forcible Interruption................................................................................................................129 DMA Transfer End....................................................................................................................130
User's Manual U15195EJ3V0UD
11
6.13 Forcible Termination............................................................................................................... 130 6.14 Cautions ................................................................................................................................... 130 CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION ..................................................131 7.1 Features.................................................................................................................................... 131 7.2 Non-Maskable Interrupt .......................................................................................................... 134
7.2.1 7.2.2 7.2.3 7.2.4 Operation................................................................................................................................... 135 Restore...................................................................................................................................... 137 Non-maskable interrupt status flag (NP).................................................................................... 138 Edge detection function ............................................................................................................. 138 Operation................................................................................................................................... 139 Restore...................................................................................................................................... 141 Priorities of maskable interrupts ................................................................................................ 142 Interrupt control register (xxICn) ................................................................................................ 146 Interrupt mask registers 0 to 3 (IMR0 to IMR3).......................................................................... 149 In-service priority register (ISPR)............................................................................................... 150 Maskable interrupt status flag (ID)............................................................................................. 151 Interrupt trigger mode selection ................................................................................................. 151 Operation................................................................................................................................... 159 Restore...................................................................................................................................... 160 Exception status flag (EP) ......................................................................................................... 161 Illegal opcode definition ............................................................................................................. 162 Debug trap................................................................................................................................. 164
7.3
Maskable Interrupts ................................................................................................................ 139
7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.3.6 7.3.7 7.3.8
7.4
Software Exception ................................................................................................................. 159
7.4.1 7.4.2 7.4.3
7.5
Exception Trap ........................................................................................................................ 162
7.5.1 7.5.2
7.6 7.7 7.8
Multiple Interrupt Servicing Control...................................................................................... 166 Interrupt Response Time ........................................................................................................ 168 Periods in Which Interrupts Are Not Acknowledged........................................................... 169
CHAPTER 8 CLOCK GENERATION FUNCTION................................................................................170 8.1 Features.................................................................................................................................... 170 8.2 Configuration........................................................................................................................... 170 8.3 Input Clock Selection.............................................................................................................. 171
8.3.1 8.3.2 8.3.3 8.3.4 8.3.5 Direct mode ............................................................................................................................... 171 PLL mode .................................................................................................................................. 171 Peripheral command register (PHCMD) .................................................................................... 172 Clock control register (CKC) ...................................................................................................... 173 Peripheral status register (PHS) ................................................................................................ 175
8.4 8.5
PLL Lockup.............................................................................................................................. 176 Power Save Control ................................................................................................................ 177
8.5.1 8.5.2 8.5.3 8.5.4 8.5.5 Overview.................................................................................................................................... 177 Control registers ........................................................................................................................ 180 HALT mode ............................................................................................................................... 183 IDLE mode................................................................................................................................. 185 Software STOP mode................................................................................................................ 187 Oscillation stabilization time security specification..................................................................... 189
User's Manual U15195EJ3V0UD
8.6
Securing Oscillation Stabilization Time................................................................................ 189
8.6.1
12
8.6.2
Time base counter (TBC) ...........................................................................................................190
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)........................................191 9.1 TIMER 0 .....................................................................................................................................191
9.1.1 9.1.2 9.1.3 9.1.4 9.1.5 9.1.6 9.1.7 Features (timer 0).......................................................................................................................191 Function overview (timer 0) ........................................................................................................191 Functions added to V850E/IA2...................................................................................................193 Basic configuration .....................................................................................................................194 Control registers .........................................................................................................................201 Operation ...................................................................................................................................225 Operation timing .........................................................................................................................275 Features (timer 1).......................................................................................................................284 Function overview (timer 1) ........................................................................................................284 Basic configuration .....................................................................................................................286 Control registers .........................................................................................................................292 Operation ...................................................................................................................................300 Supplementary description of internal operation ........................................................................310 Features (timer 2).......................................................................................................................313 Function overview (timer 2) ........................................................................................................313 Basic configuration .....................................................................................................................315 Control registers .........................................................................................................................321 Operation ...................................................................................................................................337 Features (timer 3).......................................................................................................................355 Function overview (timer 3) ........................................................................................................355 Function added to V850E/IA1 ....................................................................................................356 Basic configuration .....................................................................................................................356 Control registers .........................................................................................................................360 Operation ...................................................................................................................................367 Application examples .................................................................................................................375 Cautions .....................................................................................................................................381 Features (timer 4).......................................................................................................................382 Function overview (timer 4) ........................................................................................................382 Basic configuration .....................................................................................................................383 Control register...........................................................................................................................387 Operation ...................................................................................................................................388 Application example ...................................................................................................................390 Cautions .....................................................................................................................................390 Overview ....................................................................................................................................391 Control register...........................................................................................................................392
9.2
Timer 1 ......................................................................................................................................284
9.2.1 9.2.2 9.2.3 9.2.4 9.2.5 9.2.6
9.3
Timer 2 ......................................................................................................................................313
9.3.1 9.3.2 9.3.3 9.3.4 9.3.5
9.4
Timer 3 ......................................................................................................................................355
9.4.1 9.4.2 9.4.3 9.4.4 9.4.5 9.4.6 9.4.7 9.4.8
9.5
Timer 4 ......................................................................................................................................382
9.5.1 9.5.2 9.5.3 9.5.4 9.5.5 9.5.6 9.5.7
9.6
Timer Connection Function ....................................................................................................391
9.6.1 9.6.2
CHAPTER 10 SERIAL INTERFACE FUNCTION ................................................................................393 10.1 Features ....................................................................................................................................393
10.1.1 Selecting UART1 or CSI1 mode.................................................................................................394
User's Manual U15195EJ3V0UD
13
10.2 Asynchronous Serial Interface 0 (UART0)............................................................................ 395
10.2.1 10.2.2 10.2.3 10.2.4 10.2.5 10.2.6 10.2.7 10.3.1 10.3.2 10.3.3 10.3.4 10.3.5 10.3.6 10.3.7 10.4.1 10.4.2 10.4.3 10.4.4 10.4.5 10.4.6 Features .................................................................................................................................... 395 Configuration ............................................................................................................................. 396 Control registers ........................................................................................................................ 398 Interrupt requests ...................................................................................................................... 405 Operation................................................................................................................................... 406 Dedicated baud rate generator 0 (BRG0).................................................................................. 418 Cautions .................................................................................................................................... 425 Features .................................................................................................................................... 426 Configuration ............................................................................................................................. 427 Control registers ........................................................................................................................ 429 Interrupt requests ...................................................................................................................... 438 Operation................................................................................................................................... 439 Synchronous mode.................................................................................................................... 449 Dedicated baud rate generator 1 (BRG1).................................................................................. 454 Features .................................................................................................................................... 461 Configuration ............................................................................................................................. 462 Control registers ........................................................................................................................ 465 Operation................................................................................................................................... 479 Output pins ................................................................................................................................ 494 Dedicated baud rate generator 3 (BRG3).................................................................................. 495
10.3 Asynchronous Serial Interface 1 (UART1)............................................................................ 426
10.4 Clocked Serial Interfaces 0, 1 (CSI0, CSI1) ........................................................................... 461
CHAPTER 11 A/D CONVERTER ..........................................................................................................499 11.1 Features.................................................................................................................................... 499 11.2 Configuration........................................................................................................................... 499 11.3 Functions Added to V850E/IA2 .............................................................................................. 503 11.4 Control Registers .................................................................................................................... 504 11.5 Interrupt Requests .................................................................................................................. 514 11.6 A/D Converter Operation ........................................................................................................ 515
11.6.1 11.6.2 11.7.1 11.7.2 11.8.1 11.8.2 11.9.1 11.9.2 A/D converter basic operation ................................................................................................... 515 Operation modes and trigger modes ......................................................................................... 516 Operation in select mode........................................................................................................... 519 Operation in scan mode ............................................................................................................ 520 Operation in select mode........................................................................................................... 521 Operation in scan mode ............................................................................................................ 522 Operation in select mode........................................................................................................... 523 Operation in scan mode ............................................................................................................ 524
11.7 Operation in A/D Trigger Mode .............................................................................................. 519
11.8 Operation in A/D Trigger Polling Mode ................................................................................. 521
11.9 Operation in Timer Trigger Mode .......................................................................................... 523
11.10 Operation in External Trigger Mode ...................................................................................... 525
11.10.1 Operation in select mode........................................................................................................... 525 11.10.2 Operation in scan mode ............................................................................................................ 526
11.11 Operation Cautions ................................................................................................................. 527
11.11.1 Stopping A/D conversion operation ........................................................................................... 527 11.11.2 Trigger input during A/D conversion operation .......................................................................... 527
14
User's Manual U15195EJ3V0UD
11.11.3 External or timer trigger interval .................................................................................................527 11.11.4 Operation in standby modes ......................................................................................................527 11.11.5 Compare match interrupt in timer trigger mode..........................................................................527 11.11.6 Timing that makes the A/D conversion result undefined ............................................................528
11.12 How to Read A/D Converter Characteristics Table ..............................................................529 CHAPTER 12 PORT FUNCTIONS ........................................................................................................533 12.1 Features ....................................................................................................................................533 12.2 Basic Configuration of Ports ..................................................................................................533 12.3 Pin Functions of Each Port .....................................................................................................549
12.3.1 12.3.2 12.3.3 12.3.4 12.3.5 12.3.6 12.3.7 12.3.8 12.3.9 12.4.1 12.4.2 12.4.3 Port 0..........................................................................................................................................549 Port 1..........................................................................................................................................550 Port 2..........................................................................................................................................552 Port 3..........................................................................................................................................554 Port 4..........................................................................................................................................556 Port DH ......................................................................................................................................558 Port DL .......................................................................................................................................560 Port CT.......................................................................................................................................562 Port CM ......................................................................................................................................564 Interrupt pins ..............................................................................................................................566 Timer 10, timer 3 input pins........................................................................................................566 Timer 2 input pins.......................................................................................................................570
12.4 Noise Eliminator.......................................................................................................................566
CHAPTER 13 RESET FUNCTION ........................................................................................................573 13.1 Features ....................................................................................................................................573 13.2 Pin Functions ...........................................................................................................................573 13.3 Initialization ..............................................................................................................................578 CHAPTER 14 REGULATOR ..................................................................................................................583 14.1 Features ....................................................................................................................................583 14.2 Functional Outline ...................................................................................................................583 14.3 Connection Example ...............................................................................................................584 14.4 Control Register .......................................................................................................................586 CHAPTER 15 FLASH MEMORY (PD70F3114) .................................................................................587 15.1 Features ....................................................................................................................................587 15.2 Writing Using Flash Programmer...........................................................................................587 15.3 Programming Environment.....................................................................................................590 15.4 Communication Mode .............................................................................................................590 15.5 Pin Connection.........................................................................................................................592
15.5.1 15.5.2 15.5.3 15.5.4 15.5.5 15.5.6 15.5.7 MODE1/VPP pin ..........................................................................................................................592 Serial interface pin......................................................................................................................592 RESET pin .................................................................................................................................594 NMI pin.......................................................................................................................................594 MODE0, MODE1 pins ................................................................................................................594 Port pins .....................................................................................................................................594 Other signal pins ........................................................................................................................594
User's Manual U15195EJ3V0UD
15
15.5.8
Power supply ............................................................................................................................. 594
CHAPTER 16 ELECTRICAL SPECIFICATIONS ..................................................................................595 16.1 Normal Operation Mode.......................................................................................................... 595 16.2 Flash Memory Programming Mode ....................................................................................... 617 CHAPTER 17 PACKAGE DRAWINGS .................................................................................................619 CHAPTER 18 RECOMMENDED SOLDERING CONDITIONS ............................................................621 APPENDIX A NOTES ON TARGET SYSTEM DESIGN ....................................................................623 APPENDIX B REGISTER INDEX ..........................................................................................................625 APPENDIX C INSTRUCTION SET LIST ..............................................................................................634 C.1 Conventions............................................................................................................................. 634 C.2 Instruction Set (Alphabetical Order) ..................................................................................... 637 APPENDIX D INDEX...............................................................................................................................643 APPENDIX E REVISION HISTORY.......................................................................................................651
16
User's Manual U15195EJ3V0UD
LIST OF FIGURES (1/6)
Figure No. 3-1 3-2 3-3 3-4 3-5 4-1 4-2 5-1 6-1 6-2 6-3 6-4 6-5 6-6 6-7 6-8 6-9 7-1 7-2 7-3 7-4 7-5 7-6 7-7 7-8 7-9 7-10 7-11 7-12 7-13 7-14 8-1 9-1 9-2 9-3 Title Page
CPU Address Space .................................................................................................................................... 60 Image on Address Space............................................................................................................................. 61 Memory Map ................................................................................................................................................ 63 Internal ROM/Internal Flash Memory Area................................................................................................... 64 Recommended Memory Map....................................................................................................................... 70 Example When CSC0 Register Is Set to 0703H .......................................................................................... 86 Example of Wait Insertion ............................................................................................................................ 98 SRAM, External ROM, External I/O Access Timing ................................................................................... 103 DMAC Bus Cycle (Two-Cycle Transfer) State Transition........................................................................... 122 Single Transfer Example 1......................................................................................................................... 123 Single Transfer Example 2......................................................................................................................... 123 Single Transfer Example 3......................................................................................................................... 124 Single Transfer Example 4......................................................................................................................... 124 Single-Step Transfer Example 1 ................................................................................................................ 125 Single-Step Transfer Example 2 ................................................................................................................ 125 Buffer Register Configuration..................................................................................................................... 128 Example of Forcible Interruption of DMA Transfer ..................................................................................... 129 Servicing Configuration of Non-Maskable Interrupt.................................................................................... 135 Acknowledging Non-Maskable Interrupt Request ...................................................................................... 136 RETI Instruction Processing....................................................................................................................... 137 Maskable Interrupt Servicing...................................................................................................................... 140 RETI Instruction Processing....................................................................................................................... 141 Example of Servicing in Which Another Interrupt Request Is Issued While an Interrupt Is Being Serviced......................................................................................................................... 143 Example of Servicing Interrupt Requests Generated Simultaneously........................................................ 145 Software Exception Processing ................................................................................................................. 159 RETI Instruction Processing....................................................................................................................... 160 Exception Trap Processing ........................................................................................................................ 163 Restore Processing from Exception Trap .................................................................................................. 163 Debug Trap Processing ............................................................................................................................. 164 Restore Processing from Debug Trap........................................................................................................ 165 Pipeline Operation at Interrupt Request Acknowledgement (Outline) ........................................................ 168 Power Save Mode State Transition Diagram ............................................................................................. 178 Block Diagram of Timer 0 (Mode 0: Symmetric Triangular Wave, Mode 1: Asymmetric Triangular Wave)................................................................................................................... 194 Block Diagram of Timer 0 (Mode 2: Sawtooth Wave) ................................................................................ 195 Timer 00 and Timer 01 Clock..................................................................................................................... 201
User's Manual U15195EJ3V0UD
17
LIST OF FIGURES (2/6)
Figure No. 9-4 9-5 9-6 9-7 9-8 9-9 9-10 9-11 9-12 9-13 9-14 9-15 9-16 9-17 9-18 9-19 9-20 9-21 9-22 9-23 9-24 9-25 9-26 9-27 9-28 9-29 9-30 9-31 9-32 9-33 9-34 9-35 9-36 9-37 9-38 9-39 Title Specification of INTTM0n Interrupt in PWM Mode 0 (Symmetric Triangular Wave), PWM Mode 1 (Asymmetric Triangular Wave) (MOD01, MOD00 Bits of TMC0n Register = 0n) ......................................205 Interrupt Culling Processing .......................................................................................................................206 Interrupt Culling Ratio Change Timing (Relationship Between STINTn Bit Setting and CUL Bit Change): PWM Mode 1 (Asymmetric Triangular Wave) ........................................................207 Output Waveforms of TO000 and TO001 in PWM Mode 0 (Symmetric Triangular Waves) (Without Dead Time (TM0CED0 Bit = 1)) ...................................................................................................211 Output Waveforms of TO000 and TO001 in PWM Mode 0 (Symmetric Triangular Waves) (With Dead Time (TM0CED0 Bit = 0))........................................................................................................212 When UPORTn = 1 Is Set Immediately Before TORTOn = 0 (Switched by Active Value) .........................218 When UPORTn = 0 Is Set Immediately Before TORTOn = 0 (Switched by Inactive Value).......................219 When UPORTn = 0 Is Set Immediately Before TORTOn = 1.....................................................................220 Software Output Waveforms of TO000 and TO001 (Without Dead Time (TM0CED0 = 1))........................221 Software Output Waveforms of TO000 and TO001 (With Dead Time (TM0CED0 = 0)) ............................222 Software Output Waveforms of TO000 and TO001 When "1" Is Written to UPORT0 Bit While TORTO0 = 1 (When TOMR0 Register Value = 80H) .......................................................................223 Operation Timing in PWM Mode 0 (Symmetric Triangular Wave) ..............................................................230 Overall Operation Image of PWM Mode 0 (Symmetric Triangular Wave) ..................................................232 Operation Timing in PWM Mode 0 (Symmetric Triangular Wave, BFCMnx CM0n3)...............................233 Operation Timing in PWM Mode 0 (Symmetric Triangular Wave, BFCMnx = 0000H) ...............................235 Change Timing from 100% Duty State (PWM Mode 0) ..............................................................................237 Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave) ............................................................242 Overall Operation Image of PWM Mode 1 (Asymmetric Triangular Wave) ................................................244 Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx CM0n3).............................245 Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx > CM0n3).............................247 Change Timing from 100% Duty State (PWM Mode 1) ..............................................................................249 Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx = 0000H) (1) ........................251 Change Timing from 100% Duty State (1) (PWM Mode 1).........................................................................253 Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx = 0000H) (2) ........................255 Change Timing from 100% Duty State (2) (PWM Mode 1).........................................................................257 Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx = CM0n3).............................259 Operation Timing in PWM Mode 2 (Sawtooth Wave) .................................................................................264 Overall Operation Image of PWM Mode 2 (Sawtooth Wave) .....................................................................266 Operation Timing in PWM Mode 2 (Sawtooth Wave, BFCMnx > CM0n3)..................................................267 Change Timing from 100% Duty State (PWM Mode 2) ..............................................................................269 Operation Timing in PWM Mode 2 (Sawtooth Wave, BFCMnx = CM0n3)..................................................271 Operation Timing in PWM Mode 2 (Sawtooth Wave, BFCMnx = 0000H)...................................................273 TM0CEn Bit Write and TM0n Timer Operation Timing ...............................................................................275 Interrupt Generation Timing in PWM Mode 0 (Symmetric Triangular Wave), PWM Mode 1 (Asymmetric Triangular Wave)...................................................................................................................276 Interrupt Generation Timing in PWM Mode 2 (Sawtooth Wave).................................................................277 Interrupt Generation Timing in PWM Mode 0 (Symmetric Triangular Wave), PWM Mode 1 (Asymmetric Triangular Wave): In Case of Interrupt Culling Ratio of 1/1 ...................................................278 Page
18
User's Manual U15195EJ3V0UD
LIST OF FIGURES (3/6)
Figure No. 9-40 9-41 9-42 9-43 9-44 9-45 9-46 9-47 9-48 9-49 9-50 9-51 9-52 9-53 9-54 9-55 9-56 9-57 9-58 9-59 9-60 9-61 9-62 9-63 9-64 9-65 9-66 9-67 9-68 9-69 9-70 Title Interrupt Generation Timing in PWM Mode 0 (Symmetric Triangular Wave), PWM Mode 1 (Asymmetric Triangular Wave): In Case of Interrupt Culling Ratio of 1/2 ................................................... 279 Interrupt Generation Timing in PWM Mode 2 (Sawtooth Wave): In Case of Interrupt Culling Ratio of 1/1 ..................................................................................................... 280 Interrupt Generation Timing in PWM Mode 2 (Sawtooth Wave): In Case of Interrupt Culling Ratio of 1/2 ..................................................................................................... 281 TO0n0 to TO0n5 Output Timing in PWM Mode 0 (Symmetric Triangular Wave), PWM Mode 1 (Asymmetric Triangular Wave) ............................................................................................ 282 TO0n0 to TO0n5 Output Timing in PWM Mode 2 (Sawtooth Wave).......................................................... 283 Block Diagram of Timer 1........................................................................................................................... 286 TM10 Block Diagram (During PWM Output Operation) ............................................................................. 302 PWM Signal Output Example (When ALVT10 Bit = 0 Is Set)..................................................................... 303 Mode 1 (When Rising Edge Is Specified as Valid Edge of TIUD10 Pin) .................................................... 305 Mode 1 (When Rising Edge Is Specified as Valid Edge of TIUD10 Pin): In Case of Simultaneous TCUD10, TCUD10 Pin Edge Timing .................................................................. 305 Mode 2 (When Rising Edge Is Specified as Valid Edge of TIUD10, TCUD10 Pins) .................................. 306 Mode 3 (When Rising Edge Is Specified as Valid Edge of TIUD10 pin) .................................................... 306 Mode 3 (When Rising Edge Is Specified as Valid Edge of TIUD10 Pin): In Case of Simultaneous TIUD10, TCUD10 Pin Edge Timing.................................................................... 307 Mode 4 307 Example of TM10 Operation When Interval Operation and Transfer Operation Are Combined................. 308 Example of TM10 Operation in UDC Mode................................................................................................ 309 Clear Operation upon Match with CM100 During TM10 Up Count Operation............................................ 310 Clear Operation upon Match with CM101 During TM10 Down Count Operation ....................................... 310 Count Value Clear Operation upon Compare Match.................................................................................. 311 Internal Operation During Transfer Operation............................................................................................ 311 Interrupt Output upon Compare Match (CM101 with Operation Mode Set to General-Purpose Timer Mode and Count Clock Set to fCLK/2) ................................................................... 312 TM1UBD0 Flag Operation.......................................................................................................................... 312 Block Diagram of Timer 2........................................................................................................................... 317 Edge Detection Timing............................................................................................................................... 337 Timer 2 Up Count Timing (When TCRE0 Register's UDSEn1, UDSEn0 Bits = 00B, ECEEn Bit = 0, ECREn Bit = 0, CLREn Bit = 0, CASE1 Bit = 0) ................................................................ 338 External Control Timing of Timer 2 (When TCRE0 Register's UDSEn1, UDSEn0 Bits = 00B, OSTEn Bit = 0, CEEn Bit = 1, CASE1 Bit = 0) .......................................................... 339 Operation in Timer 2 Up/Down Count Mode (When TCRE0 Register's ECEEn bit = 0, ECREn Bit = 0, CLREn Bit = 0, OSTEn Bit = 0, CEEn Bit = 1, CASE1 Bit = 0)................................................................... 340 Timing in 32-Bit Cascade Operation Mode (When TCRE0 Register's UDSEn1, UDSEn0 Bits = 00B, ECEEn Bit = 0, ECREn Bit = 0, CLREn Bit = 0, OSTEn Bit = 0, CEEn Bit = 1, CASE1 Bit = 1)................. 341 Block Diagram of Timer 2 Multiplex Count Generator................................................................................ 342 Multiplex Count Timing .............................................................................................................................. 343 Capture Operation: 16-Bit Buffer-Less Mode (When Operation Is Delayed Through Setting of LNKEy Bit of CMSEx0 Register, and CMSEx0 Register's CCSEy Bit = 0, BFEEy Bit = 0, EEVEy Bit = 1, and CSCE0 Register's SEVEy Bit = 0).............................................................................. 344
User's Manual U15195EJ3V0UD
Page
19
LIST OF FIGURES (4/6)
Figure No. 9-71 9-72 Title Capture Operation: Mode with 16-Bit Buffer (When CMSEx0 Register's TByE1 Bit = 0, TByE0 Bit = 1, CCSEy Bit = 0, LNKEy Bit = 0, BFEEy Bit = 1, EEVEy Bit = 1, and CSCE0 Register's SEVEy Bit = 0).....345 Capture Operation: 32-Bit Cascade Operation Mode (When CMSEx Register's TByE1 Bit = 1, TByE0 Bit = 1, CCSEy Bit = 0, LNKEy Bit = 0, BFEEy Bit = Arbitrary, EEVEy Bit = 1, and CSCE0 Register's SEVEy Bit = 0).......................................................................................................346 9-73 9-74 9-75 9-76 9-77 9-78 9-79 9-80 9-81 9-82 9-83 9-84 9-85 9-86 9-87 9-88 9-89 9-90 9-91 9-92 9-93 9-94 9-95 9-96 9-97 9-98 9-99 10-1 Capture Operation: Capture Control by Software and Trigger Timing (When CMSEx0 Register's TByE1 Bit = 0, TByE0 Bit = 1, CCSEy Bit = 0, LNKEy Bit = 0, BFEEy Bit = 1)..........................347 Compare Operation: Buffer-Less Mode (When CMSEx0 Register's CCSEy Bit = 1, LNKEy Bit = Arbitrary, BFEEy Bit = 0)........................................................................................................348 Compare Operation: Mode with Buffer (When Operation Is Delayed Through Setting of LNKEy Bit of CMSEx0 Register, CMSEx0 Register's CCSEy Bit = 1, BFEEy Bit = 1) ....................................................349 Capture Operation: Timer 2 Count Value Read Timing (When CMSE050 Register's CCSEy Bit = 0, EEVEy Bit = 1, and CSCE0 Register's SEVEy Bit = 0) .....................................................350 Compare Operation: Timing of Compare Match and Write Operation to Register (When CMSE050 Register's CCSEy Bit = 1, EEVEy Bit = Arbitrary, and CSCE0 Register's SEVEy Bit = Arbitrary) .............351 Signal Output Operation: Toggle Mode 0 and Toggle Mode 1 (When OCTLE0 Register's SWFEn Bit = 0, and ODELE0 Register's ODLEn2 to ODLEn0 Bits = 0) ....................................................352 Signal Output Operation: Toggle Mode 2 and Toggle Mode 3 (When OCTLE0 Register's SWFEn Bit = 0, and ODELE0 Register's ODLEn2 to ODLEn0 Bits = 0) ....................................................353 Signal Output Operation: During Software Control (When OCTLE0 Register's OTMEn1, OTMEn0 Bits = Arbitrary, SWFEn Bit = 1, and ODELE0 Register's ODLEn2 to ODLEn0 Bits = 0) ...........353 Signal Output Operation: During Delay Output Operation (When OCTLE0 Register's OTMEn1, OTMEn0 Bits = 0, ALVEn = 0, SWFEn Bit = 0) ..........................................................................................354 Block Diagram of Timer 3...........................................................................................................................356 Basic Operation of Timer 3.........................................................................................................................367 Operation After Overflow (When OST = 1).................................................................................................368 Capture Operation Example.......................................................................................................................369 TM3 Capture Operation Example (When Both Edges Are Specified) ........................................................370 Compare Operation Example.....................................................................................................................371 TM3 Compare Operation Example (Set/Reset Output Mode) ....................................................................373 Example of Operation of TO3 Output Control Function by INTP4 Pin (in TO3 Output Mode (PMC27 Bit = 1 and PFC27 Bit = 1))........................................................................374 Contents of Register Settings When Timer 3 Is Used as Interval Timer.....................................................375 Interval Timer Operation Timing Example ..................................................................................................376 Contents of Register Settings When Timer 3 Is Used for PWM Output......................................................377 PWM Output Operation Timing Example ...................................................................................................378 Contents of Register Settings When Timer 3 Is Used for Cycle Measurement ..........................................379 Cycle Measurement Operation Timing Example ........................................................................................380 Block Diagram of Timer 4...........................................................................................................................383 Example of Timing During TM4 Operation .................................................................................................386 TM4 Compare Operation Example.............................................................................................................388 Block Diagram of Timer Connection Function ............................................................................................391 Selecting Mode of UART1 or CSI1.............................................................................................................394
User's Manual U15195EJ3V0UD
Page
20
LIST OF FIGURES (5/6)
Figure No. 10-2 10-3 10-4 10-5 10-6 10-7 10-8 10-9 10-10 10-11 10-12 10-13 10-14 10-15 10-16 10-17 10-18 10-19 10-20 10-21 10-22 10-23 10-24 10-25 10-26 10-27 10-28 10-29 10-30 10-31 10-32 10-33 10-34 10-35 11-1 11-2 11-3 11-4 11-5 11-6 11-7 11-8 Title Page
Asynchronous Serial Interface 0 Block Diagram ........................................................................................ 397 Asynchronous Serial Interface Transmit/Receive Data Format.................................................................. 406 Asynchronous Serial Interface Transmission Completion Interrupt Timing ................................................ 408 Continuous Transmission Processing Flow ............................................................................................... 410 Continuous Transmission Starting Procedure............................................................................................ 411 Continuous Transmission End Procedure.................................................................................................. 412 Asynchronous Serial Interface Reception Completion Interrupt Timing ..................................................... 414 When Reception Error Interrupt Is Separated from INTSR0 Interrupt (ISRM Bit = 0) ................................ 415 When Reception Error Interrupt Is Included in INTSR0 Interrupt (ISRM Bit = 1)........................................ 415 Noise Filter Circuit...................................................................................................................................... 417 Timing of RXD0 Signal Judged as Noise ................................................................................................... 417 Configuration of Baud Rate Generator 0 (BRG0)....................................................................................... 418 Allowable Baud Rate Range During Reception.......................................................................................... 423 Transfer Rate During Continuous Transmission ........................................................................................ 425 Block Diagram of Asynchronous Serial Interface 1 .................................................................................... 428 Asynchronous Serial Interface Transmit/Receive Data Format.................................................................. 439 Asynchronous Serial Interface Transmission Completion Interrupt Timing ................................................ 442 Continuous Transmission of 3 or More Frames ......................................................................................... 443 Asynchronous Serial Interface Reception Completion Interrupt Timing ..................................................... 446 Transmission/Reception Timing in Synchronous Mode ............................................................................. 449 Transmission/Reception Timing Chart for Synchronous Mode .................................................................. 450 Reception Completion Interrupt and Error Interrupt Generation Timing During Synchronous Mode Reception................................................................................................................................................... 453 Block Diagram of Baud Rate Generator 1 (BRG1)..................................................................................... 454 Allowable Baud Rate Range During Reception.......................................................................................... 459 Block Diagram of Clocked Serial Interface................................................................................................. 464 Timing Chart in Single Transfer Mode ....................................................................................................... 480 Timing Chart According to Clock Phase Selection..................................................................................... 482 Timing Chart of Interrupt Request Signal Output in Delay Mode ............................................................... 484 Repeat Transfer (Receive-Only) Timing Chart........................................................................................... 487 Repeat Transfer (Transmission/Reception) Timing Chart .......................................................................... 489 Timing Chart of Next Transfer Reservation Period .................................................................................... 490 Transfer Request Clear and Register Access Conflict ............................................................................... 492 Interrupt Request and Register Access Conflict......................................................................................... 493 Block Diagram of Baud Rate Generator 3 (BRG3)..................................................................................... 495 Block Diagram of A/D Converter 0 or 1...................................................................................................... 501 Block Diagram of Trigger Source Switching Circuit in Timer Trigger Made................................................ 502 Relationship Between Analog Input Voltages and A/D Conversion Results............................................... 513 Example of Select Mode Operation Timing (ANI01): For A/D Converter 0................................................. 517 Example of Scan Mode Operation Timing: For A/D Converter 0 (4-Channel Scan (ANI00 to ANI03)) ...... 518 Example of Select Mode (A/D Trigger Select) Operation (ANI02): For A/D Converter 0............................ 519 Example of Scan Mode (A/D Trigger Scan) Operation (ANI02 to ANI05): For A/D Converter 0 ................ 520 Example of Select Mode (A/D Trigger Polling Select) Operation (ANI02): For A/D Converter 0 ................ 521
User's Manual U15195EJ3V0UD
21
LIST OF FIGURES (6/6)
Figure No. 11-9 11-10 11-11 11-12 11-13 11-14 11-15 11-16 11-17 11-18 11-19 11-20 11-21 11-22 12-1 12-2 12-3 12-4 12-5 12-6 12-7 12-8 12-9 12-10 12-11 12-12 12-13 12-14 12-15 14-1 14-2 14-3 A-1 A-2 Title Page
Example of Scan Mode (A/D Trigger Polling Scan) Operation (ANI02 to ANI05) : For A/D Converter 0 ....522 Example of Timer Trigger Select Mode Operation (ANI04): For A/D Converter 0 ......................................523 Example of Timer Trigger Scan Mode Operation (For A/D Converter 0) : INTTM00 Selected by ITRG0, ITRG1 Register ..........................................................................................524 Example of Select Mode (External Trigger Select) Operation (ANI02): For A/D Converter 0.....................525 Example of Scan Mode (External Trigger Scan) Operation: For A/D Converter 0......................................526 Conversion Result Read Timing (When Conversion Result Is Undefined).................................................528 Conversion Result Read Timing (When Conversion Result Is Normal)......................................................528 Overall Error...............................................................................................................................................529 Quantization Error ......................................................................................................................................530 Zero-Scale Error.........................................................................................................................................530 Full-Scale Error ..........................................................................................................................................531 Differential Linearity Error...........................................................................................................................531 Integral Linearity Error................................................................................................................................532 Sampling Time ...........................................................................................................................................532 Type A Block Diagram................................................................................................................................536 Type B Block Diagram................................................................................................................................537 Type C Block Diagram ...............................................................................................................................538 Type D Block Diagram ...............................................................................................................................539 Type E Block Diagram................................................................................................................................540 Type F Block Diagram................................................................................................................................540 Type G Block Diagram ...............................................................................................................................541 Type H Block Diagram ...............................................................................................................................542 Type I Block Diagram .................................................................................................................................543 Type J Block Diagram ................................................................................................................................544 Type K Block Diagram................................................................................................................................545 Type L Block Diagram ................................................................................................................................546 Type M Block Diagram ...............................................................................................................................547 Type N Block Diagram ...............................................................................................................................548 Example of Noise Elimination Timing .........................................................................................................567 Example of Connection When Using N-ch Transistor ................................................................................584 Mount Pad Dimensions When Mounted on 2SD1950 (VL Standard Product)............................................585 Connection When Using External Regulator ..............................................................................................585 100-Pin Plastic LQFP (Fine Pitch) (14 x 14) ..............................................................................................623 100-Pin Plastic QFP (14 x 20)....................................................................................................................624
22
User's Manual U15195EJ3V0UD
LIST OF TABLES (1/2)
Table No. 1-1 1-2 3-1 3-2 3-3 4-1 6-1. 6-2 7-1 7-2 8-1 8-2 8-3 8-4 8-5 8-6 8-7 8-8 9-1 9-2 9-3 9-4 9-5 9-6 9-7 9-8 9-9 9-10 9-11 9-12 9-13 9-14 9-15 9-16 10-1 10-2 10-3 Title Page
Differences Between V850E/IA1 and V850E/IA2......................................................................................... 26 Differences Between V850E/IA1 and V850E/IA2 Register Setting Values................................................... 26 Program Registers ....................................................................................................................................... 55 System Register Numbers ........................................................................................................................... 56 Interrupt/Exception Table ............................................................................................................................. 65 Bus Priority Order ...................................................................................................................................... 100 Relationship Between Transfer Type and Transfer Object ........................................................................ 127 External Bus Cycles During DMA Transfer (Two-Cycle Transfer).............................................................. 127 Interrupt/Exception Source List .................................................................................................................. 132 Addresses and Bits of Interrupt Control Registers ..................................................................................... 147 Clock Generator Operation Using Power Save Control ............................................................................. 179 Operation Status in HALT Mode ................................................................................................................ 183 Operation After HALT Mode Is Released by Interrupt Request ................................................................. 184 Operation Status in IDLE Mode ................................................................................................................. 185 Operation After IDLE Mode Is Released by Interrupt Request................................................................... 186 Operation Status in Software STOP Mode................................................................................................. 187 Operation After Software STOP Mode Is Released by Interrupt Request.................................................. 188 Counting Time Examples (fXX = 10 x fX)..................................................................................................... 190 Sources of INTCM010 to INTCM012, INTCM0n4, and INTCM0n5............................................................ 193 Operation Modes of Timer 0 ...................................................................................................................... 196 Output Status of External Pulse Output (In Case of TO0n0)...................................................................... 223 Operation Modes of Timer 0 (TM0n).......................................................................................................... 226 Timer 1 Configuration List .......................................................................................................................... 286 Timer 1 (TM10) Clear Conditions............................................................................................................... 288 Capture Trigger Signal (TM10) to 16-Bit Capture Register ........................................................................ 302 List of Count Operations in UDC Mode...................................................................................................... 304 Timer 2 Configuration List .......................................................................................................................... 315 Capture/Compare Operation Sources........................................................................................................ 315 Output Level Sources During Timer Output ............................................................................................... 316 Meaning of Signals in Block Diagram ........................................................................................................ 318 Timer 3 Configuration List .......................................................................................................................... 356 Relationship Between Setting of Each Register and Status of TO3, P27, and INTP31 Pins...................... 366 TO3 Output Control.................................................................................................................................... 373 Timer 4 Configuration List .......................................................................................................................... 383 Generated Interrupts and Default Priorities................................................................................................ 405 Reception Error Causes............................................................................................................................. 414 Baud Rate Generator Setting Data ............................................................................................................ 422
User's Manual U15195EJ3V0UD
23
LIST OF TABLES (2/2)
Table No. 10-4 10-5 10-6 10-7 10-8 10-9 10-10 10-11 11-1 11-2 11-3 11-4 13-1 13-2 15-1 15-2 15-3 18-1 Title Page
Maximum and Minimum Allowable Baud Rate Error ..................................................................................424 Default Priority of Generated Interrupts......................................................................................................438 ASIM10, ASIM11 Register Settings and Data Format................................................................................440 Reception Error Causes .............................................................................................................................447 Baud Rate Generator Setting Data (BRG = fXX/2) ......................................................................................458 SCKn Pin Output Status.............................................................................................................................494 SOn Pin Output Status ...............................................................................................................................494 Baud Rate Generator Setting Data ............................................................................................................498 Correspondence Between ADCR0m (m = 0 to 5) Register Names and Addresses ...................................508 Correspondence Between ADCR1n (n = 0 to 7) Register Names and Addresses .....................................508 Correspondence Between Analog Input Pins and ADCR0m and ADCR1n Registers................................509 Timer Trigger Source Selection of A/D Converters 0 and 1 .......................................................................510 Operation Status of Each Pin During Reset Period ....................................................................................573 Initial Values of CPU, Internal RAM, and On-Chip Peripheral I/O After Reset ...........................................578 Connection of V850E/IA2 Flash Writing Adapter (FA-100GC-8EU) ...........................................................588 Connection of V850E/IA2 Flash Writing Adapter (FA-100GF-3BA)............................................................589 Pins Used by Each Serial Interface ............................................................................................................592 Surface Mounting Type Soldering Conditions ............................................................................................622
24
User's Manual U15195EJ3V0UD
CHAPTER 1 INTRODUCTION
The V850E/IA2 is a product in NEC Electronics' V850 Series provides an overview of the V850E/IA2.
TM
of single-chip microcontrollers.
This chapter
1.1
Outline
The V850E/IA2 is a 32-bit single-chip microcontroller that uses high-speed operations to realize high-precision inverter control of motors. It uses the V850E1 CPU of the V850 Series and has on-chip peripheral functions such as ROM, RAM, a bus interface, a DMA controller, timers including a 3-phase sine-wave PWM timer for motors, serial interfaces, and A/D converters. (1) V850E1 CPU The V850E1 CPU supports a RISC instruction set in which the instruction execution speed is increased greatly through the use of basic instructions that execute one instruction per clock, and an optimized pipeline. Moreover, it supports multiply instructions using a 32-bit hardware multiplier, saturated product-sum operation instructions, and bit manipulation instructions as optimum instructions for digital servo control applications. Object code efficiency is increased in the C compiler by using 2-byte-length basic instructions and instructions corresponding to high-level languages, which promote a compact program. Furthermore, since the interrupt response time, including processing by the on-chip interrupt controller, is also fast, this CPU is ideal for advanced real-time control. (2) External bus interface function A bus configuration consisting of a multiplexed address bus (22 bits) and data bus (8 bits or 16 bits selectable) suitable for compact system design is used as the external bus interface. SRAM and ROM memories can be connected. In the DMA controller, transfer is started using software and transfers between external memories can be made concurrent with internal CPU operations or data transfers. Real-time control such as motor control or communication control can also be realized simultaneously due to high-speed, high-performance CPU instruction execution. (3) On-chip flash memory (PD70F3114) The on-chip flash memory version (PD70F3114), which has a quickly accessible flash memory on-chip, can shorten system development time since it is possible to rewrite a program with the V850E/IA2 mounted in an application system. Moreover, it can greatly improve maintainability after a system is shipped. (4) Complete middleware, development environment The V850E/IA2 can execute JPEG, JBIG, MH/MR/MMR and other middleware at high speeds. Moreover, since middleware for realizing speech recognition, voice synthesis, and other processing also is provided, multimedia systems can be realized easily. A development environment that integrates an optimized C compiler, debugger, in-circuit emulator, simulator, and system performance analyzer is also provided.
User's Manual U15195EJ3V0UD
25
CHAPTER 1 INTRODUCTION
Table 1-1 lists the differences between the V850E/IA1 and V850E/IA2. between the V850E/IA1 and V850E/IA2 register setting values.
Table 1-2 lists the differences
Table 1-1. Differences Between V850E/IA1 and V850E/IA2
Item Maximum operating frequency Internal ROM Mask ROM Flash memory Internal RAM Timer Timer 00, 01 50 MHz V850E/IA1 40 MHz V850E/IA2
PD703116: 256 KB PD70F3116: 256 KB
10 KB Provided
PD703114: 128 KB PD70F3114: 128 KB
6 KB Buffer register, compare register, and compare match interrupt added Timer 10: Provided, Timer 11: Not provided Provided TO3 output buffer off function added by INTP4 input Provided Provided Provided (pins multiplexed with CSI1) Not provided Provided Provided (pins multiplexed with UART1) Not provided Not provided
Timer 10, 11
Provided
Timer 20, 21 Timer 3
Provided Provided
Timer 4 Serial interface UART0 UART1 UART2 CSI0 CSI1 FCAN Debug support function A/D converter NBD
Provided Provided Provided Provided Provided Provided Provided Provided
Analog input
Total of two circuits: 16 ch A/D converter 0: 8 ch A/D converter 1: 8 ch Independent pins VDD3 = 3.3 V 0.3 V VDD5 = 5.0 V 0.5 V 144-pin plastic LQFP
Total of two circuits: 14 ch A/D converter 0: 6 ch A/D converter 1: 8 ch Alternate-function pins VDD = RVDD = 5.0 V 0.5 V Internal regulator 100-pin plastic LQFP
AVDD, AVREF pins Supply voltage
Package
Remark
For details, refer to the user's manual of each product. Table 1-2. Differences Between V850E/IA1 and V850E/IA2 Register Setting Values
Register Name V850E/IA1 12H (fXX = 50 MHz) 00H or 01H V850E/IA2 02H (fXX = 40 MHz) 01H (initial value 00H)
System wait control register (VSWC) Timer 1/timer 2 clock selection register (PRM02)
Remark
For details, refer to the user's manual of each product.
User's Manual U15195EJ3V0UD
26
CHAPTER 1 INTRODUCTION
1.2
Features
83
Number of instructions
Minimum instruction execution time 25 ns (@ internal 40 MHz operation) General-purpose registers Instruction set 32 bits x 32 registers V850E1 (NB85E) CPU Signed multiplication (32 bits x 32 bits 64 bits): 1 or 2 clocks Saturated operation instructions (with overflow/underflow detection function) 32-bit shift instruction: 1 clock Bit manipulation instructions Long/short format load/store instructions Signed load instructions Memory space 4 MB linear address space (shared by program and data) Memory block division function: 2 MB/block Programmable wait function Idle state insertion function External bus interface 16-bit data bus (address/data multiplexed) 16-/8-bit bus sizing function External wait function Internal memory
Part Number Internal ROM 128 KB (mask ROM) 128 KB (flash memory) Internal RAM 6 KB 6 KB
PD703114 PD70F3114
Interrupts/exceptions
External interrupts: 16 (including NMI) Internal interrupts: 42 sources Exceptions: 1 source 8 levels of priority can be specified
DMA controller
4-channel configuration Transfer unit: Transfer type: Transfer modes: Transfer subjects: Transfer requests: 8 bits/16 bits
16
Maximum transfer count: 65,536 (2 ) 2-cycle transfer Single transfer, single-step transfer, block transfer Memory Memory, Memory I/O, I/O I/O On-chip peripheral I/O, software
Next address setting function
User's Manual U15195EJ3V0UD
27
CHAPTER 1 INTRODUCTION
I/O lines
Input ports: 6 I/O ports: 47
Real-time pulse unit
16-bit timer for 3-phase sine wave PWM inverter control: 2 channels 16-bit up/down counter/timer for 2-phase encoder input: 1 channel General-purpose 16-bit timer/counter: 2 channels General-purpose 16-bit timer/event counter: 1 channel 16-bit interval timer: 1 channel
Serial interface (SIO)
Asynchronous serial interface (UART): 2 channels Clocked serial interface (CSI): 2 channels Of the four channels, two channels are used for both CSI and UART and therefore one or the other function must be selected.
A/D converter Regulator
10-bit resolution A/D converter: 6 channels + 8 channels (2 units) Two power supplies, one for the internal CPU and one for the peripheral interface, are not necessary. A 5 V single-power-supply system can be configured by connecting an N-ch transistor (2SD1950 (VL standard product, surface mount type) or 2SD1581 (independent type) is recommended). If a 3.3 V power supply is available, it can be directly connected to the REGIN pin.
Clock generator
Multiplication function (x1, x2.5, x5, x10) using PLL clock synthesizer Divide-by-2 function using external clock input
Power-saving function Package
HALT, IDLE, and software STOP modes 100-pin plastic LQFP (fine pitch) (14 x 14) 100-pin plastic QFP (14 x 20)
CMOS technology
All static circuits
1.3
Application Fields
* Consumer equipment (inverter air conditioners) * Industrial equipment (motor control, general-purpose inverters)
1.4
Ordering Information
Part Number Package 100-pin plastic LQFP (fine pitch) (14 x 14) 100-pin plastic QFP (14 x 20) 100-pin plastic LQFP (fine pitch) (14 x 14) 100-pin plastic QFP (14 x 20) Internal ROM Mask ROM Mask ROM Flash memory Flash memory
PD703114GC-xxx-8EU PD703114GC-xxx-3BA PD70F3114GC-8EU PD70F3114GF-3BA
Remark
xxx indicates ROM code suffix.
28
User's Manual U15195EJ3V0UD
CHAPTER 1 INTRODUCTION
1.5
Pin Configuration (Top View)
* 100-pin plastic LQFP (fine pitch) (14 x 14) xxx-8EU PD703114GC-xxx xxx PD70F3114GC-8EU
100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76
ANI04 ANI03 ANI02 ANI01 ANI00 AVSS0 AVDD0 TO015 TO014 TO013 TO012 TO011 TO010 VSS VDD TO005 TO004 TO003 TO002 TO001 TO000 INTP4/TO3OFF/P05 ADTRG1/INTP3/P04 ADTRG0/INTP2/P03 ESO1/INTP1/P02
Note PD70F3114 only.
TXD0/P31 SI1/RXD1/P32 SO1/TXD1/P33 SCK1/ASCK1/P34 TI2/INTP20/P20 TO21/INTP21/P21 TO22/INTP22/P22 TO23/INTP23/P23 TO24/INTP24/P24 TCLR2/INTP25/P25 TI3/INTP30/TCLR3/P26 TO3/INTP31/P27 VSS VDD PDL0/AD0 PDL1/AD1 PDL2/AD2 PDL3/AD3 PDL4/AD4 PDL5/AD5 PDL6/AD6 PDL7/AD7 PDL8/AD8 PDL9/AD9 PDL10/AD10
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
ANI05 AVDD1 AVSS1 ANI10 ANI11 ANI12 ANI13 ANI14 ANI15 ANI16 ANI17 MODE0 VSS3 RVDD REGOUT REGIN X1 X2 RESET CVSS CKSEL SI0/P40 SO0/P41 SCK0/P42 RXD0/P30
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
ESO0/INTP0/P01 NMI/P00 TCLR10/INTP101/P12 TCUD10/INTP100/P11 TIUD10/TO10/P10 PCM1/CLKOUT PCM0/WAIT PCT6/ASTB PCT4/RD PCT1/UWR PCT0/LWR VDD VSS3 MODE1/VPPNote PDH5/A21 PDH4/A20 PDH3/A19 PDH2/A18 PDH1/A17 PDH0/A16 PDL15/AD15 PDL14/AD14 PDL13/AD13 PDL12/AD12 PDL11/AD11
User's Manual U15195EJ3V0UD
29
CHAPTER 1 INTRODUCTION
* 100-pin plastic QFP (14 x 20) xxx-3BA PD703114GF-xxx xxx PD70F3114GF-3BA
100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81
ANI02 ANI01 ANI00 AVSS0 AVDD0 TO015 TO014 TO013 TO012 TO011 TO010 VSS VDD TO005 TO004 TO003 TO002 TO001 TO000 INTP4/TO3OFF/P05
Note PD70F3114 only.
30
SCK1/ASCK1/P34 TI2/INTP20/P20 TO21/INTP21/P21 TO22/INTP22/P22 TO23/INTP23/P23 TO24/INTP24/P24 TCLR2/INTP25/P25 TI3/INTP30/TCLR3/P26 TO3/INTP31/P27 VSS VDD PDL0/AD0 PDL1/AD1 PDL2/AD2 PDL3/AD3 PDL4/AD4 PDL5/AD5 PDL6/AD6 PDL7/AD7 PDL8/AD8
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
ANI03 ANI04 ANI05 AVDD1 AVSS1 ANI10 ANI11 ANI12 ANI13 ANI14 ANI15 ANI16 ANI17 MODE0 VSS3 RVDD REGOUT REGIN X1 X2 RESET CVSS CKSEL SI0/P40 SO0/P41 SCK0/P42 RXD0/P30 TXD0/P31 SI1/RXD1/P32 SO1/TXD1/P33
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
ADTRG1/INTP3/P04 ADTRG0/INTP2/P03 ESO1/INTP1/P02 ESO0/INTP0/P01 NMI/P00 TCLR10/INTP101/P12 TCUD10/INTP100/P11 TIUD10/TO10/P10 PCM1/CLKOUT PCM0/WAIT PCT6/ASTB PCT4/RD PCT1/UWR PCT0/LWR VDD VSS3 MODE1/VPPNote PDH5/A21 PDH4/A20 PDH3/A19 PDH2/A18 PDH1/A17 PDH0/A16 PDL15/AD15 PDL14/AD14 PDL13/AD13 PDL12/AD12 PDL11/AD11 PDL10/AD10 PDL9/AD9
User's Manual U15195EJ3V0UD
CHAPTER 1 INTRODUCTION
Pin Identification
A16 to A21: AD0 to AD15: ADTRG0, ADTRG1: ANI00 to ANI05, ANI10 to ANI17: ASCK1: ASTB: AVDD0, AVDD1: AVSS0, AVSS1: CKSEL: CLKOUT: CVSS: ESO0, ESO1: INTP0 to INTP4, INTP100, INTP101, INTP20 to INTP25, INTP30, INTP31: LWR: MODE0, MODE1: NMI: P00 to P05: P10 to P12: P20 to P27: P30 to P34: P40 to P42: PCM0, PCM1: PCT0, PCT1, PCT4, PCT6: Port CT Interrupt request from peripherals Lower write strobe Mode Non-maskable interrupt request Port 0 Port 1 Port 2 Port 3 Port 4 Port CM Analog input Asynchronous serial clock Address strobe Analog power supply Analog ground Clock generator operating mode select Clock output Clock generator ground Emergency shut off Address bus Address/data bus A/D trigger input PDH0 to PDH5: PDL0 to PLD15: RD: RESET: REGIN: REGOUT: RVDD: RXD0, RXD1: SCK0, SCK1: SI0, SI1: SO0, SO1: TCLR10, TCLR2, TCLR3: TCUD10: TI2, TI3: TIUD10: TO000 to TO005, TO010 to TO015, TO10, TO21 to TO24, TO3: Timer output TO3OFF: TXD0, TXD1: UWR: VDD: VPP: VSS, VSS3: WAIT: X1, X2: Timer output 3 off Transmit data Upper write strobe Power supply Programming power supply Ground Wait Crystal Timer clear Timer control pulse input Timer input Timer count pulse input Port DH Port DL Read strobe Reset Regulator input Regulator output Regulator power supply Receive data Serial clock Serial input Serial output
User's Manual U15195EJ3V0UD
31
CHAPTER 1 INTRODUCTION
1.6
Configuration of Function Block
1.6.1 Internal block diagram
NMI INTP2, INTP3 INTP0/ESO0, INTP1/ESO1, INTP4/TO3OFF, INTP20/TI2, INTP21/TO21 to INTP24/TO24, INTP25/TCLR2, INTP30/TI3/TCLR3, INTP31/TO3, INTP100/TCUD10, INTP101/TCLR10 TO000 to TO005, TO010 to TO015 TIUD10/TO10
INTC
ROM PC Note 1 32-bit barrel shifter System registers RAM
Generalpurpose registers 32 bits x 32
CPU
BCU Instruction queue
MEMC RD SRAMC UWR LWR
Multiplier 32 x 32 64
ROMC
ASTB WAIT AD0 to AD15
RPU
Timer 0: TM00, TM01 Timer 1: TM10 Timer 2: TM20, TM21
ALU
A16 to A21
6 KB
Timer 3: TM3 Timer 4: TM4
DMAC
SIO TXD0 RXD0 SO1/TXD1 SI1/RXD1 SCK1/ASCK1 UART0 Ports ADC0 ADC1 CG UART1
ADTRG0 ANI00 to ANI05 AVSS0 AVDD0 PDL0 to PDL15 PDH0 to PDH5 PCT0, PCT1, PCT4, PCT6 PCM0, PCM1 P40 to P42 P30 to P34 P20 to P27 P10 to P12 P00 to P05 ADTRG1 ANI10 to ANI17 AVSS1 AVDD1
CKSEL CLKOUT X1 X2 CVSS
CSI1 SO0 SI0 SCK0
System controller
CSI0 Regulator
REGIN REGOUT RVDD VSS3
MODE0, MODE1/VPPNote 2 RESET VDD VSS VSS3
Notes 1. 2.
PD703114: 128 KB (mask ROM) PD70F3114: 128 KB (flash memory) PD70F3114 only.
32
User's Manual U15195EJ3V0UD
CHAPTER 1 INTRODUCTION
1.6.2 Internal units (1) CPU The CPU uses 5-stage pipeline control to execute address calculation, arithmetic and logical operation, data transfer, and most other instruction processing in one clock. A multiplier (16 bits x 16 bits 32 bits or 32 bits x 32 bits 64 bits), barrel shifter (32-bit), and other dedicated hardware are on-chip to accelerate complex instruction processing. (2) Bus control unit (BCU) The BCU starts a required external bus cycle based on a physical address obtained from the CPU. If there is no bus cycle start request from the CPU when fetching an instruction from an external memory area, the BCU generates a prefetch address and prefetches the instruction code. The prefetched instruction code is fetched into the internal instruction queue of the CPU. (3) Memory controller (MEMC) The MEMC controls SRAM, ROM, and various I/O for external memory expansion. (4) DMA controller (DMAC) The DMAC transfers data between memory and I/O in place of the CPU. The address mode is two-cycle transfer. The three bus modes are single transfer, single-step transfer, and block transfer. (5) ROM The PD703114 includes mask ROM (128 KB), and the PD70F3114 includes flash memory (128 KB). On an instruction fetch, the ROM can be accessed by the CPU in one clock. When single-chip mode or flash memory programming mode is set, ROM is mapped starting from address 00000000H. ROM cannot be accessed if ROMless mode is set. (6) RAM RAM is mapped starting from address FFFFC000H. It can be accessed by the CPU in one clock on an instruction fetch or data access. (7) Interrupt controller (INTC) The INTC services hardware interrupt requests from on-chip peripheral I/O and external sources (NMI, INTP0 to INTP4, INTP20 to INTP25, INTP30, INTP31, INTP100, INTP101). For these interrupt requests, eight levels of interrupt priority can be defined and multiprocessing controls against the interrupt sources can be performed. (8) Clock generator (CG) The CG provides a frequency that is 1, 2.5, 5, or 10 times (using the on-chip PLL) or 0.5 times (not using the on-chip PLL) the input clock (fX) as the internal system clock (fXX). As the input clock, connect an external resonator to pins X1 and X2 (only when using the on-chip PLL synthesizer) or input an external clock from the X1 pin.
User's Manual U15195EJ3V0UD
33
CHAPTER 1 INTRODUCTION
(9) Real-time pulse unit (RPU) The RPU has a 2-channel 16-bit timer (TM0) for 3-phase sine wave PWM inverter control, a 1-channel 16-bit up/down counter (TM1) that can be used for 2-phase encoder input or as a general-purpose timer, a 2channel 16-bit general-purpose timer unit (TM2), a 1-channel 16-bit timer/event counter (TM3), and a 1channel 16-bit interval timer (TM4) on-chip. The RPU can measure the pulse interval or frequency and can output a programmable pulse. (10)Serial interface (SIO) A total of four channels of serial interfaces, including asynchronous serial interface (UART) and clocked serial interface (CSI), are provided. Of these channels, two are used for both UART and CSI, and their function must be selected. Of the other two channels, one is fixed to UART, and one is fixed to CSI. The UART performs data transfer using pins TXDn and RXDn (n = 0, 1). The CSI performs data transfer using pins SOn, SIn, and SCKn (n = 0, 1). (11)A/D converter (ADC) Two circuits of high-speed, high-resolution 10-bit A/D converters with a total of 14 pins (A/D converter 0: 6 pins, A/D converter 1: 8 pins) are available. The ADC converts using a successive approximation method. (12)Ports As shown in the table below, ports function as general-purpose ports and as control pins.
Port Port 0 I/O 6-bit input Control Functions NMI input Real-time pulse unit output stop signal input External interrupt input A/D converter external trigger input Timer 3 output stop signal input Real-time pulse unit I/O External interrupt input Real-time pulse unit I/O External interrupt input Serial interface I/O (UART0, UART1/CSI1) Serial interface I/O (CSI0) External address bus (A16 to A21) External address/data bus (AD0 to AD15) External bus interface control signal output Wait insertion signal input Internal system clock output
Port 1
3-bit I/O
Port 2
8-bit I/O
Port 3 Port 4 Port DH Port DL Port CT Port CM
5-bit I/O 3-bit I/O 6-bit I/O 16-bit I/O 4-bit I/O 2-bit I/O
34
User's Manual U15195EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
The names and functions of the V850E/IA2 pins are shown below. These pins can be divided by function into port pins and non-port pins.
2.1
List of Pin Functions
(1) Port pins (1/2)
Pin Name I/O Input Port 0 6-bit input-only port Function Alternate Function NMI ESO0/INTP0 ESO1/INTP1 ADTRG0/INTP2 ADTRG1/INTP3 INTP4/TO3OFF I/O Port 1 3-bit I/O port Input or output can be specified in 1-bit units Port 2 8-bit I/O port Input or output can be specified in 1-bit units TIUD10/TO10 TCUD10/INTP100 TCLR10/INTP101 I/O TI2/INTP20 TO21/INTP21 TO22/INTP22 TO23/INTP23 TO24/INTP24 TCLR2/INTP25 TI3/TCLR3/INTP30 TO3/INTP31 I/O Port 3 5-bit I/O port Input or output can be specified in 1-bit units RXD0 TXD0 RXD1/SI1 TXD1/SO1 ASCK1/SCK1 I/O Port 4 3-bit I/O port Input or output can be specified in 1-bit units Port CM 2-bit I/O port Input or output can be specified in 1-bit units SI0 SO0 SCK0 I/O WAIT CLKOUT
P00 P01 P02 P03 P04 P05 P10 P11 P12 P20 P21 P22 P23 P24 P25 P26 P27 P30 P31 P32 P33 P34 P40 P41 P42 PCM0 PCM1
User's Manual U15195EJ3V0UD
35
CHAPTER 2 PIN FUNCTIONS
(2/2)
Pin Name PCT0 PCT1 PCT4 PCT6 PDH0 PDH1 PDH2 PDH3 PDH4 PDH5 PDL0 PDL1 PDL2 PDL3 PDL4 PDL5 PDL6 PDL7 PDL8 PDL9 PDL10 PDL11 PDL12 PDL13 PDL14 PDL15 I/O Port DL 16-bit I/O port Input or output can be specified in 1-bit units I/O Port DH 6-bit I/O port Input or output can be specified in 1-bit units I/O I/O Function Port CT 4-bit I/O port Input or output can be specified in 1-bit units Alternate Function LWR UWR RD ASTB A16 A17 A18 A19 A20 A21 AD0 AD1 AD2 AD3 AD4 AD5 AD6 AD7 AD8 AD9 AD10 AD11 AD12 AD13 AD14 AD15
36
User's Manual U15195EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
(2) Non-port pins (1/3)
Pin Name TO000 TO001 TO002 TO003 TO004 TO005 TO010 TO011 TO012 TO013 TO014 TO015 TO10 TO21 TO22 TO23 TO24 TO3 ESO0 ESO1 TIUD10 TCUD10 TCLR10 TI2 TI3 TCLR2 TCLR3 INTP0 INTP1 INTP2 INTP3 INTP4 INTP100 INTP101 Input External maskable interrupt request input and timer 10 external capture trigger input Input External maskable interrupt request input Input Timer 2 or 3 clear signal input Input Input Input Input External count clock input to up/down counter (timer 10) Count operation switching signal to up/down counter (timer 10) Clear signal input to up/down counter (timer 10) Timer 2 or 3 external count clock input Output Input Timer 3 pulse signal output Timer 00 or 01 output stop signal input Output Output Timer 10 pulse signal output Timer 2 pulse signal output Output Timer 01 pulse signal output I/O Output Timer 00 pulse signal output Function Alternate Function - - - - - - - - - - - - P10/TIUD10 P21/INTP21 P22/INTP22 P23/INTP23 P24/INTP24 P27/INTP31 P01/INTP0 P02/INTP1 P10/TO10 P11/INTP100 P12/INTP101 P20/INTP20 P26/INTP30/TCLR3 P25/INTP25 P26/INTP30/TI3 P01/ESO0 P02/ESO1 P03/ADTRG0 P04/ADTRG1 P05/TO3OFF P11/TCUD10 P12/TCLR10
User's Manual U15195EJ3V0UD
37
CHAPTER 2 PIN FUNCTIONS
(2/3)
Pin Name INTP20 INTP21 INTP22 INTP23 INTP24 INTP25 INTP30 INTP31 TO3OFF SO0 SO1 SI0 SI1 SCK0 SCK1 TXD0 TXD1 RXD0 RXD1 ASCK1 ANI00 to ANI05 ANI10 to ANI17 ADTRG0 ADTRG1 NMI MODE0 MODE1 VPP
Note
I/O Input
Function External maskable interrupt request input and timer 2 external capture trigger input
Alternate Function P20/TI2 P21/TO21 P22/TO22 P23/TO23 P24/TO24 P25/TCLR2
Input
External maskable interrupt request input and timer 3 external capture trigger input Timer 3 output stop signal input Serial transmit data output (3-wire) of CSI0 and CSI1
P26/TI3/TCLR3 P27/TO3 P05/INTP4 P41 P33/TXD1
Input Output
Input
Serial receive data input (3-wire) of CSI0 and CSI1
P40 P32/RXD1
I/O
Serial clock I/O (3-wire) of CSI0 and CSI1
P42 P34/ASCK1
Output
Serial transmit data output of UART0 and UART1
P31 P33/SO1
Input
Serial receive data input of UART0 and UART1
P30 P32/SI1
I/O Input
UART1 serial clock I/O Analog input to A/D converter
P34/SCK1 - -
Input
External trigger input to A/D converter
P03/INTP2 P04/INTP3
Input Input
Non-maskable interrupt request input Specifies V850E/IA2 operation mode
P00 - VPP
Note
- Input Output Output Output Output I/O Output Input Input -
Power application for flash memory write Control signal input to insert wait in bus cycle External data lower byte write strobe signal output External data higher byte write strobe signal output External data bus read strobe signal output External data bus address strobe signal output 16-bit address/data bus for external memory Higher 6-bit address bus for external memory System reset input Crystal resonator connection pin for system clock oscillation. Input to X1 pin when providing clocks from outside.
MODE1 PCM0 PCT0 PCT1 PCT4 PCT6 PDL0 to PDL15 PDH0 to PDH5 - - -
WAIT LWR UWR RD ASTB AD0 to AD15 A16 to A21 RESET X1 X2
Note PD70F3114 only
38
User's Manual U15195EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
(3/3)
Pin Name CLKOUT CKSEL AVDD0, AVDD1 AVSS0, AVSS1 CVSS VDD VSS RVDD VSS3 REGOUT REGIN I/O Output Input - - - - - - - Output Input System clock output Input specifying clock generator operation mode Positive power supply for A/D converter Ground potential for A/D converter Ground potential for oscillator, PLL and regulator 5 V system positive power supply for peripheral interface 5 V system ground potential for peripheral interface Positive power supply pin for regulator (5 V system power supply pin) Internal 3.3 V system ground pin Regulator output pin Regulator input pin (3.3 V system power supply pin) Function Alternate Function PCM1 - - - - - - - - - -
User's Manual U15195EJ3V0UD
39
CHAPTER 2 PIN FUNCTIONS
2.2
Pin Status
The following table shows the status of each pin after a reset, in power-saving mode (software STOP mode, IDLE, HALT), and during a DMA transfer.
Operating Status Pin A16 to A21 (PDH0 to PDH5) AD0 to AD15 (PDL0 to PDL15) LWR, UWR (PCT0, PCT1) RD (PCT4) ASTB (PCT6) WAIT (PCM0) CLKOUT (PCM1) Reset (Single-Chip Mode) Hi-Z Hi-Z Hi-Z Hi-Z Hi-Z Hi-Z Hi-Z Reset (ROMless Mode) Hi-Z Hi-Z Hi-Z Hi-Z Hi-Z Hi-Z Operating IDLE Mode/ HALT Mode/ Software STOP Mode During DMA Transfer Hi-Z Hi-Z H H H - L Operating Operating Operating Operating Operating Operating Operating
Caution
When controlling the external bus using an ASIC or the like in standby mode, provide a separate controller.
Remarks Hi-Z: High impedance H: L: -: High-level output Low-level output No input sampling
40
User's Manual U15195EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
2.3
Description of Pin Functions
(1) P00 to P05 (Port 0) ... Input P00 to P05 function as a 6-bit input-only port in which all pins are fixed to input. Besides functioning as an input port, in control mode, P00 to P05 operate as NMI input, real-time pulse unit (RPU) output stop signal input, external interrupt request input, A/D converter (ADC) external trigger input, and timer 3 output stop signal input. Normally, if port pins also have alternate functions, the mode is selected using a port mode control register. However, there is no such register for P00 to P05. Therefore, the input port cannot be switched with the NMI input pin, RPU output stop signal input pin, external interrupt request input pin, A/D converter (ADC) external trigger input pin, and timer 3 output stop signal input pin. Read the status of each pin by reading the port. (a) Port mode P00 to P05 are input-only. (b) Control mode P00 to P05 also serve as the NMI, ESO0, ESO1, ADTRG0, ADTRG1, INTP0 to INTP4, and TO3OFF pins, but they cannot be switched. (i) NMI (Non-maskable interrupt request) ... Input This is non-maskable interrupt request input. (ii) ESO0, ESO1 (Emergency shut off) ... Input These pins input timer 00 and timer 01 output stop signals. (iii) INTP0 to INTP4 (Interrupt request from peripherals) ... Input These are external interrupt request input pins. (iv) ADTRG0, ADTRG1 (A/D trigger input) ... Input These are A/D converter external trigger input pins. (v) TO3OFF (Timer output 3 off) ... Input This is a timer output stop signal input pin.
User's Manual U15195EJ3V0UD
41
CHAPTER 2 PIN FUNCTIONS
(2) P10 to P12 (Port 1) ... I/O P10 to P12 function as a 3-bit I/O port in which input or output can be set in 1-bit units. Besides functioning as an I/O port, in control mode, P10 to P12 operate as RPU I/O and external interrupt request input. Port or control mode can be selected as the operation mode for each bit, specified by the port 1 mode control register (PMC1). (a) Port mode P10 to P12 can be set to input or output in 1-bit units using the port 1 mode register (PM1). (b) Control mode P10 to P12 can be set to port or control mode in 1-bit units using PMC1. (i) TO10 (Timer output) ... Output This pin outputs the timer 10 pulse signal. (ii) TIUD10 (Timer count pulse input) ... Input This is an external count clock input pin to the up/down counter (timer 10). (iii) TCUD10 (Timer control pulse input) ... Input This pin inputs count operation switching signals to the up/down counter (timer 10). (iv) TCLR10 (Timer clear) ... Input This is a clear signal input pin to the up/down counter (timer 10). (v) INTP100, INTP101 (Interrupt request from peripherals) ... Input These are external interrupt request input pins and timer 10 external capture trigger input pins.
42
User's Manual U15195EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
(3) P20 to P27 (Port 2) ... I/O P20 to P27 function as an 8-bit I/O port in which input or output can be set in 1-bit units. Besides functioning as an I/O port, in control mode, P20 to P27 operate as RPU I/O and external interrupt request input. Port or control mode can be selected as the operation mode for each bit, specified by the port 2 mode control register (PMC2). (a) Port mode P20 to P27 can be set to input or output in 1-bit units using the port 2 mode register (PM2). (b) Control mode P20 to P27 can be set to port or control mode in 1-bit units using PMC2. (i) TO21 to TO24 (Timer output) ... Output These pins output a timer 2 pulse signal. (ii) TO3 (Timer output) ... Output This pin outputs a timer 3 pulse signal. (iii) TI2, TI3 (Timer input) ... Input These are timer 2 and timer 3 external count clock input pins. (iv) TCLR2, TCLR3 (Timer clear) ... Input These are timer 2 and timer 3 clear signal input pins. (v) INTP20 to INTP25 (Interrupt request from peripherals) ... Input These are external interrupt request input pins and timer 2 external capture trigger input pins. (vi) INTP30, INPT31 (Interrupt request from peripherals) ... Input These are external interrupt request input pins and timer 3 external capture trigger input pins.
User's Manual U15195EJ3V0UD
43
CHAPTER 2 PIN FUNCTIONS
(4) P30 to P34 (Port 3) ... I/O P30 to P34 function as a 5-bit I/O port in which input or output can be set in 1-bit units. Besides functioning as an I/O port, in control mode, P30 to P34 operate as serial interface (UART0, UART1/CSI1) I/O. Port or control mode can be selected as the operation mode for each bit, specified by the port 3 mode control register (PMC3). The selection of UART/SCI1 is specified by the port 3 function control register (PFC3). (a) Port mode P30 to P34 can be set to input or output in 1-bit units using the port 3 mode register (PM3). (b) Control mode P30 to P34 can be set to port or control mode in 1-bit units using PMC3. (i) TXD0, TXD1 (Transmit data) ... Output These pins output serial transmit data of UART0 and UART1. (ii) RXD0, RXD1 (Receive data) ... Input These pins input serial receive data of UART0 and UART1. (iii) ASCK1 (Asynchronous serial clock) ... I/O This is UART1 serial clock I/O pin. (iv) SO1 (Serial output) ... Output This pin outputs serial transmit data of CSI1. (v) SI1 (Serial input) ... Input This pin inputs serial receive data of CSI1. (vi) SCK1 (Serial clock) ... I/O This pin is CSI1 serial clock I/O pin.
44
User's Manual U15195EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
(5) P40 to P42 (Port 4) ... I/O P40 to P42 function as a 3-bit I/O port in which input or output can be set in 1-bit units. Besides functioning as an I/O port, in control mode, P40 to P42 operate as serial interface (CSI0) I/O. Port or control mode can be selected as the operation mode for each bit, specified by the port 4 mode control register (PMC4). (a) Port mode P40 to P42 can be set to input or output in 1-bit units using the port 4 mode register (PM4). (b) Control mode P40 to P42 can be set to port or control mode in 1-bit units using PMC4. (i) SO0 (Serial output) ... Output This pin outputs CSI0 serial transmit data. (ii) SI0 (Serial input) ... Input This pin inputs CSI0 serial receive data. (iii) SCK0 (Serial clock) ... I/O This is CSI0 serial clock I/O pin. (6) PCM0, PCM1 (Port CM) ... I/O PCM0 and PCM1 function as a 2-bit I/O port in which input or output can be set in 1-bit units. Besides functioning as a port, in control mode, PCM0 and PCM1 operate as wait insertion signal input and internal system clock output. Port or control mode can be selected as the operation mode for each bit, specified by the port CM mode control register (PMCCM). (a) Port mode PCM0 and PCM1 can be set to input or output in 1-bit units using the port CM mode register (PMCM). (b) Control mode PCM0 and PCM1 can be set to port or control mode in 1-bit units using PMCCM. (i) WAIT (Wait) ... Input This control signal input pin, which inserts a data wait in a bus cycle, can be input asynchronously to the CLKOUT signal. Sampling is performed at the falling edge of the CLKOUT signal in the T2 or TW state of the bus cycle. If the setup or hold time is not secured within the sampling timing, wait insertion may not be performed. (ii) CLKOUT (Clock output) ... Output This is an internal system clock output pin. In single-chip mode, output is not performed by the CLKOUT pin because it is in port mode. To perform CLKOUT output, set this pin to control mode using the port CM mode control register (PMCCM). This pin performs CLKOUT output, even during the reset period, in ROMless mode.
User's Manual U15195EJ3V0UD
45
CHAPTER 2 PIN FUNCTIONS
(7) PCT0, PCT1, PCT4, PCT6 (Port CT) ... I/O PCT0, PCT1, PCT4, and PCT6 function as a 4-bit I/O port in which input or output can be set in 1-bit units. Besides functioning as a port, in control mode, these pins operate as control signal output for when memory is expanded externally. Port or control mode can be selected as the operation mode for each bit, specified by the port CT mode control register (PMCCT). (a) Port mode PCT0, PCT1, PCT4, and PCT6 can be set to input or output in 1-bit units using the port CT mode register (PMCT). (b) Control mode PCT0, PCT1, PCT4, and PCT6 can be set to port or control mode in 1-bit units using PMCCT. (i) LWR (Lower byte write strobe) ... Output This is a strobe signal that shows that the bus cycle being executed is a write cycle for SRAM, external ROM, or an external peripheral I/O area. In the data bus, the lower byte is valid. If the bus cycle is a lower memory write, it becomes active at the falling edge of the CLKOUT signal in the T1 state and becomes inactive at the falling edge of the CLKOUT signal in the T2 state. (ii) UWR (Higher byte write strobe) ... Output This is a strobe signal that shows that the bus cycle being executed is a write cycle for SRAM, external ROM, or an external peripheral I/O area. In the data bus, the higher byte is valid. If the bus cycle is a higher memory write, it becomes active at the falling edge of the CLKOUT signal in the T1 state and becomes inactive at the falling edge of the CLKOUT signal in the T2 state. (iii) RD (Read strobe) ... Output This is a strobe signal that shows that the bus cycle being executed is a read cycle for SRAM, external ROM, or external peripheral I/O. It is inactive in the idle state (TI). (iv) ASTB (Address strobe) ... Output This is the external address bus latch strobe signal output pin. Output becomes low level in synchronization with the falling edge of the clock in the T1 state of the bus cycle, and high level in synchronization with the falling edge of the clock in the T3 state.
46
User's Manual U15195EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
(8) PDH0 to PDH5 (Port DH) ... I/O PDH0 to PDH5 function as a 6-bit I/O port in which input or output can be set in 1-bit units. Besides functioning as a port, in control mode (external expansion mode), these pins operate as the address bus (A16 to A21) for when memory is expanded externally. Port or control mode can be selected as the operation mode for each bit, specified by the port DH mode control register (PMCDH). (a) Port mode PDH0 to PDH5 can be set to input or output in 1-bit units using the port DH mode register (PMDH). (b) Control mode PDH0 to PDH5 can be specified as A16 to A21 using PMCDH. (i) A16 to A21 (Address) ... Output These pins output the higher 6-bit address of the 22-bit address in the address bus on an external access. (9) PDL0 to PDL15 (Port DL) ... I/O PDL0 to PDL15 function as a 16-bit I/O port in which input or output can be set in 1-bit units. Besides functioning as a port, in control mode (external expansion mode), these pins operate as the address/data bus (AD0 to AD15) for when memory is expanded externally. Port or control mode can be selected as the operation mode for each bit, specified by the port DL mode control register (PMCDL). (a) Port mode PDL0 to PDL15 can be set to input or output in 1-bit units using the port DL mode register (PMDL). (b) Control mode PDL0 to PDL15 can be specified as AD0 to AD15 using PMCDL. (i) AD0 to AD15 (Address/data bus) ... I/O This is a multiplexed bus for addresses or data on an external access. When used for addresses (T1 state) these pins output A0 to A15 of the 22-bit address, and when used for data (T2, TW, T3) they are 16-bit data I/O bus pins. (10) TO000 to TO005 (Timer output) ... Output These pins output the pulse signal of timer 00. (11) TO010 to TO015 (Timer output) ... Output These pins output the pulse signal of timer 01. (12) ANI00 to ANI05, ANI10 to ANI17 (Analog input) ... Input These pins input analog signals to the A/D converter. (13) CKSEL (Clock generator operating mode select) ... Input This is the input pin that specifies the operation mode of the clock generator. Fix this pin so that the input level does not change during operation.
User's Manual U15195EJ3V0UD
47
CHAPTER 2 PIN FUNCTIONS
(14) MODE0, MODE1 (Mode) ... Input These are the input pins that specify the operation mode. Operation modes are broadly divided into normal operation modes and flash memory programming mode. The normal operation modes are single-chip mode and ROMless mode (see 3.3 Operation Modes for details). The operation mode is determined by sampling the status of each of the MODE0 and MODE1 pins on a reset. Fix these pins so that the input level does not change during operation. (a) PD703114
MODE1 L L Other than above L H Setting prohibited MODE0 Normal operation mode Operation Mode ROMless mode Single-chip mode
(b) PD70F3114
MODE1/VPP L L 7.8 V Other than above L H H Flash memory programming mode Setting prohibited MODE0 Normal operation mode Operation Mode ROMless mode Single-chip mode
Remark
L: Low-level input H: High-level input
(15) RESET (Reset) ... Input RESET input is asynchronous input. When a signal having a certain low level width is input in asynchronous with the operation clock, a system reset that takes precedence over all operations occurs. Besides a normal initialize or start, this signal is also used to release a standby mode (HALT, IDLE, software STOP). (16) X1, X2 (Crystal) These pins connect a resonator for system clock generation. They can also input external clocks. In this case, connect the external clock to the X1 pin and leave the X2 pin open. (17) CVSS (Ground for clock generator) This is the ground pin for the resonator, PLL and regulator. (18) VDD (Power supply) This is the 5 V system positive power supply pin for the peripheral interface. (19) VSS (Ground) This is the 5 V system ground pin for the peripheral interface.
48
User's Manual U15195EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
(20) RVDD (Regulator power supply) This is the positive power supply pin for the regulator. Supply 5 V system power to this pin. (21) VSS3 (Ground) This is the internal 3.3 V system ground pin. (22) REGOUT (Regulator output) ... Output This is the regulator output pin. (23) REGIN (Regulator input) ... Input This is the regulator input pin. Supply 3.3 V system power to this pin. (24) AVDD0, AVDD1 (Analog power supply) These are the analog positive power supply pins for the A/D converter. (25) AVSS0, AVSS1 (Analog ground) These are the ground pins for the A/D converter.
User's Manual U15195EJ3V0UD
49
CHAPTER 2 PIN FUNCTIONS
2.4
Types of Pin I/O Circuits and Connection of Unused Pins
Connection of a 1 to 10 k resistor is recommended when connecting to VDD, VSS, or CVSS via a resistor. (1/2)
Pin P00/NMI P01/ESO0/INTP0 P02/ESO1/INTP1 P03/ADTRG0/INTP2 P04/ADTRG1/INTP3 P05/INTP4/TO3OFF P10/TIUD10/TO10 P11/TCUD10/INTP100 P12/TCLR10/INTP101 P20/TI2/INTP20 P21/TO21/INTP21 to P24/TO24/INTP24 P25/TCLR2/INTP25 P26/TI3/TCLR3/INTP30 P27/TO3/INTP31 P30/RXD0 P31/TXD0 P32/RXD1/SI1 P33/TXD1/SO1 P34/ASCK1/SCK1 P40/SI0 P41/SO0 P42/SCK0 PCM0/WAIT PCM1/CLKOUT PCT0/LWR PCT1/UWR PCT4/RD PCT6/ASTB PDH0/A16 to PDH5/A21 PDL0/AD0 to PDL15/AD15 ANI00 to ANI05 ANI10 to ANI17 TO000 to TO005, TO010 to TO015 4 7 Connect to AVSS0. Connect to AVSS1. Leave open. 5 5-AC 5 5 5-AC 5 5-AC 5-AC Input: Independently connect to VDD or VSS via a resistor. Output: Leave open. I/O Circuit Type 2 Recommended Connection Connect directly to VSS.
50
User's Manual U15195EJ3V0UD
CHAPTER 2 PIN FUNCTIONS
(2/2)
Pin MODE0 VPP
Note
I/O Circuit Type 2
Recommended Connection -
/MODE1
RESET CKSEL X2 AVSS0, AVSS1 AVDD0, AVDD1 REGOUT - - - - Leave open. Connect to VSS. Connect to VDD. Leave open.
Note PD70F3114 only
User's Manual U15195EJ3V0UD
51
CHAPTER 2 PIN FUNCTIONS
2.5
Pin I/O Circuits
Type 2
Type 5-AC VDD Data IN Output disable N-ch P-ch IN/OUT
Schmitt-triggered input with hysteresis characteristics
Input enable
Type 4 VDD Data P-ch
Type 7
P-ch OUT Output disable N-ch IN N-ch
+ _
Comparator
VREF (threshold voltage) Push-pull output with possible high-impedance output (P-ch, N-ch both off)
Type 5 VDD Data P-ch IN/OUT Output disable N-ch
Input enable
52
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
The CPU of the V850E/IA2 is based on RISC architecture and executes almost all instructions in one clock cycle, using 5-stage pipeline control.
3.1
Features
* Minimum instruction execution time: 25 ns (@ internal 40 MHz operation) * Memory space Program space: 64 MB Linear Data space: * Internal 32-bit architecture * Five-stage pipeline control * Multiplication/division instructions * Saturated operation instructions * One-clock 32-bit shift instruction * Load/store instructions in long/short format * Four types of bit manipulation instructions * SET1 * CLR1 * NOT1 * TST1 4 GB Linear
* Thirty-two 32-bit general-purpose registers
User's Manual U15195EJ3V0UD
53
CHAPTER 3 CPU FUNCTION
3.2
CPU Register Set
The registers of the V850E/IA2 can be classified into two categories: a general-purpose program register set and a dedicated system register set. The width of all the registers is 32 bits. For details, refer to V850E1 Architecture User's Manual.
(1) Program register set
31 r0 0
(2) System register set
31 EIPC EIPSW (Status saving register during interrupt) (Status saving register during interrupt) 0
(Zero register) (Assembler-reserved register)
r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31
(Stack pointer (SP)) (Global pointer (GP)) (Text pointer (TP))
FEPC
(Status saving register during NMI)
FEPSW (Status saving register during NMI)
ECR
(Interrupt source register)
PSW
(Program status word)
CTPC
(Status saving register during CALLT execution)
CTPSW (Status saving register during CALLT execution)
DBPC
(Status saving register during exception/debug trap)
DBPSW (Status saving register during exception/debug trap)
CTBP
(CALLT base pointer)
(Element pointer (EP)) (Link pointer (LP))
31
0
PC
(Program counter)
54
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
3.2.1
Program register set
The program register set includes general-purpose registers and a program counter. (1) General-purpose registers Thirty-two general-purpose registers, r0 to r31, are available. Any of these registers can be used as a data variable or address variable. However, r0 and r30 are implicitly used by instructions, and care must be exercised when using these registers. r0 is a register that always holds 0, and is used for operations using 0 and offset 0 addressing. r30 is used, by means of the SLD and SST instructions, as a base pointer for when memory is accessed. Also, r1, r3 to r5, and r31 are implicitly used by the assembler and C compiler. Therefore, before using these registers, their contents must be saved so that they are not lost. The contents must be restored to these registers after they have been used. r2 is sometimes used by a real-time OS. r2 can be used as a register for variables when it is not being used by the real-time OS. Table 3-1. Program Registers
Name r0 r1 r2 r3 r4 r5 Usage Zero register Assembler-reserved register Always holds 0 Working register for generating address Operation
Address/data variable register (when not being used by the real-time OS) Stack pointer Global pointer Text pointer Used to generate stack frame when function is called Used to access global variable in data area Register to indicate the start of the text area (where program code is located)
r6 to r29 r30
Address/data variable registers Element pointer Base pointer for generating address when memory is accessed Used by compiler when calling function Holds instruction address during program execution
r31 PC
Link pointer Program counter
Remark
For detailed descriptions of r1, r3 to r5, and r31, which are used by the assembler and C compiler, refer to CA850 (C Compiler Package) Assembly Language User's Manual (U10543E).
(2) Program counter (PC) This register holds the instruction address during program execution. The lower 26 bits of this register are valid, and bits 31 to 26 are fixed to 0. If a carry occurs from bit 25 to 26, it is ignored. Bit 0 is fixed to 0, and branching to an odd address cannot be performed.
31 PC Fixed to 0
26 25 Instruction address during execution
10 0 After reset 00000000H
User's Manual U15195EJ3V0UD
55
CHAPTER 3 CPU FUNCTION
3.2.2
System register set
System registers control the status of the CPU and hold interrupt information. To read/write these system registers, specify a system register number indicated below using the system register load/store instruction (LDSR or STSR instruction). Table 3-2. System Register Numbers
No. System Register Name Status saving register during interrupt (EIPC)Note 1 Status saving register during interrupt (EIPSW) Status saving register during NMI (FEPC) Status saving register during NMI (FEPSW) Interrupt source register (ECR) Program status word (PSW) Reserved number for future function expansion (operations that access these register numbers cannot be guaranteed). Status saving register during CALLT execution (CTPC) Status saving register during CALLT execution (CTPSW) Status saving register during exception/debug trap (DBPC) Status saving register during exception/debug trap (DBPSW) CALLT base pointer (CTBP) Reserved number for future function expansion (operations that access these register numbers cannot be guaranteed). x x
Note 2 Note 2
Operand Specification LDSR Instruction STSR Instruction
0 1 2 3 4 5 6 to 15 16 17 18 19 20 21 to 31
x x x
Notes 1. 2. Caution
Because this register has only one set, to allow multiple interrupts, it is necessary to save this register by program. Access is only possible when the DBTRAP instruction is executed. Even if bit 0 of EIPC, FEPC, or CTPC is set to 1 with the LDSR instruction, bit 0 will be ignored when the program is returned by the RETI instruction after interrupt servicing (because bit 0 of the PC is fixed to 0). When setting the value of EIPC, FEPC, or CTPC, use an even value (bit 0 = 0).
Remark
: Access allowed x: Access prohibited
(1) Interrupt source register (ECR)
31 ECR FECC
16 15 EICC
0 After reset 00000000H
Bit position 31 to 16 15 to 0
Bit name FECC EICC
Function Exception code of non-maskable interrupt (NMI) Exception code of exception/maskable interrupt
56
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
(2) Program status word (PSW)
31 PSW RFU
876543210 NP EP ID SAT CY OV S Z After reset 00000020H
Bit position 31 to 8 7
Flag RFU NP Reserved field (fixed to 0).
Function
Indicates that non-maskable interrupt (NMI) servicing is in progress. This flag is set when an NMI is acknowledged, and disables multiple interrupts. 0: NMI servicing not under execution. 1: NMI servicing under execution. Indicates that exception processing is in progress. This flag is set when an exception is generated. Moreover, interrupt requests can be acknowledged when this bit is set. 0: Exception processing not under execution. 1: Exception processing under execution. Displays whether a maskable interrupt request can be acknowledged or not. 0: Interrupt enabled (EI). 1: Interrupt disabled (DI). Displays that the operation result of a saturated operation processing instruction is saturated due to overflow. Due to the cumulative flag, if the operation result is saturated by the saturation operation instruction, this bit is set (1), but is not cleared (0) even if the operation results of subsequent instructions are not saturated. To clear (0) this bit, load the data in PSW. Note that in a general arithmetic operation, this bit is neither set (1) nor cleared (0). 0: Not saturated. 1: Saturated. This flag is set if a carry or borrow occurs as result of an operation (if a carry or borrow does not occur, it is reset). 0: Carry or borrow does not occur. 1: Carry or borrow occurs. This flag is set if an overflow occurs during operation (if an overflow does not occur, it is reset). 0: Overflow does not occur. 1: Overflow occurs. This flag is set if the result of an operation is negative (it is reset if the result is positive). 0: The operation result was positive or 0. 1: The operation result was negative. This flag is set if the result of an operation is zero (if the result is not zero, it is reset). 0: The operation result was not 0. 1: The operation result was 0.
6
EP
5
ID
4
SATNote
3
CY
2
OVNote
1
SNote
0
Z
Note The result of a saturation-processed operation is determined by the contents of the OV and S flags during the saturation operation. Simply setting the OV flag (1) will set the SAT flag (1) in a saturation operation.
Status of operation result S Maximum positive value exceeded Maximum negative value exceeded Positive (not exceeding the maximum) Negative (not exceed the maximum) 1 1
Retain the value before operation
Flag status OV 1 1 0 0 1 0 1 SAT
Saturation-processed operation result 7FFFFFFFH 80000000H Operation result itself
User's Manual U15195EJ3V0UD
57
CHAPTER 3 CPU FUNCTION
3.3
3.3.1 pins.
Operation Modes
Operation modes
The V850E/IA2 has the following operation modes. Mode specification is carried out by the MODE0 and MODE1
(1) Normal operation mode (a) Single-chip mode Access to the internal ROM is enabled. In single-chip mode, after the system reset is cleared, each pin related to the bus interface enters the port mode, program execution branches to the reset entry address of the internal ROM, and instruction processing starts. By setting the PMCDH, PMCDL, PMCCT, and PMCCM registers to control mode by instruction, an external device can be connected to the external memory area. (b) ROMless mode After the system reset is cleared, each pin related to the bus interface enters the control mode, program execution branches to the external device's (memory) reset entry address, and instruction processing starts. Fetching of instructions and data access for internal ROM becomes impossible. In ROMless mode, the data bus is a 16-bit data bus. (2) Flash memory programming mode (PD70F3114 only) If this mode is specified, it becomes possible for the flash programmer to run a program to the internal flash memory. The initial values of the registers differ depending on the mode.
Operation Mode Normal operation mode ROMless mode Single-chip mode PMCDH FFH 00H PMCDL FFFFH 0000H PMCCT 53H 00H PMCCM 03H 00H BSC 5555H 5555H
58
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
3.3.2
Operation mode specification
The operation mode is specified according to the status of the MODE0 and MODE1 pins. In an application system, fix the specification of these pins and do not change them during operation. Operation is not guaranteed if these pins are changed during operation. (a) PD703114
MODE1 L L MODE0 L H Operation Mode Normal operation mode ROMless mode Single-chip mode Remark 16-bit data bus Internal ROM area is allocated from address 000000H.
Other than above
Setting prohibited
(b) PD70F3114
MODE1/VPP L L MODE0 L H Operation Mode Normal operation mode ROMless mode Single-chip mode Remark 16-bit data bus Internal ROM area is allocated from address 000000H. -
7.8 V Other than above
H
Flash memory programming mode Setting prohibited
Remarks L: H:
Low-level input High-level input
User's Manual U15195EJ3V0UD
59
CHAPTER 3 CPU FUNCTION
3.4
3.4.1
Address Space
CPU address space
The V850E1 CPU of the V850E/IA2 is of 32-bit architecture and supports up to 4 GB of linear address space (data space) during operand addressing (data access). Also, in instruction address addressing, a maximum of 64 MB of linear address space (program space) is supported. Figure 3-1 shows the CPU address space. Figure 3-1. CPU Address Space
CPU address space FFFFFFFFH
Data area (4 GB linear)
04000000H 03FFFFFFH Program area (64 MB linear)
00000000H
60
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
3.4.2
Image
16 images, each containing a 256 MB physical address space, are seen in the 4 GB CPU address space. In actuality, the same 256 MB physical address space is accessed regardless of the values of bits 31 to 28 of the CPU address. Figure 3-2 shows the image of the virtual addressing space. Physical address x0000000H can be seen as CPU address 00000000H, and in addition, can be seen as address 10000000H, address 20000000H, ... , address E0000000H, or address F0000000H. Figure 3-2. Image on Address Space
CPU address space FFFFFFFFH
Image
F0000000H EFFFFFFFH
Image Physical address space E0000000H DFFFFFFFH Image External memory 20000000H 1FFFFFFFH Internal ROM On-chip peripheral I/O Internal RAM FFFFFFFH
0000000H
Image
10000000H 0FFFFFFFH
Image
00000000H
User's Manual U15195EJ3V0UD
61
CHAPTER 3 CPU FUNCTION
3.4.3
Wrap-around of CPU address space
(1) Program space Of the 32 bits of the PC (program counter), the higher 6 bits are fixed to 0, and only the lower 26 bits are valid. Even if a carry or borrow occurs from bit 25 to 26 as a result of branch address calculation, the higher 6 bits ignore the carry or borrow. Therefore, the lower-limit address of the program space, address 00000000H, and the upper-limit address 03FFFFFFH become contiguous addresses. Wrap-around refers to a situation like this whereby the lowerlimit address and upper-limit address become contiguous. Caution Access to the 4 KB area of addresses 03FFF000H to 03FFFFFFH is prohibited. Operation is not guaranteed if this area is accessed.
03FFFFFEH 03FFFFFFH
Program space
(+) direction 00000000H 00000001H Program space
( ) direction
(2) Data space The result of an operand address calculation that exceeds 32 bits is ignored. Therefore, the lower-limit address of the program space, address 00000000H, and the upper-limit address FFFFFFFFH are contiguous addresses, and the data space is wrapped around at the boundary of these addresses.
FFFFFFFEH FFFFFFFFH
Data space
(+) direction 00000000H 00000001H Data space
( ) direction
62
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
3.4.4
Memory map
The V850E/IA2 reserves areas as shown in Figure 3-3. Each mode is specified by the MODE0 and MODE1 pins. Figure 3-3. Memory Map
Single-chip mode xFFFFFFFH On-chip peripheral I/O area xFFFF000H xFFFEFFFH
ROMless mode
On-chip peripheral I/O area
4 KB
xFFFD800H xFFFD7FFH
Internal RAM area
Internal RAM area
6 KB
xFFFC000H xFFFBFFFH
256 MB
x0400000H x03FFFFFH Access prohibitedNote
4 MB
x0200000H x01FFFFFH
External memory area of V850E/IA2 1 MB
x0100000H x00FFFFFH Internal ROM area x0000000H 1 MB
Note By setting the PMCDH, PMCDL, PMCCT, and PMCCM registers to control mode, this area can be used as external memory area.
User's Manual U15195EJ3V0UD
63
CHAPTER 3 CPU FUNCTION
3.4.5
Area
(1) Internal ROM/internal flash memory area (a) Memory map 1 MB of internal ROM/internal flash memory area, addresses 00000H to FFFFFH, is reserved. Actually, internal ROM/internal flash memory of 128 KB is mapped to addresses 000000H to 01FFFFH. Addresses 020000H to 0FFFFFH are undefined. Figure 3-4. Internal ROM/Internal Flash Memory Area
0FFFFFH
Undefined
020000H 01FFFFH Internal ROM/ internal flash memory area
000000H
64
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
(b) Interrupt/exception table The V850E/IA2 increases the interrupt response speed by assigning handler addresses corresponding to interrupts/exceptions. The collection of these handler addresses is called an interrupt/exception table, which is located in the internal ROM area. When an interrupt/exception request is acknowledged, execution jumps to the handler address, and the program written at that memory location is executed. Table 3-3 shows the sources of interrupts/exceptions, and the corresponding addresses. Remark When in ROMless mode, in order to resume correct operation after reset, provide a handler address to the reset routine at address 0 of the external memory. Table 3-3. Interrupt/Exception Table
Start Address of Interrupt/Exception Table 00000000H 00000010H 00000040H 00000050H 00000060H 00000080H 00000090H 000000A0H 000000B0H 000000C0H 000000F0H 00000100H 00000110H 00000120H 00000130H 00000140H 00000150H 00000160H 00000170H 00000180H 000001D0H 000001E0H 000001F0H 00000200H 00000210H 00000220H Interrupt/Exception Source Start Address of Interrupt/Exception Table 00000230H 00000240H 00000250H 00000260H 00000270H 00000280H 00000290H 000002A0H 000002B0H 000002C0H 00000310H 00000320H 00000330H 00000340H 00000350H 00000360H 00000370H 000003A0H 000003B0H 000003F0H 00000400H 00000410H 00000420H 00000430H 00000440H 00000450H Interrupt/Exception Source
RESET NMI0 TRAP0n (n = 0 to F) TRAP1n (n = 0 to F) ILGOP/DBG0 INTP0 INTP1 INTP2 INTP3 INTP4 INTDET0 INTDET1 INTTM00 INTCM003 INTTM01 INTCM013 INTP100/INTCC100 INTP101/INTCC101 INTCM100 INTCM101 INTTM20 INTTM21 INTP20/INTCC20 INTP21/INTCC21 INTP22/INTCC22 INTP23/INTCC23
INTP24/INTCC24 INTP25/INTCC25 INTTM3 INTP30/INTCC30 INTP31/INTCC31 INTCM4 INTDMA0 INTDMA1 INTDMA2 INTDMA3 INTCSI0 INTCSI1 INTSR0 INTST0 INTSER0 INTSR1 INTST1 INTAD0 INTAD1 INTCM010 INTCM011 INTCM012 INTCM014 INTCM015 INTCM004 INTCM005
User's Manual U15195EJ3V0UD
65
CHAPTER 3 CPU FUNCTION
(2) Internal RAM area 12 KB of memory, addresses FFFC000H to FFFEFFFH, are reserved for the internal RAM area. The 12 KB area of 3FFC000H to 3FFEFFFH can be seen as an image of FFFC000H to FFFEFFFH. In the V850E/IA2, 6 KB of memory, addresses FFFC000H to FFFD7FFH, are provided as physical internal RAM. Access to the area of addresses FFFD800H to FFFEFFFH is prohibited.
FFFEFFFH Access prohibited
FFFD800H FFFD7FFH
Internal RAM area (6 KB)
FFFC000H
66
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
(3) On-chip peripheral I/O area 4 KB of memory, addresses FFFF000H to FFFFFFFH, are provided as an on-chip peripheral I/O area. An image of addresses FFFF000H to FFFFFFFH can be seen in the area between addresses 3FFF000H and 3FFFFFFH
Note
. To access the on-chip
Note Access to the area of addresses 3FFF000H to 3FFFFFFH is prohibited. peripheral I/O, specify addresses FFFF000H to FFFFFFFH.
FFFFFFFH
On-chip peripheral I/O area (4 KB) FFFF000H
On-chip peripheral I/O registers associated with the operation mode specification and the state monitoring for the on-chip peripheral I/O are all memory-mapped to the on-chip peripheral I/O area. cannot be executed from this area. Cautions 1. The least significant bit of an address is not decoded. Therefore, if byte access is executed in the register at an odd address (2n + 1), the register at the even address (2n) will be accessed because of the hardware specification. 2. In the V850E/IA2, no registers exist that are capable of word access, but if a register is word accessed, halfword access is performed twice in the order of lower address, then higher address of the word area, ignoring the lower 2 bits of the address. 3. For registers in which byte access is possible, if halfword access is executed, the higher 8 bits become undefined during the read operation, and the lower 8 bits of data are written to the register during the write operation. 4. 5. Addresses that are not defined as registers are reserved for future expansion. If these addresses are accessed, the operation is undefined and not guaranteed. Addresses 3FFF000H to 3FFFFFFH cannot be specified as the source/destination address of DMA transfer. Be sure to use addresses FFFF000H to FFFFFFFH for the source/destination address of DMA transfer. (4) External memory area 4 MB are available for external memory area. * Single-chip mode: x100000H to x3FFFFFH * ROMless mode: x000000H to x3FFFFFH Program fetches
Note that the internal ROM, internal RAM, and on-chip peripheral I/O areas cannot be accessed as external memory areas.
User's Manual U15195EJ3V0UD
67
CHAPTER 3 CPU FUNCTION
3.4.6
External memory expansion
By setting the port n mode control register (PMCn) to control mode, an external device can be connected to the external memory space using each pin of ports DH, DL, CT, and CM. Each register is set by selecting control mode for each pin of these ports using PMCn (n = DH, DL, CT, CM). Note that the status after reset differs as shown below in accordance with the operating mode specification set by the MODE0 and MODE1 pins (refer to 3.3 Operation Modes for details of the operation modes). (a) In the case of ROMless mode Because each pin of ports DH, DL, CT, and CM enters control mode following a reset, external memory can be used without making changes to the port n mode control register (PMCn) (the external data bus width is 16 bits). (b) In the case of single-chip mode Since the internal ROM area is accessed after a reset, each pin of ports DH, DL, CT, and CM enters the port mode, and external devices cannot be used. To use external memory, set the port n mode control register (PMCn). Remark n = DH, DL, CT, CM
68
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
3.4.7
Recommended use of address space
The architecture of the V850E/IA2 requires that a register that serves as a pointer be secured for address generation when accessing operand data in the data space. Operand data access from instruction can be directly executed at the address in this pointer register 32 KB. However, because there is a limit to which general-purpose registers are used as a pointer register, by minimizing the deterioration of address calculation performance when changing the pointer value, the number of usable general-purpose registers for handling variables is maximized, and the program size can be saved. To enhance the efficiency of using the pointer in connection with of the memory map of the V850E/IA2, the following points are recommended. (1) Program space Of the 32 bits of the program counter (PC), the higher 6 bits are fixed to 0, and only the lower 26 bits are valid. Therefore, a contiguous 64 MB space, starting from address 00000000H, unconditionally corresponds to the memory map of the program space. (2) Data space For the efficient use of resources that make use of the wrap-around feature of the data space, the continuous 16 MB address spaces 00000000H to 00FFFFFFH and FF000000H to FFFFFFFFH of the 4 GB CPU are used as the data space. With the V850E/IA2, a 256 MB physical address space is seen as 16 images in the 4 GB CPU address space. The highest bit (bit 25) of this 26-bit address is assigned as address signextended to 32 bits. Example Application of wrap-around
0001FFFFH 00007FFFH
Internal ROM area (R =) 00000000H FFFFF000H FFFFEFFFH On-chip peripheral I/O area
32 KB
4 KB
FFFFD800H FFFFD7FFH FFFFC000H FFFFBFFFH FFFF8000H
Internal RAM area
6 KB
16 KB
When R = r0 (zero register) is specified with the LD/ST disp16 [R] instruction, an addressing range of 00000000H 32 KB can be referenced by the sign-extended disp 16. By mapping the external memory in the 16 KB area in the figure, all resources including internal hardware can be accessed with one pointer. The zero register (r0) is a register set to 0 by the hardware, and eliminates the need for additional registers for the pointer.
User's Manual U15195EJ3V0UD
69
CHAPTER 3 CPU FUNCTION
Figure 3-5. Recommended Memory Map
Program space FFFFFFFFH FFFFFA78H FFFFFA77H FFFFF000H FFFFEFFFH
Data space On-chip peripheral I/O
Internal RAM FFFFD800H FFFFD7FFH FFFFC000H FFFFBFFFH On-chip peripheral I/O xFFFFFFFH xFFFFA78H xFFFFA77H xFFFF000H xFFFEFFFH Internal RAM xFFFD800H xFFFD7FFH xFFFC000H xFFFBFFFH On-chip peripheral I/ONote Internal RAM
04000000H 03FFFFFFH 03FFF000H 03FFEFFFH 03FFD800H 03FFC7FFH 03FFC000H 03FFBFFFH
x0400000H x03FFFFFH External memory of V850E/IA2 x0100000H x00FFFFFH Internal ROM External memory of V850E/IA2 External memory of V850E/IA2 x0020000H x001FFFFH x0000000H
Program space 64 MB 00400000H 003FFFFFH
00100000H 000FFFFFH Internal ROM 00020000H 0001FFFFH 00000000H Internal ROM
Note Access to this area is prohibited. To access the on-chip peripheral I/O, specify addresses FFFF000H to FFFFFFFH. Remarks 1. The arrows indicate the recommended area. 2. This is a recommended memory map when the V850E/IA2 is set to single-chip mode, and used in external expansion mode.
70
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
3.4.8
On-chip peripheral I/O registers (1/10)
Address Function Register Name Symbol R/W Bit Units for Manipulation 1 Bit 8 Bits 16 Bits Undefined Undefined Undefined Undefined Undefined Undefined FFFFH FFH FFH FFH FFH FFH 0000H/FFFFH 00H/FFH 00H/FFH 00H/FFH 00H/53H 00H/03H 2C11H 2C11H 5555H 77H Undefined Undefined Undefined Undefined Undefined Undefined Undefined Undefined Undefined Undefined Undefined Undefined Undefined Undefined Undefined After Reset
FFFFF004H
Port DL
PDL PDLL PDLH PDH PCT PCM PMDL PMDLL PMDLH PMDH PMCT PMCM PMCDL PMCDLL PMCDLH PMCDH PMCCT PMCCM CSC0 CSC1 BSC VSWC DSA0L DSA0H DDA0L DDA0H DSA1L DSA1H DDA1L DDA1H DSA2L DSA2H DDA2L DDA2H DSA3L DSA3H DDA3L
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
FFFFF004H Port DLL FFFFF005H Port DLH FFFFF006H FFFFF00AH FFFFF00CH FFFFF024H Port DH Port CT Port CM Port DL mode register
FFFFF024H Port DL mode register L FFFFF025H Port DL mode register H FFFFF026H FFFFF02AH FFFFF02CH FFFFF044H Port DH mode register Port CT mode register Port CM mode register Port DL mode control register
FFFFF044H Port DL mode control register L FFFFF045H Port DL mode control register H FFFFF046H FFFFF04AH FFFFF04CH FFFFF060H FFFFF062H FFFFF066H FFFFF06EH FFFFF080H FFFFF082H FFFFF084H FFFFF086H FFFFF088H FFFFF08AH FFFFF08CH FFFFF08EH FFFFF090H FFFFF092H FFFFF094H FFFFF096H FFFFF098H FFFFF09AH FFFFF09CH Port DH mode control register Port CT mode control register Port CM mode control register Chip area select control register 0 Chip area select control register 1 Bus size configuration register System wait control register DMA source address register 0L DMA source address register 0H DMA destination address register 0L DMA destination address register 0H DMA source address register 1L DMA source address register 1H DMA destination address register 1L DMA destination address register 1H DMA source address register 2L DMA source address register 2H DMA destination address register 2L DMA destination address register 2H DMA source address register 3L DMA source address register 3H DMA destination address register 3L
User's Manual U15195EJ3V0UD
71
CHAPTER 3 CPU FUNCTION
(2/10)
Address Function Register Name Symbol R/W Bit Units for Manipulation 1 Bit FFFFF09EH FFFFF0C0H FFFFF0C2H FFFFF0C4H FFFFF0C6H FFFFF0D0H FFFFF0D2H FFFFF0D4H FFFFF0D6H FFFFF0E0H FFFFF0E2H FFFFF0E4H FFFFF0E6H FFFFF0F0H FFFFF0F2H FFFFF100H DMA destination address register 3H DMA transfer count register 0 DMA transfer count register 1 DMA transfer count register 2 DMA transfer count register 3 DMA addressing control register 0 DMA addressing control register 1 DMA addressing control register 2 DMA addressing control register 3 DMA channel control register 0 DMA channel control register 1 DMA channel control register 2 DMA channel control register 3 DMA disable status register DMA restart register Interrupt mask register 0 DDA3H DBC0 DBC1 DBC2 DBC3 DADC0 DADC1 DADC2 DADC3 DCHC0 DCHC1 DCHC2 DCHC3 DDIS DRST IMR0 IMR0L IMR0H IMR1 IMR1L IMR1H IMR2 IMR2L IMR2H IMR3 IMR3L IMR3H P0IC0 P0IC1 P0IC2 P0IC3 P0IC4 DETIC0 DETIC1 TM0IC0 CM03IC0 TM0IC1 CM03IC1 R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W 8 Bits 16 Bits Undefined Undefined Undefined Undefined Undefined 0000H 0000H 0000H 0000H 00H 00H 00H 00H 00H 00H FFFFH FFH FFH FFFFH FFH FFH FFFFH FFH FFH FFFFH FFH FFH 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H After Reset
FFFFF100H Interrupt mask register 0L FFFFF101H Interrupt mask register 0H FFFFF102H Interrupt mask register 1
FFFFF102H Interrupt mask register 1L FFFFF103H Interrupt mask register 1H FFFFF104H Interrupt mask register 2
FFFFF104H Interrupt mask register 2L FFFFF105H Interrupt mask register 2H FFFFF106H Interrupt mask register 3
FFFFF106H Interrupt mask register 3L FFFFF107H Interrupt mask register 3H FFFFF110H FFFFF112H FFFFF114H FFFFF116H FFFFF118H FFFFF11EH FFFFF120H FFFFF122H FFFFF124H FFFFF126H FFFFF128H Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register
72
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
(3/10)
Address Function Register Name Symbol R/W Bit Units for Manipulation 1 Bit FFFFF12AH FFFFF12CH FFFFF12EH FFFFF130H FFFFF13AH FFFFF13CH FFFFF13EH FFFFF140H FFFFF142H FFFFF144H FFFFF146H FFFFF148H FFFFF14AH FFFFF14CH FFFFF14EH FFFFF150H FFFFF152H FFFFF154H FFFFF156H FFFFF158H FFFFF162H FFFFF164H FFFFF166H FFFFF168H FFFFF16AH FFFFF16CH FFFFF16EH FFFFF174H FFFFF176H FFFFF17EH FFFFF180H FFFFF182H FFFFF184H FFFFF186H FFFFF188H FFFFF18AH FFFFF1FAH FFFFF1FCH Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register In-service priority register Command register CC10IC0 CC10IC1 CM10IC0 CM10IC1 TM2IC0 TM2IC1 CC2IC0 CC2IC1 CC2IC2 CC2IC3 CC2IC4 CC2IC5 TM3IC0 CC3IC0 CC3IC1 CM4IC0 DMAIC0 DMAIC1 DMAIC2 DMAIC3 CSIIC0 CSIIC1 SRIC0 STIC0 SEIC0 SRIC1 STIC1 ADIC0 ADIC1 CM00IC1 CM01IC1 CM02IC1 CM04IC1 CM05IC1 CM04IC0 CM05IC0 ISPR PRCMD
User's Manual U15195EJ3V0UD
After Reset
8 Bits
16 Bits 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 47H 00H Undefined
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R W

73
CHAPTER 3 CPU FUNCTION
(4/10)
Address Function Register Name Symbol R/W Bit Units for Manipulation 1 Bit FFFFF1FEH FFFFF200H Power-saving control register A/D scan mode register 00 PSC ADSCM00
ADSCM00L ADSCM00H
After Reset
8 Bits
16 Bits 00H 0000H 00H 00H 0000H 00H 00H 0000H 00H 00H 0000H 0000H 0000H 0000H 0000H 0000H 0000H 00H 00H 0000H 00H 00H 0000H 00H 00H 0000H 0000H 0000H 0000H 0000H 0000H 0000H 0000H 00H 00H 00H Undefined Undefined
R/W R/W R/W R/W R/W R R/W R/W R/W R/W R R R R R R R/W R/W R/W R/W R R/W R/W R/W R/W R R R R R R R R R/W R/W R/W R R/W
FFFFF200H A/D scan mode register 00L FFFFF201H A/D scan mode register 00H FFFFF202H A/D scan mode register 01


ADSCM01
ADSCM01L ADSCM01H
FFFFF202H A/D scan mode register 01L FFFFF203H A/D scan mode register 01H FFFFF204H A/D voltage detection mode register 0

ADETM0 ADETM0L ADETM0H ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05 ADSCM10
ADSCM10L ADSCM10H
FFFFF204H A/D voltage detection mode register 0L FFFFF205H A/D voltage detection mode register 0H FFFFF210H FFFFF212H FFFFF214H FFFFF216H FFFFF218H FFFFF21AH FFFFF240H A/D conversion result register 00 A/D conversion result register 01 A/D conversion result register 02 A/D conversion result register 03 A/D conversion result register 04 A/D conversion result register 05 A/D scan mode register 10


FFFFF240H A/D scan mode register 10L FFFFF241H A/D scan mode register 10H FFFFF242H A/D scan mode register 11


ADSCM11
ADSCM11L ADSCM11H
FFFFF242H A/D scan mode register 11L FFFFF243H A/D scan mode register 11H FFFFF244H A/D voltage detection mode register 1

ADETM1 ADETM1L ADETM1H ADCR10 ADCR11 ADCR12 ADCR13 ADCR14 ADCR15 ADCR16 ADCR17 ITRG0 ITRG1 REGC P0 P1
FFFFF244H A/D voltage detection mode register 1L FFFFF245H A/D voltage detection mode register 1H FFFFF250H FFFFF252H FFFFF254H FFFFF256H FFFFF258H FFFFF25AH FFFFF25CH FFFFF25EH FFFFF280H FFFFF288H FFFFF300H FFFFF400H FFFFF402H A/D conversion result register 10 A/D conversion result register 11 A/D conversion result register 12 A/D conversion result register 13 A/D conversion result register 14 A/D conversion result register 15 A/D conversion result register 16 A/D conversion result register 17 A/D internal trigger select register 0 A/D internal trigger select register 1 Regulator control register Port 0 Port 1




74
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
(5/10)
Address Function Register Name Symbol R/W Bit Units for Manipulation 1 Bit FFFFF404H FFFFF406H FFFFF408H FFFFF422H FFFFF424H FFFFF426H FFFFF428H FFFFF442H FFFFF444H FFFFF446H FFFFF448H FFFFF462H FFFFF464H FFFFF466H FFFFF480H FFFFF482H FFFFF484H FFFFF486H FFFFF488H FFFFF48AH FFFFF540H FFFFF542H FFFFF544H FFFFF570H FFFFF572H FFFFF574H FFFFF576H FFFFF578H FFFFF57AH Port 2 Port 3 Port 4 Port 1 mode register Port 2 mode register Port 3 mode register Port 4 mode register Port 1 mode control register Port 2 mode control register Port 3 mode control register Port 4 mode control register Port 1 function control register Port 2 function control register Port 3 function control register Bus cycle type configuration register 0 Bus cycle type configuration register 1 Data wait control register 0 Data wait control register 1 Address wait control register Bus cycle control register Timer 4 Compare register 4 Timer control register 4 Dead time timer reload register 0 Buffer register CM00 Buffer register CM01 Buffer register CM02 Buffer register CM03 Timer control register 00 P2 P3 P4 PM1 PM2 PM3 PM4 PMC1 PMC2 PMC3 PMC4 PFC1 PFC2 PFC3 BCT0 BCT1 DWC0 DWC1 AWC BCC TM4 CM4 TMC4 DTRR0 BFCM00 BFCM01 BFCM02 BFCM03 TMC00 TMC00L TMC00H TUC00 TOMR0 PSTO0 POER0 SPEC0 BFCM04 R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W 8 Bits 16 Bits Undefined Undefined Undefined FFH FFH FFH FFH 00H 00H 00H 00H 00H 00H 00H CCCCH CCCCH 3333H 3333H 0000H AAAAH 0000H 0000H 00H 0FFFH FFFFH FFFFH FFFFH FFFFH 0508H 08H 05H 01H 00H 00H 00H 0000H FFFFH After Reset
FFFFF57AH Timer control register 00L FFFFF57BH Timer control register 00H FFFFF57CH FFFFF57DH FFFFF57EH FFFFF57FH FFFFF580H FFFFF59CH Timer unit control register 00 Timer output mode register 0 PWM software timing output register 0 PWM output enable register 0 TOMR write enable register 0 Buffer register CM04
User's Manual U15195EJ3V0UD
75
CHAPTER 3 CPU FUNCTION
(6/10)
Address Function Register Name Symbol R/W Bit Units for Manipulation 1 Bit FFFFF59EH FFFFF5B0H FFFFF5B2H FFFFF5B4H FFFFF5B6H FFFFF5B8H FFFFF5BAH Buffer register CM05 Dead time timer reload register 1 Buffer register CM10 Buffer register CM11 Buffer register CM12 Buffer register CM13 Timer control register 01 BFCM05 DTRR1 BFCM10 BFCM11 BFCM12 BFCM13 TMC01 TMC01L TMC01H TUC01 TOMR1 PSTO1 POER1 SPEC1 PRM01 PRM02 BFCM14 BFCM15 TM10 CM100 CM101 CC100 CC101 CCR0 TUM0 TMC10 SESA10 PRM10 STATUS0 CSL10 R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R R/W R/W R/W R/W R/W R/W R/W R/W 8 Bits 16 Bits FFFFH 0FFFH FFFFH FFFFH FFFFH FFFFH 0508H 08H 05H 01H 00H 00H 00H 0000H 00H 00H FFFFH FFFFH 0000H 0000H 0000H 0000H 0000H 00H 00H 00H 00H 07H 00H 00H 00H 00H 00H 00H 00H 00H 00H After Reset
FFFFF5BAH Timer control register 01L FFFFF5BBH Timer control register 01H FFFFF5BCH FFFFF5BDH FFFFF5BEH FFFFF5BFH FFFFF5C0H FFFFF5D0H FFFFF5D8H FFFFF5DCH FFFFF5DEH FFFFF5E0H FFFFF5E2H FFFFF5E4H FFFFF5E6H FFFFF5E8H FFFFF5EAH FFFFF5EBH FFFFF5ECH FFFFF5EDH FFFFF5EEH FFFFF5EFH FFFFF5F6H FFFFF5F8H FFFFF620H FFFFF630H FFFFF631H FFFFF632H FFFFF633H FFFFF634H Timer unit control register 01 Timer output mode register 1 PWM software timing output register 1 PWM output enable register 1 TOMR write enable register 1 Timer 0 clock select register Timer 1/Timer 2 clock select register Buffer register CM14 Buffer register CM15 Timer 10 Compare register 100 Compare register 101 Capture/compare register 100 Capture/compare register 101 Capture/compare control register 0 Timer unit mode register 0 Timer control register 10 Signal edge select register 10 Prescaler mode register 10 Status register 0 CC101 capture input select register
Timer 10 noise elimination time select register NRC10 Timer connection select register 0 Timer 2 input filter mode register 0 Timer 2 input filter mode register 1 Timer 2 input filter mode register 2 Timer 2 input filter mode register 3 Timer 2 input filter mode register 4 TMIC0 FEM0 FEM1 FEM2 FEM3 FEM4
76
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
(7/10)
Address Function Register Name Symbol R/W Bit Units for Manipulation 1 Bit FFFFF635H FFFFF640H Timer 2 input filter mode register 5 Timer 2 clock stop register 0 FEM5 STOPTE0 STOPTE0L R/W R/W R 8 Bits 16 Bits 00H 0000H 00H 00H 0000H After Reset
FFFFF640H Timer 2 clock stop register 0L FFFFF641H Timer 2 clock stop register 0H FFFFF642H Timer 2 count clock/control edge select register 0
STOPTE0H R/W CSE0 R/W
FFFFF642H Timer 2 count clock/control edge select register 0L FFFFF643H Timer 2 count clock/control edge select register 0H FFFFF644H Timer 2 subchannel input event edge select register 0
CSE0L
R/W
00H
CSE0H
R/W
00H
SESE0
R/W
0000H
FFFFF644H Timer 2 subchannel input event edge select register 0L FFFFF645H Timer 2 subchannel input event edge select register 0H FFFFF646H Timer 2 time base control register 0
SESE0L
R/W
00H
SESE0H
R/W
00H
TCRE0 TCRE0L TCRE0H OCTLE0 OCTLE0L OCTLE0H CMSE050
R/W R/W R/W R/W R/W R/W R/W
0000H 00H 00H 0000H 00H 00H 0000H
FFFFF646H Timer 2 time base control register 0L FFFFF647H Timer 2 time base control register 0H FFFFF648H Timer 2 output control register 0
FFFFF648H Timer 2 output control register 0L FFFFF649H Timer 2 output control register 0H FFFFF64AH Timer 2 subchannel 0, 5 capture/compare control register Timer 2 subchannel 1, 2 capture/compare control register Timer 2 subchannel 3, 4 capture/compare control register Timer 2 subchannel 1 sub capture/compare register Timer 2 subchannel 1 main capture/compare register Timer 2 subchannel 2 sub capture/compare register Timer 2 subchannel 2 main capture/compare register Timer 2 subchannel 3 sub capture/compare register Timer 2 subchannel 3 main capture/compare register Timer 2 subchannel 4 sub capture/compare register
FFFFF64CH
CMSE120
R/W
0000H
FFFFF64EH
CMSE340
R/W
0000H
FFFFF650H
CVSE10
R/W
0000H
FFFFF652H
CVPE10
R
0000H
FFFFF654H
CVSE20
R/W
0000H
FFFFF656H
CVPE20
R
0000H
FFFFF658H
CVSE30
R/W
0000H
FFFFF65AH
CVPE30
R
0000H
FFFFF65CH
CVSE40
R/W
0000H
User's Manual U15195EJ3V0UD
77
CHAPTER 3 CPU FUNCTION
(8/10)
Address Function Register Name Symbol R/W Bit Units for Manipulation 1 Bit FFFFF65EH Timer 2 subchannel 4 main capture/compare register Timer 2 subchannel 0 capture/compare register Timer 2 subchannel 5 capture/compare register Timer 2 time base status register 0 CVPE40 R 8 Bits 16 Bits 0000H After Reset
FFFFF660H
CVSE00
R/W
0000H
FFFFF662H
CVSE50
R/W
0000H
FFFFF664H
TBSTATE0
TBSTATE0L TBSTATE0H
R/W R/W R/W
0101H 01H 01H 0000H
FFFFF664H Timer 2 time base status register 0L FFFFF665H Timer 2 time base status register 0H FFFFF666H Timer 2 capture/compare 1 to 4 status register 0
CCSTATE0 R/W
FFFFF666H Timer 2 capture/compare 1 to 4 status register 0L FFFFF667H Timer 2 capture/compare 1 to 4 status register 0H FFFFF668H Timer 2 output delay register 0
CCSTATE0L
R/W
00H
CCSTATE0H
R/W
00H
ODELE0 ODELE0L ODELE0H CSCE0 TM3 CC30 CC31 TMC30 TMC31 SESC PRM03 NRC3 TO3C PHCMD PHS DTFR0 DTFR1 DTFR2 DTFR3 PSMR CKC LOCKR INTM0
R/W R/W R/W R/W R R/W R/W R/W R/W R/W R/W R/W R/W W R/W R/W R/W R/W R/W R/W R/W R R/W
0000H 00H 00H 0000H 0000H 0000H 0000H 00H 20H 00H 00H 00H 00H Undefined 00H 00H 00H 00H 00H 00H 00H 0000000xB 00H
FFFFF668H Timer 2 output delay register 0L FFFFF669H Timer 2 output delay register 0H FFFFF66AH FFFFF680H FFFFF682H FFFFF684H FFFFF686H FFFFF688H FFFFF689H FFFFF690H FFFFF698H FFFFF6A0H FFFFF800H FFFFF802H FFFFF810H FFFFF812H FFFFF814H FFFFF816H FFFFF820H FFFFF822H FFFFF824H FFFFF880H Timer 2 software event capture register Timer 3 Capture/compare register 30 Capture/compare register 31 Timer control register 30 Timer control register 31 Valid edge select register Timer 3 clock select register Timer 3 noise elimination time select register Timer 3 output control register Peripheral command register Peripheral status register DMA trigger factor register 0 DMA trigger factor register 1 DMA trigger factor register 2 DMA trigger factor register 3 Power-saving mode register Clock control register Lock register External interrupt mode register 0
78
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
(9/10)
Address Function Register Name Symbol R/W Bit Units for Manipulation 1 Bit FFFFF882H FFFFF884H FFFFF900H FFFFF901H FFFFF902H External interrupt mode register 1 External interrupt mode register 2 Clocked serial interface mode register 0 INTM1 INTM2 CSIM0 R/W R/W R/W R/W R R R/W R/W 8 Bits 16 Bits 00H 00H 00H 00H 0000H 00H 0000H 00H After Reset
Clocked serial interface clock select register 0 CSIC0 Clocked serial interface receive buffer register 0 SIRB0
FFFFF902H Clocked serial interface receive buffer register L0 SIRBL0 FFFFF904H Clocked serial interface transmit buffer register 0 SOTB0 SOTBL0
FFFFF904H Clocked serial interface transmit buffer register L0 FFFFF906H Clocked serial interface read-only receive buffer register 0
SIRBE0
R
0000H
FFFFF906H Clocked serial interface read-only receive buffer register L0 FFFFF908H Clocked serial interface first transmit buffer register 0
SIRBEL0
R
00H
SOTBF0
R/W
0000H
FFFFF908H Clocked serial interface first transmit buffer register L0 FFFFF90AH Serial I/O shift register 0
SOTBFL0
R/W
00H
SIO0 SIOL0 CSIM1
R R R/W R/W R R R/W R/W
0000H 0000H 00H 00H 0000H 0000H 0000H 00H
FFFFF90AH Serial I/O shift register L0 FFFFF910H FFFFF911H FFFFF912H Clocked serial interface mode register 1
Clocked serial interface clock select register 1 CSIC1 Clocked serial interface receive buffer register 1 SIRB1
FFFFF912H Clocked serial interface receive buffer register L1 SIRBL1 FFFFF914H Clocked serial interface transmit buffer register 1 SOTB1 SOTBL1
FFFFF914H Clocked serial interface transmit buffer register L1 FFFFF916H Clocked serial interface read-only receive buffer register 1
SIRBE1
R
0000H
FFFFF916H Clocked serial interface read-only receive buffer register L1 FFFFF918H Clocked serial interface first transmit buffer register 1
SIRBEL1
R
00H
SOTBF1
R/W
0000H
FFFFF918H Clocked serial interface first transmit buffer register L1 FFFFF91AH Serial I/O shift register 1
SOTBFL1
R/W
00H
SIO1 SIOL1 PRSM3 PRSCM3
R R R/W R/W R/W R
0000H 00H 00H 00H 01H FFH
FFFFF91AH Serial I/O shift register L1 FFFFF920H FFFFF922H FFFFFA00H FFFFFA02H Prescaler mode register 3 Prescaler compare register 3
Asynchronous serial interface mode register 0 ASIM0 Receive buffer register 0 RXB0
User's Manual U15195EJ3V0UD
79
CHAPTER 3 CPU FUNCTION
(10/10)
Address Function Register Name Symbol R/W Bit Units for Manipulation 1 Bit FFFFFA03H FFFFFA04H FFFFFA05H Asynchronous serial interface status register 0 Transmit buffer register 0 Asynchronous serial interface transmit status register 0 Clock select register 0 Baud rate generator control register 0 2-frame successive receive buffer register 1 Receive buffer register L1 2-frame successive transmit shift register 1 Transmit shift register L1 ASIS0 TXB0 ASIF0 R R/W R 8 Bits 16 Bits 00H FFH 00H After Reset
FFFFFA06H FFFFFA07H FFFFFA20H FFFFFA22H FFFFFA24H FFFFFA26H FFFFFA28H FFFFFA2AH FFFFFA2CH FFFFFA2EH FFFFFA30H
CKSR0 BRGC0 RXB1 RXBL1 TXS1 TXSL1
R/W R/W R R W W R/W R/W R R/W R/W
00H FFH Undefined Undefined Undefined Undefined 81H 00H 00H 00H 00H
Asynchronous serial interface mode register 10 ASIM10 Asynchronous serial interface mode register 11 ASIM11 Asynchronous serial interface status register 1 Prescaler mode register 1 Prescaler compare register 1 ASIS1 PRSM1 PRSCM1
80
User's Manual U15195EJ3V0UD
CHAPTER 3 CPU FUNCTION
3.4.9
Specific registers
Specific registers are registers that are protected from being written with illegal data due to inadvertent program loop (runaway), etc. The V850E/IA2 has two specific registers, the power save control register (PSC) (refer to 8.5.2 Control registers) and clock control register (CKC) (refer to 8.3.4 Clock control register (CKC)). 3.4.10 System wait control register (VSWC) The system wait control register (VSWC) controls the wait cycles of a bus access to the on-chip peripheral I/O registers. Set the following values to this register. Set value of VSWC: 02H (when operating frequency (fXX) = 40 MHz) This register can be read/written in 8-bit units (address: FFFFF06EH, after reset: 77H). Remark If the timing at which the flag or count value changes overlaps the register access timing when a register that includes a status flag indicating the status of on-chip peripheral functions (ASIF0, etc.) or a register that indicates a timer count value (TM0n, etc.) are accessed, a register access retry operation occurs. Therefore, it may take longer than normal to access an on-chip peripheral register. 3.4.11 Cautions When using the V850E/IA2, the following registers must be set from the beginning. * System wait control register (VSWC) (See 3.4.10 System wait control register (VSWC)) * Clock control register (CKC) (See 8.3.4 Clock control register (CKC)) After setting VSWC and CKC, set other registers as required.
User's Manual U15195EJ3V0UD
81
CHAPTER 4 BUS CONTROL FUNCTION
The V850E/IA2 is provided with an external bus interface function by which external I/O and memories, such as ROM and RAM, can be connected.
4.1
Features
* 16-bit/8-bit data bus sizing function * Wait function * Programmable wait function: up to 7 wait states can be inserted * External wait function via WAIT pin * Idle state insertion function * External device connection enabled via bus control/port alternate function pins
4.2
Bus Control Pins
The following pins are used for connection to external devices.
Bus Control Pin (Function When in Control Mode) Function When in Port Mode Register for Port/Control Mode Switching PMCDL PMCDH PMCCT
Address data bus (AD0 to AD15) Address bus (A16 to A21) Read/write control (LWR/UWR, RD, ASTB)
PDL0 to PDL15 (Port DL) PDH0 to PDH5 (Port DH) PCT0, PCT1, PCT4, PCT6 (Port CT) PCM0 (Port CM) PCM1 (Port CM)
External wait control (WAIT) Internal system clock (CLKOUT)
PMCCM
Remark
In the case of ROMless mode, when the system is reset, each bus control pin becomes valid unconditionally.
4.2.1 Pin status during internal ROM, internal RAM, and on-chip peripheral I/O access When the internal ROM and RAM are accessed, both the address bus and address data bus become undefined. The external bus control signal becomes inactive. When on-chip peripheral I/O are accessed, both the address bus and address data bus output the address of the on-chip peripheral I/O currently being accessed. No data is output. The external bus control signal becomes inactive.
82
User's Manual U15195EJ3V0UD
CHAPTER 4 BUS CONTROL FUNCTION
4.3
Memory Block Function
In the V850E/IA1, the 256 MB memory space is divided into memory blocks of 2 MB and 64 MB units. The programmable wait function and bus cycle operation mode can be independently controlled for each block. The area that can be used as program area is the 64 MB space of addresses 0000000H to 3FFFFFFH. In the V850E/IA2, memory space is the 4 MB space of addresses 000000H to 3FFFFFH (n = 1 to 7) because the CSn pin has been deleted and the A0 to A21 pins have been specified as address pins.
FFFFFFFH FE00000H FDFFFFFH CS7, CS6, CS5 Area 3 FC00000H FBFFFFFH FA00000H F9FFFFFH F800000H F7FFFFFH CS6 C000000H BFFFFFFH
Block 7 (2 MB) Block 6 (2 MB) Block 5 (2 MB) Block 4 (2 MB)
FFFFFFFH On-chip peripheral I/O area (4 KB) FFFF000H FFFEFFFH Internal RAM area (12 KBNote 1) FFFC000H
External memory area
CS4
Area 2 8000000H 7FFFFFFH
64 MB
CS3
Area 1 4000000H 3FFFFFFH
64 MB
CS1 0800000H 07FFFFFH 0600000H 05FFFFFH 0400000H 03FFFFFH 0200000H 01FFFFFH 0000000H Block 3 (2 MB) Block 2 (2 MB) Block 1 (2 MB) Block 0 (2 MB)
3FFFFFFH On-chip peripheral I/O area (4 KB)Note 2 3FFF000H 3FFEFFFH Internal RAM area (12 KBNote 1) 3FFC000H External memory area
Area 0 CS2, CS1, CS0
00FFFFFH Internal ROM area (1 MB)Note 3 0000000H
Note 4
Notes 1. 2. 3. 4.
Internal physical RAM: 6 KB Access to this area is prohibited. FFFF000H to FFFFFFFH. When in ROMless mode, this becomes an external memory area. Memory space of the V850E/IA2 To access the on-chip peripheral I/O, specify addresses
User's Manual U15195EJ3V0UD
83
CHAPTER 4 BUS CONTROL FUNCTION
4.3.1 Chip select control function Of the 256 MB memory area, the lower 8 MB (0000000H to 07FFFFFH) and the higher 8 MB (F800000H to FFFFFFFH) can be divided into 2 MB memory blocks by chip area select control registers 0 and 1 (CSC0, CSC1) to control the chip select signal. The memory area can be effectively used by dividing it into memory blocks using the chip select control function. The priority order is described below. (1) Chip area select control registers 0, 1 (CSC0, CSC1) These registers can be read/written in 16-bit units and become valid by setting each bit to 1. Only the CS01 and CS00 bits of the CSC0 register are valid in the V850E/IA2. These registers are not affected by other bit settings. In the V850E/IA2, set the CS01 and CS00 bits to 11B so that CS0 is output to both block 0 and 1. If different chip select signal outputs are set to the same block, the priority order is controlled as follows. CSC0: On-chip peripheral I/O area > CS0 > CS2 > CS1 CSC1: On-chip peripheral I/O area > CS7 > CS5 > CS6 If both the CS0m and CS2m bits of the CSC0 register are set to 0, CS1 is output to the corresponding block (m = 0 to 3). Similarly, if both the CS5m and CS7m bits of the CSC1 register are set to 0, CS6 is output to the corresponding block (m = 0 to 3). Caution Write to the CSC0 and CSC1 registers after reset, and then do not change the set values.
84
User's Manual U15195EJ3V0UD
CHAPTER 4 BUS CONTROL FUNCTION
15 CSC0
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0 Address FFFFF060H After reset 2C11H
CS33 CS32 CS31 CS30 CS23 CS22 CS21 CS20 CS13 CS12 CS11 CS10 CS03 CS02 CS01 CS00
15 CSC1
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0 Address FFFFF062H After reset 2C11H
CS43 CS42 CS41 CS40 CS53 CS52 CS51 CS50 CS63 CS62 CS61 CS60 CS73 CS72 CS71 CS70
Bit position 15 to 0
Bit name CSnm (n = 0 to 7) (m = 0 to 3)
Function Chip select enabled by setting CSnm bit to 1.
CSnm CS00 CS01 CS02 CS03 CS10 to CS13 CS20 CS21 CS22 CS23 CS30 to CS33 CS40 to CS43 CS50 CS51 CS52 CS53 CS60 to CS63 CS70 CS71 CS72 CS73
CS operation CS0 output during block 0 access CS0 output during block 1 access. CS0 output during block 2 access. CS0 output during block 3 access. Note 1 CS2 output during block 0 access. CS2 output during block 1 access. CS2 output during block 2 access. CS2 output during block 3 access. Note 2 Note 3 CS5 output during block 7 access. CS5 output during block 6 access. CS5 output during block 5 access. CS5 output during block 4 access. Note 4 CS7 output during block 7 access. CS7 output during block 6 access. CS7 output during block 5 access. CS7 output during block 4 access.
Notes 1. 2. 3. 4.
If both the CS0m and CS2m bits have been set to 0, if area 0 is accessed, CS1 will be output regardless of the setting of the CS1m bit. When area 1 is accessed, CS3 will be output regardless of the setting of the CS3m bit. When area 2 is accessed, CS4 will be output regardless of the setting of the CS4m bit. If both the CS5m and CS7m bits have been set to 0, if area 3 is accessed, CS6 will be output regardless of the setting of the CS6m bit.
Caution
In the V850E/IA2, set the CS01 and CS00 bits to 11B so that CS0 is output to both block 0 and 1.
User's Manual U15195EJ3V0UD
85
CHAPTER 4 BUS CONTROL FUNCTION
The following diagram shows the CS signal that is enabled for area 0 when the CSC0 register is set to 0703H. When the CSC0 register is set to 0703H, CS0 and CS2 are output to block 0 and block 1, but since CS0 has priority over CS2, CS0 is output if the addresses of block 0 and block 1 are accessed. If the address of block 3 is accessed, both the CS03 and CS23 bits of the CSC0 register are 0, and CS1 is output. Figure 4-1. Example When CSC0 Register Is Set to 0703H
3FFFFFFH
58 MB
CS1 is output. 0800000H 07FFFFFH Block 3 (2 MB) 0600000H 05FFFFFH
2 MB 0400000H 03FFFFFH
Block 2 (2 MB)
CS2 is output.
Block 1 (2 MB) 4 MB 0200000H 01FFFFFH Block 0 (2 MB) 0000000H CS0 is output.
86
User's Manual U15195EJ3V0UD
CHAPTER 4 BUS CONTROL FUNCTION
4.4
Bus Cycle Type Control Function
In the V850E/IA2, the following external devices can be connected directly to each memory block. * SRAM, external ROM, external I/O Connected external devices are specified by bus cycle type configuration registers 0 and 1 (BCT0 and BCT1). (1) Bus cycle type configuration registers 0, 1 (BCT0, BCT1) These registers can be read/written in 16-bit units. Only the ME0 bit is valid in the V850E/IA2. These registers are not affected by other bit settings. Caution Write to the BCT0 and BCT1 registers after reset, and then do not change the set values. Also, do not access an external memory area other than the one for this initialization routine until the initial setting of the BCT0 and BCT1 registers is complete. However, it is possible to access external memory areas whose initial settings are complete.
15 BCT0 ME3
14 1
13 0
12
11
10 1
9 0
8 0
7
6
5 0
4
3
2
1 0
0 0 Address FFFFF480H After reset CCCCH
0 ME2 CS2
ME1 1 CS1
0 ME0 1 CS0
CSn signal CS3 15 BCT1 ME7 14 1 13 0 12
11
10
9 0
8
7
6
5 0
4 0
3
2
1 0
0 0 Address FFFFF482H After reset CCCCH
0 ME6 1 CS6
0 ME5 1 CS5
ME4 1 CS4
CSn signal CS7
Bit position 15, 11, 7, 3 (BCT0), 15, 11, 7, 3 (BCT1)
Bit name MEn (n = 0 to 7)
Function Sets memory controller operation enable for each chip select.
MEn 0 1
Memory controller operation enable Operation disabled Operation enabled
User's Manual U15195EJ3V0UD
87
CHAPTER 4 BUS CONTROL FUNCTION
4.5
Bus Access
4.5.1 Number of access clocks The number of basic clocks required to access each resource is shown below.
Bus Cycle Status Resource (Bus Width) Internal ROM (32 bits) Internal RAM (32 bits) On-chip peripheral I/O (16 bits) External memory (16 bits) 3 1Note 1 1
Note 2
Instruction Fetch
Operand Data Access
5 1 5
Note 3
-
Note 3
3Note 3
Notes 1. 2. 3. Remark
This value is 2 in the case of instruction branch. This value is 2 if there is conflict with data access. MIN. value Unit: Clock/access
88
User's Manual U15195EJ3V0UD
CHAPTER 4 BUS CONTROL FUNCTION
4.5.2 Bus sizing function The bus sizing function controls the data bus width for each CS space. The data bus width is specified by using the bus size configuration register (BSC). (1) Bus size configuration register (BSC) This register can be read/written in 16-bit units. Only the BS00 bit is valid in the V850E/IA2. This register is not affected by other bit settings. Cautions 1. Write to the BSC register after reset, and then do not change the set values. Also, do not access an external memory area other than the one for this initialization routine until the initial setting of the BSC register is complete. However, it is possible to access external memory areas whose initial settings are complete. 2. When the data bus width is specified as 8 bits, only the signals shown below become active. LWR: When accessing SRAM, external ROM, or external I/O (write cycle)
15 BSC CSn signal 0
14 BS70 CS7
13 0
12 BS60 CS6
11 0
10 BS50 CS5
9 0
8 BS40 CS4
7 0
6 BS30 CS3
5 0
4 BS20 CS2
3 0
2 BS10 CS1
1 0
0 BS00 CS0 Address FFFFF066H After reset 5555H
Bit position 14, 12, 10, 8, 6, 4, 2, 0
Bit name BSn0 (n = 0 to 7)
Function Sets the data bus width of CSn space.
BSn0 0 1 8 bits 16 bits
Data bus width of CSn space
User's Manual U15195EJ3V0UD
89
CHAPTER 4 BUS CONTROL FUNCTION
4.5.3 Bus width The V850E/IA2 accesses on-chip peripheral I/O and external memory in 8-bit, 16-bit, or 32-bit units. The following shows the operation for each type of access. Access all data in order starting from the lower side. (1) Byte access (8 bits) (a) When the data bus width is 16 bits (little endian)
<1> Access to even address (2n)
Address 15
<2> Access to odd address (2n + 1)
Address 15 2n + 1
7
8 7 2n
7
8 7
0 Byte data
0 External data bus
0 Byte data
0 External data bus
(b) When the data bus width is 8 bits (little endian)
<1> Access to even address (2n)
Address 7 7 2n 0 Byte data 0 External data bus
<2> Access to odd address (2n + 1)
Address 7 7 2n + 1 0 Byte data 0 External data bus
90
User's Manual U15195EJ3V0UD
CHAPTER 4 BUS CONTROL FUNCTION
(2) Halfword access (16 bits) (a) When the bus width is 16 bits (little endian)
<1> Access to even address (2n)
<2> Access to odd address (2n + 1) 1st access 2nd access
Address 15 2n + 1 8 7 8 7 8 7 8 7 2n + 2 0 Halfword data 0 External data bus 0 Halfword data 0 External data bus 15
Address 15 15 2n + 1 8 7 8 7 2n 0 Halfword data 0 External data bus
15 15
Address
(b) When the data bus width is 8 bits (little endian)
<1> Access to even address (2n) 1st access
15 Address 7 2n 0 Halfword data 0 External data bus 0 Halfword data 0 External data bus 15 Address 7 2n + 1 0 Halfword data
<2> Access to odd address (2n + 1) 1st access
15 Address 7 2n + 1 0 External data bus 0 Halfword data 0 External data bus 15 Address 7 2n + 2
2nd access
2nd access
8 7
8 7
8 7
8 7
User's Manual U15195EJ3V0UD
91
CHAPTER 4 BUS CONTROL FUNCTION
(3) Word access (32 bits) (a) When the bus width is 16 bits (little endian) (1/2)
<1> Access to address 4n 1st access
31 31
2nd access
24 23 Address 15 4n + 1 8 7 8 7 4n 0 Word data 0 External data bus
24 23 Address 15 4n + 3 8 7 8 7 4n + 2 0 Word data 0 External data bus
16 15
16 15
<2> Access to address 4n + 1 1st access
31 31
2nd access
31
3rd access
24 23 Address 15 4n + 1 8 7 8 7
24 23 Address 15 4n + 3 8 7 8 7 4n + 2
24 23 Address 15
16 15
16 15
16 15
8 7
8 7 4n + 4
0 Word data
0 External data bus
0 Word data
0 External data bus
0 Word data
0 External data bus
92
User's Manual U15195EJ3V0UD
CHAPTER 4 BUS CONTROL FUNCTION
(a) When the bus width is 16 bits (little endian) (2/2)
<3> Access to address 4n + 2 1st access
31 31
2nd access
24 23 Address 15 4n + 3 8 7 8 7 4n + 2 0 Word data 0 External data bus
24 23 Address 15 4n + 5 8 7 8 7 4n + 4 0 Word data 0 External data bus
16 15
16 15
<4> Access to address 4n + 3 1st access
31 31
2nd access
31
3rd access
24 23 Address 15 4n + 3 8 7 8 7
24 23 Address 15 4n + 5 8 7 8 7 4n + 4
24 23 Address 15
16 15
16 15
16 15
8 7
8 7 4n + 6
0 Word data
0 External data bus
0 Word data
0 External data bus
0 Word data
0 External data bus
User's Manual U15195EJ3V0UD
93
CHAPTER 4 BUS CONTROL FUNCTION
(b) When the data bus width is 8 bits (little endian) (1/2)
<1> Access to address 4n 1st access
31 31
2nd access
31
3rd access
31
4th access
24 23
24 23
24 23
24 23
16 15 Address 7 4n 0 Word data 0 External data bus
16 15 Address 7 4n + 1 0 Word data 0 External data bus
16 15 Address 7 4n + 2 0 Word data 0 External data bus
16 15 Address 7 4n + 3 0 Word data 0 External data bus
8 7
8 7
8 7
8 7
<2> Access to address 4n + 1 1st access
31 31
2nd access
31
3rd access
31
4th access
24 23
24 23
24 23
24 23
16 15 Address 7 4n + 1 0 Word data 0 External data bus
16 15 Address 7 4n + 2 0 Word data 0 External data bus
16 15 Address 7 4n + 3 0 Word data 0 External data bus
16 15 Address 7 4n + 4 0 Word data 0 External data bus
8 7
8 7
8 7
8 7
94
User's Manual U15195EJ3V0UD
CHAPTER 4 BUS CONTROL FUNCTION
(b) When the data bus width is 8 bits (little endian) (2/2)
<3> Access to address 4n + 2 1st access
31 31
2nd access
31
3rd access
31
4th access
24 23
24 23
24 23
24 23
16 15 Address 7 4n + 2 0 Word data 0 External data bus
16 15 Address 7 4n + 3 0 Word data 0 External data bus
16 15 Address 7 4n + 4 0 Word data 0 External data bus
16 15 Address 7 4n + 5 0 Word data 0 External data bus
8 7
8 7
8 7
8 7
<4> Access to address 4n + 3 1st access
31 31
2nd access
31
3rd access
31
4th access
24 23
24 23
24 23
24 23
16 15 Address 7 4n + 3 0 Word data 0 External data bus
16 15 Address 7 4n + 4 0 Word data 0 External data bus
16 15 Address 7 4n + 5 0 Word data 0 External data bus
16 15 Address 7 4n + 6 0 Word data 0 External data bus
8 7
8 7
8 7
8 7
User's Manual U15195EJ3V0UD
95
CHAPTER 4 BUS CONTROL FUNCTION
4.6
Wait Function
4.6.1 Programmable wait function (1) Data wait control registers 0, 1 (DWC0, DWC1) To facilitate interfacing with low-speed memory or with I/Os, it is possible to insert up to 7 data wait states in the bus cycle activated for each CS space. The number of wait states can be specified by program using data wait control registers 0 and 1 (DWC0 and DWC1). Just after system reset, all blocks have 3 data wait states inserted. These registers can be read/written in 16-bit units. Only the DW02, DW01, and DW00 bits are valid in the V850E/IA2. These registers are not affected by other bit settings. Cautions 1. The internal ROM area and internal RAM area are not subject to programmable waits and ordinarily no wait access is carried out. The on-chip peripheral I/O area is also not subject to programmable wait states, with wait control performed by each peripheral function only. 2. Write to the DWC0 and DWC1 registers after reset, and then do not change the set values. Also, do not access an external memory area other than the one for this However, it is possible to access external memory areas whose initial initialization routine until the initial setting of the DWC0 and DWC1 registers is complete. settings are complete.
15 DWC0 CSn signal 15 DWC1 CSn signal
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0 Address FFFFF484H After reset 3333H
0 DW32 DW31 DW30 0 DW22 DW21 DW20 0 DW12 DW11 DW10 0 DW02 DW01 DW00 CS3 14 13 12 11 10 CS2 9 8 7 6 CS1 5 4 3 2 CS0 1 0
0 DW72 DW71 DW70 0 DW62 DW61 DW60 0 DW52 DW51 DW50 0 DW42 DW41 DW40 CS7 CS6 CS5 CS4
Address FFFFF486H
After reset 3333H
Bit position 14 to 12, 10 to 8, 6 to 4, 2 to 0
Bit name DWn2 to DWn0 (n = 0 to 7)
Function Specifies the number of wait states inserted in the CSn space. DWn2 0 0 0 0 1 1 1 1 DWn1 0 0 1 1 0 0 1 1 DWn0 0 1 0 1 0 1 0 1 Number of wait states inserted in CSn space Not inserted 1 2 3 4 5 6 7
96
User's Manual U15195EJ3V0UD
CHAPTER 4 BUS CONTROL FUNCTION
(2) Address wait control register (AWC) In the V850E/IA2, address setup wait and address hold wait states can be inserted before and after the T1 cycle, respectively. These wait states can be set for each CS space via the AWC register. This register can be read/written in 16-bit units. Only the AHW0 and ASW0 bits are valid in the V850E/IA2. This register is not affected by other bit settings. Caution Write to the AWC register after reset, and then do not change the set values.
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF488H
After reset 0000H
AWC AHW7 ASW7 AHW6 ASW6 AHW5 ASW5 AHW4 ASW4 AHW3 ASW3 AHW2 ASW2 AHW1 ASW1 AHW0 ASW0 CSn signal CS7 CS6 CS5 CS4 CS3 CS2 CS1 CS0
Bit position 15, 13, 11, 9, 7, 5, 3, 1
Bit name AHWn (n = 0 to 7)
Function Sets the insertion of an address hold wait state in each CSn space after the T1 cycle. 0: Address hold wait state not inserted 1: Address hold wait state inserted Sets the insertion of an address setup wait state in each CSn space before the T1 cycle. 0: Address setup wait state not inserted 1: Address setup wait state inserted
14, 12, 10, 8, 6, 4, 2, 0
ASWn (n = 0 to 7)
User's Manual U15195EJ3V0UD
97
CHAPTER 4 BUS CONTROL FUNCTION
4.6.2 External wait function When an extremely slow device, an I/O, or an asynchronous system is connected, an arbitrary number of wait states can be inserted in the bus cycle by the external wait pin (WAIT) for synchronization with the external device. Just as with programmable waits, accessing internal ROM, internal RAM, and on-chip peripheral I/O areas cannot be controlled by external waits. The external WAIT signal can be input asynchronously to CLKOUT and is sampled at the falling edge of the clock in the T2 and TW states of the bus cycle. If the setup/hold time is not satisfied within the sampling timing, a wait state may or may not be inserted in the next state. 4.6.3 Relationship between programmable wait and external wait A wait cycle is inserted as the result of an OR operation between the wait cycles specified by the set value of the programmable wait and the wait cycles controlled by the WAIT pin. In other words, the number of wait cycles is determined by the side with the greatest number of cycles.
Programmable wait Wait control Wait by WAIT pin
For example, if the timings of the programmable wait and the WAIT pin signal are as illustrated below, three wait states will be inserted in the bus cycle. Figure 4-2. Example of Wait Insertion
T2 CLKOUT
TW
TW
TW
T3
WAIT pin
Wait from WAIT pin
Programmable wait
Wait control
Remark
The circles indicate the sampling timing.
98
User's Manual U15195EJ3V0UD
CHAPTER 4 BUS CONTROL FUNCTION
4.7
Idle State Insertion Function
To facilitate interfacing with low-speed memory devices, a set number of idle states (T1) can be inserted into the bus cycle to be activated after the T3 state to secure the data output float delay time (tDF) of the memory when each CS space is read-accessed. The bus cycle following the T3 state starts after the inserted idle state(s). Idle states are inserted at the following timing. * After the read cycle for SRAM, external I/O, or external ROM. The idle state insertion setting can be specified using the bus cycle control register (BCC). Idle state insertion is automatically programmed for all memory blocks immediately after a system reset. (1) Bus cycle control register (BCC) This register can be read/written in 16-bit units. Only the BC01 bit is valid in the V850E/IA2. This register is not affected by other bit settings. Cautions 1. Idle states cannot be inserted in internal ROM, internal RAM, or on-chip peripheral I/O areas. 2. Write to the BCC register after reset, and then do not change the set values. Also, do not access an external memory area other than the one for this initialization routine until the initial setting for this register is complete. However, it is possible to access external memory areas whose initial settings are complete.
15 BCC BC71 CSn signal CS7
14 0
13 BC61 CS6
12 0
11 BC51 CS5
10 0
9 BC41 CS4
8 0
7 BC31 CS3
6 0
5 BC21 CS2
4 0
3 BC11 CS1
2 0
1 BC01 CS0
0 0
Address FFFFF48AH
After reset AAAAH
Bit position 15, 13, 11, 9, 7, 5, 3, 1
Bit name BCn1 (n = 0 to 7)
Function Specifies the insertion of idle states after the T3 state in each CSn space. 0: Idle state not inserted 1: Idle state inserted
User's Manual U15195EJ3V0UD
99
CHAPTER 4 BUS CONTROL FUNCTION
4.8
Bus Priority Order
There are three external bus cycles: DMA cycle, operand data access, and instruction fetch. In order of priority, DMA cycle is the highest, followed by operand data access and instruction fetch, in that order. An instruction fetch may be inserted between a read access and write access during a read modify write access. Also, an instruction fetch may be inserted between bus accesses when the CPU bus clock is used. Table 4-1. Bus Priority Order
Priority Order High External Bus Cycle Bus Master
DMA cycle Operand data access
DMA controller CPU CPU
Low
Instruction fetch
100
User's Manual U15195EJ3V0UD
CHAPTER 4 BUS CONTROL FUNCTION
4.9
Boundary Operation Conditions
4.9.1 Program space (1) Branching to the on-chip peripheral I/O area or successive fetches from the internal RAM area to the on-chip peripheral I/O area are prohibited. If the above is performed (branching or successive fetch), the data to be fetched is undefined and the operation is not guaranteed. (2) If a branch instruction exists at the upper limit of the internal RAM area, a prefetch operation (invalid fetch) that straddles over the on-chip peripheral I/O area does not occur. 4.9.2 Data space The V850E/IA2 is provided with an address misalign function. Through this function, regardless of the data format (word data, halfword data, or byte data), data can be allocated to all addresses. However, in the case of word data and halfword data, if the data is not subject to boundary alignment, the bus cycle will be generated at least 2 times and bus efficiency will drop. (1) In the case of halfword-length data access When the address's LSB is 1, the byte-length bus cycle will be generated 2 times. (2) In the case of word-length data access (a) When the address's LSB is 1, bus cycles will be generated in the order of byte-length bus cycle, halfword-length bus cycle, and byte-length bus cycle. (b) When the address's lowest 2 bits are 10, the halfword-length bus cycle will be generated 2 times.
User's Manual U15195EJ3V0UD
101
CHAPTER 5 MEMORY ACCESS CONTROL FUNCTION
5.1
SRAM, External ROM, External I/O Interface
5.1.1 Features * SRAM is accessed in a minimum of 3 states. * A maximum of 7 programmable data wait states can be inserted according to DWC0 and DWC1 register settings. * Data waits can be controlled by WAIT pin input. * An idle state (1 state) can be inserted after a read/write cycle by setting the BCC register. * An address hold wait state or address setup wait state can be inserted by setting the AWC register.
102
User's Manual U15195EJ3V0UD
CHAPTER 5 MEMORY ACCESS CONTROL FUNCTION
5.1.2 SRAM, external ROM, external I/O access Figure 5-1. SRAM, External ROM, External I/O Access Timing (1/4)
(a) When reading (1 wait inserted)
T1 CLKOUT (Output) T2 TW T3
A16 to A21 (Output)
Address
AD0 to AD15 (I/O)
Address
Data
ASTB (Output)
RD (Output)
UWR, LWR (Output)
H
WAIT (Input)
Remarks 1. The circles indicate the sampling timing. 2. Broken lines indicate high impedance.
User's Manual U15195EJ3V0UD
103
CHAPTER 5 MEMORY ACCESS CONTROL FUNCTION
Figure 5-1. SRAM, External ROM, External I/O Access Timing (2/4)
(b) When reading (0 waits, address setup waits, address hold wait states inserted)
TASW CLKOUT (Output) T1 TAHW T2 T3
A16 to A21 (Output)
Address
AD0 to AD15 (I/O)
Address
Data
ASTB (Output)
RD (Output)
UWR, LWR (Output)
H
WAIT (Input)
Remarks 1. The circles indicate the sampling timing. 2. Broken lines indicate high impedance.
104
User's Manual U15195EJ3V0UD
CHAPTER 5 MEMORY ACCESS CONTROL FUNCTION
Figure 5-1. SRAM, External ROM, External I/O Access Timing (3/4)
(c) When writing (1 wait inserted)
T1 CLKOUT (Output) T2 TW T3
A16 to A21 (Output)
Address
AD0 to AD15 (I/O)
Address
DataNote
ASTB (Output)
RD (Output)
H
UWR, LWR (Output)
WAIT (Input)
Note AD0 to AD7 output invalid data when odd-numbered address byte data is accessed. AD8 to AD15 output invalid data when even-numbered address byte data is accessed. Remarks 1. The circles indicate the sampling timing. 2. Broken lines indicate high impedance.
User's Manual U15195EJ3V0UD
105
CHAPTER 5 MEMORY ACCESS CONTROL FUNCTION
Figure 5-1. SRAM, External ROM, External I/O Access Timing (4/4)
(d) When writing (0 waits inserted, for 8-bit data bus)
T1 CLKOUT (Output) T2 T3
A16 to A21 (Output)
Address
AD8 to AD15 (I/O)
Address
AD0 to AD7 (I/O)
Address
DataNote
ASTB (Output)
RD (Output)
H
UWR, LWR (Output)
WAIT (Input)
Note AD0 to AD7 output invalid data when odd-numbered address byte data is accessed. Remarks 1. The circles indicate the sampling timing. 2. Broken lines indicate high impedance.
106
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
The V850E/IA2 includes a direct memory access (DMA) controller (DMAC) that executes and controls DMA transfer. The DMAC controls data transfer between memory and I/O, between memories or between I/Os, based on DMA requests issued by the on-chip peripheral I/O (serial interface, real-time pulse unit, and A/D converter), or software triggers (memory refers to internal RAM or external memory).
6.1
Features
* Four independent DMA channels * Transfer unit: 8/16 bits * Maximum transfer count: 65,536 (2 ) * Two-cycle transfer * Three transfer modes * Single transfer mode * Single-step transfer mode * Block transfer mode * Transfer requests * Request by interrupts from on-chip peripheral I/O (serial interface, real-time pulse unit, A/D converter) * Requests by software trigger * Transfer objects * Memory I/O * Memory memory * I/O I/O * Next address setting function
16
User's Manual U15195EJ3V0UD
107
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.2
Configuration
Internal RAM
On-chip peripheral I/O Internal bus On-chip peripheral I/O bus
CPU
Data control
Address control
DMA source address register (DSAnH/DSAnL) DMA destination address register (DDAnH/DDAnL)
Count control
DMA transfer count register (DBCn) DMA channel control register (DCHCn) DMA addressing control register (DADCn)
Channel control
DMA disable status register (DDIS) DMA restart register (DRST) DMA trigger factor register (DTFRn) DMAC
Bus interface
External bus
V850E/IA2
External I/O
External RAM
External ROM
Remark
n = 0 to 3
108
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.3
Control Registers
6.3.1 DMA source address registers 0 to 3 (DSA0 to DSA3) These registers are used to set the DMA source addresses (28 bits each) for DMA channel n (n = 0 to 3). They are divided into two 16-bit registers, DSAnH and DSAnL. Since these registers are configured as 2-stage FIFO buffer registers, a new source address for DMA transfer can be specified during DMA transfer. (Refer to 6.9 Next Address Setting Function.) (1) DMA source address registers 0H to 3H (DSA0H to DSA3H) These registers can be read/written in 16-bit units. Be sure to set bits 14 to 12 to 0. If they are set to 1, the operation is not guaranteed. Caution When setting an address of an on-chip peripheral I/O register for the source address, be sure to specify an address between FFFF000H and FFFFFFFH. An address of the on-chip peripheral I/O register image (3FFF000H to 3FFFFFFH) must not be specified.
15 DSA0H IR 15 DSA1H IR 15 DSA2H IR 15 DSA3H IR
14 0 14 0 14 0 14 0
13 0 13 0 13 0 13 0
12 0 12 0 12 0 12 0
11
10
9
8
7
6
5
4
3
2
1
0 Address FFFFF082H After reset Undefined
SA27 SA26 SA25 SA24 SA23 SA22 SA21 SA20 SA19 SA18 SA17 SA16 11 10 9 8 7 6 5 4 3 2 1 0
SA27 SA26 SA25 SA24 SA23 SA22 SA21 SA20 SA19 SA18 SA17 SA16 11 10 9 8 7 6 5 4 3 2 1 0
FFFFF08AH
Undefined
SA27 SA26 SA25 SA24 SA23 SA22 SA21 SA20 SA19 SA18 SA17 SA16 11 10 9 8 7 6 5 4 3 2 1 0
FFFFF092H
Undefined
SA27 SA26 SA25 SA24 SA23 SA22 SA21 SA20 SA19 SA18 SA17 SA16
FFFFF09AH
Undefined
Bit position 15 IR
Bit name
Function Specifies the DMA source address. 0: External memory, on-chip peripheral I/O 1: Internal RAM Sets the DMA source addresses (A27 to A16). During DMA transfer, it stores the next DMA transfer source address.
11 to 0
SA27 to SA16
User's Manual U15195EJ3V0UD
109
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
(2) DMA source address registers 0L to 3L (DSA0L to DSA3L) These registers can be read/written in 16-bit units.
15 DSA0L
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0 Address FFFFF080H After reset Undefined
SA15 SA14 SA13 SA12 SA11 SA10 SA9 SA8 SA7 SA6 SA5 SA4 SA3 SA2 SA1 SA0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DSA1L
SA15 SA14 SA13 SA12 SA11 SA10 SA9 SA8 SA7 SA6 SA5 SA4 SA3 SA2 SA1 SA0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FFFFF088H
Undefined
DSA2L
SA15 SA14 SA13 SA12 SA11 SA10 SA9 SA8 SA7 SA6 SA5 SA4 SA3 SA2 SA1 SA0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FFFFF090H
Undefined
DSA3L
SA15 SA14 SA13 SA12 SA11 SA10 SA9 SA8 SA7 SA6 SA5 SA4 SA3 SA2 SA1 SA0
FFFFF098H
Undefined
Bit position 15 to 0
Bit name SA15 to SA0
Function Sets the DMA source address (A15 to A0). During DMA transfer, it stores the next DMA transfer source address.
110
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.3.2 DMA destination address registers 0 to 3 (DDA0 to DDA3) These registers are used to set the DMA destination address (28 bits each) for DMA channel n (n = 0 to 3). They are divided into two 16-bit registers, DDAnH and DDAnL. Since these registers are configured as 2-stage FIFO buffer registers, a new destination address for DMA transfer can be specified during DMA transfer. (Refer to 6.9 Next Address Setting Function.) (1) DMA destination address registers 0H to 3H (DDA0H to DDA3H) These registers can be read/written in 16-bit units. Be sure to set bits 14 to 12 to 0. If they are set to 1, the operation is not guaranteed. Caution When setting an address of an on-chip peripheral I/O register for the destination address, be sure to specify an address between FFFF000H and FFFFFFFH. An address of the onchip peripheral I/O register image (3FFF000H to 3FFFFFFH) must not be specified.
15 DDA0H IR 15 DDA1H IR 15 DDA2H IR 15 DDA3H IR
14 0 14 0 14 0 14 0
13 0 13 0 13 0 13 0
12 0 12 0 12 0 12 0
11
10
9
8
7
6
5
4
3
2
1
0 Address FFFFF086H After reset Undefined
DA27 DA26 DA25 DA24 DA23 DA22 DA21 DA20 DA19 DA18 DA17 DA16 11 10 9 8 7 6 5 4 3 2 1 0
DA27 DA26 DA25 DA24 DA23 DA22 DA21 DA20 DA19 DA18 DA17 DA16 11 10 9 8 7 6 5 4 3 2 1 0
FFFFF08EH
Undefined
DA27 DA26 DA25 DA24 DA23 DA22 DA21 DA20 DA19 DA18 DA17 DA16 11 10 9 8 7 6 5 4 3 2 1 0
FFFFF096H
Undefined
DA27 DA26 DA25 DA24 DA23 DA22 DA21 DA20 DA19 DA18 DA17 DA16
FFFFF09EH
Undefined
Bit position 15
Bit name IR
Function Specifies the DMA destination address. 0: External memory, on-chip peripheral I/O 1: Internal RAM Sets the DMA destination addresses (A27 to A16). During DMA transfer, it stores the next DMA transfer destination address.
11 to 0
DA27 to DA16
User's Manual U15195EJ3V0UD
111
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
(2) DMA destination address registers 0L to 3L (DDA0L to DDA3L) These registers can be read/written in 16-bit units.
15 DDA0L
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0 Address FFFFF084H After reset Undefined
DA15 DA14 DA13 DA12 DA11 DA10 DA9 DA8 DA7 DA6 DA5 DA4 DA3 DA2 DA1 DA0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DDA1L
DA15 DA14 DA13 DA12 DA11 DA10 DA9 DA8 DA7 DA6 DA5 DA4 DA3 DA2 DA1 DA0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FFFFF08CH
Undefined
DDA2L
DA15 DA14 DA13 DA12 DA11 DA10 DA9 DA8 DA7 DA6 DA5 DA4 DA3 DA2 DA1 DA0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FFFFF094H
Undefined
DDA3L
DA15 DA14 DA13 DA12 DA11 DA10 DA9 DA8 DA7 DA6 DA5 DA4 DA3 DA2 DA1 DA0
FFFFF09CH
Undefined
Bit position 15 to 0
Bit name DA15 to DA0
Function Sets the DMA destination address (A15 to A0). During DMA transfer, it stores the next DMA transfer destination address.
112
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.3.3 DMA byte count registers 0 to 3 (DBC0 to DBC3) These 16-bit registers are used to set the byte transfer counts for DMA channels n (n = 0 to 3). They store the remaining transfer counts during DMA transfer. Since these registers are configured as 2-stage FIFO buffer registers, a new DMA byte transfer count for DMA transfer can be specified during DMA transfer. (Refer to 6.9 Next Address Setting Function.) These registers are decremented by 1 per transfer. Transfer is terminated if a borrow occurs. These registers can be read/written in 16-bit units. Remark If the DBCn register is read after a terminal count has occurred during DMA transfer without the value of the DBCn register rewritten, the value set immediately before DMA transfer is read (0000H is not read even after completion of transfer).
15 DBC0
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0 Address FFFFF0C0H After reset Undefined
BC15 BC14 BC13 BC12 BC11 BC10 BC9 BC8 BC7 BC6 BC5 BC4 BC3 BC2 BC1 BC0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DBC1
BC15 BC14 BC13 BC12 BC11 BC10 BC9 BC8 BC7 BC6 BC5 BC4 BC3 BC2 BC1 BC0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FFFFF0C2H
Undefined
DBC2
BC15 BC14 BC13 BC12 BC11 BC10 BC9 BC8 BC7 BC6 BC5 BC4 BC3 BC2 BC1 BC0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FFFFF0C4H
Undefined
DBC3
BC15 BC14 BC13 BC12 BC11 BC10 BC9 BC8 BC7 BC6 BC5 BC4 BC3 BC2 BC1 BC0
FFFFF0C6H
Undefined
Bit position 15 to 0
Bit name BC15 to BC0
Function Sets the byte transfer count. It stores the remaining byte transfer count during DMA transfer.
DBCn (n = 0 to 3) 0000H 0001H : FFFFH
States Byte transfer count 1 or remaining byte transfer count Byte transfer count 2 or remaining byte transfer count : Byte transfer count 65,536 (216) or remaining byte transfer count
User's Manual U15195EJ3V0UD
113
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.3.4 DMA addressing control registers 0 to 3 (DADC0 to DADC3) These 16-bit registers are used to control the DMA transfer modes for DMA channel n (n = 0 to 3). These registers cannot be accessed during DMA operation. They can be read/written in 16-bit units. Be sure to set bits 13 to 8, 1, and 0 to 0. If they are set to 1, the operation is not guaranteed. Caution The DS1 and DS0 bits are used to set how many bits of data are transferred. When 8-bit data (DS1, DS0 bits = 00) is set, the lower data bus (AD0 to AD7) is not necessarily used. When the transfer data size is set to 16 bits, the transfer must start from an address with bit 1 of the lower address aligned to "0". In this case, the transfer cannot start from an odd address. (1/2)
15 DADC0 14 13 0 13 0 13 0 13 0 12 0 12 0 12 0 12 0 11 0 11 0 11 0 11 0 10 0 10 0 10 0 10 0 9 0 9 0 9 0 9 0 8 7 6 5 4 3 2 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 FFFFF0D6H 0000H FFFFF0D4H 0000H FFFFF0D2H 0000H Address FFFFF0D0H After reset 0000H
DS1 DS0 15 14
0 SAD1 SAD0 DAD1 DAD0 TM1 TM0 8 7 6 5 4 3 2
DADC1
DS1 DS0 15 14
0 SAD1 SAD0 DAD1 DAD0 TM1 TM0 8 7 6 5 4 3 2
DADC2
DS1 DS0 15 14
0 SAD1 SAD0 DAD1 DAD0 TM1 TM0 8 7 6 5 4 3 2
DADC3
DS1 DS0
0 SAD1 SAD0 DAD1 DAD0 TM1 TM0
Bit position 15, 14
Bit name DS1, DS0
Function Sets the transfer data size for DMA transfer.
DS1 0 0 1 1
DS0 0 1 0 1 8 bits 16 bits Setting prohibited Setting prohibited
Transfer data size
For the on-chip peripheral I/O registers, ensure the transfer size matches the access size. 7, 6 SAD1, SAD0 Sets the count direction of the source address for DMA channel n (n = 0 to 3).
SAD1 0 0 1 1
SAD0 0 1 0 1 Increment Decrement Fixed Setting prohibited
Count direction
114
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
(2/2)
Bit position 5, 4 Bit name DAD1, DAD0 Function Sets the count direction of the destination address for DMA channel n (n = 0 to 3). DAD1 0 0 1 1 DAD0 0 1 0 1 Increment Decrement Fixed Setting prohibited Count direction
3, 2
TM1, TM0
Sets the transfer mode during DMA transfer.
TM1 0 0 1 1
TM0 0 1 0 1 Single transfer mode Single-step transfer mode Setting prohibited Block transfer mode
Transfer mode
User's Manual U15195EJ3V0UD
115
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.3.5 DMA channel control registers 0 to 3 (DCHC0 to DCHC3) These 8-bit registers are used to control the DMA transfer operating mode for DMA channel n (n = 0 to 3). These registers can be read/written in 8-bit or 1-bit units. (However, bit 7 is read only and bits 2 and 1 are write only. If bits 2 and 1 are read, the read value is always 0.) Be sure to set bits 6 to 4 to 0. If they are set to 1, the operation is not guaranteed. Caution Setting the MLEn bit to 1 is valid only for starting DMA transfer by the DMARQn signal (internal signal) or an interrupt from the on-chip peripheral I/O (n = 0 to 3) (hardware DMA). To start DMA transfer by setting the STGn bit to 1 (software DMA), read the TCn bit and check that it is set to 1, and then set the STGn bit to 1.
<7> DCHC0 TC0 <7> DCHC1 TC1 <7> DCHC2 TC2 <7> DCHC3 TC3
6 0 6 0 6 0 6 0
5 0 5 0 5 0 5 0
4 0 4 0 4 0 4 0
<3> MLE0 <3> MLE1 <3> MLE2 <3> MLE3
<2> INIT0 <2> INIT1 <2> INIT2 <2> INIT3
<1> STG0 <1> STG1 <1> STG2 <1> STG3
<0> E00 <0> E11 <0> E22 <0> E33 FFFFF0E6H 00H FFFFF0E4H 00H FFFFF0E2H 00H Address FFFFF0E0H After reset 00H
Bit position 7
Bit name TCn
Function This status bit indicates whether DMA transfer through DMA channel n has ended or not. This bit is read-only. It is set to 1 when DMA transfer ends and cleared (to 0) when it is read. 0: DMA transfer had not ended. 1: DMA transfer had ended. When this bit is set to 1 at terminal count output, the Enn bit is not cleared to 0 and the DMA transfer enable state is retained. When the next DMA transfer request is the DMARQn signal (internal signal) or an interrupt from the on-chip peripheral I/O (hardware DMA), the DMA transfer request can be accepted even when the TCn bit is not read. When the next DMA transfer request is the setting of the STGn bit to 1 (software DMA), the DMA transfer request can be accepted by reading and clearing the TCn bit to 0. When this bit is cleared to 0 at terminal count output, the Enn bit is cleared to 0 and the DMA transfer disable state is entered. At the next DMA transfer request, the setting of the Enn bit to 1 and the reading of the TCn bit are required. When this bit is set to 1, DMA transfer is forcibly terminated. If this bit is set to 1 in the DMA transfer enable state (TCn bit = 0, Enn bit = 1), DMA transfer is started. Specifies whether DMA transfer through DMA channel n is to be enabled or disabled. This bit is cleared to 0 when DMA transfer ends. It is also cleared to 0 when DMA transfer is forcibly terminated by means of setting the INITn bit to 1 or by NMI input. 0: DMA transfer disabled 1: DMA transfer enabled
3
MLEn
2 1
INITn STGn
0
Enn
Remark
n = 0 to 3
116
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.3.6 DMA disable status register (DDIS) This register holds the contents of the Enn bit of the DCHCn register during NMI input (n = 0 to 3). This register is read-only in 8-bit units. Be sure to set bits 7 to 4 to 0. If they are set to 1, the operation is not guaranteed.
7 DDIS 0
6 0
5 0
4 0
3 CH3
2 CH2
1 CH1
0 CH0 Address FFFFF0F0H After reset 00H
Bit position 3 to 0
Bit name CH3 to CH0
Function Reflects the contents of the Enn bit of the DCHCn register during NMI input. The contents of this register are held until the next NMI input or until the system is reset.
6.3.7 DMA restart register (DRST) This register is used to restart DMA transfer that has been forcibly interrupted by NMI input. The ENn bit of this register and the Enn bit of the DCHCn register are linked to each other (n = 0 to 3). Following forcible interrupt by NMI input, the DMA channel that was interrupted is confirmed from the contents of the DDIS register, and DMA transfer is restarted by setting the ENn bit of the corresponding channel to 1. This register can be read/written in 8-bit units. Be sure to set bits 7 to 4 to 0. If they are set to 1, the operation is not guaranteed.
7 DRST 0
6 0
5 0
4 0
3 EN3
2 EN2
1 EN1
0 EN0 Address FFFFF0F2H After reset 00H
Bit position 3 to 0
Bit name EN3 to EN0
Function Specifies whether DMA transfer via DMA channel n is to be enabled or disabled. This bit is cleared to 0 when DMA transfer is completed in accordance with the terminal count output (n = 0 to 3). It is also cleared to 0 when DMA transfer is forcibly terminated by setting the INITn bit of the DCHCn register to 1 or by NMI input. 0: DMA transfer disabled 1: DMA transfer enabled
User's Manual U15195EJ3V0UD
117
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.3.8 DMA trigger factor registers 0 to 3 (DTFR0 to DTFR3) These 8-bit registers are used to control the DMA transfer start trigger via interrupt requests from on-chip peripheral I/O. The interrupt requests set with these registers serve as DMA transfer start factors. These registers can be read/written in 8-bit units. Only bit 7 (DFn) can be read/written in 1-bit units (n = 0 to 3). Cautions 1. Be sure to stop the DMA operation before making changes to DTFRn register settings. 2. Except INTP0 to INPT4 and INTP20 to INTP25 (when noise elimination by an analog filter is selected), an interrupt request input in standby mode (IDLE or software STOP mode) does not trigger DMA transfer. 3. INTCM004 and INTCM005 cannot be used as DMA trigger sources. (1/3)
<7> DTFR0 DF0 <7> DTFR1 DF1 <7> DTFR2 DF2 <7> DTFR3 DF3 6 0 6 0 6 0 6 0 5 IFC05 5 IFC15 5 IFC25 5 IFC35 4 IFC04 4 IFC14 4 IFC24 4 IFC34 3 IFC03 3 IFC13 3 IFC23 3 IFC33 2 IFC02 2 IFC12 2 IFC22 2 IFC32 1 IFC01 1 IFC11 1 IFC21 1 IFC31 0 IFC00 0 IFC10 0 IFC20 0 IFC30 FFFFF816H 00H FFFFF814H 00H FFFFF812H 00H Address FFFFF810H After reset 00H
Bit position 7
Bit name DFn This is a DMA transfer request flag. Only 0 can be written to this bit. 0: No DMA transfer request 1: DMA transfer request
Function
If the interrupt specified as the DMA transfer start factor occurs and it is necessary to clear the DMA transfer request while DMA transfer is disabled (including when it is aborted by NMI or forcibly stopped by software), stop the operation that has caused the interrupt (e.g., if serial reception is in progress, by disabling reception) and then clear the DFn bit. If it is clearly known that the interrupt will not occur until the next DMA transfer is started, it is not necessary to stop the operation that has caused the interrupt.
Remark
n = 0 to 3
118
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
(2/3)
Bit position 5 to 0 Bit name IFCn5 to IFCn0 Function Sets the interrupt source that serves as the DMA transfer start factor.
IFCn5 0
IFCn4 0
IFCn3 0
IFCn2 0
IFCn1 0
IFCn0 0
Interrupt source DMA request from on-chip peripheral I/O disabled INTP0 INTP1 INTP2 INTP3 INTP4 INTDET0 INTDET1 INTTM00 INTCM003 INTTM01 INTCM013 INTP100/INTCC100 INTP101/INTCC101 INTCM100 INTCM101 INTTM20 INTTM21 INTP20/INTCC20 INTP21/INTCC21 INTP22/INTCC22 INTP23/INTCC23 INTP24/INTCC24 INTP25/INTCC25 INTTM3 INTP30/INTCC30 INTP31/INTCC31 INTCM4 INTDMA0 INTDMA1 INTDMA2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0
0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1
0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Remark
n = 0 to 3
User's Manual U15195EJ3V0UD
119
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
(3/3)
Bit position 5 to 0 Bit name IFCn5 to IFCn0 Function
IFCn5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
IFCn4 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
IFCn3 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1
IFCn2 1 0 0 1 1 1 1 0 0 1 0 0 1 1 1
IFCn1 0 1 1 0 0 1 1 0 1 0 1 1 0 0 1
IFCn0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0
Interrupt source INTDMA3 INTCSI0 INTCSI1 INTSR0 INTST0 INTSER0 INTSR1 INTST1 INTAD0 INTAD1 INTCM010 INTCM011 INTCM012 INTCM014 INTCM015 Setting prohibited
Other than above
Remark
n = 0 to 3
120
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.4
DMA Bus States
6.4.1 Types of bus states The DMAC bus cycle consist of the following 10 states. (1) TI state The TI state is an idle state, during which no access request is issued. The DMA request signals are sampled at the rising edge of the CLKOUT signal. (2) T0 state DMA transfer ready state (state in which a DMA transfer request has been issued and the bus mastership is acquired for the first DMA transfer). (3) T1R state The bus enters the T1R state at the beginning of a read operation in the two-cycle transfer mode. Address driving starts. After entering the T1R state, the bus invariably enters the T2R state. (4) T1RI state The T1RI state is a state in which the bus waits for the acknowledge signal corresponding to an external memory read request. After entering the last T1RI state, the bus invariably enters the T2R state. (5) T2R state The T2R state corresponds to the last state of a read operation in the two-cycle transfer mode, or to a wait state. In the last T2R state, read data is sampled. After entering the last T2R state, the bus invariably enters the T1W state. (6) T2RI state State in which the bus is ready for DMA transfer to on-chip peripheral I/O or internal RAM (state in which the bus mastership is acquired for DMA transfer to on-chip peripheral I/O or internal RAM). After entering the last T2RI state, the bus invariably enters the T1W state. (7) T1W state The bus enters the T1W state at the beginning of a write operation in the two-cycle transfer mode. Address driving starts. After entering the T1W state, the bus invariably enters the T2W state. (8) T1WI state State in which the bus waits for the acknowledge signal corresponding to an external memory write request. After entering the last T1WI state, the bus invariably enters the T2W state. (9) T2W state The T2W state corresponds to the last state of a write operation in the two-cycle transfer mode, or to a wait state. In the last T2W state, the write strobe signal is made inactive.
User's Manual U15195EJ3V0UD
121
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
(10) TE state The TE state corresponds to DMA transfer completion. Various internal signals are initialized (n = 0 to 3). After entering the TE state, the bus invariably enters the TI state. 6.4.2 DMAC bus cycle state transition Except for the block transfer mode, each time the processing for a DMA transfer is completed, the bus mastership is released. Figure 6-1. DMAC Bus Cycle (Two-Cycle Transfer) State Transition
TI
T0
T1R
T1RI
T2R T2RI T1W T1WI T2W
TE
TI
122
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.5
Transfer Modes
6.5.1 Single transfer mode In single transfer mode, the DMAC releases the bus at each byte/halfword transfer. If there is a subsequent DMA transfer request, transfer is performed again once. This operation continues until a terminal count occurs. When the DMAC has released the bus, if another higher priority DMA transfer request is issued, the higher priority DMA request always takes precedence. However, if a lower priority DMA transfer request is generated within one clock after the end of a single transfer, even if the previous higher priority DMA transfer request signal stays active, this request is not prioritized, and the next DMA transfer after the bus is released for the CPU is a transfer based on the newly generated, lower priority DMA transfer request. Figures 6-2 to 6-5 show examples of single transfer. Figure 6-2. Single Transfer Example 1
DMARQ3 (Internal signal) Note
CPU
Note
Note
CPU CPU CPU CPU
Note
CPU DMA3 CPU DMA3 CPU CPU CPU
CPU DMA3 CPU DMA3 CPU DMA3 CPU
DMA channel 3 terminal count
Note The bus is always released.
Figure 6-3 shows a single transfer mode example in which a higher priority DMA transfer request is generated. DMA channels 0 to 2 are used for a block transfer, and channel 3 is used for a single transfer. Figure 6-3. Single Transfer Example 2
DMARQ0 (Internal signal) DMARQ1 (Internal signal) DMARQ2 (Internal signal) DMARQ3 (Internal signal) Note
CPU CPU
Note
Note
Note
CPU DMA3
CPU DMA3 CPU DMA0 DMA0 CPU DMA1 DMA1 CPU DMA2 DMA2 CPU DMA3
DMA channel 0 terminal count
DMA channel 1 terminal count
DMA channel 2 terminal count
DMA channel 3 terminal count
Note The bus is always released.
User's Manual U15195EJ3V0UD
123
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
Figure 6-4 shows a single transfer mode example in which a lower priority DMA transfer request is generated within one clock after the end of a single transfer. DMA channels 0 and 3 are used for a single transfer. When two DMA transfer request signals are activated at the same time, the two DMA transfers are performed alternately. Figure 6-4. Single Transfer Example 3
DMARQ0 (Internal signal) DMARQ3 (Internal signal) Note
CPU
Note
Note
Note
Note
Note
Note
CPU
CPU DMA0 CPU DMA0 CPU DMA3 CPU DMA0 CPU DMA3 CPU DMA0 CPU DMA0 CPU DMA0 CPU
DMA channel 3 terminal count
DMA channel 0 terminal count
Note The bus is always released.
Figure 6-5 shows a single transfer mode example in which two or more lower priority DMA transfer requests are generated within one clock after the end of a single transfer. DMA channels 0, 2, and 3 are used for a single transfer. When three or more DMA transfer request signals are activated at the same time, always the two highest priority DMA transfers are performed alternately. Figure 6-5. Single Transfer Example 4
DMARQ0 (Internal signal) DMARQ2 (Internal signal) DMARQ3 (Internal signal) Note Note Note Note Note Note Note Note Note
CPU CPU
CPU DMA3 CPU DMA3 CPU DMA2 CPU DMA0 CPU DMA2 CPU DMA0 CPU DMA2 CPU DMA3 CPU DMA2 CPU DMA3
DMA channel 0 terminal count
DMA channel 2 terminal count
DMA channel 3 terminal count
Note The bus is always released.
124
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.5.2 Single-step transfer mode In single-step transfer mode, the DMAC releases the bus at each byte/halfword transfer. Once a DMA transfer request signal has been received, transfer continues until a terminal count occurs. When the DMAC has released the bus, if another higher priority DMA transfer request is issued, the higher priority DMA request always takes precedence. Figures 6-6 and 6-7 show examples of single-step transfer. Figure 6-6. Single-Step Transfer Example 1
DMARQ1 (Internal signal) Note
CPU CPU
Note
Note
CPU CPU CPU CPU CPU CPU
CPU DMA1 CPU DMA1 CPU DMA1 CPU DMA1 CPU
DMA channel 1 terminal count
Note The bus is always released.
Figure 6-7. Single-Step Transfer Example 2
DMARQ0 (Internal signal) DMARQ1 (Internal signal) Note
CPU CPU
Note
Note
Note
Note
Note
DMA1 CPU
CPU DMA1 CPU DMA1 CPU DMA0 CPU DMA0 CPU DMA0 CPU DMA1 CPU
DMA channel 0 terminal count
DMA channel 1 terminal count
Note The bus is always released.
6.5.3 Block transfer mode In the block transfer mode, once transfer starts, the DMAC continues the transfer operation without releasing the bus until a terminal count occurs. No other DMA requests are acknowledged during block transfer. After the block transfer ends and the DMAC releases the bus, another DMA transfer can be acknowledged.
User's Manual U15195EJ3V0UD
125
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.6
Transfer Types
6.6.1 Two-cycle transfer In two-cycle transfer, data transfer is performed in two cycles, a read cycle (source to DMAC) and a write cycle (DMAC to destination). In the first cycle, the source address is output and reading is performed from the source to the DMAC. In the second cycle, the destination address is output and writing is performed from the DMAC to the destination. Caution An idle cycle of 1 clock is always inserted between the read cycle and write cycle.
126
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.7
Transfer Object
6.7.1 Transfer type and transfer object Table 6-1 lists the relationship between the transfer type and transfer object (: Transfer enabled, x: Transfer disabled). Table 6-1. Relationship Between Transfer Type and Transfer Object
Destination Two-Cycle Transfer Internal ROM x x x x x On-Chip Peripheral I/O x Internal RAM x x External Memory, External I/O x
On-chip peripheral I/O Source External I/O Internal RAM External memory Internal ROM
Cautions 1. The operation is not guaranteed for combinations of transfer destination and source marked with "x" in Table 6-1. x 2. Addresses between 3FFF000H and 3FFFFFFH cannot be specified for the source and destination address of DMA transfer. Be sure to specify an address between FFFF000H and FFFFFFFH. Remark During two-cycle 16-bit transfer, if the data bus width of the transfer source and that of the transfer destination are different, the operation becomes as follows. In the case of transfer from a 16-bit bus to an 8-bit bus A 16-bit read cycle is generated and then an 8-bit write cycle is sequentially generated twice. In the case of transfer from an 8-bit bus to a 16-bit bus An 8-bit read cycle is sequentially generated twice and then a 16-bit write cycle is generated. 6.7.2 External bus cycles during DMA transfer (two-cycle transfer) The external bus cycles during DMA transfer (two-cycle transfer) are shown below. Table 6-2. External Bus Cycles During DMA Transfer (Two-Cycle Transfer)
Transfer Object On-chip peripheral I/O, internal RAM External memory, external I/O None Yes
Note
External Bus Cycle - SRAM, external ROM, external I/O access cycle
Note Other external cycles such as a CPU-based bus cycle can be started.
User's Manual U15195EJ3V0UD
127
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.8
DMA Channel Priorities
The DMA channel priorities are fixed as follows. DMA channel 0 > DMA channel 1 > DMA channel 2 > DMA channel 3 These priorities are valid in the TI state only. In the block transfer mode, the channel used for transfer is never switched. In the single-step transfer mode, if a higher priority DMA transfer request is issued while the bus is released (in the TI state), the higher priority DMA transfer request is acknowledged. Caution Be sure not to activate multiple DMA channels using the same start factor. If multiple channels are activated in this way, a lower priority DMA channel may be acknowledged prior to a higher priority DMA channel.
6.9
Next Address Setting Function
The DMA source address registers (DSAnH, DSAnL), DMA destination address registers (DDAnH, DDAnL), and DMA transfer count register (DBCn) are buffer registers with a 2-stage FIFO configuration (n = 0 to 3). When the terminal count is issued, these registers are automatically rewritten with the value that was set immediately before. Therefore, during DMA transfer, transfer is automatically started when a new DMA transfer setting is made for these registers and both the Enn and MLEn bits of the DCHCn register are set (1) (however, the DMA transfer end interrupt may be issued even if DMA transfer is automatically started). Figure 6-8 shows the configuration of the buffer register. Figure 6-8. Buffer Register Configuration
Data read
Internal bus
Data write
Master register
Slave register
Address/ count controller
128
User's Manual U15195EJ3V0UD
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.10 DMA Transfer Start Factors
There are two types of DMA transfer start factors, as shown below. (1) Request from software If the STGn, Enn, and TCn bits of the DCHCn register are set as follows, DMA transfer starts (n = 0 to 3). * STGn bit = 1 * Enn bit = 1 * TCn bit = 0 (2) Request from on-chip peripheral I/O If, when the Enn and TCn bits of the DCHCn register are set as shown below, an interrupt request is issued from the on-chip peripheral I/O that is set in the DTFRn register, DMA transfer starts (n = 0 to 3). * Enn bit = 1 * TCn bit = 0
6.11 Forcible Interruption
DMA transfer can be forcibly interrupted by NMI input during DMA transfer. At such a time, the DMAC resets the Enn bit of the DCHCn register of all channels to 0 and the DMA transfer disabled state is entered. An NMI request can then be acknowledged after the DMA transfer executed during NMI input is terminated (n = 0 to 3). In the single-step transfer mode or block transfer mode, the DMA transfer request is held in the DMAC. If the Enn bit is set to 1, DMA transfer restarts from the point it was interrupted. In the single transfer mode, if the Enn bit is set to 1, the next DMA transfer request is acknowledged and DMA transfer starts. Figure 6-9. Example of Forcible Interruption of DMA Transfer
NMI (input) Forcible interruption DMA transfer DMA transfer stop Transfer restart DMA transfer Forcible interruption DMA transfer stop
DDIS register
01H
DRST register E00 bit of DCHC register
01H
User's Manual U15195EJ3V0UD
129
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
6.12 DMA Transfer End
When DMA transfer ends and the TCn bit of the DCHCn register is set to 1, a DMA transfer end interrupt (INTDMAn) is issued to the interrupt controller (INTC) (n = 0 to 3).
6.13 Forcible Termination
In addition to the forcible interruption operation by means of NMI input, DMA transfer can be forcibly terminated by the INITn bit of the DCHCn register (n = 0 to 3). Remark Because the DSAn, DDAn, and DBCn registers are FIFO-configured buffer registers, the values are held even after a forcible termination. Also, the next transfer condition can be set even during DMA transfer. But, because the DADCn and DCHCn registers are not buffer registers, setting during DMA transfer is invalid (refer to 6.9 Next Address Setting Function and 6.3.4 DMA addressing control registers 0 to 3 (DADC0 to DADC3)).
6.14 Cautions
(1) Memory boundary The transfer operation is not guaranteed if the source or the destination address exceeds the area of DMA objects (external memory, internal RAM, or on-chip peripheral I/O) during DMA transfer. (2) Transfer of misaligned data DMA transfer of 16-bit bus width misaligned data is not supported. (3) Times related to DMA transfer The overhead before and after DMA transfer and the minimum execution clock for DMA transfer are shown below. * Internal RAM access: 1 clock Note that for external memory access, the time depends on the type of external memory connected. (4) Bus arbitration for CPU The CPU can access external memory, on-chip peripheral I/O, and internal RAM not undergoing DMA transfer. While data transfer between external memories or to and from I/O is being performed, the CPU can access internal RAM. While data transfer is being executed between internal RAMs, the CPU can access external memory and onchip peripheral I/O. (5) DMA start factors Be sure not to activate multiple DMA channels using the same start factor. If multiple channels are activated in this way, a lower priority DMA channel may be acknowledged prior to a higher priority DMA channel.
130
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
The V850E/IA2 is provided with a dedicated interrupt controller (INTC) for interrupt servicing and can process a total of 48 interrupt requests. An interrupt is an event that occurs independently of program execution, and an exception is an event whose occurrence is dependent on program execution. The V850E/IA2 can process interrupt requests from the on-chip peripheral hardware and external sources. Moreover, exception processing can be started by the TRAP instruction (software exception) or by generation of an exception event (i.e. fetching of an illegal opcode) (exception trap). Eight levels of software-programmable priorities can be specified for each interrupt request. Interrupt servicing starts after at least 4 system clocks (125 ns (@ 40 MHz)) following the generation of an interrupt request.
7.1
Features
Interrupts * Non-maskable interrupts: 1 source * Maskable interrupts: 47 sources * 8 levels of programmable priorities (maskable interrupts) * Multiple interrupt control according to priority * Masks can be specified for each maskable interrupt request. * Noise elimination
Note
, edge detection, and valid edge specification for external interrupt request signals.
Note For details of the noise eliminator, refer to 12.4 Noise Eliminator. Exceptions * Software exceptions: 32 sources * Exception traps: 2 sources (illegal opcode exception and debug trap) Interrupt/exception sources are listed in Table 7-1.
User's Manual U15195EJ3V0UD
131
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
Table 7-1. Interrupt/Exception Source List (1/2)
Type Classification Name Interrupt/Exception Source Controlling Register Reset Interrupt RESET NMI0 TRAP0n TRAP1n
Note 1 Note 1
Default Exception Generating Priority Unit Code
Handler Address
Restored PC
Generating Source
- - - - - P0IC0 P0IC1 P0IC2 P0IC3 P0IC4 - - - - DETIC0 DETIC1 TM0IC0 CM03IC0 TM0IC1 CM03IC1 CC10IC0
RESET input NMI input TRAP instruction TRAP instruction Illegal opcode/ DBTRAP instruction
Pin Pin - - - Pin Pin Pin Pin Pin - - ADC ADC RPU RPU RPU RPU Pin/RPU
- - - - - 0 1 2 3 4 - - 5 6 7 8 9 10 11
0000H 0010H 004nH
Note 1
00000000H Undefined 00000010H nextPC 00000040H nextPC
Non-maskable Interrupt Software exception Exception Exception
005nHNote1 00000050H nextPC 0060H 00000060H nextPC
Exception trap Exception
ILGOP/DBG0
Maskable
Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt
INTP0 INTP1 INTP2 INTP3 INTP4
INTP0 pin INTP1 pin INTP2 pin INTP3 pin INTP4 pin Not usedNote 2 Not usedNote 2 AD0 voltage detection AD1 voltage detection TM00 underflow CM003 match TM01 underflow CM013 match INTP100 pin/ CC100 match
0080H 0090H 00A0H 00B0H 00C0H - - 00F0H 0100H 0110H 0120H 0130H 0140H 0150H
00000080H nextPC 00000090H nextPC 000000A0H nextPC 000000B0H nextPC 000000C0H nextPC 000000D0H 000000E0H - -
INTDET0 INTDET1 INTTM00 INTCM003 INTTM01 INTCM013 INTP100/ INTCC100
000000F0H nextPC 00000100H nextPC 00000110H nextPC 00000120H nextPC 00000130H nextPC 00000140H nextPC 00000150H nextPC
Interrupt
INTP101/ INTCC101
CC10IC1
INTP101/INTP100 pin/ CC101 match
Pin/RPU
12
0160H
00000160H nextPC
Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt
INTCM100 INTCM101 - - - - INTTM20 INTTM21
CM10IC0 CM10IC1 - - - - TM2IC0 TM2IC1
CM100 match CM101 match Not usedNote 2 Not used
Note 2
RPU RPU - - - - RPU RPU Pin/RPU Pin/RPU Pin/RPU Pin/RPU Pin/RPU Pin/RPU RPU Pin/RPU Pin/RPU RPU DMA DMA
13 14 - - - - 15 16 17 18 19 20 21 22 23 24 25 26 27 28
0170H 0180H - - - - 01D0H 01E0H 01F0H 0200H 0210H 0220H 0230H 0240H 0250H 0260H 0270H 0280H 0290H 02A0H
00000170H nextPC 00000180H nextPC 00000190H 000001A0H 000001B0H 000001C0H - - - -
Not usedNote 2 Not usedNote 2 TM20 overflow TM20 overflow INTP20 pin/CC20 match INTP21 pin/CC21 match INTP22 pin/CC22 match INTP23 pin/CC23 match INTP24 pin/CC24 match INTP25 pin/CC25 match TM3 overflow INTP30 pin/CC30 match INTP31 pin/CC31 match CM4 match signal End of DMA0 transfer End of DMA1 transfer
000001D0H nextPC 000001E0H nextPC 000001F0H nextPC 00000200H nextPC 00000210H nextPC 00000220H nextPC 00000230H nextPC 00000240H nextPC 00000250H nextPC 00000260H nextPC 00000270H nextPC 00000280H nextPC 00000290H nextPC 000002A0H nextPC
INTP20/INTCC20 CC2IC0 INTP21/INTCC21 CC2IC1 INTP22/INTCC22 CC2IC2 INTP23/INTCC23 CC2IC3 INTP24/INTCC24 CC2IC4 INTP25/INTCC25 CC2IC5 INTTM3 TM3IC0
INTP30/INTCC30 CC3IC0 INTP31/INTCC31 CC3IC1 INTCM4 INTDMA0 INTDMA1 CM4IC0 DMAIC0 DMAIC1
Notes 1. 2.
n = 0 to FH Reserved for expansion to the V850E/IA1.
User's Manual U15195EJ3V0UD
132
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
Table 7-1. Interrupt/Exception Source List (2/2)
Type Classification Name Interrupt/Exception Source Controlling Register Maskable Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt INTDMA2 INTDMA3 - - - - INTCSI0 DMAIC2 DMAIC3 - - - - CSIIC0 End of DMA2 transfer End of DMA3 transfer Not usedNote Not used Not used
Note
Default Exception Generating Priority Unit DMA DMA - - - - SIO 29 30 - - - - 31 02B0H 02C0H - - - - 0310H Code
Handler Address
Restored PC
Generating Source
000002B0H nextPC 000002C0H nextPC 000002D0H 000002E0H 000002F0H 00000300H - - - -
Note
Not usedNote CSI0 transmission complete
00000310H nextPC
Interrupt Interrupt
INTCSI1 INTSR0
CSIIC1 SRIC0
CSI1 reception complete UART0 reception complete
SIO SIO
32 33
0320H 0330H
00000320H nextPC 00000330H nextPC
Interrupt
INTST0
STIC0
UART0 transmission complete
SIO
34
0340H
00000340H nextPC
Interrupt Interrupt
INTSER0 INTSR1
SEIC0 SRIC1
UART0 receiver error UART1 reception complete
SIO SIO
35 36
0350H 0360H
00000350H nextPC 00000360H nextPC
Interrupt
INTST1
STIC1
UART1 transmission complete
SIO
37
0370H
00000370H nextPC
Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt INTAD0 INTAD1
- -
- - ADIC0 ADIC1
Not usedNote Not used
Note
- - ADC ADC - - - RPU RPU RPU RPU RPU RPU RPU
- - 38 39 - - - 40 41 42 43 44 45 46
- - 03A0H 03B0H - - - 03F0H 0400H 0410H 0420H 0430H 0440H 0450H
00000380H 00000390H
- -
End of AD0 conversion End of AD0 conversion Not usedNote Not used
Note
000003A0H nextPC 000003B0H nextPC 000003C0H 000003D0H 000003E0H - - -
- - - INTCM010 INTCM011 INTCM012 INTCM014 INTCM015 INTCM004 INTCM005
- - - CM00IC1 CM01IC1 CM02IC1 CM04IC1 CM05IC1 CM04IC0 CM05IC0
Not usedNote CM010 match CM011 match CM012 match CM014 match CM015 match CM004 match CM005 match
000003F0H nextPC 00000400H nextPC 00000410H nextPC 00000420H nextPC 00000430H nextPC 00000440H nextPC 00000450H nextPC
Note Reserved for expansion to the V850E/IA1. Remarks 1. Default priority: Restored PC: The priority order when two or more maskable interrupt requests are generated at the same time. The highest priority is 0. The value of the PC saved to EIPC or FEPC when interrupt/exception processing is started. However, the value of the PC saved when an interrupt is acknowledged during division (DIV, DIVH, DIVU, DIVHU) instruction execution is the value of the PC of the current instruction (DIV, DIVH, DIVU, DIVHU). nextPC: The PC value that starts the processing following interrupt/exception processing. 2. The execution address of the illegal instruction when an illegal opcode exception occurs is calculated by (Restored PC - 4).
User's Manual U15195EJ3V0UD
133
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.2
Non-Maskable Interrupt
A non-maskable interrupt request is acknowledged unconditionally, even when interrupts are in the interrupt disabled (DI) status. An NMI is not subject to priority control and takes precedence over all the other interrupts. A non-maskable interrupt request is input from the NMI pin. When the valid edge specified by bit 0 (ESN0) of the external interrupt mode register 0 (INTM0) is detected on the NMI pin, the interrupt occurs. While the service program of the non-maskable interrupt is being executed (PSW.NP = 1), the acknowledgement of another non-maskable interrupt request is held pending. The pending NMI is acknowledged after the original service program of the non-maskable interrupt under execution has been terminated (by the RETI instruction). Note that if two or more NMI requests are input during the execution of the service program for an NMI, the number of NMIs that will be acknowledged after PSW.NP is cleared to 0 is only one. Remark PSW.NP: The NP bit of the PSW register.
134
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.2.1 Operation If a non-maskable interrupt is generated, the CPU performs the following processing, and transfers control to the handler routine. (1) Saves the restored PC to FEPC. (2) Saves the current PSW to FEPSW. (3) Writes exception code 0010H to the higher halfword (FECC) of ECR. (4) Sets the NP and ID bits of the PSW and clears the EP bit. (5) Sets the handler address (00000010H) corresponding to the non-maskable interrupt to the PC, and transfers control. The servicing configuration of a non-maskable interrupt is shown in Figure 7-1. Figure 7-1. Servicing Configuration of Non-Maskable Interrupt
NMI input INTC acknowledged Non-maskable interrupt request
CPU processing PSW.NP 0 FEPC FEPSW ECR.FECC PSW.NP PSW.EP PSW.ID PC restored PC PSW 0010H 1 0 1 00000010H Interrupt request held pending 1
Interrupt servicing
User's Manual U15195EJ3V0UD
135
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
Figure 7-2. Acknowledging Non-Maskable Interrupt Request
(a) If a new NMI request is generated while an NMI service program is being executed
Main routine
(PSW.NP = 1)
NMI request
NMI request
NMI request held pending regardless of the value of the NP bit of the PSW
Pending NMI request processed
(b) If a new NMI request is generated twice while an NMI service program is being executed
Main routine
NMI request NMI request
Held pending because NMI service program is being processed
NMI request
Held pending because NMI service program is being processed
Only one NMI request is acknowledged even though two NMI requests are generated
136
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.2.2 Restore Execution is restored from the non-maskable interrupt servicing by the RETI instruction. When the RETI instruction is executed, the CPU performs the following processing, and transfers control to the address of the restored PC. (1) Restores the values of the PC and the PSW from FEPC and FEPSW, respectively, because the EP bit of the PSW is 0 and the NP bit of the PSW is 1. (2) Transfers control back to the address of the restored PC and PSW. Figure 7-3 illustrates how the RETI instruction is processed. Figure 7-3. RETI Instruction Processing
RETI instruction
1
PSW.EP 0 PSW.NP 0 1
PC PSW
EIPC EIPSW
PC PSW
FEPC FEPSW
Original processing restored
Caution
When the PSW.EP bit and PSW.NP bit are changed by the LDSR instruction during nonmaskable interrupt servicing, in order to restore the PC and PSW correctly during recovery by the RETI instruction, it is necessary to set PSW.EP back to 0 and PSW.NP back to 1 using the LDSR instruction immediately before the RETI instruction. The solid lines show the CPU processing flow.
Remark
User's Manual U15195EJ3V0UD
137
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.2.3 Non-maskable interrupt status flag (NP) The NP flag is a status flag that indicates that non-maskable interrupt (NMI) servicing is under execution. This flag is set when an NMI interrupt has been acknowledged, and masks all interrupt requests and exceptions to prohibit multiple interrupts from being acknowledged.
31 PSW
876543210 After reset 00000020H
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 NP EP ID SAT CY OV S Z
Bit position 7 NP
Bit name
Function Indicates whether NMI interrupt servicing is in progress. 0: No NMI interrupt servicing 1: NMI interrupt currently being serviced
7.2.4 Edge detection function (1) External interrupt mode register 0 (INTM0) External interrupt mode register 0 (INTM0) is a register that specifies the valid edge of a non-maskable interrupt (NMI). The NMI valid edge can be specified to be either the rising edge or the falling edge by the ESN0 bit. This register can be read/written in 8-bit or 1-bit units.
7 INTM0 0
6 0
5 0
4 0
3 0
2 0
1 0
<0> ESN0 Address FFFFF880H After reset 00H
Bit position 0
Bit name ESN0 Specifies the NMI pin's valid edge. 0: Falling edge 1: Rising edge
Function
138
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.3
Maskable Interrupts
Maskable interrupt requests can be masked by interrupt control registers. The V850E/IA2 has 47 maskable interrupt sources. If two or more maskable interrupt requests are generated at the same time, they are acknowledged according to the default priority. In addition to the default priority, eight levels of priorities can be specified by using the interrupt control registers (programmable priority control). When an interrupt request has been acknowledged, the acknowledgement of other maskable interrupt requests is disabled and the interrupt disabled (DI) status is set. When the EI instruction is executed in an interrupt servicing routine, the interrupt enabled (EI) status is set, which enables servicing of interrupts having a higher priority than the interrupt request in progress (specified by the interrupt control register). Note that only interrupts with a higher priority will have this capability; interrupts with the same priority level cannot be nested. However, if multiple interrupts are executed, the following processing is necessary. <1> Save EIPC and EIPSW in memory or a general-purpose register before executing the EI instruction. <2> Execute the DI instruction before executing the RETI instruction, then reset EIPC and EIPSW with the values saved in <1>. 7.3.1 Operation If a maskable interrupt occurs by INT input, the CPU performs the following processing, and transfers control to a handler routine. (1) Saves the restored PC to EIPC. (2) Saves the current PSW to EIPSW. (3) Writes an exception code to the lower halfword of ECR (EICC). (4) Sets the ID bit of the PSW and clears the EP bit. (5) Sets the handler address corresponding to each interrupt to the PC, and transfers control. The servicing configuration of a maskable interrupt is shown in Figure 7-4.
User's Manual U15195EJ3V0UD
139
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
Figure 7-4. Maskable Interrupt Servicing
INT input INTC acknowledged xxIF = 1 Yes xxMK = 0 Yes
Priority higher than that of interrupt currently being serviced?
No
No Is the interrupt mask released?
No
Yes
Priority higher than that of other interrupt request?
No
Yes
Highest default priority of interrupt requests with the same priority?
No
Yes Maskable interrupt request CPU processing PSW.NP 0 PSW.ID 0 EIPC EIPSW ECR.EICC PSW.EP PSW.ID Corresponding bit of ISPRNote PC restored PC PSW exception code 0 1 1 handler address Interrupt request held pending 1 1 Interrupt request held pending
Interrupt servicing
Note For details of the ISPR register, see 7.3.6 In-service priority register (ISPR).
The INT input masked by the interrupt controllers and the INT input that occurs while another interrupt is being serviced (when PSW.NP = 1 or PSW.ID = 1) are held pending internally by the interrupt controller. In such case, if the interrupts are unmasked, or when PSW.NP = 0 and PSW.ID = 0 as set by the RETI and LDSR instructions, input of the pending INT starts the new maskable interrupt servicing.
140
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.3.2 Restore Recovery from maskable interrupt servicing is carried out by the RETI instruction. When the RETI instruction is executed, the CPU performs the following steps, and transfers control to the address of the restored PC. (1) Restores the values of the PC and the PSW from EIPC and EIPSW because the EP bit of the PSW is 0 and the NP bit of the PSW is 0. (2) Transfers control to the address of the restored PC and PSW. Figure 7-5 illustrates the processing of the RETI instruction. Figure 7-5. RETI Instruction Processing
RETI instruction
1
PSW.EP 0 PSW.NP 0 PC PSW Corresponding bit of ISPRNote EIPC EIPSW 0 PC PSW FEPC FEPSW 1
Restores original processing
Note For details of the ISPR register, see 7.3.6 In-service priority register (ISPR). Caution When the PSW.EP bit and the PSW.NP bit are changed by the LDSR instruction during maskable interrupt servicing, in order to restore the PC and PSW correctly during recovery by the RETI instruction, it is necessary to set PSW.EP back to 0 and PSW.NP back to 0 using the LDSR instruction immediately before the RETI instruction. The solid lines show the CPU processing flow.
Remark
User's Manual U15195EJ3V0UD
141
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.3.3 Priorities of maskable interrupts The V850E/IA2 provides multiple interrupt servicing in which an interrupt is acknowledged while another interrupt is being serviced. Multiple interrupts can be controlled by priority levels. There are two types of priority level control: control based on the default priority levels, and control based on the programmable priority levels that are specified by the interrupt priority level specification bit (xxPRn) of the interrupt control register (xxICn). When two or more interrupts having the same priority level specified by the xxPRn bit are generated at the same time, interrupts are serviced in order depending on the priority level allocated to each interrupt request type (default priority level) beforehand. level specification flag. Note that when an interrupt request is acknowledged, the ID flag of PSW is automatically set to 1. Therefore, when multiple interrupts are to be used, clear the ID flag to 0 beforehand (for example, by placing the EI instruction in the interrupt service program) to set the interrupt enable mode. Remark xx: Identification name of each peripheral unit (refer to Table 7-2) n: Peripheral unit number (refer to Table 7-2) For more information, refer to Table 7-1 Interrupt/Exception Source List. The programmable priority control customizes interrupt requests into eight levels by setting the priority
142
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
Figure 7-6. Example of Servicing in Which Another Interrupt Request Is Issued While an Interrupt Is Being Serviced (1/2)
Main routine Servicing of a EI Interrupt request a (level 3) Interrupt request b (level 2) EI Interrupt request b is acknowledged because the priority of b is higher than that of a and interrupts are enabled. Servicing of b
Servicing of c
Interrupt request c (level 3)
Interrupt request d (level 2) Servicing of d
Although the priority of interrupt request d is higher than that of c, d is held pending because interrupts are disabled.
Servicing of e EI Interrupt request e (level 2) Interrupt request f (level 3) Interrupt request f is held pending even if interrupts are enabled because its priority is lower than that of e. Servicing of f
Servicing of g EI Interrupt request g (level 1) Interrupt request h (level 1) Interrupt request h is held pending even if interrupts are enabled because its priority is the same as that of g. Servicing of h
Caution The values of the EIPC and EIPSW registers must be saved before executing multiple interrupts. When returning from multiple interrupt servicing, restore the values of EIPC and EIPSW after executing the DI instruction. Remarks 1. a to u in the figure are the temporary names of interrupt requests shown for the sake of explanation. 2. The default priority in the figure indicates the relative priority between two interrupt requests.
User's Manual U15195EJ3V0UD
143
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
Figure 7-6. Example of Servicing in Which Another Interrupt Request Is Issued While an Interrupt Is Being Serviced (2/2)
Main routine Servicing of i EI Interrupt request i (level 2) EI Interrupt request j (level 3) Interrupt request k (level 1) Servicing of k
Interrupt request j is held pending because its priority is lower than that of i. k that occurs after j is acknowledged because it has the higher priority.
Servicing of j
Servicing of l Interrupt request m (level 3) Interrupt request n (level 1) Servicing of n Interrupt requests m and n are held pending because servicing of l is performed in the interrupt disabled status.
Interrupt request l (level 2)
Pending interrupt requests are acknowledged after servicing of interrupt request l. At this time, interrupt requests n is acknowledged first even though m has occurred first because the priority of n is higher than that of m.
Servicing of m
Interrupt request o (level 3)
Interrupt request p (level 2)
Servicing of o Servicing of p EI Servicing of q EI Servicing of r EI Interrupt request q Interrupt (level 1) request r (level 0)
If levels 3 to 0 are acknowledged Servicing of s Interrupt request t (level 2) Interrupt request u (level 2) Pending interrupt requests t and u are acknowledged after servicing of s. Because the priorities of t and u are the same, u is acknowledged first because it has the higher default priority, regardless of the order in which the interrupt requests have been generated.
Interrupt request s (level 1)
Note 1
Note 2
Servicing of u
Servicing of t
Notes 1. 2.
Lower default priority Higher default priority
Caution
The values of the EIPC and EIPSW registers must be saved before executing multiple interrupts. When returning from multiple interrupt servicing, restore the values of EIPC and EIPSW after executing the DI instruction.
144
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
Figure 7-7. Example of Servicing Interrupt Requests Generated Simultaneously
Main routine EI Interrupt request a (level 2) Interrupt request b (level 1) Interrupt request c (level 1) Servicing of interrupt request b
NMI request
. .
Default priority a>b>c
Servicing of interrupt request c
Interrupt request b and c are acknowledged first according to their priorities. Because the priorities of b and c are the same, b is acknowledged first according to the default priority.
Servicing of interrupt request a
Caution
The values of the EIPC and EIPSW registers must be saved before executing multiple interrupts. When returning from multiple interrupt servicing, restore the values of EIPC and EIPSW after executing the DI instruction.
Remark
a to c in the figure are pseudo names given to interrupt requests for the sake of explanation.
User's Manual U15195EJ3V0UD
145
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.3.4 Interrupt control register (xxICn) An interrupt control register is assigned to each interrupt request (maskable interrupt) and sets the control conditions for each maskable interrupt request. This register can be read/written in 8-bit or 1-bit units. Caution Read the xxIFn bit of the xxICn register in the interrupt disabled (DI) state. Otherwise if the timing of interrupt acknowledgement and bit reading conflict, normal values may not be read.
<7> xxICn xxIFn
<6> xxMKn
5 0
4 0
3 0
<2> xxPRn2
<1> xxPRn1
<0> xxPRn0 Address FFFFF110H to FFFF18AH After reset 47H
Bit position 7
Bit name xxIFn
Function This is an interrupt request flag. 0: Interrupt request not issued 1: Interrupt request issued The flag xxlFn is reset automatically by the hardware if an interrupt request is acknowledged. This is an interrupt mask flag. 0: Enables interrupt servicing 1: Disables interrupt servicing (pending) 8 levels of priority order are specified for each interrupt.
6
xxMKn
2 to 0
xxPRn2 to xxPRn0
xxPRn2 0 0 0 0 1 1 1 1
xxPRn1 0 0 1 1 0 0 1 1
xxPRn0 0 1 0 1 0 1 0 1
Interrupt priority specification bit Specifies level 0 (highest). Specifies level 1. Specifies level 2. Specifies level 3. Specifies level 4. Specifies level 5. Specifies level 6. Specifies level 7 (lowest).
Remark xx: Identification name of each peripheral unit (refer to Table 7-2) n: Peripheral unit number (refer to Table 7-2).
The address and bit of each interrupt control register are as follows.
146
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
Table 7-2. Addresses and Bits of Interrupt Control Registers (1/2)
Address Register <7> FFFFF110H FFFFF112H FFFFF114H FFFFF116H FFFFF118H P0IC0 P0IC1 P0IC2 P0IC3 P0IC4 P0IF0 P0IF1 P0IF2 P0IF3 P0IF4 - - DETIF0 DETIF1 TM0IF0 CM03IF0 TM0IF1 <6> P0MK0 P0MK1 P0MK2 P0MK3 P0MK4 - - DETMK0 DETMK1 TM0MK0 CM03MK0 TM0MK1 CM03MK1 CC10MK0 CC10MK1 CM10MK0 CM10MK1 - - - - TM2MK0 TM2MK1 CC2MK0 CC2MK1 CC2MK2 CC2MK3 CC2MK4 CC2MK5 TM3MK0 CC3MK0 CC3MK1 5 0 0 0 0 0 - - 0 0 0 0 0 0 0 0 0 0 - - - - 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 - - 0 0 0 0 0 0 0 0 0 0 - - - - 0 0 0 0 0 0 0 0 0 0 0 Bit 3 0 0 0 0 0 - - 0 0 0 0 0 0 0 0 0 0 - - - - 0 0 0 0 0 0 0 0 0 0 0 <2> P0PR02 P0PR12 P0PR22 P0PR32 P0PR42 - - DETPR02 DETPR12 TM0PR02 <1> P0PR01 P0PR11 P0PR21 P0PR31 P0PR41 - - DETPR01 DETPR11 TM0PR01 <0> P0PR00 P0PR10 P0PR20 P0PR30 P0PR40 - - DETPR00 DETPR10 TM0PR00
FFFFF11AH Not usedNote FFFFF11CH Not usedNote FFFFF11EH DETIC0 FFFFF120H FFFFF122H FFFFF124H FFFFF126H FFFFF128H DETIC1 TM0IC0 CM3IC0 TM0IC1
CM03PR02 CM03PR01 CM03PRC0 TM0PR12 TM0PR11 TM0PR10
CM03IC1 CM03IF1
CM03PR12 CM03PR11 CM03PR10 CC10PR02 CC10PR01 CC10PR00 CC10PR12 CC10PR11 CC10PR10 CM10PR02 CM10PR01 CM10PR00 CM10PR12 CM10PR11 CM10PR10 - - - - TM2PR02 TM2PR12 CC2PR02 CC2PR12 CC2PR22 CC2PR32 CC2PR42 CC2PR52 TM3PR02 CC3PR02 CC3PR12 - - - - TM2PR01 TM2PR11 CC2PR01 CC2PR11 CC2PR21 CC2PR31 CC2PR41 CC2PR51 TM3PR01 CC3PR01 CC3PR11 - - - - TM2PR00 TM2PR10 CC2PR00 CC2PR10 CC2PR20 CC2PR30 CC2PR40 CC2PR50 TM3PR00 CC3PR00 CC3PR10
FFFFF12AH CC10IC0 CC10IF0 FFFFF12CH CC1CIC1 CC10IF1 FFFFF12EH CM10IC0 CM10IF0 FFFFF130H FFFFF132H FFFFF134H FFFFF136H FFFFF138H CM10IC1 CM10IF1 Not usedNote Not usedNote Not usedNote Not usedNote - - - - TM2IF0 TM2IF1 CC2IF0 CC2IF1 CC2IF2 CC2IF3 CC2IF4 CC2IF5 TM3IF0 CC3IF0 CC3IF1
FFFFF13AH TM2IC0 FFFFF13CH TM2IC1 FFFFF13EH CC2IC0 FFFFF140H FFFFF142H FFFFF144H FFFFF146H FFFFF148H CC2IC1 CC2IC2 CC2IC3 CC2IC4 CC2IC5
FFFFF14AH TM3IC0 FFFFF14CH CC3IC0 FFFFF14EH CC3IC1
Note Reserved for expansion to V850E/IA1.
User's Manual U15195EJ3V0UD
147
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
Table 7-2. Addresses and Bits of Interrupt Control Registers (2/2)
Address Register <7> FFFFF150H FFFFF152H FFFFF154H FFFFF156H FFFFF158H CM4IC0 DMAIC0 DMAIC1 DMAIC2 DMAIC3 CM4IF0 DMAIF0 DMAIF1 DMAIF2 DMAIF3 - - - - CSIIF0 CSIIF1 SRIF0 STIF0 SEIF0 SRIF1 STIF1 - - ADIF0 ADIF1 - - - <6> CM4MK0 DMAMK0 DMAMK1 DMAMK2 DMAMK3 - - - - CSIMK0 CSIMK1 SRMK0 STMK0 SEMK0 SRMK1 STMK1 - - ADMK0 ADMK1 - - - CM00MK1 CM01MK1 CM02MK1 CM04MK1 CM05MK1 CM04MK0 CM05MK0 5 0 0 0 0 0 - - - - 0 0 0 0 0 0 0 - - 0 0 - - - 0 0 0 0 0 0 0 4 0 0 0 0 0 - - - - 0 0 0 0 0 0 0 - - 0 0 - - - 0 0 0 0 0 0 0 Bit 3 0 0 0 0 0 - - - - 0 0 0 0 0 0 0 - - 0 0 - - - 0 0 0 0 0 0 0 <2> CM4PR02 DMAPR02 DMAPR12 DMAPR22 DMAPR32 - - - - CSIPR02 CSIPR12 SRPR02 STPR02 SEPR02 SRPR12 STPR12 - - ADPR02 ADPR12 - - - <1> CM4PR01 DMAPR01 DMAPR11 DMAPR21 DMAPR31 - - - - CSIPR01 CSIPR11 SRPR01 STPR01 SEPR01 SRPR11 STPR11 - - ADPR01 ADPR11 - - - <0> CM4PR00 DMAPR00 DMAPR10 DMAPR20 DMAPR30 - - - - CSIPR00 CSIPR10 SRPR00 STPR00 SEPR00 SRPR10 STPR10 - - ADPR00 ADPR10 - - -
FFFFF15AH Not usedNote FFFFF15CH Not usedNote FFFFF15EH Not usedNote FFFFF160H FFFFF162H FFFFF164H FFFFF166H FFFFF168H Not usedNote CSIIC0 CSIIC1 SRIC0 STIC0
FFFFF16AH SEIC0 FFFFF16CH SRIC1 FFFFF16EH STIC1 FFFFF170H FFFFF172H FFFFF174H FFFFF176H FFFFF178H Not usedNote Not usedNote ADIC0 ADIC1 Not usedNote
FFFFF17AH Not usedNote FFFFF17CH Not usedNote
FFFFF17EH CM00IC1 CM00IF1 FFFFF180H FFFFF182H FFFFF184H FFFFF186H FFFFF188H CM01IC1 CM01IF1 CM02IC1 CM02IF1 CM04IC1 CM04IF1 CM05IC1 CM05IF1 CM04IC0 CM04IF0
CM00PR12 CM00PR11 CM00PR10 CM01PR12 CM01PR11 CM01PR10 CM02PR12 CM02PR11 CM02PR10 CM04PR12 CM04PR11 CM04PR10 CM05PR12 CM05PR11 CM05PR10 CM04PR02 CM04PR01 CM04PR00 CM05PR02 CM05PR01 CM05PR00
FFFFF18AH CM05IC0 CM05IF0
Note Reserved for expansion to V850E/IA1.
148
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.3.5 Interrupt mask registers 0 to 3 (IMR0 to IMR3) These registers set the interrupt mask state for the maskable interrupts. The xxMKn bit of the IMR0 to IMR3 registers is equivalent to the xxMKn bit of the xxICn register. IMRm can be read/written in 16-bit units (m = 0 to 3). When the IMRm register is divided into two registers: higher 8 bits (IMRmH register) and lower 8 bits (IMRmL register), these registers can be read/written in 8-bit or 1-bit units.
<15>
<14>
<13>
<12>
<11>
<10>
<9>
<8>
Address FFFFF100H
After reset FFFFH
IMR0 CM10MK0 CC10MK1 CC10MK0 CM03MK1 TM0MK1 CM03MK0 TM0MK0 DETMK1 <7> DETMK0 6 1 5 1 <4> P0MK4 <3> P0MK3 <2> P0MK2 <1> P0MK1 <0> P0MK0
<15>
<14>
<13>
<12>
<11>
<10>
<9>
<8>
Address FFFFF102H
After reset FFFFH
IMR1 CC3MK1 CC3MK0 TM3MK0 CC2MK5 CC2MK4 CC2MK3 CC2MK2 CC2MK1 <7> <6> <5> 4 1 3 1 2 1 1 1 <0> CM10MK1
CC2MK0 TM2MK1 TM2MK0
<15> IMR2 STMK1 7 1
<14> SRMK1 6 1
<13> SEMK0 5 1
<12> STMK0 <4>
<11> SRMK0 <3>
<10> CSIMK1 <2>
<9> CSIMK0 <1>
8 1 <0>
Address FFFFF104H
After reset FFFFH
DMAMK3 DMAMK2 DMAMK1 DMAMK0 CM4MK0
15 IMR3 1 <7> CM00MK1
14 1 6 1
<13>
<12>
<11>
<10>
<9>
<8>
Address FFFFF106H
After reset FFFFH
CM05MK0 CM04MK0 CM05MK1 CM04MK1 CM02MK1 CM01MK1 5 1 4 1 <3> ADMK1 <2> ADMK0 1 1 0 1
Bit position
Bit name
Function Interrupt mask flag 0: Interrupt servicing enabled 1: Interrupt servicing disabled (pending)
15 to 7, 4 to 0 (IMR0) xxMKn 15 to 5, 0 (IMR1) 15 to 9, 4 to 0 (IMR2) 13 to 7, 3, 2 (IMR3)
Remark xx: Identification name of each peripheral unit (refer to Table 7-2). n: Peripheral unit number (refer Table 7-2)
User's Manual U15195EJ3V0UD
149
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.3.6 In-service priority register (ISPR) This register holds the priority level of the maskable interrupt currently acknowledged. When an interrupt request is acknowledged, the bit of this register corresponding to the priority level of that interrupt request is set to 1 and remains set while the interrupt is serviced. When the RETI instruction is executed, the bit corresponding to the interrupt request having the highest priority is automatically reset to 0 by hardware. However, it is not reset to 0 when execution is returned from non-maskable interrupt servicing or exception processing. This register is read-only in 8-bit or 1-bit units. Caution In the interrupt enabled (EI) state, if an interrupt is acknowledged during the reading of the ISPR register, the value of the ISPR register may be read after the bit is set (1) by this interrupt acknowledgement. To read the value of the ISPR register properly before interrupt acknowledgement, read it in the interrupt disabled (DI) state.
<7> ISPR ISPR7
<6> ISPR6
<5> ISPR5
<4> ISPR4
<3> ISPR3
<2> ISPR2
<1> ISPR1
<0> ISPR0 Address FFFFF1FAH After reset 00H
Bit position 7 to 0
Bit name ISPR7 to ISPR0
Function Indicates priority of interrupt currently acknowledged 0: Interrupt request with priority n not acknowledged 1: Interrupt request with priority n acknowledged
Remark
n = 0 to 7 (priority level)
150
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.3.7 Maskable interrupt status flag (ID) The ID flag is bit 5 of the PSW and this controls the maskable interrupt's operating state, and stores control information regarding enabling or disabling of interrupt requests.
31 PSW
876543210 After reset 00000020H
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 NP EP ID SAT CY OV S Z
Bit position 5 ID
Bit name
Function Indicates whether maskable interrupt servicing is enabled or disabled. 0: Maskable interrupt request acknowledgement enabled 1: Maskable interrupt request acknowledgement disabled (pending) This bit is set to 1 by the DI instruction and reset to 0 by the EI instruction. Its value is also modified by the RETI instruction or LDSR instruction when referencing the PSW. Non-maskable interrupt requests and exceptions are acknowledged regardless of this flag. When a maskable interrupt is acknowledged, the ID flag is automatically set to 1 by hardware. The interrupt request generated during the acknowledgement disabled period (ID = 1) is acknowledged when the xxIFn bit of xxICn register is set to 1, and the ID flag is reset to 0.
7.3.8 Interrupt trigger mode selection The valid edge of the INTPn, ADTRG0, ADTRG1, TIUD10, TCUD10, TCLR10, TCLR3, and TI3 pins can be selected by program. The edge that can be selected as the valid edge is one of the following (n = 0 to 4, 20 to 25, 30, 31, 100, 101). * Rising edge * Falling edge * Both the rising and falling edges When the INTPn, ADTRG0, ADTRG1, TIUD10, TCUD10, TCLR10, TCLR3, and TI3 signals are edge-detected, they become an interrupt source or capture trigger. The valid edge is specified by external interrupt mode registers 1 and 2 (INTM1 and INTM2), signal edge selection register 10 (SESA10), the valid edge selection register (SESC), and TM2 input filter mode registers 0 to 5 (FEM0 to FEM5).
User's Manual U15195EJ3V0UD
151
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
(1) External interrupt mode registers 1, 2 (INTM1, INTM2) These registers specify the valid edge for external interrupt requests (INTP0 to INTP4), input via external pins. The correspondence between each register and the external interrupt requests that register controls is shown below. * INTM1: INTP0, INTP1, INTP2/ADTRG0, INTP3/ADTRG1 * INTM2: INTP4 INTP2 and INTP3 function alternately as ADTRG0 and ADTRG1 (A/D converter external trigger input). Therefore, if the external trigger mode has been set by the TRG0 to TRG2 bits of A/D converter mode register n0 (ADSCMn0), setting the ES20 and ES21, and ES30 and ES31 bits of INTM1 also specifies the valid edge of the external trigger input (ADTRG0 and ADTRG1) (n = 0, 1). The valid edge can be specified independently for each pin (rising edge, falling edge, or both rising and falling edges). These registers can be read/written in 8-bit or 1-bit units.
7 INTM1 ES31
6 ES30
5 ES21
4 ES20
3 ES11
2 ES10
1 ES01
0 ES00
Address FFFFF882H
After reset 00H
INTP3/ADTRG1 7 INTM2 0 6 0
INTP2/ADTRG0 5 0 4 0 3 0
INTP1 2 0 1
INTP0 0 ES40 Address FFFFF884H After reset 00H
ES41
INTP4
Bit position 7 to 0 (INTM1), 1, 0 (INTM2)
Bit name ESn1, ESn2 (n = 0 to 4)
Function Specifies the valid edge of the INTPn, ADTRG0 and ADTRG1 pins.
ESn1 0 0 1 1
ESn0 0 1 0 1 Falling edge Rising edge Setting prohibited
Valid edge
Both rising and falling edges
152
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
(2) Signal edge selection register 10 (SESA10) These registers specify the valid edge of external interrupt requests (INTP100, INTP101, TIUD10, TCUD10, and TCLR10), input via external pins. The valid edge can be specified independently for each pin (rising edge, falling edge, or both rising and falling edges). These registers can be read/written in 8-bit or 1-bit units. Cautions 1. The bits of the SESA10 register cannot be changed during TM10 operation (TM1CE0 bit of timer control register 10 (TMC10) = 1). 2. TM1CE0 bit must be set (1) before using the TCUD10/INTP100 and TCLR10/INTP101 pins as INTP100 and INTP101, even if not using timer 1. 3. Setting the trigger mode of the INTP100, INTP101, TIUD10, TCUD10, or TCLR10 pin should be performed after setting the PMC1 register. If the PMC1 register is set after setting the SESA10 register, an invalid interrupt may occur when the PMC1 register is set. (1/2)
7 6 5 4 3 2 1 0 Address FFFFF5EDH After reset 00H
SESA10 TESUD01 TESUD00 CESUD01 CESUD00 IES1011 IES1010 IES1001 IES1000 TIUD10, TCUD10 TCLR10 INTP101 INTP100
Bit position 7, 6
Bit name TESUD01, TESUD00
Function Specifies the valid edge of the TIUD10 and TCUD10 pins.
TESUD01 0 0 1 1
TESUD00 0 1 0 1 Falling edge Rising edge Setting prohibited
Valid edge
Both rising and falling edges
Cautions 1. The values set to the TESUD01 and TESUD00 bits are valid only in UDC mode ANote 1 and UDC mode BNote 1. 2. If TM10 operation has been specified in mode 4Note 2, the valid edge specification (TESUD01 and TESUD00 bits) for the TIUD10 and TCUD10 pins is invalid.
Notes 1. 2.
See 9.2.4 (2) Timer unit mode register 0 (TUM0). See 9.2.4 (6) Prescaler mode register 10 (PRM10).
User's Manual U15195EJ3V0UD
153
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
(2/2)
Bit position 5, 4 Bit name CESUD01, CESUD00 Function Specifies the valid edge of the TLCR10 pin
CESUD01 0 0 1 1
CESUD00 0 1 0 1 Falling edge Rising edge Low level High level
Valid edge
The setting values of the CESUD01 and CESUD00 bits and the operation of TM10 are as follows. 00: TM10 cleared after detection of TCLR10 rising edge 01: TM10 cleared after detection of TCLR10 falling edge 10: TM10 holds cleared status while TCLR10 input is low level 11: TM10 holds cleared status while TCLR10 input is high level Caution The values set to the CESUD01 and CESUD00 bits are valid only in UDC mode ANote.
3, 2
IES1011, IES1010
Specifies the valid edge of the pin selected using the CSL0 bit of the CSL10 register (INTP101/INTP100)
IES1011 0 0 1 1
IES1010 0 1 0 1 Falling edge Rising edge Setting prohibited
Valid edge
Both rising and falling edges
1, 0
IES1001, IES1000
Specifies the valid edge of the INTP100 pin
IES1001 0 0 1 1
IES1000 0 1 0 1 Falling edge Rising edge Setting prohibited
Valid edge
Both rising and falling edges
Note See 9.2.4 (2) Timer unit mode register 0 (TUM0).
154
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
(3) Valid edge selection register (SESC) This register specifies the valid edge for external interrupt requests (INTP30, INTP31, TCLR3, TI3), input via external pins. The valid edge can be specified independently for each pin (rising edge, falling edge, or both rising and falling edges). This register can be read/written in 8-bit or 1-bit units. Cautions 1. The TM3CAE and TM3CE bits of timer control register 30 (TMC30) must be set (1) before using the TI3/TCLR3/INTP30 and TO3/INTP31 pins as INTP30 and INTP31, even if not using timer 3. 2. Setting the trigger mode of the INTP30, INTP31, TCLR3, or TI3 pin should be performed after setting the PMC2 register. If the PMC2 register is set after setting the SESC register, an invalid interrupt may occur when the PMC2 register is set.
7 SESC TES31 TI3
6 TES30
5 CES31
4 CES30
3 IES311
2 IES310
1 IES301
0 IES300
Address FFFFF689H
After reset 00H
TCLR3
INTP31
INTP30
Bit position 7, 6
Bit name TES31, TES30 CES31, CES30
Function Specifies the valid edge of the INTP30, INTP31, TCLR3, or TI3 pins.
5, 4
xESn1 0 0
xESn0 0 1 0 1 Falling edge Rising edge Setting prohibited
Valid edge
3, 2
IES311, IES310
1 1
Both rising and falling edges
1, 0
TES301, TES300
Remark
n = 3, 30, 31
User's Manual U15195EJ3V0UD
155
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
(4) Timer 2 input filter mode registers 0 to 5 (FEM0 to FEM5) These registers specify the valid edge for external interrupts input to timer 2 (INTP20 to INTP25). below. * FEM0: INTP20 * FEM1: INTP21 * FEM2: INTP22 * FEM3: INTP23 * FEM4: INTP24 * FEM5: INTP25 The valid edge can be specified independently for each pin (rising edge, falling edge, or both rising and falling edges). These registers can be read/written in 8-bit or 1-bit units. Cautions 1. Be sure to clear (0) the STFTE bit of timer 2 clock stop register 0 (STOPTE0) even when using the TI2/INTP20, TO21/INTP21, TO22/INTP22, TO23/INTP23, TO24/INTP24, and TCLR2/INTP25 pins as INTP20, INTP21, INTP22, INTP23, INTP24, and INTP25, respectively, even if not using timer 2. 2. Setting the trigger mode of the INTP2n pin should be performed after setting the PMC2 register. If the PMC2 register is set after setting the FEMn register, an invalid interrupt may occur when the PMC2 register is set (n = 0 to 5). The correspondence between each register and the external interrupt request that register controls is shown
156
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
(1/2)
7 FEM0 DFEN00 6 0 5 0 4 0 3 2 1 0 TMS000 Address FFFFF630H After reset 00H
EDGE010 EDGE000 TMS010 INTP20
7 FEM1 DFEN01
6 0
5 0
4 0
3
2
1
0 TMS001
Address FFFFF631H
After reset 00H
EDGE011 EDGE001 TMS011 INTP21
7 FEM2 DFEN02
6 0
5 0
4 0
3
2
1
0 TMS002
Address FFFFF632H
After reset 00H
EDGE012 EDGE002 TMS012 INTP22
7 FEM3 DFEN03
6 0
5 0
4 0
3
2
1
0 TMS003
Address FFFFF633H
After reset 00H
EDGE013 EDGE003 TMS013 INTP23
7 FEM4 DFEN04
6 0
5 0
4 0
3
2
1
0 TMS004
Address FFFFF634H
After reset 00H
EDGE014 EDGE004 TMS014 INTP24
7 FEM5 DFEN05
6 0
5 0
4 0
3
2
1
0 TMS005
Address FFFFF635H
After reset 00H
EDGE015 EDGE005 TMS015 INTP25
Bit position 7
Bit name DFEN0n Specifies the filter of the INTP2n pin. 0: Analog filter 1: Digital filter
Function
Caution When the DFEN0n bit = 1, the sampling clock of the digital filter is fXTM2 (clock selected by the PRM02 register). 3, 2 EDGE01n, EDGE00n Specifies the valid edge of the INTP2n pin.
EDGE01n 0 0 1 1
EDGE00n 0 1 0 1
Operation Interrupt by INTCC2nNote Rising edge Falling edge Both rising and falling edges
Note Set when INTCC2n is selected by a match between TM20, TM21 and the subchannel compare register (specified by the TMS01n, TMS00n bits) (n = 0 to 5).
Remark
n = 0 to 5
User's Manual U15195EJ3V0UD
157
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
(2/2)
Bit position 1, 0 Bit name TMS01n, TMS00n Selects the capture inputNote. Function
TMS01n 0 0 1 1
TMS00n 0 1 0 1 Used as a pin
Operation
Digital filter (noise eliminator specification) Timer-based capture to subchannel 1 Timer-based capture to subchannel 2
Note Selection of capture input based on INTCM100 and INTCM101 is valid only for the FEM1 and FEM2 registers. Set the TMS01m and TMS00m bits of the FEMm register to 00B or 01B. All other settings are prohibited (m = 1, 3 to 5). Subchannels 1 and 2 of timer 2 can be captured by INTP21, INTP22, and INTCM100, INTCM101. An example is given below. (a) When subchannel 1 is captured by INTCM101 FEM1 register = xxxxxx10B TMIC0 register = 00000010B (b) When subchannel 2 is captured by INTCM101 FEM2 register = xxxxxx11B TMIC0 register = 00001000B Remark n = 0 to 5
158
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.4
Software Exception
A software exception is generated when the CPU executes the TRAP instruction, and can be always acknowledged. 7.4.1 Operation If a software exception occurs, the CPU performs the following processing, and transfers control to the handler routine: (1) Saves the restored PC to EIPC. (2) Saves the current PSW to EIPSW. (3) Writes an exception code to the lower 16 bits (EICC) of ECR (interrupt source). (4) Sets the EP and ID bits of the PSW. (5) Sets the handler address (00000040H or 00000050H) corresponding to the software exception to the PC, and transfers control. Figure 7-8 illustrates the processing of a software exception. Figure 7-8. Software Exception Processing
TRAP instructionNote
CPU processing
EIPC EIPSW ECR.EICC PSW.EP PSW.ID PC
restored PC PSW exception code 1 1 handler address
Exception processing
Note TRAP instruction format: TRAP vector (the vector is a value from 0 to 1FH.)
The handler address is determined by the TRAP instruction's operand (vector). If the vector is 0 to 0FH, it becomes 00000040H, and if the vector is 10H to 1FH, it becomes 00000050H.
User's Manual U15195EJ3V0UD
159
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.4.2 Restore Recovery from software exception processing is carried out by the RETI instruction. By executing the RETI instruction, the CPU carries out the following processing and shifts control to the restored PC's address. (1) Loads the restored PC and PSW from EIPC and EIPSW because the EP bit of the PSW is 1. (2) Transfers control to the address of the restored PC and PSW. Figure 7-9 illustrates the processing of the RETI instruction. Figure 7-9. RETI Instruction Processing
RETI instruction
1
PSW.EP 0 PSW.NP 0 1
PC PSW
EIPC EIPSW
PC PSW
FEPC FEPSW
Original processing restored
Caution When the PSW.EP bit and the PSW.NP bit are changed by the LDSR instruction during the software exception processing, in order to restore the PC and PSW correctly during recovery by the RETI instruction, it is necessary to set PSW.EP back to 1 using the LDSR instruction immediately before the RETI instruction. Remark The solid lines show the CPU processing flow.
160
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.4.3 Exception status flag (EP) The EP flag is bit 6 of PSW, and is a status flag used to indicate that exception processing is in progress. It is set when an exception occurs.
31 PSW
876543210 After reset 00000020H
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 NP EP ID SAT CY OV S Z
Bit position 6 EP
Bit name
Function Shows that exception processing is in progress. 0: Exception processing not in progress. 1: Exception processing in progress.
User's Manual U15195EJ3V0UD
161
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.5
Exception Trap
An exception trap is an interrupt that is requested when an illegal execution of an instruction takes place. In the V850E/IA2, an illegal opcode exception (ILGOP: Illegal Opcode Trap) is considered as an exception trap. 7.5.1 Illegal opcode definition The illegal instruction has an opcode (bits 10 to 5) of 111111B, sub-opcodes of 0111B to 1111B (bits 26 to 23), and 0B (bit 16). An exception trap is generated when an instruction applicable to this illegal instruction is executed.
15
11 10
54
0 31
27 26
23 22
16 0
xxxxx
x : Arbitrary
111111
xxxxxxxxxx
0111 to 1111
xxxxxx
Caution
Since it is possible that this instruction will be assigned to an illegal opcode in the future, it is recommended that it not be used.
(1) Operation If an exception trap occurs, the CPU performs the following processing, and transfers control to the handler routine. (1) Saves the restored PC to DBPC. (2) Saves the current PSW to DBPSW. (3) Sets the NP, EP, and ID bits of the PSW. (4) Sets the handler address (00000060H) corresponding to the exception trap to the PC, and transfers control. Figure 7-10 illustrates the processing of the exception trap.
162
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
Figure 7-10. Exception Trap Processing
Exception trap (ILGOP) occurs
CPU processing
DBPC DBPSW PSW.NP PSW.EP PSW.ID PC
Restored PC PSW 1 1 1 00000060H
Exception processing
(2) Restore Recovery from an exception trap is carried out by the DBRET instruction. By executing the DBRET instruction, the CPU carries out the following processing and controls the address of the restored PC. (1) Loads the restored PC and PSW from DBPC and DBPSW. (2) Transfers control to the address indicated by the restored PC and PSW. Figure 7-11 illustrates the restore processing from an exception trap. Figure 7-11. Restore Processing from Exception Trap
DBRET instruction
PC PSW
DBPC DBPSW
Jump to address of restored PC
User's Manual U15195EJ3V0UD
163
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.5.2 Debug trap The debug trap is an exception that can be acknowledged every time and is generated by execution of the DBTRAP instruction. When the debug trap is generated, the CPU performs the following processing. (1) Operation When the debug trap is generated, the CPU performs the following processing, transfers control to the debug monitor routine, and shifts to debug mode. (1) Saves the restored PC to DBPC. (2) Saves the current PSW to DBPSW. (3) Sets the NP, EP and ID bits of the PSW. (4) Sets the handler address (00000060H) corresponding to the debug trap to the PC and transfers control. Figure 7-12 illustrates the processing of the debug trap. Figure 7-12. Debug Trap Processing
DBTRAP instruction
CPU processing
DBPC DBPSW PSW.NP PSW.EP PSW.ID PC
Restored PC PSW 1 1 1 00000060H
Exception processing
164
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
(2) Restore Recovery from a debug trap is carried out by the DBRET instruction. By executing the DBRET instruction, the CPU carries out the following processing and controls the address of the restored PC. (1) Loads the restored PC and PSW from DBPC and DBPSW. (2) Transfers control to the address indicated by the restored PC and PSW. Figure 7-13 illustrates the restore processing from a debug trap. Figure 7-13. Restore Processing from Debug Trap
DBRET instruction
PC PSW
DBPC DBPSW
Jump to address of restored PC
User's Manual U15195EJ3V0UD
165
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.6
Multiple Interrupt Servicing Control
Multiple interrupt servicing control is a process by which an interrupt request that is currently being processed can be interrupted during processing if there is an interrupt request with a higher priority level, and the higher priority interrupt request is received and processed first. If there is an interrupt request with a lower priority level than the interrupt request currently being processed, that interrupt request is held pending. Maskable interrupt multiple processing control is executed when interrupts are enabled (ID = 0). Thus, if multiple interrupts are executed, it is necessary for interrupts to be enabled (ID = 0) even during an interrupt servicing routine. If a maskable interrupt or a software exception is generated in a maskable interrupt or software exception service program, it is necessary to save EIPC and EIPSW. This is accomplished by the following procedure. (1) Acknowledgement of maskable interrupts in service program Service program of maskable interrupt or exception ... ... * EIPC saved to memory or register * EIPSW saved to memory or register * EI instruction (interrupt acknowledgement enabled) ... ... ... ... * DI instruction (interrupt acknowledgement disabled) * Saved value restored to EIPSW * Saved value restored to EIPC * RETI instruction Maskable interrupt acknowledgement
166
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
(2) Generation of exception in service program Service program of maskable interrupt or exception ... ... * EIPC saved to memory or register * EIPSW saved to memory or register ... * TRAP instruction ... * Saved value restored to EIPSW * Saved value restored to EIPC * RETI instruction Exception such as TRAP instruction acknowledged.
The priority order for multiple interrupt servicing control has 8 levels, from 0 to 7 for each maskable interrupt request (0 is the highest priority), but it can be set as desired via software. Setting of the priority order level is done using the xxPRn0 to xxPRn2 bits of the interrupt control request register (xxlCn), which is provided for each maskable interrupt request. After system reset, an interrupt request is masked by the xxMKn bit and the priority order is set to level 7 by the xxPRn0 to xxPRn2 bits. The priority order of maskable interrupts is as follows. (High) Level 0 > Level 1 > Level 2 > Level 3 > Level 4 > Level 5 > Level 6 > Level 7 (Low)
Interrupt servicing that has been suspended as a result of multiple servicing control is resumed after the servicing of the higher priority interrupt has been completed and the RETI instruction has been executed. A pending interrupt request is acknowledged after the current interrupt servicing has been completed and the RETI instruction has been executed. Caution In a non-maskable interrupt servicing routine (time until the RETI instruction is executed), maskable interrupts are suspended and not acknowledged.
User's Manual U15195EJ3V0UD
167
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.7
Interrupt Response Time
The following table describes the V850E/IA2 interrupt response time (from interrupt generation to start of interrupt servicing). Figure 7-14. Pipeline Operation at Interrupt Request Acknowledgement (Outline)
4 system clocks Internal clock
Interrupt request Instruction 1 Instruction 2 Interrupt acknowledgement operation Instruction (start instruction of interrupt servicing routine) IF ID EX DF WB
IFX IDX INT1 INT2 INT3 INT4 IF IF ID EX
Interleave accessNote
Note For details of interleave access, refer to 8.1.2 2-clock branch in V850E1 Architecture User's Manual (U14559E). Remark INT1 to INT4: Interrupt acknowledgement processing IFX: IDX: Invalid instruction fetch Invalid instruction decode
Condition
Interrupt Response Time (Internal System Clock (fXX)) Internal Interrupt Minimum Maximum 4 7Note 2 External Interrupt INTP0 to INTP4, INTP20 to INTP25 INTP100, INTP30, INTP20 to INTP25 INTP101, INTP31 4+ analog delay time 7+ analog delay time 4+ digital noise filter 7+ digital noise filter 4 + Note 1 + digital noise filter 7 + Note 1 + digital noise filter
The following cases are exceptions. * In IDLE/software STOP mode * External bus access * Two or more interrupt request nonsampling instructions are executed in succession * Access to on-chip peripheral I/O register
Notes 1.
The number of internal system clocks is as follows. * For timer 10 (TM10) using INTP100 and INTP101 as external interrupt inputs (see 9.2.4 (1) Timer 1/timer 2 clock selection register (PRM02)): fCLK = fXX/2 (PRM2 bit = 1): 2 fCLK = fXX/4 (PRM2 bit = 0): 4 * For timer 3 (TM3) using INTP30 and INTP31 as external interrupt inputs (see 9.4.5 (1) Timer 3 clock selection register (PRM03)): fCLK = fXX (PRM3 bit = 1): 2 fCLK = fXX/2 (PRM3 bit = 0): 4
2.
When LD instruction is executed to internal ROM (during align access)
168
User's Manual U15195EJ3V0UD
CHAPTER 7 INTERRUPT/EXCEPTION PROCESSING FUNCTION
7.8
Periods in Which Interrupts Are Not Acknowledged
An interrupt is acknowledged while an instruction is being executed. However, no interrupt will be acknowledged between an interrupt non-sample instruction and the next instruction (interrupt is held pending). The interrupt request non-sampling instructions are as follows. * EI instruction * DI instruction * LDSR reg2, 0x5 instruction (for PSW) * The load instruction, store instruction, and bit manipulation instruction for the interrupt control register (xxlCn), in-service priority register (ISPR), and interrupt mask registers 0 to 3 (IMR0 to IMR3). * The store instruction for the command register (PRCMD) * The load instruction, store instruction, and bit manipulation instruction for the registers related to CSI
User's Manual U15195EJ3V0UD
169
CHAPTER 8 CLOCK GENERATION FUNCTION
The clock generator (CG) generates and controls the internal system clock (fXX) that is supplied to each internal unit, such as the CPU.
8.1 Features
* Multiplier function using a phase locked loop (PLL) synthesizer * Clock sources * Oscillation by connecting a resonator * External clock * Power-saving modes * HALT mode * IDLE mode * Software STOP mode * Internal system clock output function
8.2 Configuration
X1
(fX)
fXX
X2 CKSEL
Clock generator (CG)
CPU, on-chip peripheral I/O CLKOUT Time base counter (TBC)
Remark
fX: External resonator or external clock frequency fXX: Internal system clock
170
User's Manual U15195EJ3V0UD
CHAPTER 8 CLOCK GENERATION FUNCTION
8.3 Input Clock Selection
The clock generator consists of an oscillator and a PLL synthesizer. For example, connecting a 4.0 MHz crystal resonator or ceramic resonator to the X1 and X2 pins enables a 40 MHz internal system clock (fXX) to be generated when the multiplier is 10. Also, an external clock can be input directly to the oscillator. In this case, the clock signal should be input only to the X1 pin (the X2 pin should be left open). Two basic operation modes are provided for the clock generator. These are the PLL mode and the direct mode. The operation mode is selected by the CKSEL pin. The input to this pin is latched on reset.
CKSEL 0 1 Operation Mode PLL mode Direct mode
Caution The input level for the CKSEL pin must be fixed. malfunction may occur. 8.3.1 Direct mode
If it is switched during operation, a
In the direct mode, the external clock is divided by two and the divided clock is supplied as the internal system clock. The maximum frequency that can be input in the direct mode is 50 MHz. This mode is used in application system where the V850E/IA2 operates at relatively low frequencies. Caution In direct mode, an external clock must be input (an external resonator should not be connected). 8.3.2 PLL mode In PLL mode, an external resonator is connected or external clock is input and multiplied by the PLL synthesizer. The multiplied PLL output is divided by the division ratio specified by the clock control register (CKC) to generate a system clock that is 10, 5, 2.5, or 1 times the frequency (fX) of the external resonator or external clock. After reset, an internal system clock (fXX) that is 1 time the frequency (1 x fX) of the internal clock frequency (fX) is generated. When a frequency that is 10 times the clock frequency (fX) (10 x fX) is generated, a system with low noise and low power consumption can be realized because a frequency of up to 40 MHz is obtained based on a 4 MHz external resonator or external clock. In PLL mode, if the clock supply from an external resonator or external clock source stops, operation of the internal system clock (fXX) based on the self-propelled frequency of the clock generator's internal voltage controlled oscillator (VCO) continues. In this case, fXX is undefined. However, do not devise an application method expecting to use this self-propelled frequency. Example: Clocks when PLL mode (fXX = 10 x fX) is used
Internal System Clock Frequency (fXX) 40.000 MHz External Resonator or External Clock Frequency (fX) 4.0000 MHz
User's Manual U15195EJ3V0UD
171
CHAPTER 8 CLOCK GENERATION FUNCTION
Caution Only an fX value for which 10 x fX does not exceed the system clock maximum frequency (40 MHz) (i.e. 4 MHz) can be used for the oscillation frequency or external clock frequency. When 5 x fX, 2.5 x fX, or 1 x fX is used, a frequency of 4 to 6.6 MHz can be used. Remark Note the following when PLL mode is selected (fXX = 5 x fX, fXX = 2.5 x fX, or fXX = 1 x fX) If the V850E/IA2 does not need to be operated at a high frequency, use fXX = 5 x fX, fXX = 2.5 x fX, or fXX = 1 x fX to reduce the power consumption by lowering the system clock frequency using software. 8.3.3 Peripheral command register (PHCMD) This is an 8-bit register that is used to set protection for writing to registers that can significantly affect the system so that the application system is not halted unexpectedly due to erroneous program execution. This register is writeonly in 8-bit units (when it is read, undefined data is read out). Writing to the first specific register (CKC register) is only valid after first writing to the PHCMD register. Because of this, the register value can be overwritten only in the specified sequence, preventing an illegal write operation from being performed.
7 PHCMD REG7
6 REG6
5 REG5
4 REG4
3 REG3
2 REG2
1 REG1
0 REG0
Address
After reset
FFFFF800H Undefined
Bit position 7 to 0
Bit name REG7 to REG0
Function Registration code (arbitrary 8-bit data) The specific register targeted is the clock control register (CKC).
The generation of an illegal store operation can be checked with the PRERR bit of the peripheral status register (PHS).
172
User's Manual U15195EJ3V0UD
CHAPTER 8 CLOCK GENERATION FUNCTION
8.3.4 Clock control register (CKC) The clock control register is an 8-bit register that controls the internal system clock (fXX) in PLL mode. It can be written to only by a specific sequence combination so that it cannot easily be overwritten by mistake due to erroneous program execution. This register can be read or written in 8-bit units. Caution Do not change the CKDIV2 to CKDIV0 bits in direct mode.
7 CKC 0
6 0
5 TBCS
4 CESEL
3 0
2 CKDIV2
1 CKDIV1
0
Address
After reset 00H
CKDIV0 FFFFF822H
Bit position 5
Bit name TBCS
Function Selects the time base counter clock. 0: fX/28 1: fX/29 For details, see 8.6.2 Time base counter (TBC). Specifies the functions of the X1 and X2 pins. 0: A resonator is connected to the X1 and X2 pins 1: An external clock is connected to the X1 pin When CESEL = 1, the oscillator feedback loop is disconnected to prevent current leakage in software STOP mode. Sets the internal system clock frequency (fXX) when PLL mode is used.
4
CESEL
2 to 0
CKDIV2 to CKDIV0
CKDIV2 CKDIV1 CKDIV0 0 0 0 1 0 0 1 1 0 1 1 1 fX 2.5 x fX 5 x fX 10 x fX
Internal system clock (fXX)
Other than above
Setting prohibited
Caution When changing the internal system clock during operation, be sure to set the clock to be changed after setting the CKDIV2 to CKDIV0 bits to 000 (fX).
Example Clock generator settings
Operation Mode Direct mode PLL mode CKSEL Pin CKDIV2 High-level input Low-level input 0 0 0 0 1 Other than above CKC Register CKDIV0 0 0 0 1 1 CKDIV0 0 0 1 1 1 16 MHz 4 MHz 5 MHz 6.4 MHz 4 MHz Setting prohibited Input Clock (fX) Internal System Clock (fXX) 8 MHz 4 MHz 12.5 MHz 32 MHz 40 MHz Setting prohibited
User's Manual U15195EJ3V0UD
173
CHAPTER 8 CLOCK GENERATION FUNCTION
Data is set in the clock control register (CKC) according to the following sequence. <1> <2> <3> <4> <5> Disable interrupts (set the NP bit of PSW to 1) Prepare data in any one of the general-purpose registers to set in the specific register. Write arbitrary data to the peripheral command register (PHCMD) Set the clock control register (CKC) (with the following instructions). * Store instruction (ST/SST instruction) Insert five or more NOP instructions (5 instructions (<5> to <9>)) <10> Release the interrupt disabled state (set the NP bit of PSW to 0). [Sample coding] <1> <2> <3> <4> <5> <6> <7> <8> <9> LDSR MOV ST.B ST.B NOP NOP NOP NOP NOP rY, 5 rX, 5 0X04, r10 r10, PHCMD [r0] r10, CKC [r0]
<10> LDSR Remark rX: Value written to PSW rY: Value returned to PSW
No special sequence is required to read the specific register. Cautions 1. If an interrupt is acknowledged between the issuing of data to PHCMD <3> and writing to the specific register immediately after <4>, the write operation to the specific register is not performed and a protection error (the PRERR bit of the PHS register = 1) may occur. Therefore, set the NP bit of the PSW to 1 <1> to disable interrupt acknowledgement. Also disable interrupt acknowledgement when selecting a bit manipulation instruction for the specific register setting. 2. Although the data written to the PHCMD register is dummy data, use the same register as the general-purpose register used in specific register setting <4> for writing to the PHCMD register (<3>). The same method should be applied when using a general-purpose register for addressing. 3. Before executing this processing, complete all DMA transfer operations.
174
User's Manual U15195EJ3V0UD
CHAPTER 8 CLOCK GENERATION FUNCTION
8.3.5 Peripheral status register (PHS) If a write operation is not performed in the correct sequence including access to the command register for the protection-targeted internal registers, writing is not performed and a protection error is generated, setting the status flag (PRERR) to 1. This flag is a cumulative flag. After checking the PRERR flag, it is cleared to 0 by an instruction. This register can be read or written in 8-bit or 1-bit units
7 PHS 0
6 0
5 0
4 0
3 0
2 0
1 0
<0> PRERR
Address FFFFF802H
After reset 00H
Bit position 0
Bit name PRERR 0: Protection error does not occur 1: Protection error occurs
Function
The operation conditions of the PRERR flag are as follows. Set conditions: <1> If the operation of the relevant store instruction for the on-chip peripheral I/O is not a write operation for the PHCMD register, but the peripheral specific register is written to. <2> If the first store instruction operation after the write operation to the PHCMD register is for memory other than the specific registers and on-chip peripheral I/O. Reset conditions: <1> If the PRERR flag of the PHS register is set to 0. <2> If the system is reset
User's Manual U15195EJ3V0UD
175
CHAPTER 8 CLOCK GENERATION FUNCTION
8.4 PLL Lockup
The lockup time (frequency stabilization time) is the time from when the power is turned on or the software STOP mode is released until the phase locks at the prescribed frequency. The state until this stabilization occurs is called a lockup state, and the stabilized state is called a lock state. The lock register (LOCKR) has a LOCK flag that reflects the stabilized state of the PLL frequency. This register is read-only in 8-bit or 1-bit units. Caution When the PLL is locked, the LOCK flag is 0. If the system then enters an unlocked state due to a standby, the LOCK flag becomes 1. If anything other than a standby causes the system to enter an unlocked state, the LOCK flag is not affected (LOCK = 0).
7 LOCKR 0
6 0
5 0
4 0
3 0
2 0
1 0
<0> LOCK
Address
After reset
FFFFF824H 0000000xB
Bit position 0
Bit name LOCK
Function This is a read-only flag that indicates the PLL state. This flag holds the value 0 as long as a lockup state is maintained and is not initialized by a system reset. 0: Indicates that the PLL is locked. 1: Indicates that the PLL is not locked (UNLOCK state).
If the clock stops, the power fails, or some other factor operates to cause an unlock state to occur, for control processing that depends on software execution speed, such as real-time processing, be sure to judge the LOCK flag using software immediately after operation begins so that processing does not begin until after the clock stabilizes. On the other hand, static processing such as the setting of internal hardware or the initialization of register data or memory data can be executed without waiting for the LOCK flag to be reset. The relationship between the oscillation stabilization time (the time from when the resonator starts to oscillate until the input waveform stabilizes) when a resonator is used, and the PLL lockup time (the time until frequency stabilizes) is shown below. Oscillation stabilization time < PLL lockup time
176
User's Manual U15195EJ3V0UD
CHAPTER 8 CLOCK GENERATION FUNCTION
8.5 Power Save Control
8.5.1 Overview The power save function has the following three modes. (1) HALT mode In this mode, the clock generator (oscillator and PLL synthesizer) continues to operate, but the CPU's operation clock stops. Since the supply of clocks to on-chip peripheral functions other than the CPU continues, operation continues. The power consumption of the overall system can be reduced by intermittent operation that is achieved due to a combination of HALT mode and normal operation mode. The system is switched to HALT mode by a specific instruction (the HALT instruction). (2) IDLE mode In this mode, the clock generator (oscillator and PLL synthesizer) continues to operate, but the supply of internal system clocks is stopped, which causes the overall system to stop. When the system is released from IDLE mode, it can be switched to normal operation mode quickly because the oscillator's oscillation stabilization time need not be secured. The system is switched to IDLE mode according to a PSMR register setting. IDLE mode is located midway between software STOP mode and HALT mode in relation to the clock stabilization time and current consumption. It is used for situations in which a low current consumption mode is to be used and the clock stabilization time is to be eliminated after the mode is released. (3) Software STOP mode In this mode, the overall system is stopped by stopping the clock generator (oscillator and PLL synthesizer). The system enters an ultra-low power consumption state in which only leak current is lost. The system is switched to software STOP mode according to a PSMR register setting. (a) PLL mode The system is switched to software STOP mode by setting the register by software. The PLL synthesizer's clock output is stopped at the same time that the oscillator is stopped. After software STOP mode is released, the oscillator's oscillation stabilization time must be secured while the system clock stabilizes. Also, PLL lockup time may be required depending on the program. When a resonator or external clock is connected, following the release of the software STOP mode, execution of the program is started after the count time of the time base counter has elapsed. (b) Direct Mode To stop the clock, set the X1 pin to low level. After the release of software STOP mode, execution of the program is started after the count-time of the time base counter has elapsed.
User's Manual U15195EJ3V0UD
177
CHAPTER 8 CLOCK GENERATION FUNCTION
Figure 8-1 shows the operation of the clock generator in normal operation mode, HALT mode, IDLE mode, and software STOP mode. An effective low power consumption system can be realized by combining these modes and switching modes according to the required use. Figure 8-1. Power Save Mode State Transition Diagram
Release according to RESET, NMI, or maskable interrupt Normal operation mode Set HALT mode Release according to RESET, NMI, or maskable interruptNote Set STOP mode Release according to RESET, NMI, or maskable interruptNote Set IDLE mode HALT mode
Software STOP mode
IDLE mode
Note INTPn (n = 0 to 4, 20 to 25) However, in cases such as when a digital filter using clock sampling is selected as the noise eliminator for INTP20 to INTP25, the software STOP or IDLE mode cannot be released.
178
User's Manual U15195EJ3V0UD
CHAPTER 8 CLOCK GENERATION FUNCTION
Table 8-1. Clock Generator Operation Using Power Save Control
Clock Source Power Save Mode Oscillator PLL Synthesizer - - - - - - Clock Supply to Peripheral I/O - - - - - - Clock Supply to CPU - - - - - - - - -
PLL mode
Oscillation with resonator
Normal operation HALT mode IDLE mode Software STOP mode
- - - - - - - - -
External clock
Normal operation HALT mode IDLE mode Software STOP mode
Direct mode
External clock
Normal operation HALT mode IDLE mode Software STOP mode
Remark
: Operating -: Stopped
User's Manual U15195EJ3V0UD
179
CHAPTER 8 CLOCK GENERATION FUNCTION
8.5.2 Control registers (1) Power save mode register (PSMR) This is an 8-bit register that controls the power save mode. It is effective only when the STB bit of the PSC register is set to 1. Writing to the PSMR is executed by store instructions (ST/SST instruction) and bit manipulation instructions (SET1/CLR1/NOT1 instruction). This register can be read or written in 8-bit or 1-bit units.
7 PSMR 0
6 0
5 0
4 0
3 0
2 0
1 0
<0> PSM
Address FFFFF820H
After reset 00H
Bit position 0
Bit name PSM
Function Specifies IDLE mode or software STOP mode. 0: Switches the system to IDLE mode 1: Switches the system to software STOP mode
(2) Command register (PRCMD) This is an 8-bit register that is used to set protection for write operations to registers that can significantly affect the system so that the application system is not halted unexpectedly due to erroneous program execution. Writing to the first specific register (power save control register (PSC)) is only valid after first writing to the PRCMD register. Because of this, the register value can be overwritten only by the specified sequence, preventing an illegal write operation from being performed. This register is write-only in 8-bit units. Undefined data is read out if read.
7 PRCMD REG7
6 REG6
5 REG5
4 REG4
3 REG3
2 REG2
1 REG1
0 REG0
Address
After reset
FFFFF1FCH Undefined
Bit position 7 to 0
Bit name REG7 to REG0
Function Registration code (arbitrary 8-bit data) The specific register targeted is the power save control register (PSC).
180
User's Manual U15195EJ3V0UD
CHAPTER 8 CLOCK GENERATION FUNCTION
(3) Power save control register (PSC) This is an 8-bit register that controls the power save function. This register, which is one of the specific registers, is effective only when accessed by a specific sequence during a write operation (see 3.4.9 Specific registers). This register can be read or written in 8-bit or 1-bit units. Caution It is impossible to set the STB bit and NMIM or INTM bit at the same time. Be sure to set the STB bit after setting the NMIM or INTM bit.
7 PSC 0
6 0
<5> NMIM
<4> INTM
3 0
2 0
<1> STB
0 0
Address FFFFF1FEH
After reset 00H
Bit position 5
Bit name NMIM
Function This is the enable/disable setting bit for standby mode release using valid edge input of NMI. 0: Enables NMI cancellation 1: Disables NMI cancellation This is the enable/disable setting for standby mode release using an unmasked maskable interrupt (INTPn) (n = 0 to 4, 20 to 25, 30, 31, 100, 101). 0: Enables maskable interrupt cancellation 1: Disables maskable interrupt cancellation Indicates the standby mode status. If 1 is written to this bit, the system enters standby mode (when it is in IDLE or software STOP mode). When standby mode is released, this bit is automatically reset to 0. 0: Standby mode is released 1: Standby mode is in effect
4
INTM
1
STB
Data is set in the power save control register (PSC) according to the following sequence. <1> Set the power save mode register (PSMR) (with the following instructions). * Store instruction (ST/SST instruction) * Bit manipulation instruction (SET1/CLR1/NOT1 instruction) <2> Prepare data in any one of the general-purpose registers to set to the specific register. <3> Write arbitrary data to the command register (PRCMD). <4> Set the power save control register (PSC) (with the following instructions). * Store instruction (ST/SST instruction) * Bit manipulation instruction (SET1/CLR1/NOT1 instruction) <5> Assert the NOP instructions (5 instructions (<5> to <9>).
User's Manual U15195EJ3V0UD
181
CHAPTER 8 CLOCK GENERATION FUNCTION
[Sample coding]
<1> ST.B <2> MOV
r11, PSMR [r0] 0x04, r10
; Set PSMR register ; Prepare data for setting specific register in general-purpose register
<3> ST.B <4> ST.B <5> NOP <6> NOP <7> NOP <8> NOP <9> NOP
r10, PRCMD [r0] r10, PSC [r0]
; Write PRCMD register ; Set PSC register ; Dummy instruction ; Dummy instruction ; Dummy instruction ; Dummy instruction ; Dummy instruction ; Execution routine after software STOP mode and IDLE mode release
(next instruction)
No special sequence is required to read the specific register. Cautions 1. Interrupts are not acknowledged in store instructions for the command register. This
coding is made on assumption that <3> and <4> above are executed by the program with consecutive store instructions. If another instruction is set between <3> and <4>, the above sequence may become ineffective when the interrupt is acknowledged by that instruction, and a malfunction of the program may result. 2. Although the data written to the PRCMD register is dummy data, use the same register as the general-purpose register used in specific register setting <4> for writing to the PRCMD register (<3>). The same method should be applied when using a general-purpose register for addressing. 3. At least 5 NOP instructions must be inserted after executing a store instruction to the PSC register to set software STOP or IDLE mode. 4. Before executing this processing, complete all DMA transfer operations.
182
User's Manual U15195EJ3V0UD
CHAPTER 8 CLOCK GENERATION FUNCTION
8.5.3 HALT mode (1) Setting and operation status In the HALT mode, the clock generator (oscillator and PLL synthesizer) continues to operate, but the operation clock of the CPU is stopped. Since the supply of clocks to on-chip peripheral I/O units other than the CPU continues, operation continues. The power consumption of the overall system can be reduced by setting the system to HALT mode while the CPU is idle. The system is switched to HALT mode by the HALT instruction. Although program execution stops in the HALT mode, the contents of all registers, internal RAM, and ports are maintained in the state they were in immediately before HALT mode began. Also, operation continues for all on-chip peripheral I/O units (other than ports) that do not depend on CPU instruction processing. Table 8-2 shows the status of each hardware unit in the HALT mode. Table 8-2. Operation Status in HALT Mode
Function Clock generator Internal system clock CPU Ports On-chip peripheral I/O (excluding ports) Internal data Operating Operating Stopped Maintained Operating All internal data such as CPU registers, statuses, data, and the contents of internal RAM are maintained in the state they were in immediately before HALT mode began. Operating Operation Status
AD0 to AD15 A16 to A21 RD, ASTB UWR, LWR WAIT CLKOUT
Clock output
User's Manual U15195EJ3V0UD
183
CHAPTER 8 CLOCK GENERATION FUNCTION
(2) Release of HALT mode HALT mode is released by a non-maskable interrupt request, an unmasked maskable interrupt request, or RESET pin input. (a) Release by a non-maskable interrupt request or an unmasked maskable interrupt request HALT mode is released by a non-maskable interrupt request or by an unmasked maskable interrupt request regardless of the priority. However, if the system is set to HALT mode during an interrupt servicing routine, operation will differ as follows. (i) If an interrupt request is generated with a lower priority than that of the interrupt request that is currently being serviced, HALT mode is released, but the newly generated interrupt request is not acknowledged. The new interrupt request is held pending. (ii) If an interrupt request (including non-maskable interrupt requests) is generated with a higher priority than that of the interrupt request that is currently being serviced, HALT mode is released and the newly generated interrupt request is acknowledged. Table 8-3. Operation After HALT Mode Is Released by Interrupt Request
Release Source Non-maskable interrupt request Maskable interrupt request Enable Interrupt (EI) Status Branch to handler address Branch to handler address or execute next instruction Execute next instruction Disable Interrupt (DI) Status
(b) Release by RESET pin input This is the same as a normal reset operation.
184
User's Manual U15195EJ3V0UD
CHAPTER 8 CLOCK GENERATION FUNCTION
8.5.4 IDLE mode (1) Setting and operation status In the IDLE mode, the clock generator (oscillator and PLL synthesizer) continues to operate, but the supply of internal system clocks is stopped which causes the overall system to stop. When IDLE mode is released, the system can be switched to normal operation mode quickly because the oscillator's oscillation stabilization time or the PLL lockup time do not need to be secured. The system is switched to IDLE mode by setting the PSC or PSMR register using a store instruction (ST or SST instruction) or a bit manipulation instruction (SET1, CLR1, or NOT1 instruction) (see 8.5.2 Control registers). In the IDLE mode, program execution is stopped, and the contents of all registers, internal RAM, and ports are maintained in the state they were in immediately before execution stopped. The operation of on-chip peripheral I/O units (excluding ports) also is stopped. Table 8-4 shows the status of each hardware unit in the IDLE mode. Table 8-4. Operation Status in IDLE Mode
Function Clock generator Internal system clock CPU Ports On-chip peripheral I/O (excluding ports) Internal data Operating Stopped Stopped Maintained Stopped All internal data such as CPU registers, statuses, data, and the contents of internal RAM are maintained in the state they were in immediately before IDLE mode began. High impedance Operation Status
AD0 to AD15 A16 to A21 RD UWR, LWR WAIT ASTB CLKOUT
High level output
Input (no sampling) High-level output Low-level output
User's Manual U15195EJ3V0UD
185
CHAPTER 8 CLOCK GENERATION FUNCTION
(2) Release of IDLE mode IDLE mode is released by a non-maskable interrupt request, an unmasked maskable interrupt request (INTPn)
Note
, or RESET pin input (n = 0 to 4, 20 to 25).
Note When a digital filter using clock sampling is selected as the noise eliminator for INTP20 to INTP25, IDLE mode cannot be released. (a) Release by a non-maskable interrupt request or an unmasked maskable interrupt request IDLE mode is released by an interrupt request only when transition to IDLE mode is performed with the INTM and NMIM bits of the PSC register set to 0. IDLE mode is released by a non-maskable interrupt request or by an unmasked maskable interrupt request (INTPn) regardless of the priority. However, if the system is set to IDLE mode during a maskable interrupt servicing routine, operation will differ as follows (n = 0 to 4, 20 to 25). (i) If an interrupt request is generated with a lower priority than that of the interrupt request that is currently being serviced, IDLE mode is released, but the newly generated interrupt request is not acknowledged. The new interrupt request is held pending. (ii) If an interrupt request (including non-maskable interrupt requests) is generated with a higher priority than that of the interrupt request that is currently being serviced, IDLE mode is released and the newly generated interrupt request is acknowledged. Table 8-5. Operation After IDLE Mode Is Released by Interrupt Request
Release Source Non-maskable interrupt request Maskable interrupt request Enable Interrupt (EI) Status Branch to handler address Branch to handler address or execute next instruction Execute next instruction Disable Interrupt (DI) Status
If the system is set to IDLE mode during an NMI servicing routine, IDLE mode is released, but the interrupt is not acknowledged (interrupt is held pending). Interrupt servicing that is started when IDLE mode is released by NMI pin input is handled in the same way as normal NMI interrupt servicing that occurs during an emergency (because the NMI interrupt handler address is unique). Therefore, when a program must be able to distinguish between these two situations, a software status must be prepared in advance and that status must be set before setting the PSMR register using a store instruction or a bit manipulation instruction. By checking for this status during NMI interrupt servicing, an ordinary NMI can be distinguished from the processing that is started when IDLE mode is released by NMI pin input. (b) Release by RESET pin input This is the same as a normal reset operation.
186
User's Manual U15195EJ3V0UD
CHAPTER 8 CLOCK GENERATION FUNCTION
8.5.5 Software STOP mode (1) Setting and operation status In the software STOP mode, the clock generator (oscillator and PLL synthesizer) is stopped. The overall system is stopped, and ultra-low power consumption is achieved in which only leak current is lost. The system is switched to software STOP mode by using a store instruction (ST or SST instruction) or bit manipulation instruction (SET1, CLR1, or NOT1 instruction) to set the PSC and PSMR registers (see 8.5.2 Control registers). When PLL mode and resonator connection mode (CESEL bit of CKC register = 1) are used, the oscillator's oscillation stabilization time must be secured after software STOP mode is released. In both PLL and direct mode, following the release of software STOP mode, execution of the program is started after the count time of the time base counter has elapsed. Although program execution stops in software STOP mode, the contents of all registers, internal RAM, and ports are maintained in the state they were in immediately before software STOP mode began. operation of all on-chip peripheral I/O units (excluding ports) is also stopped. Table 8-6 shows the status of each hardware unit in the software STOP mode. Table 8-6. Operation Status in Software STOP Mode
Function Clock generator Internal system clock CPU Ports On-chip peripheral I/O (excluding ports) Internal data Stopped Stopped Stopped MaintainedNote Stopped All internal data such as CPU registers, statuses, data, and the contents of internal RAM are retained in the state before STOP mode has been setNote. High impedance Operation Status
The
AD0 to AD15 A16 to A21 RD UWR, LWR WAIT ASTB CLKOUT
High-level output
Input (no sampling) High-level output Low-level output
Note When the VDD value is within the operable range. However, even if it drops below the minimum operable voltage, as long as the data retention voltage VDDDR is maintained, the contents of only the internal RAM will be maintained.
User's Manual U15195EJ3V0UD
187
CHAPTER 8 CLOCK GENERATION FUNCTION
(2) Release of software STOP mode Software STOP mode is released by a non-maskable interrupt request, an unmasked maskable interrupt request (INTPn)
Note
, or RESET pin input. Also, to release software STOP mode when PLL mode (CKSEL pin
= low level) and resonator connection mode (CESEL bit of CKC register = 0) are used, the oscillator's oscillation stabilization time must be secured (n = 0 to 4, 20 to 25) Moreover, the oscillation stabilization time must be secured even when an external clock is connected (CESEL bit = 1). See 8.4 PLL Lockup for details. Note When a digital filter using clock sampling is selected as the noise eliminator for INTP20 to INTP25, software STOP mode cannot be released. (a) Release by a non-maskable interrupt request or an unmasked maskable interrupt request Software STOP mode is released by an interrupt request only when transition to software STOP mode is performed with the INTM and NMIM bits of the PSC register set to 0. Software STOP mode is released by a non-maskable interrupt request or by an unmasked maskable interrupt request (INTPn) regardless of the priority. However, if the system is set to software STOP mode during an interrupt servicing routine, operation will differ as follows (n = 0 to 4, 20 to 25). (i) If an interrupt request is generated with a lower priority than that of the interrupt request that is currently being servicing, software STOP mode is released, but the newly generated interrupt request is not acknowledged. The new interrupt request is held pending. (ii) If an interrupt request (including non-maskable interrupt requests) is generated with a higher priority than that of the interrupt request that is currently being serviced, software STOP mode is released and the newly generated interrupt request is acknowledged. Table 8-7. Operation After Software STOP Mode Is Released by Interrupt Request
Cancellation Source Non-maskable interrupt request Maskable interrupt request Enable Interrupt (EI) Status Branch to handler address Branch to handler address or execute next instruction Execute next instruction Disable Interrupt (DI) Status
If the system is set to software STOP mode during an NMI servicing routine, software STOP mode is released, but the interrupt is not acknowledged (interrupt is held pending). Interrupt servicing that is started when software STOP mode is released by NMI pin input is handled in the same way as normal NMI interrupt servicing that occurs during an emergency (because the NMI interrupt handler address is unique). Therefore, when a program must be able to distinguish between these two situations, a software status must be prepared in advance and that status must be set before setting the PSMR register using a store instruction or a bit manipulation instruction. By checking for this status during NMI interrupt servicing, an ordinary NMI can be distinguished from the servicing that is started when software STOP mode is released by NMI pin input. (b) Release by RESET pin input This is the same as a normal reset operation.
188
User's Manual U15195EJ3V0UD
CHAPTER 8 CLOCK GENERATION FUNCTION
8.6 Securing Oscillation Stabilization Time
8.6.1 Oscillation stabilization time security specification Two specification methods can be used to secure the time from when software STOP mode is released until the stopped oscillator stabilizes. (1) Securing the time using an on-chip time base counter Software STOP mode is released when a valid edge is input to the NMI pin or a maskable interrupt request is input (INTPn). When a valid edge is input to the pin causing the start of oscillation, the time base counter (TBC) starts counting, and the time until the clock output from the oscillator stabilizes is secured during that counting time (n = 0 to 4, 20 to 25). Oscillation stabilization time = TBC counting time After a fixed time, internal system clock output begins, and processing branches to the NMI interrupt or maskable interrupt (INTPn) handler address.
Set software STOP mode Oscillation waveform (X2)
Internal main clock
CLKOUT (output)
STOP state NMI (input)Note Oscillator is stopped Time base counter's counting time
Note Valid edge: When specified as the rising edge.
The NMI pin should usually be set to an inactive level (for example, high level when the valid edge is specified as the falling edge) in advance. Software STOP mode is immediately released if an operation that sets STOP mode before the CPU can acknowledge interrupts is performed due to NMI valid edge input or maskable interrupt request input (INTPn). If the direct mode or external clock connection mode (CESEL bit of CKC register = 1) is used, program execution begins after the count time of the time base counter has elapsed. Also, even if the PLL mode and resonator connection mode (CESEL bit of CKC register = 0) are used, program execution begins after the oscillation stabilization time is secured by the time base counter.
User's Manual U15195EJ3V0UD
189
CHAPTER 8 CLOCK GENERATION FUNCTION
(2) Securing the time according to the signal level width (RESET pin input) Software STOP mode is released by falling edge input to the RESET pin. The time until the clock output from the oscillator stabilizes is secured based on the low-level width of the signal that is input to the pin. The supply of internal system clocks begins after a rising edge is input to the RESET pin, and processing branches to the handler address used for a system reset.
Set software STOP mode Oscillation waveform (X2)
Internal main clock
Undefined
CLKOUT (output) STOP state RESET (input) Internal system reset signal Oscillator is stopped
Undefined
Oscillation stabilization time secured by RESET
8.6.2 Time base counter (TBC) The time base counter (TBC) is used to secure the oscillator's oscillation stabilization time when software STOP mode is released. When an external clock is connected (CESEL bit of CKC register = 1) or a resonator is connected (PLL mode and CESEL bit of CKC register = 0), the TBC counts the oscillation stabilization time after software STOP mode is released, and program execution begins after the count is completed. The TBC count clock is selected by the TBCS bit of the CKC register, and the next counting time can be set (reference). Table 8-8. Counting Time Examples (fXX = 10 x fX)
TBCS Bit Count Clock Counting Time fX = 4.0000 MHz 0 1 fX/2 fX/2
8
16.4 ms 32.8 ms
9
fX: External oscillation frequency
190
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.1 TIMER 0
9.1.1 Features (timer 0) Timers 00 and 01 (TM00, TM01) are 16-bit timer/counters with a 3-phase PWM output function, and have the following functions. * 3-phase PWM output function PWM mode 0 (symmetric triangular wave) PWM mode 1 (asymmetric triangular wave) PWM mode 2 (sawtooth wave) * Interrupt culling function Culling ratios: 1/1, 1/2, 1/3, 1/4, 1/8, 1/16 * Forcible 3-phase PWM output stop function 3-phase PWM output can be forcibly stopped by inputting a signal to the external signal input pin ESOn when an anomaly occurs. This function can also be used when the clock is stopped. * Real-time output function 3-phase PWM output or rectangular wave output can be selected at the desired timing. * Output of positive phase and negative phase or positive phase and in-phase of 3-phase PWM output 9.1.2 Function overview (timer 0) * 16-bit timer (TM0n) for 3-phase PWM inverter control: 2 channels * Compare registers: 6 registers x 2 channels * 12-bit dead-time timers (DTMn0 to DTMn2): 3 timers x 2 channels * Count clock division selectable by prescaler (set the frequency of the count clock to 40 MHz or less) * Base clock (fCLK): 2 types (set fCLK to 40 MHz or less) fXX and fXX/2 can be selected * Prescaler division ratio The following division ratios can be selected according to the base clock (fCLK).
Division Ratio Base Clock (fCLK) fXX Selected 1/1 1/2 1/4 1/8 1/16 1/32 fXX fXX/2 fXX/4 fXX/8 fXX/16 fXX/32 fXX/2 Selected fXX/2 fXX/4 fXX/8 fXX/16 fXX/32 fXX/64
User's Manual U15195EJ3V0UD
191
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
* Interrupt request sources (a) Compare-match interrupt request: 9 types * Interrupt request signal INTCM0n3 generated by match of TM0n register count value and compare register CM0n3 * Interrupt request signals INTCM010 to INTCM012, INTCM0n4, and INTCM0n5 generated by match of TM0n register count value and compare registers CM010 to CM012, CM0n4, and CM0n5
Setting Condition INTCM010 to INTCM012, INTCM0n4, INTCM0n5 Signal Occurrence Status Occurs Occurs Does not occur
CM010 to CM012, CM0n4, CM0n5 CM0n3 CM010 to CM012, CM0n4, CM0n5 = 0000H CM010 to CM012, CM0n4, CM0n5 > CM0n3
(b) Underflow interrupt request: 2 types * Interrupt request signal INTTM0n generated by underflow of the TM0n register * External pulse output (TO0n0 to TO0n5): 6 x 2 channels Remark fXX: Internal system clock n = 0, 1
192
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.1.3 Functions added to V850E/IA2 (1) Addition of BFCMn4 and CM0n4 registers, and BFCMn5 and CM0n5 registers When the TM0CEn bit of the TMC0n register is 1 (counting enabled), transferring data from the BFCMn4 or BFCMn5 register to the CM0n4 or CM0n5 register is enabled or disabled by the BFTEN bit of the TMC0n register (n = 0, 1). (2) Compare-match interrupt output function of CM010 to CM012, CM0n4, and CM0n5 registers (INTCM010 to INTCM012, INTCM0n4, INTCM0n5) The features of the compare-match interrupt output function (INTCM010 to INTCM012, INTCM0n4, INTCM0n5) of the CM010 to CM012, CM0n4, and CM0n5 registers are as follows (n = 0, 1): (a) This interrupt signal is not affected by the STINTn bit of the TMC0n register that specifies occurrence of an interrupt when timer TM0n is started. (b) The compare-match interrupt output function of the CM010 to CM012, CM0n4, and CM0n5 registers does not have an interrupt culling function. Therefore, it is not affected by the CUL02 to CUL00 bits of the TMC0n register. The sources of this interrupt signal are shown below. Table 9-1. Sources of INTCM010 to INTCM012, INTCM0n4, and INTCM0n5
Unit TM00 Interrupt Name INTCM000 to INTCM002 INTCM004, INTCM005 TM01 INTCM010 to INTCM012 INTCM014, INTCM015 x
Note
A/D Trigger Function x
Interrupt Function x
DMA Trigger Source x x
Note The V850E/IA2 does not include INTCM000 to INTCM002. Remarks 1. x: : Function provided Function not provided
2. n = 0, 1
User's Manual U15195EJ3V0UD
193
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.1.4 Basic configuration The basic configuration is shown below. Figure 9-1. Block Diagram of Timer 0 (Mode 0: Symmetric Triangular Wave, Mode 1: Asymmetric Triangular Wave)
BFCMn3
Selector
fXX fXX/2
1/1 1/2 1/4 fCLK 1/8 1/16 1/32 BFCMn0
CM0n3 16 TM0n S/R 16
INTCM0n3 INTTM0n
Output control by external input (ESOn), TM0n timer operation
6
DTRRn 12 ALVTO
Underflow
CM0n0
R S INTCM010 DTMn0
R S R S
TO0n0 (U phase) TO0n1 (U phase) ALVUB
BFCMn1
CM0n1
R DTMn1 S INTCM011
Underflow
R S R S
TO0n2 (V phase) TO0n3 (V phase) ALVVB
BFCMn2
CM0n2
R S INTCM012 DTMn2
Underflow
R S R S
TO0n4 (W phase) TO0n5 (W phase) ALVWB
BFCMn4
CM0n4
INTCM0n4
BFCMn5
CM0n5
INTCM0n5
Remarks 1. TM0n: CM0n0 to CM0n5: DTRRn: DTMn0 to DTMn2: ALVTO: ALVUB: ALVVB: ALVWB: S/R: 2. n = 0, 1
Timer register Compare registers Dead-time timer reload register Dead-time timers Bit 7 of TOMRn register Bit 6 of TOMRn register Bit 5 of TOMRn register Bit 4 of TOMRn register Set/Reset
BFCMn0 to BFCMn5: Buffer registers
3. fXX: Internal system clock 4. fCLK: Base clock (40 MHz (MAX.))
194
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-2. Block Diagram of Timer 0 (Mode 2: Sawtooth Wave)
BFCMn3
Selector
fXX fXX/2
1/1 1/2 1/4 fCLK 1/8 1/16 1/32 BFCMn0
CM0n3 16 Clear TM0n 16
INTCM0n3
Output control by external input (ESOn), TM0n timer operation
6
DTRRn R S INTCM010 R S 12
Underflow
ALVTO
CM0n0
DTMn0
R S
TO0n0 (U phase) TO0n1 (U phase) ALVUB
BFCMn1
CM0n1
R DTMn1 S INTCM011
Underflow
R S R S
TO0n2 (V phase) TO0n3 (V phase) ALVVB
BFCMn2
CM0n2
R S INTCM012 DTMn2
Underflow
R S R S
TO0n4 (W phase) TO0n5 (W phase) ALVWB
BFCMn4
CM0n4
INTCM0n4
BFCMn5
CM0n5
INTCM0n5
Remarks 1. TM0n: CM0n0 to CM0n5: DTRRn: DTMn0 to DTMn2: ALVTO: ALVUB: ALVVB: ALVWB: 2. n = 0, 1
Timer register Compare registers Dead-time timer reload register Dead-time timers Bit 7 of TOMRn register Bit 6 of TOMRn register Bit 5 of TOMRn register Bit 4 of TOMRn register
BFCMn0 to BFCMn5: Buffer registers
3. fXX: Internal system clock 4. fCLK: Base clock (40 MHz (MAX.))
User's Manual U15195EJ3V0UD
195
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(1) Timers 00, 01 (TM00, TM01) TM0n operates as a 16-bit up/down timer or up timer. The cycle is controlled by compare register 0n3 (CM0n3) (n = 0, 1). TM0n start/stop is controlled by the TM0CEn bit of timer control register 0n (TMC0n). Division by the prescaler can be selected for the count clock from among fCLK, fCLK/2, fCLK/4, fCLK/8, fCLK/16, fCLK/32 using the PRM02 to PRM00 bits of the TMC0n registers (fCLK: base clock, see 9.1.5 (1) Timer 0 clock selection register (PRM01)). The conditions when TM0n becomes 0000H are as follows. * Reset input * TM0CEn bit = 0 * TM0n register and compare register 0n3 (CM0n3) match (PWM mode 2 (sawtooth wave) only) * Immediately after overflow or underflow The TM0n timer has 3 operation modes, shown in Table 9-2. The operation mode is selected using timer control register 0n (TMC0n). Table 9-2. Operation Modes of Timer 0
Operation Mode Count Operation Timer Clear Source Interrupt Source BFCMn3 CM0n3 Transfer Timing BFCMn0 to BFCMn2, BFCMn4, BFCMn5 CM0n0 to CM0n2, CM0n4, CM0n5 Transfer Timing INTTM0n
PWM mode 0 (symmetric triangular wave)
Up/down
-
INTTM0n, INTCM010 to INTCM012, INTCM0n3 to INTCM0n5 INTTM0n, INTCM010 to INTCM012, INTCM0n3 to INTCM0n5 INTCM010 to INTCM012, INTCM0n3 to INTCM0n5
INTTM0n
PWM mode 1 (asymmetric triangular wave)
Up/down
-
INTTM0n
INTTM0n, INTCM0n3
PWM mode 2 (sawtooth wave)
Up
INTCM0n3
INTCM0n3
INTCM0n3
Caution Even if TM0ICn, CM03ICn, or an interrupt mask flag of the IMR0 register (TM0MKn or CM03MKn) is set (interrupt disabled) as the interrupt sources INTTM0n and INTCM0n3, it simply results in no interrupt occurrence and does not affect the operation of timer 0. The interrupt sources INTCM010 to INTCM012, INTCM0n4, and INTCM0n5 do not affect the operation of timer 0 regardless of whether the interrupt is masked or not. Remark n = 0, 1
196
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Dead-time timers 00 to 02, 10 to 12 (DTM00 to DTM02, DTM10 to DTM12) DTMn0 to DTMn2 are dedicated 12-bit down timers that generate dead time, which is effective for inverter control applications. DTMn0 to DTMn2 operate as one-shot timers. Counting by a dead-time timer is enabled or disabled by the TM0CEDn bit of timer control register 0n (TMC0n) and cannot be controlled by software. hardware. A dead-time timer starts counting down when the value of dead-time timer reload register n (DTRRn) is transferred in synchronization with the compare match timing of CM0n0 to CM0n2. When the value of a dead-time timer changes from 000H to FFFH, the dead-time timer generates an underflow signal, and the timer stops at the value FFFH. If the value of a dead-time timer matches the value of the corresponding compare register before underflow of the dead-time timer takes place, the value of DTRRn is transferred to the dead-time timer again, and the timer starts counting down. The count clock of the dead-time timer is fixed to the base clock (fCLK), and the dead-time width is (set value of DTRRn + 1)/base clock (fCLK). If TM0n operates in PWM mode 0 or PWM mode 1 with the dead-time timer count operation disabled, an inverted signal without dead time is output to TO0n0 and TO0n1, TO0n2 and TO0n3, and TO0n4 and TO0n5. (3) Dead-time timer reload registers 0, 1 (DTRR0, DTRR1) The DTRRn register is a 12-bit register used to set the values of the three dead-time timers (DTMn0 to DTMn2 registers) (n = 0, 1). However, a value is transferred from the DTRRn register to each dead-time register independently. DTRRn can be read/written in 16-bit units. All 0s are read for the higher 4 bits when the DTRRn register is read accessed in 16 bits. Dead-time timer count start and stop is controlled by
15 DTRR0 0
14 0
13 0
12 0
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF570H
After reset 0FFFH
15 DTRR1 0
14 0
13 0
12 0
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5B0H
After reset 0FFFH
Cautions 1. Changing the value of the DTRRn register during TM0n operation (TM0CEn bit of TMC0n register = 1) is prohibited. 2. Be sure to write 0 to the higher 4 bits. (4) Compare registers 000 to 002, 010 to 012 (CM000 to CM002, CM010 to CM012) CM0n0 to CM0n2 are 16-bit registers that always compare their own values with the value of TM0n. If the value of a compare register matches the value of TM0n, the compare register outputs a trigger signal, and changes the contents of the flip-flop (F/F) connected to the compare register. Each of CM0n0 to CM0n2 is provided with a buffer register (BFCMn0 to BFCMn2), so that the contents of the buffer are transferred to CM0n0 to CM0n2 at the following base clock (fCLK). Transfer is enabled or disabled by the BFTEN bit of the TMC0n register. If CM010 to CM012 of timer 01 match TM01, the INTCM010 to INTCM012 interrupts occur.
User's Manual U15195EJ3V0UD
197
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(5) Compare registers 004, 005, 014, 015 (CM004, CM005, CM014, CM015) CM0n4 and CM0n5 are 16-bit registers that always compare their value with TM0n. If the value of these registers matches the value of TM0n, the registers generate an interrupt signal (INTCM0n4 or INTCM0n5). CM0n4 and CM0n5 are also provided with a buffer register (BFCMn4 or BFCMn5), the contents of which are transferred to CM0n4 or CM0n5 at the next base clock (fCLK). Transfer is enabled or disabled by the BFTEN bit of the TMC0n register. (6) Compare registers 003, 013 (CM003, CM013) CM0n3 is a 16-bit register that always compare its value with the value of TM0n. If the values match, CM0n3 outputs an interrupt signal (INTCM0n3). CM0n3 controls the maximum count value of TM0n, and if the values match, it performs the following operations at the next timer count clock. * In triangular wave setting mode (PWM modes 0, 1): * Sawtooth wave setting mode (PWM mode 2): Switches TM0n operation from count up to count down Clears the count value of TM0n
CM0n3 also has a buffer register (BFCMn3) and transfers the buffer contents in the next base clock (fCLK) cycle to CM0n3. Transfer enable or disable is controlled by the BFTE3 bit of the TMC0n register. (7) Buffer registers CM00 to CM02, CM04, CM05, CM10 to CM12, CM14, CM15 (BFCM00 to BFCM02, BFCM04, BFCM05, BFCM10 to BFCM12, BFCM14, BFCM15) BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 are 16-bit registers that transfer data to the compare register (CM0n0 to CM0n2, CM0n4, CM0n5) corresponding to each buffer register when an interrupt signal (INTCM0n3/INTTM0n) is generated. These registers can be read/written in 16-bit units. Caution The set values of the BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 registers are transferred to the CM0n0 to CM0n2, CM0n4, and CM0n5 registers at the following timing (n = 0, 1). * When TM0CEn bit of TMC0n register = 0: Transfer at the next operation timing after writing to the BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 registers * When TM0CEn bit of TMC0n register = 1: The value of the BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 registers is transferred to the CM0n0 to CM0n2, CM0n4, and CM0n5 registers upon occurrence of INTTM0n or INTCM0n3. At this time, transfer enable or disable is controlled by the BFTEN bit of the timer control register (TMC0n).
198
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
15 BFCM00
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF572H
After reset FFFFH
15 BFCM10
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5B2H
After reset FFFFH
15 BFCM01
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF574H
After reset FFFFH
15 BFCM11
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5B4H
After reset FFFFH
15 BFCM02
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF576H
After reset FFFFH
15 BFCM12
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5B6H
After reset FFFFH
15 BFCM04
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF59CH
After reset FFFFH
15 BFCM14
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5DCH
After reset FFFFH
15 BFCM05
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF59EH
After reset FFFFH
15 BFCM15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5DEH
After reset FFFFH
User's Manual U15195EJ3V0UD
199
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(8) Buffer registers CM03, CM13 (BFCM03, BFCM13) BFCMn3 is a 16-bit register that transfers data to the compare register at any timing. Transfer enable or disable is controlled by the BFTE3 bit of the TMC0n register. BFCMn3 can be read/written in 16-bit units. Cautions 1. The set value of the BFCMn3 register is transferred to the CM0n3 register at the following timing (n = 0, 1). * When TM0CEn bit of TMC0n register = 0: Transfer at the next operation timing after writing to the BFCMn3 register * When TM0CEn bit of TMC0n register = 1: The value of the BFCMn3 register is transferred to the CM0n3 register upon occurrence of INTTM0n. At this time, transfer enable or disable is controlled by the BFTE3 bit of the timer control register (TMC0n). 2. Setting the BFCMn3 register to 0000H is prohibited.
15 BFCM03
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF578H
After reset FFFFH
15 BFCM13
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5B8H
After reset FFFFH
200
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.1.5 Control registers (1) Timer 0 clock selection register (PRM01) The PRM01 register is used to select the base clock (fCLK) of timer 0 (TM0n). It can be read/written in 8-bit or 1-bit units. Caution Always set this register before using the timer.
7 PRM01 0
6 0
5 0
4 0
3 0
2 0
1 0
0 PRM1
Address FFFFF5D0H
After reset 00H
Bit position 0
Bit name PRM1
Function Specifies the base clock (fCLK) of timer 0 (TM0n) (See Figure 9-3). 0: fXX/2 1: fXX Caution Set fCLK to 40 MHz or less. Remark fXX: Internal system clock
Figure 9-3. Timer 00 and Timer 01 Clock
Timer 00 fXX
Select
fCLK
fXX/2 Timer 01 PRM1
Remarks 1. fXX: Internal system clock 2. fCLK: Base clock
User's Manual U15195EJ3V0UD
201
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Timer control registers 00, 01 (TMC00, TMC01) TMC0n is a 16-bit register that sets the operation of timer 0 (TM0n). The TMC0n register can be read/written in 16-bit units. If the higher 8 bits of the TMC0n register are used as the TMC0nH register and the lower 8 bits as the TMC0nL register, the register can be read/written in 8-bit or 1-bit units. Caution To operate timer 0, first set TM0CEn = 0 and then set TM0CEn = 1. (1/4)
<15> <14> 13 12 11 10 9 8 7 0 6 <5> 4 3 2 1 0 Address FFFFF57AH After reset 0508H
TMC00 TM0CE0 STINT0 CUL02 CUL01 CUL00 PRM02 PRM01 PRM00
0 TM0CED0 BFTE3 BFTEN MBFTE MOD01 MOD00
<15> <14> 13
12
11
10
9
8
7 0
6
<5>
4
3
2
1
0
Address FFFFF5BAH
After reset 0508H
TMC01 TM0CE1 STINT1 CUL02 CUL01 CUL00 PRM02 PRM01 PRM00
0 TM0CED1 BFTE3 BFTEN MBFTE MOD01 MOD00
Bit position 15
Bit name TM0CEn
Function Specifies the operation of TM0n. 0: Count disabled (stops after all count values are cleared) 1: Count enabled Caution When TM0CEn = 0, TO0n0 to TO0n5 output becomes high impedance.
14
STINTn
Specifies interrupt during TM0n timer start. 0: Interrupt not generated at operation start 1: Interrupt generated at operation start When STINTn = 1, an interrupt is generated immediately after the rising edge of the TM0CEn signal. When MOD01 = 0 (triangular wave mode), the INTTM0n interrupt (see Figure 9-4) is generated, and when MOD01 = 1 (sawtooth wave mode), the INTCM0n3 interrupt is generated. Cautions 1. Changing the STINTn bit during TM0n operation (TM0CEn bit = 1) is prohibited. 2. The INTCM010 to INTCM012, INTCM0n4, and INTCM0n5 interrupts are not affected by the STINTn bit (an interrupt does not occur when the timer is started if STINTn = 1).
13 to 11
CUL02 to CUL00
Specifies the interrupt culling ratio. CUL02 0 0 0 0 1 CUL01 0 0 1 1 0 CUL00 0 1 0 1 0 Interrupt culling ratio 1/1 1/2 1/4 1/8 1/16 Culling not performed
Other than above
Remark
n = 0, 1
202
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2/4)
Bit position 13 to 11 Bit name CUL02 to CUL00 Function Cautions 1. The INTTM0n and INTCM0n3 interrupts can be culled at the same culling ratio (1/1, 1/2, 1/4, 1/8, 1/16). 2. Even when BFTE3 = 1, BFTEN = 1 (settings to transfer data from the BFCMn0 to BFCMn3 registers to the CM0n0 to CM0n3 registers), transfer is not performed at the generation timing of the culled INTTM0n and INTCM0n3 interrupts if MBFTE = 0. 3. If the culling ratio is changed during a count operation, the new culling ratio is applied after an interrupt has occurred at the culling ratio prior to the change (see Figure 9-5). 4. The INTCM010 to INTCM012, INTCM0n4, and INTCM0n5 interrupts are not affected by the CUL02 to CUL00 bits (the interrupts occur each time at the same culling ratio as when CUL02 to CUL00 = 000 (1/1)). Specifies the count clock for TM0n. PRM02 0 0 0 0 1 1 PRM01 0 0 1 1 0 0 PRM00 0 1 0 1 0 1 Count clock fCLK fCLK/2 fCLK/4 fCLK/8 fCLK/16 fCLK/32 Setting prohibited
10 to 8
PRM02 to PRM00
Other than above Caution
The division ratio switch timing is from when the TM0n value has become 0000H and the INTTM0n interrupt has occurred. Therefore, the division ratio is not switched at the timing that corresponds to interrupt culling.
Remark For the base clock (fCLK), see 9.1.5 (1) Timer 0 clock selection register (PRM01). 5 TM0CEDn Specifies the operation of the DTMn0 to DTMn2 timers.. 0: DTMn0 to DTMn2 perform count operation 1: DTMn0 to DTMn2 stopped Cautions1. 2. Changing the TM0CEDn bit during TM0n operation (TM0CEn = 1) is prohibited. If TM0n is operated when TM0CEDn = 1, a signal without dead time is output to the TO0n0 to TO0n5 pins.
Remark
n = 0, 1
User's Manual U15195EJ3V0UD
203
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3/4)
Bit position 4 Bit name BFTE3 Function Specifies transfer of data from the BFCMn3 register to the CM0n3 register. 0: Transfer disabled 1: Transfer enabled The transfer timing from the BFCMn3 register to the CM0n3 register is as follows. BFTE3 0 1 1 1 TM0n operation mode All modes PWM mode 0 (symmetric triangular wave) PWM mode 1 (asymmetric triangular wave) PWM mode 2 (sawtooth wave) BFCMn3 CM0n3 transfer timing No transfer INTTM0n INTTM0n INTCM0n3
When BFTE3 = 1, the value of the BFCMn3 register is transferred to the CM0n3 register upon occurrence of the INTTM0n or INTCM0n3 interrupt. 3 BFTEN Specifies transfer of data from the BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 registers to the CM0n0 to CM0n2, CM0n4, CM0n5 registers. 0: Transfer disabled 1: Transfer enabled BFTEN TM0n operation mode BFCMn0 to BFCMn2, BFCMn4, BFCMn5 CM0n0 to CM0n2, CM0n4, CM0n5 transfer timing Don't transfer INTTM0n INTTM0n, INTCM0n3 INTCM0n3
0 1 1 1
All modes PWM mode 0 (symmetric triangular wave) PWM mode 1 (asymmetric triangular wave) PWM mode 2 (sawtooth wave)
When BFTEN = 1, the values of the BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 registers are transferred to the CM0n0 to CM0n2, CM0n4, and CM0n5 registers upon occurrence of the INTTM0n or INTCM0n3 interrupt. 2 MBFTE When culling of the INTTM0n and INTCM0n3 interrupts is set by the CUL02 to CUL00 bits, this bit specifies whether to enable or disable the BFTE3 and BFTEN bit settings upon occurrence of an interrupt for culling. 0: Disable the set values of the BFTE3 and BFTEN bits upon occurrence of a culling interrupt 1: Enable the set values of the BFTE3aand BFTEN bits upon occurrence of a culling interrupt The various combinations are as follows. MBFTE Operation upon occurrence of interrupt for culling 0 BFTEN 0 1 BFTE3 0 1 . BFCMn0 to BFCMn2 CM0n0 to CM0n2 transfer disabled BFCMn0 to BFCMn2 CM0n0 to CM0n2 transfer disabled BFCMn3 CM0n3 transfer disabled BFCMn3 CM0n3 transfer disabled 1 BFCMn0 to BFCMn2 CM0n0 to CM0n2 transfer disabled BFCMn0 to BFCMn2 CM0n0 to CM0n2 transfer enabled BFCMn3 CM0n3 transfer disabled BFCMn3 CM0n3 transfer enabled
Remark
n = 0, 1
User's Manual U15195EJ3V0UD
204
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4/4)
Bit position 1, 0 Bit name MOD01, MOD00 Specifies the operation mode of TM0n. Timer clear BFCMn3 source CM0n3 timing Function
MOD 01
MOD 00
Operation mode
TM0n operation
BFCMn0 to BFCMn2, BFCMn4, BFCMn5 CM0n0 to CM0n2, CM0n4, CM0n5 timing INTTM0n
0
0
PWM mode 0 (symmetric triangular wave) PWM mode 1 (asymmetric triangular wave)
Up/down
-
INTTM0n
0
1
Up/down
-
INTTM0n
INTTM0n, INTCM0n3
1
0
PWM mode 2 Up (sawtooth wave) Setting prohibited
INTCM0n3
INTCM0n3
INTCM0n3
1 Caution
1
Changing the value of the MOD01 and MOD00 bits during TM0n operation (TM0CEn bit = 1) is prohibited.
Remark
n = 0, 1
Figure 9-4. Specification of INTTM0n Interrupt in PWM Mode 0 (Symmetric Triangular Wave), PWM Mode 1 (Asymmetric Triangular Wave) (MOD01, MOD00 Bits of TMC0n Register = 0n)
CM0n3 TM0n count value 0000H
Timer operation stopped
TM0CEn
Specification from occurrence of INTTM0n at first start after reset is possible using STINTn bit
INTTM0n occurrence
INTTM0n occurrence can be specified using STINTn bit
INTTM0n occurrence
Remark n = 0, 1
User's Manual U15195EJ3V0UD
205
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-5. Interrupt Culling Processing
(a) PWM mode 0 (symmetric triangular wave)
CM0n3 TM0n count value 0000H Interrupt request
INTTM0n occurrence INTTM0n occurrence INTTM0n occurrence INTTM0n occurrence
CUL02 to CUL00
000
001
Interrupt culling 1/1 cycle
Interrupt culling 1/2 cycle
Remark
n = 0, 1 (b) PWM mode 1 (asymmetric triangular wave)
CM0n3 TM0n count value 0000H Interrupt request
INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 occurrence occurrence occurrence occurrence occurrence INTTM0n INTCM0n3 occurrence occurrence INTTM0n occurrence
CUL02 to CUL00
000
001
Interrupt culling 1/1 cycle
Interrupt culling 1/2 cycle
Remark
n = 0, 1 (c) PWM mode 2 (sawtooth wave)
CM0n3 TM0n count value 0000H Interrupt request CUL02 to CUL00
INTCM0n3 occurrence INTCM0n3 occurrence INTCM0n3 occurrence INTCM0n3 occurrence
000
001
Interrupt culling 1/1 cycle
Interrupt culling 1/2 cycle
Remark
n = 0, 1
206
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-6. Interrupt Culling Ratio Change Timing (Relationship Between STINTn Bit Setting and CUL Bit Change): PWM Mode 1 (Asymmetric Triangular Wave)
TM0CEn bit CM0n3 TM0n count value 0000H STINTn = 1 INTTM0n INTTM0n INTTM0n INTTM0n CUL02 to CUL00 bits 000 Interrupt culling 1/1 cycle
INTCM0n3 INTCM0n3 INTCM0n3 INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3
001 Interrupt culling 1/2 cycle
010 Interrupt culling 1/4 cycle
TM0CEn bit CM0n3 TM0n count value 0000H STINTn = 1 CUL02 to CUL00 bits
INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTTM0n INTTM0n INTTM0n INTCM0n3 INTCM0n3 INTCM0n3 INTCM0n3
001 Interrupt culling 1/2 cycle
010 Interrupt culling 1/4 cycle
000 Interrupt culling 1/1 cycle
TM0CEn bit CM0n3 TM0n count value 0000H STINTn = 1 CUL02 to CUL00 bits 001 Interrupt culling 1/2 cycle
INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTCM0n3 INTTM0n INTTM0n INTTM0n INTTM0n INTTM0n INTCM0n3 INTCM0n3 INTCM0n3 INTCM0n3
010 Interrupt culling 1/4 cycle
000 Interrupt culling 1/1 cycle
Caution If, in TM0n, to realize the INTTM0n and INTCM0n3 culling function, the culling ratio is set to a value other than 1/1 by bits CUL02 to CUL00 and counting is started, the subsequent interrupt output sequence will differ due to the set value of the STINTn bit at count start. Remark n = 0, 1
User's Manual U15195EJ3V0UD
207
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3) Timer unit control registers 00, 01 (TUC00, TUC01) TUC0n is an 8-bit register that controls the TO0n0 to TO0n5 outputs. TUC0n can be read/written in 8-bit or 1-bit units. However, bit 0 is read-only.
7 TUC00 0
6 0
5 0
4 0
3 0
2 0
<1> TORS0
<0> TOSTA0
Address FFFFF57CH
After reset 01H
7 TUC01 0
6 0
5 0
4 0
3 0
2 0
<1> TORS1
<0> TOSTA1
Address FFFFF5BCH
After reset 01H
Bit position 1
Bit name TORSn
Function Flag that restarts TO0n0 to TO0n5 pin outputs that were forcibly stopped by ESOn pin input. Output is resumed by writing "1" to the TORSn bit.
Cautions1.
2.
3.
If the level is set to the ESOn pin input level (TOMR register TOEDG1 bit = 1, TOEDG0 bit = 0 or 1), the output disabled state is not released (TOSTAn bit = 1) even if "1" is written to the TORSn bit while output is disabled (TOSTAn bit = 1). If the input level is the inactive level, the output disabled state is released (TOSTAn bit = 0). If the edge is set to the ESOn pin input (TOEDG1 bit = 0, TOEDG0 bit = 0 or 1), the output disabled state is released (TOSTAn bit = 0) when "1" is written to the TORSn bit while output is disabled (TOSTAn bit = 1). After reset, be sure to write "1" to the TORSn bit prior to starting TO0n0 to TO0n5 output. "0" is read when the TORSn bit is read.
0
TOSTAn
Flag indicating TO0n0 to TO0n5 pin output status according to ES0n pin input 0: Output enabled status 1: Output disabled status
Remark
n = 0, 1
208
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4) Timer output mode registers 0, 1 (TOMR0, TOMR1) The TOMRn register controls timer output from the TO0n0 to TO0n5 pins. To prevent abnormal output from the TO0n0 to TO0n5 pins due to illegal access, data is written to the TOMRn register in the following two sequences. (a) Write access to the TOMR write enable register (SPECn), followed by (b) Write access to the TOMRn register Write is not enabled via hardware unless the these two sequences are implemented. TOMRn can be read/written in 8-bit units. Caution When interrupt requests are generated during write access to the TOMRn register (after write access to the SPECn register and prior to writing to the TOMRn register), write processing to the TOMRn register may not be performed normally if access to other addresses is performed using the internal bus during servicing of these interrupts. Add one of the following processing items during the TOMRn register write routine. * Prior to write access to the TOMRn register, disable acknowledgement of all interrupts of the CPU. * Following write access to the TOMRn register, check that write was performed normally. (1/2)
7 TOMR0 ALVTO 6 ALVUB 5 ALVVB 4 ALVWB 3 TOSP 2 0 1 0 Address FFFFF57DH After reset 00H
TOEDG1 TOEDG0
7 TOMR1 ALVTO
6 ALVUB
5 ALVVB
4 ALVWB
3 TOSP
2 0
1
0
Address FFFFF5BDH
After reset 00H
TOEDG1 TOEDG0
Bit position 7
Bit name ALVTO
Function Specifies the active level of the TO0n0, TO0n2, and TO0n4 pins. 0: Active level is low level 1: Active level is high level Caution Changing the ALVTO bit during TM0n operation (TM0CEn = 1) is prohibited.
6
ALVUB
Specifies the output level of the TO0n1 pin. 0: Inverted level of active level set by ALVTO bit 1: Active level set by ALVTO bit When ALVUB = 1, the output level of TO0n1 output is the same as TO0n0. Caution Changing the ALVUB bit during TM0n operation (TM0CEn = 1) is prohibited.
Remark
n = 0, 1
User's Manual U15195EJ3V0UD
209
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2/2)
Bit position 5 Bit name ALVVB Function Specifies the output level of the TO0n3 pin. 0: Inverted level of active level set by ALVTO bit 1: Active level set by ALVTO bit When ALVVB = 1, the output level of TO0n3 output is the same as TO0n2. Caution Changing the ALVVB bit during TM0n operation (TM0CEn = 1) is prohibited 4 ALVWB Specifies the output level of the TO0n5 pin. 0: Inverted level of active level set by ALVTO bit 1: Active level set by ALVTO bit When ALVWB = 1, the output level of TO0n5 output is the same as TO0n4. Caution Changing the ALVWB bit during TM0n operation (TM0CEn = 1) is prohibited. 3 TOSP Controls TO0n0 to TO0n5 pin output stop via ESOn pin input. 0: Enables ESOn pin input 1: Disables ESOn pin input Cautions 1. The output stop status can be released by writing "1" to the TORSn bit of the TUC0n register. The operation continues even if output is prohibited for all timers and counters. 2. Before changing the ESOn pin input status from disabled to enabled (changing the TOSP bit from 1 to 0), write "1" to the TORSn bit of the TUCn register to reset the ESOn pin input status. 1, 0 TOEDG1, TOEDG0 These bits select the valid edge or level when setting forcible stop of TO0n0 to TO0n5 output via ESOn pin input using the TOSP bit. TOEDG1 0 0 1 1 TOEDG0 0 1 0 1 Rising edge Falling edge Low level High level Operation
Cautions 1. Changing the TOEDG1 and TOEDG0 bits during TM0n operation (TM0CEn = 1) is prohibited. 2. Before changing the settings of bits TOEDG1 and TOEDG0, write "1" to the TORSn bit of the TUC0n register to reset the ESOn pin input status.
Remark
n = 0, 1
210
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Examples of the output waveforms of TO000 and TO001 when the higher 4 bits (ALVTO, ALVUB, ALVVB, and ALVWB) of the TOMRn register are set in PWM mode 0 (asymmetric triangular waves) are shown below. Figure 9-7. Output Waveforms of TO000 and TO001 in PWM Mode 0 (Symmetric Triangular Waves) (Without Dead Time (TM0CED0 Bit = 1))
(a) TOMR0 register value = 80H
TM00 = CM000 TO000 TM00 = CM000
TO001
(b) TOMR0 register value = 00H
TM00 = CM000 TO000 TM00 = CM000
TO001
(c) TOMR0 register value = C0H
TM00 = CM000 TO000 TM00 = CM000
TO001
(d) TOMR0 register value = 40H
TM00 = CM000 TO000 TM00 = CM000
TO001
User's Manual U15195EJ3V0UD
211
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-8. Output Waveforms of TO000 and TO001 in PWM Mode 0 (Symmetric Triangular Waves) (With Dead Time (TM0CED0 Bit = 0))
(a) TOMR0 register value = 80H
TM00 = CM000 TM00 = CM000
TO000
TO001 Dead time period Dead time period
(b) TOMR0 register value = 00H
TM00 = CM000 TM00 = CM000
TO000
TO001 Dead time period Dead time period
(c) TOMR0 register value = C0H
TM00 = CM000 TM00 = CM000
TO000
TO001 Dead time period Dead time period
(d) TOMR0 register value = 40H
TM00 = CM000 TM00 = CM000
TO000
TO001 Dead time period Dead time period
212
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Data is set to timer output mode registers 0 and 1 (TOMR0, TOMR1) in the following sequence. <1> Prepare the data to be set to timer output mode registers 0 and 1 (TOMR0, TOMR1) in a general-purpose register. <2> Write data to TOMR write enable registers 0 and 1 (SEPC0, SPEC1). <3> Set timer output mode registers 0 and 1 (TOMR0, TOMR1) (using the following instructions). * Store instruction (ST/SST instructions) * Bit manipulation instruction (SET1/CLR1/NOT1 instructions) [Description Example] <1> MOV <2> ST.B <3> ST.B Remark n = 0, 1 To read the TOMRn register, no special sequence is required. Cautions 1. Prohibit interrupts between SPECn issuance (<2>) and the TOMRn register write that immediately follows (<3>). 2. The data written to the SPECn register is dummy data; use the same register as the generalpurpose register used to set the TOMRn register (<3> in the above example) for SPECn register write (<2> in the above example). The same applies when using a general-purpose register for addressing. 3. Do not write to the SPECn register or TOMRn register using DMA transfer. 0x04, r10 r10, SPECn [r0] r10, TOMRn [r0]
User's Manual U15195EJ3V0UD
213
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(5) PWM output enable registers 0, 1 (POER0, POER1) The POERn register is used to make the external pulse output (TO0n0 to TO0n5) status inactive by software. POERn can be read/written in 8-bit or 1-bit units.
7 POER0 0
6 0
<5> OE210
<4> OE200
<3> OE110
<2> OE100
<1> OE010
<0> OE000
Address FFFFF57FH
After reset 00H
7 POER1 0
6 0
<5> OE211
<4> OE201
<3> OE111
<2> OE101
<1> OE011
<0> OE001
Address FFFFF5BFH
After reset 00H
Bit position 5
Bit name OE21n
Function Specifies the output status of the TO0n5 pin. 0: TO0n5 output status is high impedance. 1: TO0n5 output status is controlled by TM0CEn bit of TMC0n register and TORTOn bit of PSTOn register and ESOn pin. Specifies the output status of the TO0n4 pin. 0: TO0n4 output status is high impedance. 1: TO0n4 output status is controlled by TM0CEn bit of TMC0n register and TORTOn bit of PSTOn register and ESOn pin. Specifies the output status of the TO0n3 pin. 0: TO0n3 output status is high impedance. 1: TO0n3 output status is controlled by TM0CEn bit of TMC0n register and TORTOn bit of PSTOn register and ESOn pin. Specifies the output status of the TO0n2 pin. 0: TO0n2 output status is high impedance. 1: TO0n2 output status is controlled by TM0CEn bit of TMC0n register and TORTOn bit of PSTOn register and ESOn pin. Specifies the output status of the TO0n1 pin. 0: TO0n1 output status is high impedance. 1: TO0n1 output status is controlled by TM0CEn bit of TMC0n register and TORTOn bit of PSTOn register and ESOn pin. Specifies the output status of the TO0n0 pin. 0: TO0n0 output status is high impedance. 1: TO0n0 output status is controlled by TM0CEn bit of TMC0n register and TORTOn bit of PSTOn register and ESOn pin.
4
OE20n
3
OE11n
2
OE10n
1
OE01n
0
OE00n
Remark
n = 0, 1
214
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(6) PWM software timing output registers 0, 1 (PSTO0, PSTO1) The PSTOn register is used to perform settings to output the desired waveforms to the external pulse output pins (TO0n0 to TO0n5) by software. PSTOn can be read/written in 8-bit or 1-bit units. Cautions 1. When the value of the TORTOn bit has been changed from 0 to 1 during timer output (setting changed to software output), the timing is delayed by the dead-time portion when the output level differs from the timer output signal during output due to the settings of the UPORTn, VPORTn, and WPORTn bits. When the output level is the same as the timer output signal during output due to the settings of the UPORTn, VPORTn, and WPORTn bits, output is performed maintaining the same output level. 2. If software output is enabled (TORTOn bit = 1), the INTTM0n and INTCM0n3 interrupts and TO0n0 to TO0n5 output statuses are as follows during TM0n operation (TM0CEn bit = 1). INTTM0n and INTCM0n3 interrupts: Continue occurring at each timing in accordance with timer and compare operations. TO0n0 to TO0n5 outputs: Software output has priority.
3. If the TORTOn bit is changed from 1 to 0 during TM0n operation (TM0CEn bit = 1), the software output state is retained for the TO0n0 to TO0n5 outputs until one of the set/reset condition of the flip-flop for the TO0n0 to TO0n5 outputs shown in (a) below is generated. (a) Set/reset conditions of flip-flop for TO0n0 to TO0n5 outputs
Output Status Set Timer output Operation Mode Triangular wave mode (PWM mode 0, 1) Sawtooth wave mode (PWM mode 2) Software output Reset Timer output - Triangular wave mode (PWM mode 0, 1) Sawtooth wave mode (PWM mode 2) Software output - Conditions Compare match while TM0n is counting up
Match between TM0n and CM0n3 registers
Set (to 1) UPORTn, VPORTn, and WPORTn bits Compare match while TM0n is counting down
Compare match with TM0n
Clear (to 0) UPORTn, VPORTn, and WPORTn bits
Remark n = 0, 1 4. If the same value is written to the UPORTn (VPORTn, WPORTn) bit when TORTOn =1, the TO0n0 and TO0n1 outputs (TO0n2 and TO0n3, TO0n4 and TO0n5) are not changed.
User's Manual U15195EJ3V0UD
215
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(1/2)
<7> PSTO0 TORTO0 6 0 5 0 4 0 3 0 <2> <1> <0> Address FFFFF57EH After reset 00H
UPORT0 VPORT0 WPORT0
<7> PSTO1 TORTO1
6 0
5 0
4 0
3 0
<2>
<1>
<0>
Address FFFFF5BEH
After reset 00H
UPORT1 VPORT1 WPORT1
Bit position 7
Bit name TORTOn
Function Specifies TO0n0 to TO0n5 output control. 0: Timer output 1: Software output The change of the TO0n0 to TO0n5 signals during software output occurs when the TORTOn bit is set (to 1) and a value is written to the UPORTn, VPORTn, and WPORTn bits. A dead-time timer can also be used.
2
UPORTn
Specifies the TO0n0 (U phase)/TO0n1 (U phase) pin output value. UPORTn 0 TO0n0 TO0n1 Operation Inverted level of ALVTO bit setting When ALVUB = 0 When ALVUB = 1 1 TO0n0 TO0n1 Level of ALVTO bit setting Inverted level of ALVTO bit setting
Level of ALVTO bit setting When ALVUB = 0 When ALVUB = 1 Inverted level of ALVTO bit setting Level of ALVTO bit setting
Caution If the UPORTn bit setting value is changed when TORTOn = 1, the dead-time setting becomes valid for the TO0n0/TO0n1 output signal in the same way as during normal timer operation. 1 VPORTn Specifies the TO0n2 (V phase)/TO0n3 (V phase) pin output value. VPORTn 0 TO0n2 TO0n3 Operation Inverted level of ALVTO bit setting When ALVVB = 0 When ALVVB = 1 1 TO0n2 TO0n3 Level of ALVTO bit setting Inverted level of ALVTO bit setting
Level of ALVTO bit setting When ALVVB = 0 When ALVVB = 1 Inverted level of ALVTO bit setting Level of ALVTO bit setting
Caution If the VPORTn bit setting value is changed when TORTOn = 1, the dead-time setting becomes valid for the TO0n2/TO0n3 output signal in the same way as during normal timer operation.
Remark
n = 0, 1 ALVTO bit: Bit 7 of the TOMRn register ALVUB bit: Bit 6 of the TOMRn register ALVVB bit: Bit 5 of the TOMRn register
216
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2/2)
Bit position 0 Bit name WPORTn Function Specifies the TO0n4 (W phase)/TO0n5 (W phase) pin output value. WPORTn 0 TO0n4 TO0n5 Operation Inverted level of ALVTO bit setting When ALVWB = 0 When ALVWB = 1 1 TO0n4 TO0n5 Level of ALVTO bit setting Inverted level of ALVTO bit setting
Inverted level of ALVTO bit setting When ALVWB = 0 When ALVWB = 1 Inverted level of ALVTO bit setting Level of ALVTO bit setting
Caution If the WPORTn bit setting value is changed when TORTOn = 1, the dead-time setting becomes valid for the TO0n4/TO0n5 output signal in the same way as during normal timer operation.
Remark
n = 0, 1 ALVTO bit: Bit 7 of the TOMRn register ALVWB bit: Bit 4 of the TOMRn register
The TO0n0 to TO0n5 pins can be set to timer output by a match between TM0n and the compare register or to software output using the PSTOn register (TORTOn bit = 1). Software output has the priority over timer output. Consequently, when the setting changes from TM0CEn = 1 (timer operation enabled), TORTOn = 1 (software output enabled) to TM0CEn = 1 (timer operation enabled), TORTOn = 0 (software output disabled), the TO0n0 to TO0n5 pins continue to perform software output until the occurrence of the first F/F set/reset due to a match between TM0n and the compare register after the TORTOn bit setting changes. The relationship between the settings of the TORTOn and TM0CEn bits when ALVTO = 1 and the output of TO0n0 (negative phase side) is shown on the following pages (the positive phase side (TO0n1, TO0n3, and TO0n5) is dependent on the ALVUB, ALVVB, and ALVWB bits, so refer to the explanations of each of these bits).
User's Manual U15195EJ3V0UD
217
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-9. When UPORTn = 1 Is Set Immediately Before TORTOn = 0 (Switched by Active Value)
CM0n3 TM0n Count value 0000H Note 1 Note 2
CM0n3
CM0n3
CM0n3
Note 3
Note 2
Note 1
Note 2
F/F
INTCM0n3
Note 4
INTTM0n
TO0n0
TM0CEn
TORTOn
UPORTn Timer output Software output P1 T1 Timer output
Notes 1. 2. 3. 4. Remark
F/F set by compare match during up count F/F reset by compare match during down count F/F set by writing UPORTn bit F/F reset by writing UPORTn bit n = 0, 1
If the setting of the TORTOn bit changes from 1 to 0 while the UPORTn bit is set to 1 in the P1 period in Figure 9-9 above, the F/F continues to hold the TORTOn bit setting of "1" until the T1 timing. However, because the F/F is reset at the T1 timing (by a compare match of TM0n during down counting), the TO0n0 output changes from 1 to 0.
218
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-10. When UPORTn = 0 Is Set Immediately Before TORTOn = 0 (Switched by Inactive Value)
CM0n3 TM0n Count value 0000H Note 1 Note 2
CM0n3
CM0n3
CM0n3
Note 3
Note 1
Note 2
F/F
INTCM0n3
Note 4
INTTM0n
TO0n0
TM0CEn
TORTOn
UPORTn Timer output Software output P1 Timer output T2
Notes 1. 2. 3. 4. Remark
F/F set by compare match during up count F/F reset by compare match during down count F/F set by writing UPORTn bit F/F reset by writing UPORTn bit n = 0, 1
If the setting of the TORTOn bit changes from 1 to 0 while the UPORTn bit is set to 0 in the P1 period in Figure 910 above, the F/F continues to hold the TORTOn bit setting of "0" until the T2 timing. However, because the F/F is set at the T2 timing (by a compare match of TM0n during up counting), the TO0n0 output changes from 1 to 0. Note that TO0n0 to TO0n5 output will stop if the TORTOn bit setting is changed from 1 to 0 while the TM0CEn bit is 0.
User's Manual U15195EJ3V0UD
219
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-11. When UPORTn = 0 Is Set Immediately Before TORTOn = 1
CM0n3 TM0n Count value 0000H Note 1 Note 2
CM0n3
CM0n3
CM0n3
Note 1 Note 3
Note 1
Note 2
F/F
INTCM0n3
Note 4
INTTM0n
TO0n0
TM0CEn
TORTOn
UPORTn Timer output T3 Software output Timer output
Notes 1. 2. 3. 4. Remark
F/F set by compare match during up count F/F reset by compare match during down count F/F set by writing UPORTn bit F/F reset by writing UPORTn bit n = 0, 1
If the setting of the TORTOn bit changes from 0 to 1 while the UPORTn bit is set to 0 during TM0n operation (TM0CEn = 1), the TO0n0 output changes from 1 to 0 because the F/F is reset at the T3 timing. Examples of the software output waveforms of TO000 and TO001 based on the settings of the TORTOn, UPORTn, VPORTn, and WPORTn bits are shown on the following pages.
220
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-12. Software Output Waveforms of TO000 and TO001 (Without Dead Time (TM0CED0 = 1))
(a) TOMR0 register value = 80H
UPORT0 1 TO000 UPORT0 0
TO001
(b) TOMR0 register value = 00H
UPORT0 1 TO000 UPORT0 0
TO001
(c) TOMR0 register value = C0H
UPORT0 1 TO000 UPORT0 0
TO001
(d) TOMR0 register value = 40H
UPORT0 1 TO000 UPORT0 0
TO001
User's Manual U15195EJ3V0UD
221
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-13. Software Output Waveforms of TO000 and TO001 (With Dead Time (TM0CED0 = 0))
(a) TOMR0 register value = 80H
UPORT0 1 UPORT0 0
TO000
TO001 Dead-time period Dead-time period
(b) TOMR0 register value = 00H
UPORT0 1 UPORT0 0
TO000
TO001 Dead-time period Dead-time period
(c) TOMR0 register value = C0H
UPORT0 1 UPORT0 0
TO000
TO001 Dead-time period Dead-time period
(d) TOMR0 register value = 40H
UPORT0 1 UPORT0 0
TO000
TO001 Dead-time period Dead-time period
222
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-14. Software Output Waveforms of TO000 and TO001 When "1" Is Written to UPORT0 Bit While TORTO0 = 1 (When TOMR0 Register Value = 80H)
(a) Without dead time (TM0CED0 = 1)
UPORT0 1 UPORT0 0 UPORT0 1 TO000
TO001
(b) With dead time (TM0CED0 = 0)
UPORT0 1 UPORT0 0 UPORT0 1 TO000
TO001 Dead-time period Dead-time period
The following table shows the output status of external pulse output (in the case of TO0n0). Table 9-3. Output Status of External Pulse Output (In Case of TO0n0)
OE00n Bit 0 1 TORTOn, UPORTn Bits 0/1 0 TM0CEn Bit 0/1 0 1 1 0/1 TO0n0 High impedance High impedance Timer output Output by UPORTn bit
Remarks 1. OE00n bit: Bit 0 of POERn register TORTOn bit: Bit 7 of PSTOn register UPORTn bit: Bit 2 of PSTOn register TM0CEn bit: Bit 15 of TMC0n register 2. n = 0, 1
User's Manual U15195EJ3V0UD
223
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(7) TOMR write enable registers 0, 1 (SPEC0, SPEC1) The SPECn register enables writing to the TOMRn register. Unless writing to the TOMRn register is performed immediately after writing to the SPECn register (any data can be written), write processing to the TOMRn register is not performed normally. Normally, 0000H is read. The SPECn register can be read/written in 16-bit units. Remark n = 0, 1
15 SPEC0 0
14 0
13 0
12 0
11 0
10 0
9 0
8 0
7 0
6 0
5 0
4 0
3 0
2 0
1 0
0 0
Address FFFFF580H
After reset 0000H
15 SPEC1 0
14 0
13 0
12 0
11 0
10 0
9 0
8 0
7 0
6 0
5 0
4 0
3 0
2 0
1 0
0 0
Address FFFFF5C0H
After reset 0000H
224
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.1.6 Operation Remarks 1. In the explanation of operations in this section, the bits that affect the TO0n0 to TO0n5 outputs are assumed to be set as follows. ALVTO = 1, ALVUB = 0, ALVVB = 0, ALVWB = 0, TORTOn =0 2. The F/F in this section indicates the flip-flop for controlling the output of the TO0n0 to TO0n5 pins. (1) Basic operation Timer 0 (TM0n) is a 16-bit interval timer that operates as an up/down timer or as an up timer. The cycle is controlled by compare register 0n3 (CM0n3) (n = 0, 1). All TM0n bits are cleared (0) by RESET input and the count operation is stopped. Count operation enable/disable is controlled by the TM0CEn bit of timer control register 0n (TMC0n). The count operation is started by setting the TM0CEn bit to 1 by software. Resetting the TM0CEn bit to 0 clears TM0n and stops the count operation. When the value of compare register 0n3 (CM0n3) set beforehand and the value of the TM0n counter match, a match interrupt (INTCM0n3) is generated. The count clock to TM0n can be selected from among 6 internal clocks using the TMC0n register. If TM0n has been set as an up/down timer, an underflow interrupt (INTTM0n) is generated when TM0n becomes 0000H during down counting. TM0n has the following three operation modes, which are selected using timer control register 0n (TMC0n). * PWM mode 0: Triangular wave modulation (right-left symmetric waveform control) * PWM mode 1: Triangular wave modulation (right-left asymmetric waveform control) * PWM mode 2: Sawtooth wave modulation control
User's Manual U15195EJ3V0UD
225
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Table 9-4. Operation Modes of Timer 0 (TM0n)
TMC0n Register MOD01 MOD00 Operation Mode TM0n Operation Timer Clear Source Interrupt Source BFCMn3 CM0n3 Timing BFCMn0 to BFCMn2, BFCMn4, BFCMn5 CM0n0 to CM0n2, CM0n4, CM0n5 Timing INTTM0n
0
0
PWM mode 0 (Symmetric triangular wave)
Up/down
-
INTTM0n, INTCM010 to INTCM012, INTCM0n3 to INTCM0n5 INTTM0n, INTCM010 to INTCM012, INTCM0n3 to INTCM0n5 INTCM010 to INTCM012, INTCM0n3 to INTCM0n5
INTTM0n
0
1
PWM mode 1 (Asymmetric triangular wave)
Up/down
-
INTTM0n
INTTM0n, INTCM0n3
1
0
PWM mode 2 (Sawtooth wave)
Up
INTCM0n3
INTCM0n3
INTCM0n3
1
1
Setting prohibited
Caution Changing the MOD01 and MOD00 bits during TM0n operation (TM0CEn = 1) is prohibited. Remark n = 0, 1
The various operation modes are described below.
226
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) PWM mode 0: Triangular wave modulation (right-left symmetric waveform control) [Setting procedure] (a) Set PWM mode 0 (symmetric triangular wave) using the MOD01 and MOD00 bits of the TMC0n register. Also set the active level of the TO0n0 to TO0n5 pins using the ALVTO bit of the TOMRn register (n = 0, 1). (b) Set the count clock of TM0n using the PRM02 to PRM00 bits of the TMC0n register. The transfer operation from BFCMn3 to CM0n3 is set using the BFTE3 bit, and the transfer operation from BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 to CM0n0 to CM0n2, CM0n4, and CM0n5 is set using the BFTEN bit. (c) Set the initial values. (i) Specify the interrupt culling ratio using the CUL02 to CUL00 bits of the TMC0n register.
(ii) Set the half-cycle width of the PWM cycle in BFCMn3. * PWM cycle = BFCMn3 value x 2 x TM0n count clock (The TM0n count clock is set by the TMC0n register.) (iii) Set the dead-time width in DTRRn. * Dead-time width = (DTRRn + 1)/fCLK fCLK: Base clock (iv) Set the set/reset timing of the F/F used in the PWM cycle in BFCMn0 to BFCMn2. (d) Clear (0) the TM0CEDn bit of the TMC0n register to enable dead-time timer operation. Set TM0CEDn = 1 when not using dead time. (e) Setting (1) the TM0CEn bit of the TMC0n register starts TM0n counting, and a 6-channel PWM signal is output from the TO0n0 to TO0n5 pins. Caution Setting CM0n3 to 0000H is prohibited. Remark The TM0CEn bit of the TMC0n register indicates a transfer operation under the following conditions. * When TM0CEn bit of TMC0n register is 0 Transfer to the CM0n0 to CM0n2, CM0n4, and CM0n5 registers is performed at the next base clock (fCLK) after writing to the BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 registers. * When TM0CEn bit of TMC0n register is 1 The value of the BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 registers is transferred to the CM0n0 to CM0n2, CM0n4, and CM0n5 registers upon occurrence of the INTTM0n interrupt. Transfer enable/disable at this time is controlled by the BFTEN bit of the TMC0n register.
User's Manual U15195EJ3V0UD
227
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
[Operation] In PWM mode 0, TM0n performs up/down count operation. When TM0n = 0000H during down counting, an underflow interrupt (INTTM0n) is generated, and when TM0n = CM0n3 during up counting, a match interrupt (INTCM0n3) is generated (n = 0, 1). Switching from up counting to down counting is performed when TM0n and CM0n3 match (INTCM0n3), and switching from down counting to up counting is performed when a TM0n underflow occurs after TM0n becomes 0000H. The PWM cycle in this mode is (BFCMn3 value x 2 x TM0n count clock). Note that the next PWM cycle width is set to BFCMn3. The data of BFCMn3 is automatically transferred by hardware to CM0n3 upon generation of the INTTM0n interrupt. Furthermore, calculation is performed by software processing started by INTTM0n, and the data for the next cycle is set to BFCMn3. Data setting to CM0n0 to CM0n2, which control the PWM duty, is explained next. Setting of data to CM0n0 to CM0n2 consists of setting the duty output from BFCMn0 to BFCMn2. The values of BFCMn0 to BFCMn2 are automatically transferred by hardware to CM0n0 to CM0n2 upon generation of the INTTM0n interrupt. Furthermore, software processing is started up and calculation performed, and the set/reset timing of the F/F for the next cycle is set to BFCMn0 to BFCMn2. The PWM cycle and the PWM duty are set in the above procedure. The F/F set/reset conditions upon match of CM0n0 to CM0n2 are as follows. * Set: CM0n0 to CM0n2 match detection during TM0n up count operation
* Reset: CM0n0 to CM0n2 match detection during TM0n down count operation In this mode, the F/F set/reset timing is performed at the same timing (right-left symmetric control). The values of DTRRn are transferred to the corresponding dead-time timers (DTMn0 to DTMn2) in synchronization with the set/reset timing of the F/F, and down counting is started. DTMn0 to DTMn2 count down to 000H, and stop when they count down further to FFFH. DTMn0 to DTMn2 can automatically generate a width at which the active levels of the positive phase (TO0n0, TO0n2, TO0n4) and negative phase (TO0n1, TO0n3, TO0n5) do not overlap (dead time). In this way, software processing is started by an interrupt (INTTM0n) that occurs once during every PWM cycle after initial setting has been performed, and by setting the PWM cycle and PWM duty to be used in the next cycle, it is possible to automatically output a PWM waveform to pins TO0n0 to TO0n5 taking into consideration the dead-time width (in the case of an interrupt culling ratio of 1/1).
228
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
[Output waveform width with respect to set value] * PWM cycle = BFCMn3 x 2 x TTM0n * Dead-time width TDnm = (DTRRn + 1)/fCLK * Active width of positive phase (TO0n0, TO0n2, TO0n4 pins) = { (CM0n3 - CM0nXup) + (CM0n3 - CM0nXdown) } x TTM0n - TDnm * Active width of negative phase (TO0n1, TO0n3, TO0n5 pins) = (CM0nXdown + CM0nXup) x TTM0n - TDnm * In this mode, CM0nXup = CM0nXdown (however, within the same PWM cycle). Since CM0nXup and CM0nXdown in the negative phase formula are prepared in a separate PWM cycle, CM0nXup CM0nXdown. fCLK: TTM0n: CM0nXup: Base clock TM0n count clock Set value of CM0n0 to CM0n2 while TM0n is counting up
CM0nXdown: Set value of CM0n0 to CM0n2 while TM0n is counting down The pin level when the TO0n0 to TO0n5 pins are reset is the high impedance state. When the control mode is selected thereafter, the following levels are output until TM0n is started. * TO0n0, TO0n2, TO0n4... When active low High level When active high Low level * TO0n1, TO0n3, TO0n5... When active low Low level When active high High level The active level is set with the ALVTO bit of the TOMRn register. The default is active low. Caution If a value such that the positive phase or negative phase active width is "0" or a negative value is set in the above formula, the TO0n0 to TO0n5 pins output a waveform fixed to the inactive level waveform with active width "0". Remarks. 1 m = 0 to 2 n = 0, 1 2. The interrupt request signal occurrence conditions of INTCM010 to INTCM012, INTCM0n4, and INTCM0n5 are shown below.
Setting Condition CM010 to CM012, CM0n4, CM0n5 CM0n3 CM010 to CM012, CM0n4, CM0n5 = 0000H CM010 to CM012, CM0n4, CM0n5 > CM0n3 INTCM010 to INTCM012, INTCM0n4, INTCM0n5 Signal Occurrence Status Occurs Occurs Does not occur
User's Manual U15195EJ3V0UD
229
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-15. Operation Timing in PWM Mode 0 (Symmetric Triangular Wave) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 (d) a TM0n count value 0000H CM0nx match BFCMnx a CM0nx match b CM0nx match c CM0nx match a b b CM0n3 (e)
CM0nx
a
b
c
BFCMn3
d
e
f
CM0n3 Interrupt request
d INTCM0n3 INTCM01x INTCM01x INTTM0n
e INTCM0n3
f INTTM0n
INTCM01x
INTCM01x
F/F
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t t
Remarks 1. The above figure shows the timing chart when both BFTE3 and BFTEN of the TMC0n register are 1, and transfer from BFCMn3 to CM0n3, or from BFCMnx to CM0nx is enabled. Transfer is not performed when BFTE3 = 0 or BFTEN = 0. 2. n = 0, 1 3. x = 0 to 2 4. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 5. To not use dead time, set the TM0CEDn bit of the TMC0n register to 1. 6. The above figure shows an active-high case. 7. INTCM01x is generated on a match between TM01 and CM01x (a and b in the above figure). INTCM00x is not generated.
Figure 9-16 shows the overall operation image.
230
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-15. Operation Timing in PWM Mode 0 (Symmetric Triangular Wave) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 (d) a TM0n count value 0000H CM0nx match BFCMnx a CM0nx match b CM0nx match c CM0nx match a b b CM0n3 (e)
CM0nx
a
b
c
BFCMn3
d
e
f
CM0n3 Interrupt request
d INTCM0n3 INTCM0nx INTCM0nx INTTM0n
e INTCM0n3
f INTTM0n
INTCM0nx
INTCM0nx
Remarks 1. The above figure shows the timing chart when both BFTE3 and BFTEN of the TMC0n register are 1, and transfer from BFCMn3 to CM0n3, or from BFCMnx to CM0nx is enabled. Transfer is not performed when BFTE3 = 0 or BFTEN = 0. 2. n = 0, 1 3. x = 4, 5 4. INTCM0nx is generated on a match between TM0n and CM0nx (a and b in the above figure).
User's Manual U15195EJ3V0UD
231
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-16. Overall Operation Image of PWM Mode 0 (Symmetric Triangular Wave)
CM0n3 CM0n2 CM0n2 CM0n1 CM0n2 CM0n1
CM0n3 CM0n2 CM0n1 CM0n0
TM0n count value 0000H TO0n0 output TO0n1 output TO0n2 output Without dead time TO0n3 output TO0n4 output TO0n5 output TO0n0 output TO0n1 output TO0n2 output With dead time TO0n3 output TO0n4 output TO0n5 output
CM0n1 CM0n0
CM0n0 CM0n0
Remark
n = 0, 1
232
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Next, an example of the operation timing, which depends on the values set to CM0n0 to CM0n2, CM0n4, and CM0n5 (BFCMn0 to BFCMn2, BFCMn4, BFCMn5) is shown. (a) When CM0nx (BFCMnx) CM0n3 is set Figure 9-17. Operation Timing in PWM Mode 0 (Symmetric Triangular Wave, BFCMnx CM0n3) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a CM0nx match CM0nx match (BFCMnx = CM0n3) BFCMnx CM0n3 a CM0n3
BFCMnx CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM01x INTCM01x INTTM0n
BFCMnx CM0n3 INTCM0n3 INTCM01x (BFCM1x = CM013) INTTM0n
F/F
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t
Remarks 1. n = 0, 1 2. x = 0 to 2 3. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 4. The above figure shows an active-high case. 5. INTCM01x is generated on a match between TM01 and CM01x (a in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
233
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-17. Operation Timing in PWM Mode 0 (Symmetric Triangular Wave, BFCMnx CM0n3) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a CM0nx match CM0nx match (BFCMnx = CM0n3) BFCMnx CM0n3 a CM0n3
BFCMnx CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM0nx INTCM0nx INTTM0n
BFCMnx CM0n3 INTCM0n3 INTCM0nx (BFCMnx = CM0n3) INTTM0n
Remarks 1. n = 0, 1 2. x = 4, 5 3. INTCM0nx is generated on a match between TM0n and CM0nx (a in the above figure).
When a value greater than CM0n3 is set to BFCMn0 to BFCMn2, the positive phase side (TO0n0, TO0n2, TO0n4 pins) outputs a low level, and the negative phase side (TO0n1, TO0n3, TO0n5 pins) continues to output a high level. This feature is effective for outputting a low-level or high-level width exceeding the PWM cycle in an application such as inverter control. Furthermore, if CM0n0 to CM0n2 = CM0n3 is set, matching of TM0n and CM0n0 to CM0n2 is detected during down counting by TM0n, so that the F/F remains reset as is, and is not set. The above explanation applies to an active high case. In an active low case, the levels of positive and negative phases are merely inverted and other operations remain the same.
234
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(b) When CM0nx (BFCMnx) = 0000H is set Figure 9-18. Operation Timing in PWM Mode 0 (Symmetric Triangular Wave, BFCMnx = 0000H) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a CM0nx match 0000H CM0nx match 0000H CM0nx match a CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM01x INTCM01x INTTM0n INTCM01x
0000H INTCM0n3 INTTM0n INTCM01x
F/F
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t
Remarks 1. n = 0, 1 2. x = 0 to 2 3. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 4. The above figure shows an active-high case. 5. INTCM01x is generated on a match between TM01 and CM01x (a in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
235
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-18. Operation Timing in PWM Mode 0 (Symmetric Triangular Wave, BFCMnx = 0000H) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a CM0nx match 0000H CM0nx match 0000H CM0nx match a CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM0nx INTCM0nx INTTM0n INTCM0nx
0000H INTCM0n3 INTTM0n INTCM0nx
Remarks 1. n = 0, 1 2. x = 4, 5 3. INTCM0nx is generated on a match between TM0n and CM0nx (a in the above figure).
Since TM0n = CM0n0 to CM0n2 = 0000H match is detected during up counting by TM0n, the F/F is just set and does not get reset. Even when the setting value is 0000H, F/F is changed in the cycle during which transfer is performed from BFCMn0 to BFCMn2 to CM0n0 to CM0n2 similarly to when the setting value is other than 0000H. Figure 9-19 shows the change timing from the 100% duty state.
236
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-19. Change Timing from 100% Duty State (PWM Mode 0) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 TM0n count value a a CM0n3 CM0n3 b CM0n3 b
CM0nx CM0nx CM0nx match match match
CM0nx match
CM0nx match
CM0nx match
BFCM0nx
a
0000H
0000H
b
c
CM0nx Interrupt request
a
0000H
0000H
b
INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM01x INTCM01x INTCM01x INTCM01x INTCM01x INTCM01x
F/F
Note
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t t
t
t
Note F/F is reset upon INTTM0n occurrence. Remarks 1. n = 0, 1 2. x = 0 to 2 3. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 4. The above figure shows an active-high case. 5. INTCM01x is generated on a match between TM01 and CM01x (a and b in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
237
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-19. Change Timing from 100% Duty State (PWM Mode 0) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 TM0n count value a a CM0n3 CM0n3 b CM0n3 b
CM0nx CM0nx CM0nx match match match
CM0nx match
CM0nx match
CM0nx match
BFCM0nx
a
0000H
0000H
b
c
CM0nx Interrupt request
a
0000H
0000H
b
INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0nx INTCM0nx INTCM0nx INTCM0nx INTCM0nx INTCM0nx
Remarks 1. n = 0, 1 2. x = 4, 5 3. INTCM0nx is generated on a match between TM0n and CM0nx (a and b in the above figure).
238
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3) PWM mode 1: Triangular wave modulation (right-left asymmetric waveform control) [Setting procedure] (a) Set PWM mode 1 (asymmetric triangular wave) using the MOD01 and MOD00 bits of the TMC0n register. Also set the active level of the TO0n0 to TO0n5 pins using the ALVTO bit of the TOMRn register (n = 0, 1). (b) Set the count clock of TM0n using the PRM02 to PRM00 bits of the TMC0n register. The transfer operation from BFCMn3 to CM0n3 is set using the BFTE3 bit, and the transfer operation from BFCMn0 to BFCMn2, BFCMn4, BFCMn5 to CM0n0 to CM0n2, CM0n4, and CM0n5 is set using the BFTEN bit. (c) Set the initial values. (i) Specify the interrupt culling ratio using the CUL02 to CUL00 bits of the TMC0n register.
(ii) Set the half-cycle width of the PWM cycle in BFCMn3. * PWM cycle = BFCMn3 value x 2 x TM0n count clock (The TM0n count clock is set by the TMC0n register.) (iii) Set the dead-time width in DTRRn. * Dead-time width = (DTRRn + 1)/fCLK fCLK: Base clock (iv) Set the set timing of the F/F used in the PWM cycle in BFCMn0 to BFCMn2, BFCMn4, and BFCMn5. (d) Clear (0) the TM0CEDn bit of the TMC0n register to enable dead-time timer operation. Set TM0CEDn = 1 when not using dead time. (e) Setting (1) the TM0CEn bit of the TMC0n register starts TM0n counting, and a 6-channel PWM signal is output from the TO0n0 to TO0n5 pins. Caution Remark Setting CM0n3 to 0000H is prohibited. The TM0CEn bit of the TMC0n register indicates transfer operation under the following conditions. * When TM0CEn bit of TMC0n register is 0 Transfer to the CM0n0 to CM0n2, CM0n4, and CM0n5 registers is performed at the next base clock (fCLK) after writing to the BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 registers. * When TM0CEn bit of TMC0n register is 1 The value of the BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 registers is transferred to the CM0n0 to CM0n2, CM0n4, and CM0n5 registers upon occurrence of the INTTM0n or INTCM0n3 interrupt. Transfer enable/disable at this time is controlled by the BFTEN bit of the TMC0n register.
User's Manual U15195EJ3V0UD
239
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
[Operation] In PWM mode 1, TM0n performs up/down count operation. When TM0n = 0000H during down counting, an underflow interrupt (INTTM0n) is generated, and when TM0n = CM0n3 during up counting, a match interrupt (INTCM0n3) is generated (n = 0, 1). Switching from up counting to down counting is performed when TM0n and CM0n3 match (INTCM0n3), and switching from down counting to up counting is performed by INTTM0n. The PWM cycle in this mode is (BFCMn3 value x 2 x TM0n count clock). Note that the next PWM cycle width is set to BFCMn3. The data of BFCMn3 is automatically transferred by hardware to CM0n3 upon generation of the INTTM0n interrupt. Furthermore, calculation is performed by software processing started by INTTM0n, and the data for the next cycle is set to BFCMn3. Data setting to CM0n0 to CM0n2, which control the PWM duty, is explained next. Setting of data to CM0n0 to CM0n2 consists of setting the duty output from BFCMn0 to BFCMn2. The values of BFCMn0 to BFCMn2 are automatically transferred by hardware to CM0n0 to CM0n2 upon generation of INTTM0n and INTCM0n3 (TM0n and CM0n3 match interrupts). in BFCMn0 to BFCMn2. The PWM cycle and the PWM duty are set in the above procedure. The F/F set/reset conditions upon match of CM0n0 to CM0n2 are as follows. * Set: CM0n0 to CM0n2 match detection during TM0n up count operation Furthermore, software processing is started up and calculation performed, and the set/reset timing of the F/F after a half cycle is set
* Reset: CM0n0 to CM0n2 match detection during TM0n down count operation The values of DTRRn are transferred to the corresponding dead-time timers (DTMn0 to DTMn2) in synchronization with the set/reset timing of the F/F, and down counting is started. DTMn0 to DTMn2 count down to 000H, and stop when they count down further to FFFH. DTMn0 to DTMn2 can automatically generate a width at which the active levels of the positive phase (TO0n0, TO0n2, TO0n4) and negative phase (TO0n1, TO0n3, TO0n5) do not overlap (dead time). In this way, software processing is started by two interrupts (INTTM0n and INTCM0n3) that occur during every PWM cycle after initial setting has been performed, and by setting the PWM cycle and PWM duty to be used after a half cycle, it is possible to automatically output a PWM waveform to pins TO0n0 to TO0n5 taking into consideration the dead-time width (in the case of an interrupt culling ratio of 1/1). The difference between right-left symmetric waveform control and control in this mode (right-left asymmetric waveform control) is that BFCMn0 to BFCMn2 are transferred to CM0n0 to CM0n2, and that the interrupt signals that start software processing consist just of INTTM0n (generated once per PWM cycle) in the case of right-left symmetric waveform control, and INTTM0n and INTCM0n3 (generated twice per PWM cycle, or once per half cycle) in the case of right-left asymmetric waveform control.
240
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
[Output waveform width with respect to set value] * PWM cycle = BFCMn3 x 2 x TTM0n * Dead time width TDnm = (DTRRn + 1)/fCLK * Active width of positive phase (TO0n0, TO0n2, TO0n4 pins) = { (CM0n3 - CM0nXup) + (CM0n3 - CM0nXdown) } x TTM0n - TDnm * Active width of negative phase (TO0n1, TO0n3, TO0n5 pins) = (CM0nXdown + CM0nXup) x TTM0n - TDnm fCLK: TTM0n: CM0nXup: Base clock TM0n count clock Set value of CM0n0 to CM0n2 while TM0n is counting up
CM0nXdown: Set value of CM0n0 to CM0n2 while TM0n is counting down The pin level when the TO0n0 to TO0n5 pins are reset is high impedance state. When the control mode is selected thereafter, the following levels are output until TM0n is started. * TO0n0, TO0n2, TO0n4... When active low High level When active high Low level * TO0n1, TO0n3, TO0n5... When active low Low level When active high High level The active level is set with the ALVTO bit of the TOMRn register. The default is active low. Caution If a value such that the positive phase or negative phase active width is "0" or a negative value is set in the above formula, the TO0n0 to TO0n5 pins output a waveform fixed to the inactive level waveform with active width "0". Remarks. 1 m = 0 to 2 n = 0, 1 2. The interrupt request signal occurrence conditions of INTCM010 to INTCM012, INTCM0n4, and INTCM0n5 are shown below.
Setting Condition CM010 to CM012, CM0n4, CM0n5 CM0n3 CM010 to CM012, CM0n4, CM0n5 = 0000H CM010 to CM012, CM0n4, CM0n5 > CM0n3 INTCM010 to INTCM012, INTCM0n4, INTCM0n5 Signal Occurrence Status Occurs Occurs Does not occur
User's Manual U15195EJ3V0UD
241
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-20. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 (f) a TM0n count value 0000H CM0nx match BFCMnx a b CM0nx match c CM0nx match d CM0nx match e b CM0n3 (g) c d
CM0nx
a
b
c
d
e
BFCMn3
f
g
h
CM0n3 Interrupt request
f INTCM0n3 INTCM01x INTTM0n
g INTCM0n3 INTCM01x
h INTTM0n INTCM01x
INTCM01x
F/F
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t t
Remarks 1. The above figure shows the timing chart when both BFTE3 and BFTEN of the TMC0n register are 1, and transfer from BFCMn3 to CM0n3, or from BFCMnx to CM0nx is enabled. Transfer is not performed when BFTE3 = 0 or BFTEN = 0. 2. n = 0, 1 3. x = 0 to 2 4. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 5. To not use dead time, set the TM0CEDn bit of the TMC0n register to 1. 6. The above figure shows an active-high case. 7. INTCM01x is generated on a match between TM01 and CM01x (a to d in the above figure). INTCM00x is not generated.
242
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-20. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5))
CM0n3 (f) a TM0n count value 0000H CM0nx match BFCMnx a b CM0nx match c CM0nx match d CM0nx match e b CM0n3 (g) c d
CM0nx
a
b
c
d
e
BFCMn3
f
g
h
CM0n3 Interrupt request
f INTCM0n3 INTCM0nx INTTM0n
g INTCM0n3 INTCM0nx
h INTTM0n INTCM0nx
INTCM0nx
Remarks 1. The above figure shows the timing chart when both BFTE3 and BFTEN of the TMC0n register are 1, and transfer from BFCMn3 to CM0n3, or from BFCMnx to CM0nx is enabled. Transfer is not performed when BFTE3 = 0 or BFTEN = 0. 2. n = 0, 1 3. x = 4, 5 4. INTCM0nx is generated on a match between TM0n and CM0nx (a to d in the above figure).
Figure 9-21 shows the overall operation image.
User's Manual U15195EJ3V0UD
243
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-21. Overall Operation Image of PWM Mode 1 (Asymmetric Triangular Wave)
CM0n3 CM0n2 CM0n2 CM0n1 CM0n0 CM0n0 CM0n2 CM0n1
CM0n3 CM0n2 CM0n1 CM0n0
TM0n count value 0000H TO0n0 output TO0n1 output TO0n2 output Without dead time TO0n3 output TO0n4 output TO0n5 output TO0n0 output TO0n1 output TO0n2 output With dead time TO0n3 output TO0n4 output TO0n5 output
CM0n1 CM0n0
Remark
n = 0, 1
244
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(a) When BFCMnx CM0n3 is set in software processing started by INTCM0n3 Figure 9-22. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx CM0n3) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a b CM0nx match c CM0nx match (BFCMnx = CM0n3) c c b CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM01x
b INTTM0n
c INTCM0n3
c
c INTTM0n
INTCM01x
INTCM01x (BFCM1x = CM013)
F/F
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t
Remarks 1. n = 0, 1 2. x = 0 to 2 3. c CM0n3 4. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 5. The above figure shows an active-high case. 6. INTCM01x is generated on a match between TM01 and CM01x (a and b in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
245
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-22. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx CM0n3) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a b CM0nx match c CM0nx match (BFCMnx = CM0n3) c c b CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM0nx
b INTTM0n
c INTCM0n3
c
c INTTM0n
INTCM0nx
INTCM0nx (BFCMnx = CM0n3)
Remarks 1. n = 0, 1 2. x = 4, 5 3. c CM0n3 4. INTCM0nx is generated on a match between TM0n and CM0nx (a and b in the above figure).
When a value greater than CM0n3 is set to BFCMn0 to BFCMn2, the positive phase side (TO0n0, TO0n2, TO0n4 pins) outputs a low level, and the negative phase side (TO0n1, TO0n3, TO0n5 pins) continues to output a high level. This feature is effective for outputting a low-level or high-level width exceeding the PWM cycle in an application such as inverter control. Furthermore, if CM0n0 to CM0n2 = CM0n3 is set, matching of TM0n and CM0n0 to CM0n2 is detected during down counting by TM0n, so that the F/F remains reset as is, and is not set. The above explanation applies to an active high case. In an active low case, the levels of positive and negative phases are merely inverted and other operations remain the same.
246
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(b) When BFCMnx > CM0n3 is set in software processing started by INTTM0n Figure 9-23. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx > CM0n3) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a b b b b CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM01x
b INTTM0n
b INTCM0n3
b
b INTTM0n
F/F
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t
Remarks 1. n = 0, 1 2. x = 0 to 2 3. b > CM0n3 4. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 5. The above figure shows an active-high case. 6. INTCM01x is generated on a match between TM01 and CM01x (a in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
247
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-23. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx > CM0n3) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a b b b b CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM0nx
b INTTM0n
b INTCM0n3
b
b INTTM0n
Remarks 1. n = 0, 1 2. x = 4, 5 3. b > CM0n3 4. INTCM0nx is generated on a match between TM0n and CM0nx (a in the above figure).
When a value greater than CM0n3 is set to BFCMn0 to BFCMn2, the positive phase side (TO0n0, TO0n2, TO0n4 pins) outputs a high level, and the negative phase side (TO0n1, TO0n3, TO0n5 pins) continues to output a low level. This feature is effective for outputting a low-level or high-level width exceeding the PWM cycle in an application such as inverter control. The above explanation applies to an active high case. In an active low case, the levels of positive and negative phases are merely inverted and other operations remain the same. Figure 9-24 shows the change timing from the 100% duty state.
248
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-24. Change Timing from 100% Duty State (PWM Mode 1) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 TM0n count value 0000H a CM0n3 CM0n3 c CM0n3 d
CM0nx match
CM0nx match
CM0nx match
BFCM0nx
b
b
b
b
b
c
d
e
CM0nx Interrupt request
a
b
b
b
b
b
c
d
e
INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM01x INTCM01x INTCM01x
F/F
Note
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t
t
Note F/F is reset upon INTTM0n occurrence. Remarks 1. n = 0, 1 2. x = 0 to 2 3. b > CM0n3 4. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 5. The above figure shows an active-high case. 6. INTCM01x is generated on a match between TM01 and CM01x (a to c in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
249
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-24. Change Timing from 100% Duty State (PWM Mode 1) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 TM0n count value 0000H a CM0n3 CM0n3 c CM0n3 d
CM0nx match
CM0nx match
CM0nx match
BFCM0nx
b
b
b
b
b
c
d
e
CM0nx Interrupt request
a
b
b
b
b
b
c
d
e
INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0nx INTCM0nx INTCM0nx
Remarks 1. n = 0, 1 2. x = 4, 5 3. b > CM0n3 4. INTCM0nx is generated on a match between TM0n and CM0nx (a to c in the above figure).
250
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(c) When BFCMnx = 0000H is set in software processing started by INTCM0n3 Figure 9-25. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx = 0000H) (1) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a b CM0nx CM0nx match match 0000H 0000H CM0nx match 0000H b CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM01x
b INTTM0n
0000H INTCM0n3
0000H
0000H
INTTM0n INTCM01x
INTCM01x INTCM01x
F/F
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t
Remarks 1. n = 0, 1 2. x = 0 to 2 3. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 4. The above figure shows an active-high case. 5. INTCM01x is generated on a match between TM01 and CM01x (a and b in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
251
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-25. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx = 0000H) (1) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a b CM0nx CM0nx match match 0000H 0000H CM0nx match 0000H b CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM0nx
b INTTM0n
0000H INTCM0n3
0000H
0000H
INTTM0n INTCM0nx
INTCM0nx INTCM0nx
Remarks 1. n = 0, 1 2. x = 4, 5 3. INTCM0nx is generated on a match between TM0n and CM0nx (a and b in the above figure).
Since a TM0n = CM0n0 to CM0n2 = 0000H match is detected during up counting by TM0n, the F/F is just set and is not reset. The F/F is also set upon match detection in the cycle when 0000H is transferred to CM0n0 to CM0n2 by INTTM0n interrupt. Figure 9-26 shows the change timing from the 100% duty state.
252
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-26. Change Timing from 100% Duty State (1) (PWM Mode 1) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 TM0n count value 0000H a b CM0n3 CM0n3 CM0n3 c d
CM0nx CM0nx CM0nx match match match
CM0nx match
CM0nx CM0nx match match
BFCM0nx
b
0000H 0000H 0000H 0000H
c
d
e
CM0nx Interrupt request
a
b
0000H 0000H 0000H 0000H
c
d
e
INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM01x INTCM01x INTCM01x INTCM01x
INTCM0n3 INTTM0n
INTCM01x INTCM01x
F/F
Note
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t t
t
t
Note The F/F is reset upon INTTM0n occurrence. Remarks 1. n = 0, 1 2. x = 0 to 2 3. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 4. The above figure shows an active-high case. 5. INTCM01x is generated on a match between TM01 and CM01x (a to d in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
253
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-26. Change Timing from 100% Duty State (1) (PWM Mode 1) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 TM0n count value 0000H a b CM0n3 CM0n3 CM0n3 c d
CM0nx CM0nx CM0nx match match match
CM0nx match
CM0nx CM0nx match match
BFCM0nx
b
0000H 0000H 0000H 0000H
c
d
e
CM0nx Interrupt request
a
b
0000H 0000H 0000H 0000H
c
d
e
INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0nx INTCM0nx INTCM0nx INTCM0nx
INTCM0n3 INTTM0n
INTCM0nx INTCM0nx
Remarks 1. n = 0, 1 2. x = 4, 5 3. INTCM0nx is generated on a match between TM0n and CM0nx (a to d in the above figure).
254
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(d) When BFCMnx = 0000H is set in software processing started by INTTM0n Figure 9-27. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx = 0000H) (2) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a 0000H CM0nx match 0000H 0000H CM0nx match 0000H CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM01x
0000H INTTM0n INTCM01x
0000H INTCM0n3
0000H
0000H
INTTM0n INTCM01x
F/F
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t
Remarks 1. n = 0, 1 2. x = 0 to 2 3. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 4. The above figure shows an active-high case. 5. INTCM01x is generated on a match between TM01 and CM01x (a in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
255
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-27. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx = 0000H) (2) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 a TM0n count value 0000H CM0nx match BFCMnx a 0000H CM0nx match 0000H 0000H CM0nx match 0000H CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM0nx
0000H INTTM0n INTCM0nx
0000H INTCM0n3
0000H
0000H
INTTM0n INTCM0nx
Remarks 1. n = 0, 1 2. x = 4, 5 3. INTCM0nx is generated on a match between TM0n and CM0nx (a in the above figure).
Since TM0n = CM0n0 to CM0n2 = 0000H match is detected during up counting by TM0n, the F/F is just set and is not reset. Therefore, the positive phase side (TO0n0, TO0n2, TO0n4 pins) outputs a high level, and the negative phase side (TO0n1, TO0n3, TO0n5 pins) continues to output a low level. The above explanation applies to an active high case. In an active low case, the levels of positive and negative phases are merely inverted and other operations remain the same. Figure 9-28 shows the change timing from the 100% duty state.
256
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-28. Change Timing from 100% Duty State (2) (PWM Mode 1) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 TM0n count value 0000H a CM0n3 CM0n3 b CM0n3 c
CM0nx match
CM0nx match
CM0nx match
CM0nx match
CM0nx match
BFCM0nx
0000H 0000H 0000H 0000H 0000H
b
c
d
CM0nx Interrupt request
a
0000H 0000H 0000H 0000H 0000H
b
c
d
INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM01x INTCM01x INTCM01x INTCM01x INTCM01x
F/F
Note
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t
t
Note F/F is reset upon INTTM0n occurrence. Remarks 1. n = 0, 1 2. x = 0 to 2 3. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 4. The above figure shows an active-high case. 5. INTCM01x is generated on a match between TM01 and CM01x (a to c in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
257
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-28. Change Timing from 100% Duty State (2) (PWM Mode 1) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 TM0n count value 0000H a CM0n3 CM0n3 b CM0n3 c
CM0nx match
CM0nx match
CM0nx match
CM0nx match
CM0nx match
BFCM0nx
0000H 0000H 0000H 0000H 0000H
b
c
d
CM0nx Interrupt request
a
0000H 0000H 0000H 0000H 0000H
b
c
d
INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0n3 INTTM0n INTCM0nx INTCM0nx INTCM0nx INTCM0nx INTCM0nx
Remarks 1. n = 0, 1 2. x = 4, 5 3. INTCM0nx is generated on a match between TM0n and CM0nx (a to c in the above figure).
258
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(e) When BFCMnx = CM0n3 is set in software processing started by INTTM0n Figure 9-29. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx = CM0n3) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 a TM0n count value 0000H CM0nx CM0nx match match BFCMnx a b b CM0nx match b b CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM01x INTCM01x
b INTTM0n
b INTCM0n3 INTCM01x
b
b INTTM0n
F/F
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t
Remarks 1. n = 0, 1 2. x = 0 to 2 3. b = CM0n3 4. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 5. The above figure shows an active-high case. 6. INTCM01x is generated on a match between TM01 and CM01x (a in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
259
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-29. Operation Timing in PWM Mode 1 (Asymmetric Triangular Wave, BFCMnx = CM0n3) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 a TM0n count value 0000H CM0nx CM0nx match match BFCMnx a b b CM0nx match b b CM0n3
CM0nx Interrupt request
a INTCM0n3 INTCM0nx INTCM0nx
b INTTM0n
b INTCM0n3 INTCM0nx
b
b INTTM0n
Remarks 1. n = 0, 1 2. x = 4, 5 3. b = CM0n3 4. INTCM0nx is generated on a match between TM0n and CM0nx (a in the above figure).
Since TM0n and CM0n0 to CM0n2 match is detected during count down of TM0n when BFCMn0 to BFCMn2 = CM0n3 has been set, the F/F remains reset as is and is not set. Therefore, the positive phase side (TO0n0, TO0n2, TO0n4 pins) outputs a low level, and the negative phase side (TO0n1, TO0n3, TO0n5 pins) continues to output a high level. Moreover, the timing of matching with TM0n with CM0n0 to CM0n2 = CM0n3 is the cycle when transfer is performed from BFCMn0 to BFCMn2 to CM0n0 to CM0n2 by INTCM0n3. The above explanation applies to an active high case. In an active low case, the levels of positive and negative phases are merely inverted and other operations remain the same.
260
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4) PWM mode 2: Sawtooth wave modulation [Setting procedure] (a) Set PWM mode 2 (sawtooth wave) using the MOD01 and MOD00 bits of the TMC0n register. Also set the active level of the TO0n0 to TO0n5 pins using the ALVTO bit of the TOMRn register. (b) Set the count clock of TM0n using the PRM02 to PRM00 bits of the TMC0n register. The transfer operation from BFCMn3 to CM0n3 is set using the BFTE3 bit, and the transfer operation from BFCMn0 to BFCMn2, BFCMn4, and BFCMn5 to CM0n0 to CM0n2, CM0n4, and CM0n5 is set using the BFTEN bit. (c) Set the initial values. (i) Specify the interrupt culling ratio using the CUL02 to CUL00 bits of the TMC0n register.
(ii) Set the cycle width of the PWM cycle in BFCMn3. * PWM cycle = (BFCMn3 value + 1) x TM0n count clock (The TM0n count clock is set by the TMC0n register.) (iii) Set the dead-time width in DTRRn. * Dead-time width = (DTRRn + 1)/fCLK fCLK: Base clock (iv) Set the set/reset timing of the F/F used in the PWM cycle in BFCM0n0 to BFCM0n2. (d) Clear (0) the TM0CEDn bit of the TMC0n register to enable dead-time timer operation. Set TM0CEDn = 1 when not using dead time. (e) Setting (1) the TM0CEn bit of the TMC0n register starts TM0n counting, and a 6-channel PWM signal is output from pins TO0n0 to TO0n5. Caution Setting CM0n3 to 0000H is prohibited.
User's Manual U15195EJ3V0UD
261
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
[Operation] In PWM mode 2, TM0n performs up count operation, and when it matches the value of CM0n3, match interrupt INTCM0n3 is generated and TM0n is cleared (n = 0, 1). The PWM cycle in this mode is ((BFCMn3 value + 1) x TM0n count clock). Note that the next PWM cycle width is set to BFCMn3. The data of BFCMn3 is automatically transferred by hardware to CM0n3 upon generation of the INTCM0n3 interrupt. Furthermore, calculation is performed by software processing started by INTCM0n3, and the data for the next cycle is set to BFCMn3. Data setting to CM0n0 to CM0n2, which control the PWM duty, is explained next. Setting of data to CM0n0 to CM0n2 consists of setting the duty output from BFCMn0 to BFCMn2. The values of BFCMn0 to BFCMn2 are automatically transferred by hardware to CM0n0 to CM0n2 upon generation of the INTCM0n3 interrupt. Furthermore, software processing is started up and calculation performed, and reset timing of the F/F for the next cycle is set to BFCMn0 to BFCMn2. The PWM cycle and the PWM duty are set in the above procedure. The F/F set/reset conditions upon match of CM0n0 to CM0n2 are as follows. * Set: TM0n and CM0n3 match detection and rising edge of TM0CEn bit of TMC0n register
* Reset: TM0n and CM0n0 to CM0n2 match detection The values of DTRRn are transferred to the corresponding dead-time timers (DTMn0 to DTMn2) in synchronization with the set/reset timing of the F/F, and down counting is started. DTMn0 to DTMn2 count down to 000H, and stop when they count down further to FFFH. DTMn0 to DTMn2 can automatically generate a width at which the active levels of the positive phase (TO0n0, TO0n2, TO0n4) and negative phase (TO0n1, TO0n3, TO0n5) do not overlap (dead time). In this way, software processing is started by an interrupt (INTCM0n3) that occurs once during every PWM cycle after initial setting has been performed, and by setting the PWM cycle and PWM duty to be used in the next cycle, it is possible to automatically output a PWM waveform to pins TO0n0 to TO0n5 taking into consideration the dead-time width (in the case of an interrupt culling ratio of 1/1).
262
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
[Output waveform width with respect to set value] * PWM cycle = (BFCMn3 + 1) x TTM0n * Dead time width TDnm = (DTRRn + 1)/fCLK * Active width of positive phase (TO0n0, TO0n2, TO0n4 pins) = (CM0nX + 1) x TTM0n - TDnm * Active width of negative phase (TO0n1, TO0n3, TO0n5 pins) = (CM0n3 - CM0nX) x TTM0n - TDnm fCLK: TTM0n: CM0nX: Base clock TM0n count clock Set value of CM0n0 to CM0n2
The pin level when the TO0n0 to TO0n5 pins are reset is the high impedance state. When the control mode is selected thereafter, the following levels are output until the TM0n is started. * TO0n0, TO0n2, TO0n4... When active low High level When active high Low level * TO0n1, TO0n3, TO0n5... When active low Low level When active high High level The active level is set with the ALVTO bit of the TOMRn register. The default is active low. Caution If a value such that the positive phase or negative phase active width is "0" or a negative value is set in the above formula, the TO0n0 to TO0n5 pins output a waveform fixed to the inactive level waveform with active width "0". Remarks. 1 m = 0 to 2 n = 0, 1 2. The interrupt request signal occurrence conditions of INTCM010 to INTCM012, INTCM0n4, and INTCM0n5 are shown below.
Setting Condition CM010 to CM012, CM0n4, CM0n5 CM0n3 CM010 to CM012, CM0n4, CM0n5 = 0000H CM010 to CM012, CM0n4, CM0n5 > CM0n3 INTCM010 to INTCM012, INTCM0n4, INTCM0n5 Signal Occurrence Status Occurs Occurs Does not occur
User's Manual U15195EJ3V0UD
263
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-30. Operation Timing in PWM Mode 2 (Sawtooth Wave) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 (d) b TM0n count value 0000H CM0nx match BFCMnx a b CM0nx match c a CM0n3 (e)
CM0nx
a
b
c
BFCMn3
d
e
f
CM0n3 Interrupt request F/F
d INTCM01x INTCM0n3
e
f
INTCM01x INTCM0n3
Set by rising edge of TM0CEn bit
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t t t
Remarks 1. The above figure shows the timing chart when both BFTE3 and BFTEN of the TMC0n register are 1, and transfer from BFCMn3 to CM0n3, or from BFCMnx to CM0nx is enabled. Transfer is not performed when BFTE3 = 0 or BFTEN = 0. 2. n = 0, 1 3. x = 0 to 2 4. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 5. The above figure shows an active-high case. 6. INTCM01x is generated on a match between TM01 and CM01x (a and b in the above figure). INTCM00x is not generated.
264
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-30. Operation Timing in PWM Mode 2 (Sawtooth Wave) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 (d) b TM0n count value 0000H CM0nx match BFCMnx a b CM0nx match c a CM0n3 (e)
CM0nx
a
b
c
BFCMn3
d
e
f
CM0n3 Interrupt request
d INTCM0nx INTCM0n3
e
f
INTCM0nx INTCM0n3
Remarks 1. The above figure shows the timing chart when both BFTE3 and BFTEN of the TMC0n register are 1, and transfer from BFCMn3 to CM0n3, or from BFCMnx to CM0nx is enabled. Transfer is not performed when BFTE3 = 0 or BFTEN = 0. 2. n = 0, 1 3. x = 4, 5 4. INTCM0nx is generated on a match between TM0n and CM0nx (a and b in the above figure).
Figure 9-31 shows the overall operation image.
User's Manual U15195EJ3V0UD
265
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-31. Overall Operation Image of PWM Mode 2 (Sawtooth Wave)
CM0n3 CM0n2 CM0n2 CM0n1 CM0n0
CM0n3
TM0n count value 0000H TO0n0 output TO0n1 output TO0n2 output Without dead time TO0n3 output TO0n4 output TO0n5 output TO0n0 output TO0n1 output TO0n2 output With dead time TO0n3 output TO0n4 output TO0n5 output
CM0n1 CM0n0
Remarks. 1. n = 0, 1 2. The above figure shows an active low case.
Since the F/F is set at the rising edge of the TM0CEn bit of the TMC0n register in the first cycle, the PWM signal can be output.
266
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(a) When BFCMnx > CM0n3 is set Figure 9-32. Operation Timing in PWM Mode 2 (Sawtooth Wave, BFCMnx > CM0n3) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 a CM0n3 CM0n3
TM0n count value 0000H
CM0nx match BFCMnx a b b b
CM0nx Interrupt request F/F
a INTCM01x INTCM0n3
b INTCM0n3
b INTCM0n3
Set by rising edge of TM0CEn bit
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t
Remarks 1. n = 0, 1 2. x = 0 to 2 3. b > CM0n3 4. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 5. The above figure shows an active-high case. 6. INTCM01x is generated on a match between TM01 and CM01x (a in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
267
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-32. Operation Timing in PWM Mode 2 (Sawtooth Wave, BFCMnx > CM0n3) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 a CM0n3 CM0n3
TM0n count value 0000H
CM0nx match BFCMnx a b b b
CM0nx Interrupt request
a INTCM0nx INTCM0n3
b INTCM0n3
b INTCM0n3
Remarks 1. n = 0, 1 2. x = 4, 5 3. b > CM0n3 4. INTCM0nx is generated on a match between TM0n and CM0nx (a in the above figure).
When a value greater than CM0n3 is set to BFCMn0 to BFCMn2, the positive phase side (TO0n0, TO0n2, TO0n4 pins) outputs a high level, and the negative phase side (TO0n1, TO0n3, TO0n5 pins) continues to output a low level. Since TM0n and CM0n0 to CM0n2 match does not occur, the F/F is not reset. This feature is effective for outputting a low-level or high-level width exceeding the PWM cycle in an application such as inverter control. The above explanation applies to an active high case. In an active low case, the levels of positive and negative phases are merely inverted and other operations remain the same. Figure 9-33 shows the change timing from the 100% duty state.
268
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-33. Change Timing from 100% Duty State (PWM Mode 2) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 TM0n count value 0000H a CM0n3 CM0n3 c CM0n3
CM0nx match
CM0nx match
BFCM0nx
a
b
b
c
d
CM0nx Interrupt request F/F
a INTCM01x INTCM0n3
b INTCM0n3
b
c INTCM0n3 INTCM01x INTCM0n3 Note
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t
t
t
Note The F/F is reset upon a match with CM0nx. Remarks 1. n = 0, 1 2. x = 0 to 2 3. b > CM0n3 4. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 5. The above figure shows an active-high case. 6. INTCM01x is generated on a match between TM01 and CM01x (a and c in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
269
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-33. Change Timing from 100% Duty State (PWM Mode 2) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 TM0n count value 0000H a CM0n3 CM0n3 c CM0n3
CM0nx match
CM0nx match
BFCM0nx
a
b
b
c
d
CM0nx Interrupt request
a INTCM0nx INTCM0n3
b INTCM0n3
b
c INTCM0n3 INTCM0nx INTCM0n3
Remarks 1. n = 0, 1 2. x = 4, 5 3. b > CM0n3 4. INTCM0nx is generated on a match between TM0n and CM0nx (a and c in the above figure).
The timing at which the F/F is reset is upon occurrence of a match with CM0n0 to CM0n2 as usual.
270
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(b) When BFCMnx = CM0n3 is set Figure 9-34. Operation Timing in PWM Mode 2 (Sawtooth Wave, BFCMnx = CM0n3) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 a CM0n3 CM0n3
TM0n count value 0000H
CM0nx match BFCMnx a b
CM0nx match b
CM0nx match b
CM0nx match
CM0nx Interrupt request
a INTCM01x INTCM0n3 INTCM01x
b INTCM0n3 INTCM01x
b INTCM0n3 INTCM01x
F/F
Set by rising edge of TM0CEn bit
DTMnx
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t t t
Remarks 1. n = 0, 1 2. x = 0 to 2 3. b = CM0n3 4. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 5. The above figure shows an active-high case. 6. INTCM01x is generated on a match between TM01 and CM01x (a in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
271
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-34. Operation Timing in PWM Mode 2 (Sawtooth Wave, BFCMnx = CM0n3) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 a CM0n3 CM0n3
TM0n count value 0000H
CM0nx match BFCMnx a b
CM0nx match b
CM0nx match b
CM0nx match
CM0nx Interrupt request
a INTCM0nx INTCM0n3 INTCM0nx
b INTCM0n3 INTCM0nx
b INTCM0n3 INTCM0nx
Remarks 1. n = 0, 1 2. x = 4, 5 3. b = CM0n3 4. INTCM0nx is generated on a match between TM0n and CM0nx (a in the above figure).
If match signal INTCM0n3 for TM0n and CM0n3 and the match signal for TM0n and CM0n0 to CM0n2 conflict, reset of the F/F takes precedence, so that the F/F is not set following a match of CM0n0 to CM0n2 (= CM0n3) and TM0n.
272
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(c) When BFCMnx = 0000H is set Figure 9-35. Operation Timing in PWM Mode 2 (Sawtooth Wave, BFCMnx = 0000H) (1/2)
(a) Operation timing of compare registers 0n0 to 0n2 (CM0n0 to CM0n2)
CM0n3 CM0n3 CM0n3
TM0n count value 0000H
a
CM0nx match BFCMnx a b
CM0nx match b
CM0nx match b
CM0nx match
CM0nx Interrupt request
a INTCM01x INTCM0n3 INTCM01x
b INTCM0n3 INTCM01x
b INTCM0n3 INTCM01x
F/F Note DTMnx W W W
Positive phase (TO0n0, TO0n2, TO0n4)
Negative phase (TO0n1, TO0n3, TO0n5) t t
Note Set at the rising edge of the TM0CEn bit. Remarks 1. n = 0, 1 2. x = 0 to 2 3. t: Dead time = (DTRRn + 1)/fCLK (fCLK: Base clock) 4. The above figure shows an active-high case. 5. W: Width between CM0n3 match and CM0nx match (timer count clock) 6. INTCM01x is generated on a match between TM01 and CM01x (a in the above figure). INTCM00x is not generated.
User's Manual U15195EJ3V0UD
273
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-35. Operation Timing in PWM Mode 2 (Sawtooth Wave, BFCMnx = 0000H) (2/2)
(b) Operation timing of compare registers 0n4 and 0n5 (CM0n4, CM0n5)
CM0n3 CM0n3 CM0n3
TM0n count value 0000H
a
CM0nx match BFCMnx a b
CM0nx match b
CM0nx match b
CM0nx match
CM0nx Interrupt request
a INTCM0nx INTCM0n3 INTCM0nx
b INTCM0n3 INTCM0nx
b INTCM0n3 INTCM0nx
Remarks 1. n = 0, 1 2. x = 4, 5 3. INTCM0nx is generated on a match between TM0n and CM0nx (a in the above figure).
If CM0n0 to CM0n2 = 0000H has been set, the output waveform resulting from the TM0n count clock rate and the DTRRn set value differ.
274
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.1.7 Operation timing (1) TM0CEn bit write and TM0n timer operation timing Figure 9-36 shows the timing from when the TM0CEn bit of the TMC0n register is written until the TM0n timer starts operating. Figure 9-36. TM0CEn Bit Write and TM0n Timer Operation Timing
fCLK
TM0CEn bit write timing Register write timing TM0n 0000H 0001H 0002H 0003H 0004H 0005H 0006H 0007H
Caution The operation of TM0n starts 2fCLK after the register write timing. Remark fCLK: Base clock
User's Manual U15195EJ3V0UD
275
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Interrupt generation timing The interrupt generation timing at the TM0n count clock settings (PRM02 to PRM00 bits of the TMC0n register) in the various modes is described below. Figure 9-37. Interrupt Generation Timing in PWM Mode 0 (Symmetric Triangular Wave), PWM Mode 1 (Asymmetric Triangular Wave)
(a) When count clock = fCLK
CM0nx 0002H
TM0n
0001H 0002H 0001H 0000H 0001H 0002H 0001H 0000H 0001H 0002H 0001H 0000H 0001H 0002H 0001H 0000H 0001H 0002H 0001H 0000H
fCLK
INTCM0nx
INTTM0n
(b) When count clock = fCLK/4
CM0nx 0002H
TM0n
0000H
0001H
0002H
0001H
0000H
fCLK
INTCM0nx
INTTM0n
Cautions 1.
INTCM0nx is generated at the next fCLK after detection of a TM0n and CM0nx match.
2. INTTM0n is generated at the next fCLK after detection of a TM0n and 0000H match. 3. INTTM0n is generated at the next fCLK after detection of a TM0n and 0000H match, even if the count clock is 1/2, 1/8, 1/16, or 1/32. Remarks 1. n = 0, 1 2. Where n = 0: x = 3 to 5 Where n = 1: x = 0 to 5 3. fCLK: Base clock
276
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-38. Interrupt Generation Timing in PWM Mode 2 (Sawtooth Wave)
(a) When count clock = fCLK
CM0nx 0002H
TM0n
0001H 0002H 0000H 0001H 0002H 0000H 0001H 0002H 0000H 0001H 0002H 0000H 0001H 0002H 0000H 0001H 0002H 0000H 0001H 0002H
fCLK
INTCM0nx
(b) When count clock = fCLK/4
CM0nx 0002H
TM0n
0000H
0001H
0002H
0000H
0001H
fCLK
INTCM0nx
Cautions 1.
INTCM0nx is generated at the next fCLK after detection of a TM0n and CM0nx match. if the count clock is 1/2, 1/8, 1/16, or 1/32.
2. INTCM0nx is generated at the next fCLK after detection of a TM0n and CM0nx match even
Remarks 1. n = 0, 1 2. Where n = 0: x = 3 to 5 Where n = 1: x = 0 to 5 3. fCLK: Base clock
User's Manual U15195EJ3V0UD
277
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3) Relationship between interrupt generation and STINTn bit of TMC0n register The interrupt generation timing for the setting of the STINTn bit of the TMC0n register and the interrupt culling ratio setting (bits CUL02 to CUL00) in the various modes is described below. If, to realize the INTTM0n and INTCM0n3 interrupt culling function for TM0n, bits CUL02 to CUL00 of the TMC0n register are set for a culling ratio other than 1/1, and count operation is started, the interrupt output order differs according to the setting of the STINTn bit when counting starts. Figure 9-39. Interrupt Generation Timing in PWM Mode 0 (Symmetric Triangular Wave), PWM Mode 1 (Asymmetric Triangular Wave): In Case of Interrupt Culling Ratio of 1/1
(a) When STINTn bit = 0
TM0CEn bit
CM0n3
0004H
TM0n
0000H 0001H 0002H 0003H 0004H 0003H 0002H 0001H 0000H 0001H 0002H 0003H 0004H 0003H 0002H 0001H 0000H 0001H
fCLK
INTCM0n3
INTTM0n
(b) When STINTn bit = 1
TM0CEn bit
CM0n3
0004H
TM0n
0000H 0001H 0002H 0003H 0004H 0003H 0002H 0001H 0000H 0001H 0002H 0003H 0004H 0003H 0002H 0001H 0000H 0001H
fCLK
INTCM0n3
INTTM0n
Remarks 1. n = 0, 1 2. fCLK: Base clock
278
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-40. Interrupt Generation Timing in PWM Mode 0 (Symmetric Triangular Wave), PWM Mode 1 (Asymmetric Triangular Wave): In Case of Interrupt Culling Ratio of 1/2
(a) When STINTn bit = 0
TM0CEn bit
CM0n3
0004H
TM0n
0000H 0001H 0002H 0003H 0004H 0003H 0002H 0001H 0000H 0001H 0002H 0003H 0004H 0003H 0002H 0001H 0000H 0001H 0002H 0003H
fCLK
INTCM0n3
INTTM0n
(b) When STINTn bit = 1
TM0CEn bit
CM0n3
0004H
TM0n
0000H 0001H 0002H 0003H 0004H 0003H 0002H 0001H 0000H 0001H 0002H 0003H 0004H 0003H 0002H 0001H 0000H 0001H 0002H 0003H
fCLK
INTCM0n3
INTTM0n
Remarks 1. n = 0, 1 2. fCLK: Base clock
User's Manual U15195EJ3V0UD
279
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-41. Interrupt Generation Timing in PWM Mode 2 (Sawtooth Wave): In Case of Interrupt Culling Ratio of 1/1
(a) When STINTn bit = 0
TM0CEn bit
CM0n3
0004H
TM0n
0000H
0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H
fCLK
INTCM0n3
(b) When STINTn bit = 1
TM0CEn bit
CM0n3
0004H
TM0n
0000H
0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H
fCLK
INTCM0n3
Remarks 1. n = 0, 1 2. fCLK: Base clock
280
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-42. Interrupt Generation Timing in PWM Mode 2 (Sawtooth Wave): In Case of Interrupt Culling Ratio of 1/2
(a) When STINTn bit = 0
TM0CEn bit
CM0n3
0004H
TM0n
0000H
0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H
fCLK
INTCM0n3
(b) When STINTn bit = 1
TM0CEn bit
CM0n3
0004H
TM0n
0000H
0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H 0004H 0000H 0001H 0002H 0003H
fCLK
INTCM0n3
Remarks 1. n = 0, 1 2. fCLK: Base clock
User's Manual U15195EJ3V0UD
281
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4) TO0n0 to TO0n5 output timing Figure 9-43. TO0n0 to TO0n5 Output Timing in PWM Mode 0 (Symmetric Triangular Wave), PWM Mode 1 (Asymmetric Triangular Wave)
TM0CEn bit
CM0n3
0008H
CM0nx
0003H
TM0n
0000H 0001H 0002H 0003H 0004H 0005H 0006H 0007H 0008H 0007H 0006H 0005H 0004H 0003H 0002H 0001H 0000H 0001H 0002H 0003H
DTRRn
0002H
DTMnx
FFFFH
0002H 0001H 0000H
FFFFH
0002H 0001H 0000H
FFFFH
fCLK
Match signal
F/F TO0n0, TO0n2, TO0n4 TO0n1, TO0n3, TO0n5
Remarks 1. The above figure shows the timing until the compare register and the TM0n timer match and the TO0n0 to TO0n5 outputs change. 2. x = 0 to 2 3. n = 0, 1 4. fCLK: Base clock
282
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-44. TO0n0 to TO0n5 Output Timing in PWM Mode 2 (Sawtooth Wave)
TM0CEn bit
CM0n3
000AH
CM0nx
0005H
TM0n
0000H
0001H 0002H 0003H 0004H 0005H 0006H 0007H 0008H 0009H 000AH 0000H 0001H 0002H 0003H 0004H 0005H 0006H
DTRRn
0002H
DTMnx
FFFFH
0002H 0001H 0000H
FFFFH
0002H 0001H 0000H
FFFFH 0002H 0001H 0000H
FFFFH
fCLK
Match signal
F/F TO0n0, TO0n2, TO0n4 TO0n1, TO0n3, TO0n5
Remarks 1. The above figure shows the timing until the compare register and the TM0n timer match and the TO0n0 to TO0n5 outputs change. 2. x = 0 to 2 3. n = 0, 1 4. fCLK: Base clock
User's Manual U15195EJ3V0UD
283
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.2 Timer 1
9.2.1 Features (timer 1) Timer 10 (TM10) is a 16-bit up/down counter that performs the following operations. * General-purpose timer mode Free-running timer PWM output * Up/down counter mode UDC mode A UDC mode B 9.2.2 Function overview (timer 1)
* * * *
16-bit 2-phase encoder input up/down counter & general-purpose timer (TM10) Compare registers: 2 Capture/compare registers: 2 Interrupt request sources * Capture/compare match interrupt: 2 types * Compare match interrupt request: 2 types * The TM10 value can be latched using the valid edge of the INTP100 and INTP101 pins corresponding to the capture/compare register as the capture trigger.
* Capture request signal: 2 types
* Count clock selectable through division by prescaler (set the frequency of the count clock to 10 MHz or less) * Base clock (fCLK): 1 type (set fCLK to 20 MHz or less)
fXX/2
* Prescaler division ratio
The following division ratios can be selected according to the base clock (fCLK).
Division Ratio 1/2 1/4 1/8 1/16 1/32 1/64 1/128 Base Clock (fCLK) fXX/4 fXX/8 fXX/16 fXX/32 fXX/64 fXX/128 fXX/256
284
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
* 2-phase encoder input
The 2-phase external encoder signal is used as the count clock of the timer counter via the external clock input pins (TIUD10, TCUD10). The counter mode can be selected from among the four following modes. * Mode 1: Counts the input pulses of the count pulse input pin (TIUD10). Up/down is specified by the level of the other input pin (TCUD10). * Mode 2: Counts up/down using the respective input pulses of the up count pulse input pin and down count pulse input pin. * Mode 3: Counts up/down using the phase relationship of the pulses input to the 2 pins. * Mode 4: Counts up/down using the phase relationship of the pulses input to the 2 pins. Counting is done using the respective rising edges and the falling edges of the pulses.
* PWM output function
In the general-purpose timer mode, 16-bit resolution PWM can be output from the TO10 pin.
* Timer clear
The following timer clear operations are performed according to the mode that is used. (a) General-purpose timer mode: Timer clear operation is possible upon occurrence of match with CM100 set value. (b) Up/down counter mode: The timer clear operation can be selected from among the following four conditions. (i) Timer clear performed upon occurrence of match with CM100 set value during TM10 up count operation, and timer clear performed upon occurrence of match with CM101 set value during TM10 down count operation. (ii) Timer clear performed only by external input. (iii) Timer clear performed upon occurrence of match between TM10 count value and CM100 set value. (iv) Timer clear performed upon occurrence of external input and match between TM10 count value and CM100 set value.
* External pulse output (TO10): 1
Remark fXX: Internal system clock
User's Manual U15195EJ3V0UD
285
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.2.3 Basic configuration The basic configuration is shown below. Table 9-5. Timer 1 Configuration List
Timer Count Clock Register Read/Write Generated Interrupt Signal - INTCM100 INTCM101 INTCC100 INTCC101 Capture Trigger - - - INTP100 INTP100 or INTP101
Timer 1
fXX/4, fXX/8, fXX/16, fXX/32, fXX/64, fXX/128, fXX/256
TM10 CM100 CM101 CC100 CC101
Read/write Read/write Read/write Read/write Read/write
Remark
fXX: Internal system clock
Figure 9-45 shows the block diagram of timer 1. Figure 9-45. Block Diagram of Timer 1
Internal bus
Edge detector Selector
CC100 CC101
TM1UBD0 CMD
Selector
INTP100/ INTCC100 INTP101Note/ INTCC101
Edge detector
Selector
TCLR10/ INTP101 TCUD10/ INTP100 fXX/2 TIUD10
Edge detector Clear Edge detector Clock controller fCLK 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, 1/128 SELCLK
TCLR TM10 clear control
TM1OVF0 TM1UDF0
TM10
Output control
TO10 INTCM100 INTCM101
Edge detector
CM100
ENMD MSEL
ALVT10
CM101
RLEN CLR1, CLR0
Internal bus
Note The INT101 interrupt is the signal of the interrupt from the INTP101 pin or the interrupt from the INTP100 pin, selected by the CSL0 bit of the CSL10 register. Remarks 1. fXX: Internal system clock 2. fCLK: Base clock (20 MHz (MAX.))
286
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(1) Timer 10 (TM10) TM10 is a 2-phase encoder input up/down counter and general-purpose timer. It can be read/written in 16-bit units. Cautions 1. Writing to TM10 is enabled only when the TM1CE0 bit of the TMC10 register is 0 (count operation disabled). 2. It is prohibited to set the CMD bit (general-purpose timer mode) and the MSEL bit (UDC mode B) of the TUM0 register to 0 and 1, respectively. 3. Continuous reading of TM10 is prohibited. If TM10 is continuously read, the second read value may differ from the actual value. If TM10 must be read twice, be sure to read another register between the first and the second read operation.
15 TM10
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5E0H
After reset 0000H
TM10 start and stop is controlled by the TM1CE0 bit of timer control register 10 (TMC10). The TM10 operation consists of the following two modes. (a) General-purpose timer mode In the general-purpose timer mode, TM10 operates as a 16-bit interval timer, free-running timer, or PWM output. Counting is performed based on the clock selected by software. Division by the prescaler can be selected for the count clock from among fCLK/2, fCLK/4, fCLK/8, fCLK/16, fCLK/32, fCLK/64, or fCLK/128 using the PRM12 to PRM10 bits of prescaler mode register 10 (PRM10). (fCLK: base clock, refer to 9.2.4 (1) Timer 1/timer 2 clock selection register (PRM02)). (b) Up/down counter mode (UDC mode) In the UDC mode, TM10 functions as a 16-bit up/down counter that performs counting based on the TCUD10 and TIUD10 input signals. Two operation modes can be set by the MSEL bit of the TUM0 register for this mode. (i) UDC mode A (when CMD bit = 1, MSEL bit = 0) TM10 can be cleared by setting the CLR1 and CLR0 bits of the TMC10 register. (ii) UDC mode B (when CMD bit = 1, MSEL bit = 1) TM10 is cleared upon a match with CM100 during a TM10 up count operation. TM10 is cleared upon a match with CM101 during a TM10 down count operation. When the TM1CE0 bit of the TMC10 register is 1, TM10 counts up when the operation mode is the generalpurpose mode, and counts up/down when the operation mode is the UDC mode. The conditions for clearing TM10 are as follows, depending on the operation mode.
User's Manual U15195EJ3V0UD
287
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Table 9-6. Timer 1 (TM10) Clear Conditions
Operation Mode TUM0 Register CMD Bit General-purpose timer mode UDC mode A 0 MSEL Bit 0 TMC10 Register ENMD Bit 0 1 1 0 x x x x UDC mode B 1 1 x CLR1 Bit x x 0 0 CLR0 Bit x x 0 1 Clearing not performed Cleared upon match with CM100 set value Cleared only by TCLR10 input Cleared upon match with CM100 set value during up count operation Cleared by TCLR10 input or upon match with CM100 set value during up count operation Clearing not performed Cleared upon match with CM100 set value during up count operation or upon match with CM101 set value during down count operation Setting prohibited TM10 Clear
1
0
1 x
1 x
Other than the above
Remark
x: Indicates that the set value of that bit is ignored.
288
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Compare register 100 (CM100) CM100 is a 16-bit register that always compares its value with the value of TM10. When the value of a compare register matches the value of TM10, an interrupt signal is generated. The interrupt generation timing in the various modes is described below. * In the general-purpose timer mode (CMD bit of TUM0 register = 0) and UDC mode A (MSEL bit of TUM0 register = 0), an interrupt signal (INTCM100) is always generated upon occurrence of a match. * In UDC mode B (MSEL bit of TUM0 register = 1), an interrupt signal (INTCM100) is generated only upon occurrence of a match during a down count operation. CM100 can be read/written in 16-bit units. Caution When the TM1CE0 bit of the TMC10 register is 1, it is prohibited to overwrite the value of the CM100 register.
15 CM100
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5E2H
After reset 0000H
(3) Compare register 101 (CM101) CM101 is a 16-bit register that always compares its value with the value of TM10. When the value of the compare register matches the value of TM10, an interrupt signal is generated. The interrupt generation timing in the various modes is described below. * In the general-purpose timer mode (CMD bit of TUM0 register = 0) and UDC mode A (MSEL bit of TUM0 register = 0), an interrupt signal (INTCM101) is always generated upon occurrence of a match. * In UDC mode B (MSEL bit of TUM0 register = 1), an interrupt signal (INTCM101) is generated only upon occurrence of a match during a down count operation. CM101 can be read/written in 16-bit units. Caution When the TM1CE0 bit of the TMC10 register is "1", it is prohibited to overwrite the value of the CM101 register.
15 CM101
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5E4H
After reset 0000H
User's Manual U15195EJ3V0UD
289
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4) Capture/compare register 100 (CC100) CC100 is a 16-bit register. It can be specified as a capture register or as a compare register using capture/compare control register 0 (CCR0). CC100 can be read/written in 16-bit units. Cautions 1. When used as a capture register (CMS0 bit of CCR0 register = 0), write access from the CPU is prohibited. 2. When used as a compare register (CMS0 bit of CCR0 register = 1) and the TM1CE0 bit of the TMC10 register is 1, overwriting the CC100 register values is prohibited. 3. When the TM1CE0 bit of the TMC10 register is 0, the capture trigger is disabled. 4. When the operation mode is changed from capture register to compare register, set a new compare value. 5. Continuous reading of CC100 is prohibited. If CC100 is continuously read, the second read value may differ from the actual value. If CC100 must be read twice, be sure to read another register between the first and the second read operation.
15 CC100
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5E6H
After reset 0000H
(a) When set as a capture register When CC100 is set as a capture register, the valid edge of the corresponding external interrupt INTP100 signal is detected as the capture trigger. TM10 latches the count value in synchronization with the capture trigger (capture operation). The latched value is held in the capture register until the next capture operation. The valid edge of external interrupts (rising edge, falling edge, both edges) is selected by signal edge selection register 10 (SESA10). When the CC100 register is specified as a capture register, interrupts are generated upon detection of the valid edge of the INTP100 signal. (b) When set as a compare register When CC100 is set as a compare register, it always compares its own value with the value of TM10. If the value of CC100 matches the value of the TM10, CC100 generates an interrupt signal (INTCC100).
290
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(5) Capture/compare register 101 (CC101) CC101 is a 16-bit register. It can be specified as a capture register or as a compare register using capture/compare control register 0 (CCR0). CC101 can be read/written in 16-bit units. Cautions 1. When used as a capture register (CMS1 bit of CCR0 register = 0), write access from the CPU is prohibited. 2. When used as a compare register (CMS1 bit of CCR0 register = 1) and the TM1CE0 bit of the TMC10 register is 1, overwriting the CC101 register values is prohibited. 3. When the TM1CE0 bit of the TMC10 register is 0, the capture trigger is disabled. 4. When the operation mode is changed from capture register to compare register, newly set a compare value. 5. Continuous reading of CC101 is prohibited. If CC101 is continuously read, the second read value may differ from the actual value. If CC101 must be read twice, be sure to read another register between the first and the second read operation.
15 CC101
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF5E8H
After reset 0000H
(a) When set as a capture register When CC101 is set as a capture register, the valid edge of either corresponding external interrupt signal INTP100 or INTP101 is selected with the selector, and the valid edge of the selected external interrupt signal is detected as the capture trigger. TM10 latches the count value in synchronization with the capture trigger (capture operation). The latched value is held in the capture register until the next capture operation. The valid edge of external interrupts (rising edge, falling edge, both edges) is selected by signal edge selection register 10 (SESA10). When the CC101 register is specified as a capture register, interrupts are generated upon detection of the valid edge of either the INTP100 or INTP101 signal. (b) When set as a compare register When CC101 is set as a compare register, it always compares its own value with the value of TM10. If the value of CC101 matches the value of the TM10, CC101 generates an interrupt signal (INTCC101).
User's Manual U15195EJ3V0UD
291
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.2.4 Control registers (1) Timer 1/timer 2 clock selection register (PRM02) The PRM02 register is used to select the base clock (fCLK) of timer 1 and timer 2. This register can be read/written in 8-bit or 1-bit units. Cautions 1. Always set 01H to this register before using the timers 1 and 2. Setting to other than 01H is prohibited. 2. Set fCLK to 20 MHz or less.
7 PRM02 0
6 0
5 0
4 0
3 0
2 0
1 0
0 PRM2
Address FFFFF5D8H
After reset 00H
Bit position 0
Bit name PRM2
Function Specifies the base clock of timer 1 and timer 2. 1: fXX/2
Remark
fXX: Internal system clock
292
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Timer unit mode register 0 (TUM0) The TUM0 register is an 8-bit register used to specify the TM10 operation mode or to control the operation of the PWM output pin. TUM0 can be read/written in 8-bit or 1-bit units. Cautions 1. Changing the value of the TUM0 register during TM10 operation (TM1CE0 bit of TMC10 register = 1) is prohibited. 2. When the CMD bit = 0 (general-purpose timer mode), setting MSEL = 1 (UDC mode B) is prohibited.
7 TUM0 CMD
6 0
5 0
4 0
3 TOE10
2 ALVT10
1 0
0 MSEL
Address FFFFF5EBH
After reset 00H
Bit position 7
Bit name CMD
Function Specifies TM10 operation mode. 0: General-purpose timer mode (up count) 1: UDC mode (up/down count) Specifies timer output (TO10) enable. 0: Timer output disabled 1: Timer output enabled
3
TOE10
Caution
When CMD bit = 1 (UDC mode), timer output is not performed regardless of the setting of the TOE10 bit. At this time, timer output consists of the negative phase level of the level set by the ALVT10 bit.
2
ALVT10
Specifies active level of timer output (TO10). 0: Active level is high level 1: Active level is low level
Caution
When CMD bit = 1 (UDC mode), timer output is not performed regardless of the setting of the TOE10 bit. At this time, timer output consists of the negative phase level of the level set by the ALVT10 bit.
0
MSEL
Specifies operation in UDC mode (up/down count) 0: UDC mode A TM10 can be cleared by setting the CLR1, CLR0 bits of the TMC10 register. 1: UDC mode B TM10 is cleared in the following cases. * Upon match with CM100 during TM10 up count operation * Upon match with CM101 during TM10 down count operation When UDC mode B is set, the ENMD, CLR1, and CLR0 bits of the TMC10 register become invalid.
User's Manual U15195EJ3V0UD
293
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3) Timer control register 10 (TMC10) The TMC10 register is used to enable/disable TM10 operation and to set transfer and timer clear operations. TMC10 can be read/written in 8-bit or 1-bit units. Caution Changing the values of the TMC10 register bits other than the TM1CE0 bit during TM10 operation (TM1CE0 = 1) is prohibited. (1/2)
7 TMC10 0 <6> TM1CE0 5 0 4 0 3 RLEN 2 ENMD 1 CLR1 0 CLR0 Address FFFFF5ECH After reset 00H
Bit position 6
Bit name TM1CE0 Enables/disables TM10 operation. 0: TM10 count operation disabled 1: TM10 count operation enabled
Function
3
RLEN
Enables/disables transfer from CM100 to TM10. 0: Transfer disabled 1: Transfer enabled
Cautions 1. When RLEN = 1, the value set to CM100 is transferred to TM10 upon occurrence of a TM10 underflow. 2. When the CMD bit of the TUM0 register = 0 (general-purpose timer mode), the RLEN bit setting becomes invalid. 3. The RLEN bit is valid only in UDC mode A (TUM0 register's CMD bit = 1, MSEL bit = 0). In the general-purpose timer mode (CMD bit = 0) and in UDC mode B (CMD bit = 1, MSEL bit =1), a transfer operation is not performed even the RLEN bit is set (1). 2 ENMD Enables/disables clearing of TM10 in general-purpose timer mode (CMD bit of TUM0 register = 0). 0: Clear disabled (free-running mode) Clearing is not performed even when TM10 and CM100 values match. 1: Clear enabled Clearing is performed when TM10 and CM100 values match.
Caution
When the CMD bit of the TUM0 register = 1 (UDC mode), the ENMD bit setting becomes invalid.
294
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2/2)
Bit position 1, 0 Bit name CLR1, CLR0 Function Controls TM10 clear operation in UDC mode A.
CLR1 0 0
CLR0 0 1
Specifies TM10 clear source Cleared only by external input (TCLR10) Cleared upon match of TM10 count value and CM100 set value Cleared by TCLR10 input or upon match of TM10 count value and CM100 set value Not cleared
1
0
1
1
Cautions 1. Clearing by match of the TM10 count value and CM100 set value is valid only during a TM10 up count operation (TM10 is not cleared during a TM10 down count operation). 2. When the CMD bit of the TUM0 register = 0 (general-purpose timer mode), the CLR1 and CLR0 bit settings are invalid. 3. When the MSEL bit of the TUM0 register = 1 (UDC mode B), the CLR1 and CLR0 bit settings are invalid. 4. When clearing by TCLR10 has been enabled by bits CLR1 and CLR0, clearing is performed whether the value of the TM1CE0 bit is 1 or 0.
(4) Capture/compare control register 0 (CCR0) The CCR0 register specifies the operation mode of the capture/compare registers (CC100, CC101). CCR0 can be read/written in 8-bit or 1-bit units. Caution Overwriting the CCR0 register during TM10 operation (TM1CE0 bit = 1) is prohibited.
7 CCR0 0
6 0
5 0
4 0
3 0
2 0
1 CMS1
0 CMS0
Address FFFFF5EAH
After reset 00H
Bit position 1
Bit name CMS1 Specifies operation mode of CC101. 0: Capture register 1: Compare register
Function
0
CMS0
Specifies operation mode of CC100. 0: Capture register 1: Compare register
User's Manual U15195EJ3V0UD
295
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(5) Signal edge selection register 10 (SESA10) The SESA10 register is used to specify the valid edge of external interrupt requests from external pins (INTP100, INTP101, TIUD10, TCUD10, TCLR10). The valid edge (rising edge, falling edge, or both edges) can be specified independently for each pin. SESA10 can be read/written in 8-bit or 1-bit units. Cautions 1. Changing the values of the SESA10 register bits during TM10 operation (TM1CE0 = 1) is prohibited. 2. Be sure to set (to 1) the TM1CE0 bit of timer control register 10 (TMC10) even when timer 1 is not used and the TCUD10/INTP100 and TCLR10/INTP101 pins are used as INTP100 and INTP101. (1/2)
7 6 5 4 3 2 1 0 Address FFFFF5EDH After reset 00H
SESA10 TESUD01 TESUD00 CESUD01 CESUD00 IES1011 IES1010 IES1001 IES1000 TIUD10, TCUD10 TCLR10 INTP101 INTP100
Bit position 7, 6
Bit name TESUD01, TESUD00
Function Specifies valid edge of pins TIUD10, TCUD10.
TESUD01 0 0 1 1
TESUD00 0 1 0 1 Falling edge Rising edge Setting prohibited
Valid edge
Both rising and falling edges
Cautions 1. The set values of the TESUD01 and TESUD00 bits are only valid in UDC mode A and UDC mode B. 2. If mode 4 is specified as the operation mode of TM10 (specified by the PRM12 to PRM10 bits of the PRM10 register), the valid edge specifications for the TIUD10 and TCUD10 pins (bits TESUD01 and TESUD00) are not valid.
296
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2/2)
Bit position 5, 4 Bit name CESUD01, CESUD00 Specifies valid edge of TCLR10 pin. CESUD01 0 0 1 1 CESUD00 0 1 0 1 Falling edge Rising edge Low level High level Valid edge Function
The set values of bits CESUD01 and CESUD00 and the TM10 operation are related as follows. 00: TM10 cleared after detection of rising edge of TCLR10 01: TM10 cleared after detection of falling edge of TCLR10 10: TM10 cleared status held while TCLR10 input is low level 11: TM10 cleared status held while TCLR10 input is high level
Caution
The set values of the CESUD01 and CESUD00 bits are valid only in UDC mode A.
3, 2
IES1011, IES1010
Specifies valid edge of the pin (INTP101/INTP100) selected by the CSL0 bit of the CSL10 register. IES1011 0 0 1 1 IES1010 0 1 0 1 Falling edge Rising edge Setting prohibited Both rising and falling edges Valid edge
1, 0
IES1001, IES1000
Specifies valid edge of INTP100 pin. IES1001 0 0 1 1 IES1000 0 1 0 1 Falling edge Rising edge Setting prohibited Both rising and falling edges Valid edge
User's Manual U15195EJ3V0UD
297
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(6) Prescaler mode register 10 (PRM10) The PRM10 register is used to perform the following selections. * Selection of count clock in general-purpose timer mode (CMD bit of TUM0 register = 0) * Selection of count operation mode in UDC mode (CMD = 1) PRM10 can be read/written in 8-bit or 1-bit units. Cautions 1. Overwriting the PRM10 register during TM10 operation (TM1CE0 bit = 1) is prohibited. 2. When the CMD bit of the TUM0 register = 1 (UDC mode), setting the values of the PRM12 to PRM10 to 000, 001, 010, and 011 bits is prohibited. 3. When TM10 is in mode 4, specification of the valid edge for the TIUD10 and TCUD10 pins is valid.
7 PRM10 0
6 0
5 0
4 0
3 0
2 PRM12
1 PRM11
0 PRM10
Address FFFFF5EEH
After reset 07H
Bit position 2 to 0
Bit name PRM12 to PRM10
Function Specifies the up/down count operation mode during input of the clock rate when the internal clock of the TM10 is used, or during external clock (TIUD10) input. PRM12 PRM11 PRM10 CMD = 0 Count clock 0 0 0 0 1 1 1 1 Remark 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 Setting prohibited fCLK/2 fCLK/4 fCLK/8 fCLK/16 fCLK/32 fCLK/64 fCLK/128 TIUD10 Mode 1 Mode 2 Mode 3 Mode 4 CMD = 1 Count clock Up/down count
Setting prohibited (Mode 4) (At this time, SESA10 register is enabled.)
fCLK: Base clock
(a) In general-purpose timer mode (CMD bit of TUM0 register = 0) The count clock is fixed to the internal clock. The clock rate of TM10 is specified by bits PRM12 to PRM10. (b) UDC mode (CMD bit of TUM0 register = 1) The TM10 count triggers in the UDC mode are as follows.
Operation Mode Mode 1 Mode 2 Mode 3 Mode 4 Down count when TCUD10 = high level Up count when TCUD10 = low level Up count upon detection of valid edge of TIUD10 input Down count upon detection of valid edge of TCUD10 input Automatic judgment with TCUD10 input level upon detection of valid edge of TIUD10 input Automatic judgment upon detection of both edges of TIUD10 input and both edges of TCUD10 input
User's Manual U15195EJ3V0UD
TM10 Operation
298
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(7) Status register 0 (STATUS0) The STATUS0 register indicates the operating status of TM10. STATUS0 is read-only in 8-bit or 1-bit units. Caution Overwriting the STATUS0 register during TM10 operation (TM1CE0 bit = 1) is prohibited.
7 STATUS0 0
6 0
5 0
4 0
3 0
<2>
<1>
<0>
Address FFFFF5EFH
After reset 00H
TM1UDF0 TM1OVF0 TM1UBD0
Bit position 2
Bit name TM1UDF0 TM10 underflow flag 0: No TM10 count underflow 1: TM10 count underflow
Function
Caution
The TM1UDF0 bit is cleared (to 0) upon completion of a read access to the STATUS0 register from the CPU.
1
TM1OVF0
TM10 overflow flag 0: No TM10 count overflow 1: TM10 count overflow
Caution
The TM1OVF0 bit is cleared (to 0) upon completion of a read access to the STATUS0 register from the CPU.
0
TM1UBD0
Indicates the operating status of TM10 up/down count. 0: TM10 up count in progress 1: TM10 down count in progress
Caution
The state of the TM1UBD0 bit differs according to the mode as follows. * The TM1UBD0 bit is fixed to 0 by hardware when the CMD bit of the TUM0 register = 0 (general-purpose timer mode). * The TM1UBD0 bit indicates the TM10 up/down count status when the CMD bit of the TUM0 register = 1 (UDC mode).
(8) CC101 capture input selection register (CSL10) The CSL10 register specifies the capture input that is input by TM10. CSL10 can be read/written in 8-bit or 1-bit units.
7 CSL10 0
6 0
5 0
4 0
3 0
2 0
1 0
0 CSL0
Address FFFFF5F6H
After reset 00H
Bit position 0
Bit name CSL0 Specifies capture input to CC101. 0: INTP101 1: INTP100
Function
User's Manual U15195EJ3V0UD
299
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.2.5 Operation (1) Basic operation The following two operation modes can be selected for TM10. (a) General-purpose timer mode (CMD bit of TUM0 register = 0) In the general-purpose timer mode, TM10 operates either as a 16-bit interval timer or as a PWM output timer (the count operation is up count only). The base clock (fCLK) to TM10 is selected by the timer 1/timer 2 clock selection register (PRM02), and the count clock is selected by the prescaler mode register (PRM10) (n = 0, 1). (b) Up/down counter mode (UDC mode) (CMD bit of TUM0 register = 1) In the UDC mode, TM10 operates as a 16-bit up/down counter. The external clock input (TIUD10, TCUD10 pins) by PRM10 register setting is used as the TM10 count clock. The UDC mode is further divided into two modes according to the TM10 clear conditions. * UDC mode A (TUM0 register's CMD bit = 1, MSEL bit = 0) The TM10 clear source can be selected as only external clear input (TCLR10), a match signal between the TM10 count value and the CM100 set value during up count operation, or the logical sum (OR) of the two signals, using bits CLR1 and CLR0 of the TMC10 register. TM10 can transfer the value of CM100 upon occurrence of a TM10 underflow. * UDC mode B (TUM0 register's CMD bit = 1, MSEL bit = 1) The status of TM10 after a match of the TM10 count value and CM100 set value is as follows. <1> In the case of an up count operation, TM10 is cleared (0000H), and the INTCM100 interrupt is generated. <2> In the case of a down count operation, the TM10 count value is decremented (-1). The status of TM10 after a match of the TM10 count value and CM101 set value is as follows. <1> In the case of an up count operation, the TM10 count value is incremented (+1). <2> In the case of a down count operation, TM10 is cleared (0000H), and the INTCM101 interrupt is generated.
300
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Operation in general-purpose timer mode TM10 can perform the following operations in the general-purpose timer mode. (a) Interval operation TM10 and CM100 always compare their values and the INTCM100 interrupt is generated upon occurrence of a match. TM10 is cleared (0000H) at the count clock following the match. Furthermore, when one more count clock is input, TM10 counts up to 0001H. The interval time can be calculated with the following formula. Interval time = (CM100 value + 1) x TM10 count clock rate Caution Interval operation can be achieved by setting the ENMD bit of the TMC10 register to 1.
(b) Free-running operation TM10 performs a full count operation from 0000H to FFFFH, and after the TM1OVF0 bit of the STATUS0 register is set (to 1), TM10 is cleared and resumes counting. The free-running cycle can be calculated by the following formula. Free-running cycle = 65,536 x TM10 count clock rate Caution The free-running operation can be achieved by setting the ENMD bit of the TMC10 register to 0. (c) Compare function TM10 connects two compare register (CM100, CM101) channels and two capture/compare register (CC100, CC101) channels. When the TM10 count value and the set value of one of the compare registers match, a match interrupt (INTCM100, INTCM101, INTCC100
Note
, INTCC101
Note
) is output.
Particularly in the case of interval operation, TM10 is cleared upon generation of the INTCM100 interrupt. Note This match interrupt is generated when CC100 and CC101 are set to the compare register mode.
User's Manual U15195EJ3V0UD
301
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(d) Capture function TM10 connects two capture/compare register (CC100, CC101) channels. When CC100 and CC101 are set to the capture register mode, the value of TM10 is captured in synchronization with the corresponding capture trigger signal. Furthermore, an interrupt request (INTCC100, INTCC101) is generated by the INTP100, INTP101 input signals. Table 9-7. Capture Trigger Signal (TM10) to 16-Bit Capture Register
Capture Register CC100 CC101 Capture Trigger Signal INTP100 INTP100 or INTP101
Remark
CC100 and CC101 are capture/compare registers. Which of these registers is used is specified by capture/compare control register 0 (CCR0).
The valid edge of the capture trigger is specified by signal edge selection register 10 (SESA10). If both the rising edge and the falling edge are selected as the capture triggers, it is possible to measure the input pulse width externally. If a single edge is selected as the capture trigger, the input pulse cycle can be measured. (e) PWM output operation PWM output operation is performed from the TO10 pin by setting TM10 to the general-purpose timer mode (CMD bit = 0) using timer unit mode register 0 (TUM0). The resolution is 16 bits, and the count clock can be selected from among seven internal clocks (fCLK/2, fCLK/4, fCLK/8, fCLK/16, fCLK/32, fCLK/64, fCLK/128). Figure 9-46. TM10 Block Diagram (During PWM Output Operation)
fCLK/2 fCLK/4 fCLK/8 fCLK/16 fCLK/32 fCLK/64 fCLK/128 Clear INTCM100
TM10 (16 bits) 16 Compare register (CM100) 16 Compare register (CM101)
ALVT10 S Q
TUM0 register
TO10 R INTCM101
Caution Be sure to set the count clock of TM10 to 10 MHz or lower. Remark fCLK: Base clock
302
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(i) Description of operation The CM100 register is a compare register used to set the PWM output cycle. When the value of this register matches the value of TM10, the INTCM100 interrupt is generated. The compare match is saved by hardware, and TM10 is cleared at the next count clock after the match. The CM101 register is a compare register used to set the PWM output duty. Set the duty required for the PWM cycle. Figure 9-47. PWM Signal Output Example (When ALVT10 Bit = 0 Is Set)
CM100 set value
TM10 CM101 set value
TO10
INTCM100
INTCM101
Cautions 1. Changing the values of the CM100 and CM101 registers is prohibited during TM10 operation (TM1CE0 bit of TMC10 register = 1). 2. Changing the value of the ALVT10 bit of the TUM0 register is prohibited during TM10 operation. 3. PWM signal output is performed from the second PWM cycle after the TM1CE0 bit is set (to 1).
User's Manual U15195EJ3V0UD
303
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3) Operation in UDC mode (a) Overview of operation in UDC mode The count clock input to TM10 in the UDC mode (CMD bit of TUM0 register = 1) can only be externally input from the TIUD10 and TCUD10 pins. Up/down count judgment in the UDC mode is determined based on the phase difference of the TIUD10 and TCUD10 pin inputs according to the PRM10 register setting (there is a total of four choices). Table 9-8. List of Count Operations in UDC Mode
PRM10 Register PRM12 1 PRM11 0 PRM10 0 Operation Mode Mode 1 TM10 Operation
Down count when TCUD10 = high level Up count when TCUD10 = low level Up count upon detection of valid edge of TIUD10 input Down count upon detection of valid edge of TCUD10 input Automatic judgment in TCUD10 input level upon detection of valid edge of TIUD10 input Automatic judgment upon detection of both edges of TIUD10 input and both edges of TCUD10 input
1
0
1
Mode 2
1
1
0
Mode 3
1
1
1
Mode 4
The UDC mode is further divided into two modes according to the TM10 clear conditions (a count operation is performed only with TIUD10 and TCUD10 input in both modes). * UDC mode A (TUM0 register's CMD bit = 1, MSEL bit = 0) The TM10 clear source can be selected as only external clear input (TCLR10), a match signal between the TM10 count value and the CM100 set value during up count operation, or the logical sum (OR) of the two signals, using bits CLR1 and CLR0 of the TMC10 register. TM10 can transfer the value of CM100 upon occurrence of a TM10 underflow. * UDC mode B (TUM0 register's CMD bit = 1, MSEL bit = 1) The status of TM10 after a match of the TM10 count value and CM100 set value is as follows. <1> In the case of an up count operation, TM10 is cleared (0000H), and the INTCM100 interrupt is generated. <2> In the case of a down count operation, the TM10 count value is decremented (-1). The status of TM10 after a match of the TM10 count value and CM101 set value is as follows. <1> In the case of an up count operation, the TM10 count value is incremented (+1). <2> In the case of a down count operation, TM10 is cleared (0000H), and the INTCM101 interrupt is generated.
304
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(b) Up/down count operation in UDC mode TM10 up/down count judgment in the UDC mode is determined based on the phase difference of the TIUD10 and TCUD10 pin inputs according to the PRM10 register setting. (i) Mode 1 (PRM12 bit = 1, PRM11 bit = 0, PRM10 bit = 0) In mode 1, the following count operations are performed based on the level of the TCUD10 pin upon detection of the valid edge of the TIUD10 pin. * TM10 down count operation when TCUD10 pin = high level * TM10 up count operation when TCUD10 pin = low level Figure 9-48. Mode 1 (When Rising Edge Is Specified as Valid Edge of TIUD10 Pin)
TIUD10
TCUD10
TM10
0007H
0006H
0005H
0004H
0005H
0006H Up count
0007H
Down count
Figure 9-49. Mode 1 (When Rising Edge Is Specified as Valid Edge of TIUD10 Pin): In Case of Simultaneous TCUD10, TCUD10 Pin Edge Timing
TIUD10
TCUD10
TM10
0007H
0006H
0005H
0004H
0005H
0006H Up count
0007H
Down count
User's Manual U15195EJ3V0UD
305
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(ii) Mode 2 (PRM12 bit = 1, PRM11 bit = 0, PRM10 bit = 1) The count conditions in mode 2 are as follows. * TM10 up count upon detection of valid edge of TIUD10 pin * TM10 down count upon detection of valid edge of TCUD10 pin Caution If the count clock is simultaneously input to the TIUD10 pin and the TCUD10 pin, count operation is not performed and the immediately preceding value is held. Figure 9-50. Mode 2 (When Rising Edge Is Specified as Valid Edge of TIUD10, TCUD10 Pins)
TIUD10
TCUD10
TM10
0006H
0007H Up count
0008H Hold value
0007H
0006H
0005H
Down count
(iii) Mode 3 (PRM12 = 1, PRM11 = 1, PRM10 = 0) In mode 3, when two signals 90 degrees out of phase are input to the TIUD10 and TCUD10 pins, the level of the TCUD10 pin is sampled at the input of the valid edge of the TIUD10 pin (Refer to Figure 9-51). If the TCUD10 pin level sampled at the valid edge input to the TIUD10 pin is low, TM10 counts down when the valid edge is input to the TIUD10 pin. If the TCUD10 pin level sampled at the valid edge input to the TIUD10 pin is high, TM10 counts up when the valid edge is input to the TIUD10 pin. Figure 9-51. Mode 3 (When Rising Edge Is Specified as Valid Edge of TIUD10 pin)
TIUD10
TCUD10
TM10
0007H
0008H
0009H
000AH
0009H
0008H
0007H
Up count
Down count
306
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-52. Mode 3 (When Rising Edge Is Specified as Valid Edge of TIUD10 Pin): In Case of Simultaneous TIUD10, TCUD10 Pin Edge Timing
TIUD10
TCUD10
TM10
0007H
0008H
0009H
000AH
0009H
0008H
0007H
Up count
Down count
(iv) Mode 4 (PRM12 = 1, PRM11 = 1, PRM10 = 1) In mode 4, when two signals out of phase are input to the TIUD10 and TCUD10 pins, up/down operation is automatically judged and counting is performed according to the timing shown in Figure 9-53. In mode 4, counting is executed at both the rising and falling edges of the two signals input to the TIUD10 and TCUD10 pins. Therefore, TM10 counts four times per cycle of an input signal (x4 count). Figure 9-53. Mode 4
TIUD10
TCUD10
TM10
0003H 0004H 0005H 0006H 0007H 0008H 0009H Up count
000AH
0009H 0008H 0007H 0006H 0005H Down count
Cautions 1. When mode 4 is specified as the operation mode of TM10, the valid edge specifications for the TIUD10 and TCUD10 pins are not valid. 2. If the TIUD10 pin edge and TCUD10 pin edge are input simultaneously in mode 4, TM10 continues the same count operation (up or down) it was performing immediately before the input.
User's Manual U15195EJ3V0UD
307
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(c) Operation in UDC mode A (i) Interval operation The operations at the count clock following a match of the TM10 count value and the CM100 set value are as follows. * In case of up count operation: TM10 is cleared (0000H) and the INTCM100 interrupt is generated. * In case of down count operation: The TM10 count value is decremented (-1) and the INTCM100 interrupt is generated. Remark The interval operation can be combined with the transfer operation.
(ii) Transfer operation The operations at the next count clock after the count value of TM10 becomes 0000H during a TM10 count down operation are as follows. * In case of down count operation: The data held in CM100 is transferred. * In case of up count operation: The TM10 count value is incremented (+1). Remarks 1. Transfer enable/disable can be set using the RLEN bit of the TMC1 register. 2. The transfer operation can be combined with the interval operation. Figure 9-54. Example of TM10 Operation When Interval Operation and Transfer Operation Are Combined
CM100 set value
TM10 count value 0000H
TM10 and CM100 match & timer clear TM10 underflow & CM100 data transfer
Up count
Down count
(iii) Compare function TM10 connects two compare register (CM100, CM101) channels and two capture/compare register (CC100, CC101) channels. When the TM10 count value and the set value of one of the compare registers match, a match interrupt (INTCM100, INTCM101, INTCC100
Note
, INTCC101
Note
) is output.
Note This match interrupt is generated when CC100 and CC101 are set to the compare register mode. (iv) Capture function TM10 connects two capture/compare register (CC100, CC101) channels. When CC100 and CC101 are set to the capture register mode, the value of TM10 is captured in synchronization with the corresponding capture trigger signal. When TM10 is set to the capture register mode, a capture interrupt (INTCC100, INTCC101) is generated upon detection of the valid edge.
308
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(d) Operation in UDC mode B (i) Basic operation The operations at the next count clock after the count value of TM10 and the CM100 set value match when TM10 is in UDC mode B are as follows. * In case of up count operation: TM10 is cleared (0000H) and the INTCM100 interrupt is generated. * In case of down count operation: The TM10 count value is decremented (-1). The operations at the next count clock after the count value of TM10 and the CM101 set value match when TM10 is in UDC mode B are as follows. * In case of up count operation: The TM10 count value is incremented (+1). * In case of down count operation: TM10 is cleared (0000H) and the INTCM101 interrupt is generated. Figure 9-55. Example of TM10 Operation in UDC Mode
CM100 set value
TM10 not cleared if count clock counts up following match
Clear
TM10 count value
Clear TM10 not cleared if count clock counts down following match
CM101 set value
(ii) Compare function TM10 connects two compare register (CM100, CM101) channels and two capture/compare register (CC100, CC101) channels. When the TM10 count value and the set value of one of the compare registers match, a match interrupt (INTCM100 (only during up count operation), INTCM101 (only during down count operation), INTCC100
Note
, INTCC101
Note
) is output.
Note This match interrupt is generated when CC100 and CC101 are set to the compare register mode. (iii) Capture function TM10 connects two capture/compare register (CC100, CC101) channels. When CC100 and CC101 are set to the capture register mode, the value of TM10 is captured in synchronization with the corresponding capture trigger signal. When TM10 is set to the capture register mode, a capture interrupt (INTCC100, INTCC101) is generated upon detection of the valid edge.
User's Manual U15195EJ3V0UD
309
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.2.6 Supplementary description of internal operation (1) Clearing of count value in UDC mode B When TM10 is in UDC mode B, the count value clear operation is as follows. * In case of TM10 up count operation: TM10 is cleared upon match with CM100 * In case of TM10 down count operation: TM10 is cleared upon match with CM101 Figure 9-56. Clear Operation upon Match with CM100 During TM10 Up Count Operation
TM10 cleared (TM10 not cleared) Count clock (Rising edge set as valid edge) TM10 FFFEH FFFFH 0000H 0001H (FFFEH) (FFFDH) FFFFH Up count Up count (Down count)
CM100
Remark
The items in parentheses in the above figure apply to down count operations.
Figure 9-57. Clear Operation upon Match with CM101 During TM10 Down Count Operation
TM10 cleared (TM10 not cleared) Count clock (Rising edge set as valid edge) TM10 00FFH 00FEH 0000H FFFFH (00FFH) (0100H) 00FEH Up count Down count (Up count)
CM1n0
Remark
The items in parentheses in the above figure apply to up count operations.
310
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Clearing of count value upon occurrence of compare match The internal operation during a TM10 clear operation upon occurrence of a compare match is as follows. Figure 9-58. Count Value Clear Operation upon Compare Match
TM10 cleared (TM10 not cleared) Count clock (Rising edge set as valid edge) TM10 FFFEH FFFFH 0000H 0001H (FFFEH) (FFFDH) FFFFH Up count Up count (Down count)
CM100
Caution The operations at the next count clock after the count value of TM10 and the CM100 set value match are as follows. * In case of up count: Clear operation is performed. * In case of down count: Clear operation is not performed. Remark The items in parentheses in the above figure apply to down count operations.
(3) Transfer operation The internal operation during TM10 transfer operation is as follows. Figure 9-59. Internal Operation During Transfer Operation
Transfer operation performed. (Transfer operation not performed) Count clock (Rising edge set as valid edge) TM10 0001H 0000H FFFFH FFFEH (0001H) (0002H) FFFFH Down count Down count (Up count)
CM100
Caution The count operations after the TM10 count value becomes 0000H are as follows. * In case of down count: Transfer operation is performed. * In case of up count: Transfer operation is not performed. Remark The items in parentheses in the above figure apply to up count operations.
User's Manual U15195EJ3V0UD
311
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4) Interrupt signal output upon compare match An interrupt signal is output when the count value of TM10 matches the set value of the CM100, CM101, CC100
Note
, or CC101
Note
register. The interrupt generation timing is as follows.
Note When CC100 and CC101 are set to the compare register mode. Figure 9-60. Interrupt Output upon Compare Match (CM101 with Operation Mode Set to General-Purpose Timer Mode and Count Clock Set to fCLK/2)
fCLK
Count clock
TM10
0007H
0008H
0009H
000AH
000BH
CM101 Internal match signal
0009H
INTCM101
Remark
fCLK: Base clock
An interrupt signal such as the one illustrated in Figure 9-60 is output at the next count following a match of the TM10 count value and the set value of the corresponding compare register. (5) TM1UBD0 flag (bit 0 of STATUS0 register) operation In the UDC mode (CMD bit of TUM0 register = 1), the TM1UBD0 flag changes as follows during TM10 up/down count operation at every internal operation clock. Figure 9-61. TM1UBD0 Flag Operation
Count clock
TM10 0000H
0001H
0000H
0001H
0000H
0001H
TM1UBD0
312
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.3 Timer 2
9.3.1 Features (timer 2) Timers 20 and 21 (TM20, TM21) are 16-bit general-purpose timer units that perform the following operations. * Pulse interval or frequency measurement and programmable pulse output * Interval timer * PWM output timer * 32-bit capture timer when 2 timer/counter channels are connected in cascade (In this case, four 32-bit capture register channels can be used.) 9.3.2 Function overview (timer 2)
* 16-bit timer/counter (TM20, TM21): 2 channels * Bit length
Timer 2 registers (TM20, TM21): 16 bits During cascade operation: 32 bits (higher 16 bits: TM21, lower 16 bits: TM20)
* Capture/compare register
In 16-bit mode: 6 In 32-bit mode: 4 (capture mode only)
* Count clock division selectable by prescaler (set the frequency of the count clock to 10 MHz or less) * Base clock (fCLK): 1 type (set fCLK to 20 MHz or less)
fXX/2
* Prescaler division ratio
The following division ratios can be selected according to the base clock (fCLK).
Division Ratio 1/2 1/4 1/8 1/16 1/32 1/64 1/128 Base Clock (fCLK) fXX/4 fXX/8 fXX/16 fXX/32 fXX/64 fXX/128 fXX/256
User's Manual U15195EJ3V0UD
313
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
* Interrupt request sources
* Compare-match interrupt request: 6 types Perform comparison with sub-channel n capture/compare register and generate the INTCC2n interrupt upon compare match. * Timer/counter overflow interrupt request: 2 types The INTTM20 (INTTM21) interrupt is generated when the count value of TM20 (TM21) becomes FFFFH.
* Capture request
The count values of TM20 and TM21 can be latched using an external pin (INTP2n) signals (INTCM100, INTCM101) and interrupt requests by software as capture triggers.
Notes 1, 2
, TM10 interrupt
* PWM output function
Control of the output of the TO21 to TO24 pins in the compare mode and PWM output can be performed using the compare match timing of sub-channels 1 to 4 and the zero count signal of the timer/counter.
* Timer count operation with external clock inputNote 2
Timer count operation can be performed using the pin TI2 clock input signal.
* Timer count enable operationNote 3 with external pin inputNote 2
Timer count enable operation can be performed using the TCLR2 pin input signal.
* Timer/counter clear controlNotes 3, 4 with external pin inputNote 2
Timer/counter clear operation can be performed using the TCLR2 pin input signal.
* Up/down count controlNotes 3, 5 with external pin inputNote 2
Up/down count operation in the compare mode can be controlled using the TCLR2 pin input signal.
* Output delay operation
A clock-synchronized output delay can be added to the output signal of the TO21 to TO24 pins. This is effective as an EMI countermeasure.
* Input filter
An input filter can be inserted at the input stage of external pins (TI2, INTP20 to INTP25, TCLR2) and the TM10 interrupt signals (refer to 12.4.3 (1) Timer 2 input filter mode registers 0 to 5 (FEM0 to FEM5)). Notes 1. 2. 3. 4. 5. Remark For the registers used to specify the valid edge for external interrupt requests (INTP20 to INTP25) to timer 2, refer to 7.3.8 (4) Timer 2 input filter mode registers 0 to 5 (FEM0 to FEM5). The pairs TI2 and INTP20, TO21 and INTP21, TO22 and INTP22, TO23 and INTP23, TO24 and INTP24, TCLR2 and INTP25 are alternate function pins. The count enable operation for the timer/counter via external pin input, timer/counter clear operation, and up/down count control cannot be performed all at the same time. In the case of 32-bit cascade connection, a clear operation by external pin input (TCLR2) cannot be performed. Up/down count control using 32-bit cascade connection cannot be performed. fXX: Internal system clock n = 0 to 5
314
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.3.3 Basic configuration The basic configuration is shown below. Table 9-9. Timer 2 Configuration List
Timer Count Clock Register Read/Write - - Read/write Read/write Read/write Read/write Read/write Read/write Read Read Read Read Generated Interrupt Signal INTTM20 INTTM21 INTCC20 INTCC21 INTCC22 INTCC23 INTCC24 INTCC25 INTCC24 INTCC23 INTCC22 INTCC21 Capture Trigger - - INTP20/INTP25 INTP21/INTP24 INTP22/INTP23 INTP23/INTP22 INTP24/INTP21 INTP25/INTP20 INTP24/INTP21 INTP23/INTP22 INTP22/INTP23 INTP21/INTP24 Other Functions Note 1 Note 1 - Buffer/Note 2 Buffer/Note 2 Buffer/Note 2 Buffer/Note 2 - Note 2 Note 2 Note 2 Note 2
Timer 2
fXX/4, fXX/8, fXX/16, fXX/32, fXX/64, fXX/128, fXX/256
TM20 TM21 CVSE00 CVSE10 CVSE20 CVSE30 CVSE40 CVSE50 CVPE40 CVPE30 CVPE20 CVPE10
Notes 1. 2. Remark
Cascade operation with TM20 and TM21 is possible. Cascade operation using the CVSEn0 and CVPEn0 registers is possible (n = 1 to 4). fXX: Internal system clock
The following shows the capture/compare operation sources. Table 9-10. Capture/Compare Operation Sources
Register Sub-channel No. 0 n Timer to Be Captured Timer to Be Compared Timer Captured in 32-Bit Cascade Connection - TM21
CVSE00 CVPEn0
TM20 TM21 when BFEEy bit of CMSEm0 register = 0 TM20 when BFEEy bit of CMSEm0 register = 0 TM21
TM20 TM20 when TB1Ey, TB0Ey bits of CMSEm0 register = 01 Used as buffer
CVSEn0
n
TM20 -
CVSE50
5
TM21
Remark
n = 1 to 4 m: m = 12 when n = 1, 2, m = 34 when n = 3, 4 y: y = 1, 2 when m = 12, y = 3, 4 when m = 34
User's Manual U15195EJ3V0UD
315
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
The following shows the output level sources during timer output. Table 9-11. Output Level Sources During Timer Output
TO2n Toggle Mode 0 (OTMEn1, OTMEn0 = 00) Compare match of subchannel n Toggle Mode 1 (OTMEn1, OTMEn0 = 01) TM20 = 0 Compare match of subchannel n Active output Inactive output Toggle Mode 2 (OTMEn1, OTMEn0 = 10) TM21 = 0 Compare match of subchannel n Active output Inactive output Toggle Mode 3 (OTMEn1, OTMEn0 = 11) Compare Compare match of sub- match of subchannel n + 1 channel n Active output Inactive output
Trigger
Output level
Active output Inactive output
Remarks 1. n = 1 to 4 2. OTMEn1, OTMEn0: Bits 13, 12, 9, 8, 5, 4, 1, and 0 of timer 2 output control register 0 (OCTLE0)
316
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-62 shows the block diagram of timer 2. Figure 9-62. Block Diagram of Timer 2
Selector
Selector
fXX/2
1/2, 1/4, 1/8, 1/16, 1/32,
fCLK 1/64, 1/128
ECLR TCOUNTE0 edge selection CT TM20 (16-bit)
CNT = MAX. CNT = 0 R
INTTM20
Selector
TCOUNTE1 edge selection INTCC20
TI2/ INTP20
Input filter
TINE0 edge selection
ED1 ED2
CVSE00 (16-bit)
Sub-channel 0 INTCC21 INTP21 Input filter TINE1 edge selection ED1 ED2 CVSE10 (16-bit) CVPE10 (16-bit) Sub-channel 1 S/T RA RB RN INTCC22 INTP22 Input filter TINE2 edge selection ED1 ED2 CVSE20 (16-bit) CVPE20 (16-bit) Sub-channel 2 S/T RA RB RN INTCC23 INTP23 Input filter TINE3 edge selection ED1 ED2 CVSE30 (16-bit) CVPE30 (16-bit) Sub-channel 3 S/T RA RB RN INTCC24 INTP24 Input filter TINE4 edge selection ED1 ED2 CVSE40 (16-bit) CVPE40 (16-bit) Sub-channel 4 ED1 ED2 S/T RA RB RN Output circuit 2
RELOAD2A RELOAD2B
Output circuit 1
TO21
RELOAD2A RELOAD2B
TO22
RELOAD2A RELOAD2B
Output circuit 3
TO23
RELOAD2A RELOAD2B
Output circuit 4
TO24
TCLR2/ INTP25
Input filter
TINE5 edge selection
INTCC25 CVSE50 (16-bit)
Timer connection selector
Sub-channel 5
ECLR CT CTC CASC
TM21 (16-bit)
CNT = MAX. CNT = 0 R
INTTM21
Remark
fXX: Internal system clock fCLK: Base clock (20 MHz (MAX.))
User's Manual U15195EJ3V0UD
317
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Table 9-12. Meaning of Signals in Block Diagram
Signal Name CASC CNT
Note 1
Meaning TM21 count signal input in 32-bit mode Count value of timer 2 (CNT = MAX.: Maximum value count signal output of timer 2 (generated when TM2n = FFFFH), CNT = 0: Zero count signal output of timer 2 (generated when TM2n = 0000H)) TM2n count signal input in 16-bit mode TM21 count signal input in 32-bit mode External control signal input from TCLR2 input Capture event signal input from edge selector Compare match signal input (sub-channel 0/5) TM20 zero count signal input (reset signal of output circuit) TM21 zero count signal input (reset signal of output circuit) TM20 zero count signal input (generated when TM20 = 0000H) TM21 zero count signal input (generated when TM21 = 0000H) Sub-channel x interrupt signal input (reset signal of output circuit) Sub-channel x interrupt signal input (set signal of output circuit) Timer 2 count enable signal input Timer 2 sub-channel m capture event signal input
CT CTC ECLR ED1, ED2 R
Note 2
RA RB RELOAD2A RELOAD2B RN S/T TCOUNTE0, TCOUNTE1 TINEm
Notes 1. 2. Remark
TM21 performs a count operation when CASC (CNT = MAX. for TM20) is generated and the rising edge of CTC is detected in the 32-bit mode. TM20/TM21 clear by sub-channel 0/5 compare match or count direction can be controlled. m = 0 to 5 n = 0, 1 x = 1 to 4
318
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(1) Timers 20, 21 (TM20, TM21) The features of TM2n are listed below. * Free-running counter that enables counter clearing by compare match of sub-channel 0 and sub-channel 5 * Can be used as a 32-bit capture timer when TM20 and TM21 are connected in cascade. * Up/down control, counter clear, and count operation enable/disable can be controlled by external pin (TCLR2) * Counter up/down and clear operation control method can be set by software. * Stop upon occurrence of count value 0 and count operation start/stop can be controlled by software. (2) Timer 2 sub-channel 0 capture/compare register (CVSE00) The CVSE00 register is the 16-bit capture/compare register of sub-channel 0. In the capture register mode, it captures the TM20 count value. In the compare register mode, it detects a match with TM20. This register can be read/written in 16-bit units.
15 CVSE00
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF660H
After reset 0000H
(3) Timer 2 sub-channel n main capture/compare register (CVPEn0) (n = 1 to 4) The CVPEn0 register is the sub-channel n 16-bit main capture/compare register. In the capture register mode, this register captures the value of TM21 when the BFEEn bit of the CMSEm0 register = 0 (m = 12, 34). When the BFEEn bit = 1, this register holds the value of TM20 or TM21. In compare register mode, a match between this register and TM2x is detected (TM2x = timer/counter selected by TB1En and TB0En bits). If the capture register mode is selected in the 32-bit mode (value of TB1En, TB0En bits of CMSEm0 register = 11B), this register captures the contents of TM21 (higher 16 bits). This register is read-only in 16-bit units. Caution When the BFEEn bit = 1, a compare match occurs on starting the timer in the compare register mode because the values of both the TM2x and CVPEn0 registers are 0 after reset (TM2x = timer/counter selected by TB1En and TB0En bits (n = 1 to 4)). After that, the value of the sub register (CVSEn0) is written to the main register (CVPEn0).
15 CVPE10
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF652H
After reset 0000H
15 CVPE20
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF656H
After reset 0000H
15 CVPE30
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF65AH
After reset 0000H
15 CVPE40
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF65EH
After reset 0000H
User's Manual U15195EJ3V0UD
319
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4) Timer 2 sub-channel n sub capture/compare register (CVSEn0) (n = 1 to 4) The CVSEn0 register is the sub-channel n 16-bit sub capture/compare register. In the compare register mode, this register can be used as a buffer. In the capture register mode, this register captures the value of TM20 when the BFEEn bit of the CMSEm0 register = 0 (m = 12, 34). If the capture register mode is selected in the 32-bit mode (value of TB1En and TB0En bits of CMSEm0 register = 11B), this register captures the contents of TM20 (lower 16 bits). The CVSEn0 register can be written only in the compare register mode. If this register is written in the capture register mode, the contents written to CVSEn0 register will be lost. This register can be read/written in 16-bit units. Caution When the BFEEn bit = 1, a compare match occurs on starting the timer in the compare register mode because the values of both the TM2x and CVPEn0 registers are 0 after reset (TM2x = timer/counter selected by TB1En and TB0En bits (n = 1 to 4)). After that, the value of the sub register (CVSEn0) is written to the main register (CVPEn0).
15 CVSE10
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF650H
After reset 0000H
15 CVSE20
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF654H
After reset 0000H
15 CVSE30
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF658H
After reset 0000H
15 CVSE40
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF65CH
After reset 0000H
(5) Timer 2 sub-channel 5 capture/compare register (CVSE50) The CVSE50 register is the 16-bit capture/compare register of sub-channel 5. In the capture register mode, it captures the count value of TM21. In the compare register mode, it detects a match with TM21. This register can be read/written in 16-bit units.
15 CVSE50
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF662H
After reset 0000H
320
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.3.4 Control registers (1) Timer 1/timer 2 clock selection register (PRM02) The PRM02 register is used to select the base clock (fCLK) of timer 1 and timer 2. This register can be read/written in 8-bit or 1-bit units. Cautions 1. Always set this register to 01H before using timer 1 and timer 2. Setting of other than 01H is prohibited. 2. Set fCLK to 20 MHz or less.
7 PRM02 0
6 0
5 0
4 0
3 0
2 0
1 0
0 PRM2
Address FFFFF5D8H
After reset 00H
Bit position 0
Bit name PRM2
Function Specifies the base clock of timer 1 and timer 2. 1: fXX/2
Remark
fXX: Internal system clock
(2) Timer 2 clock stop register 0 (STOPTE0) The STOPTE0 register is used to stop the operation clock input to timer 2. This register can be read/written in 16-bit units. When the higher 8 bits of the STOPTE0 register are used as the STOPTE0H register, and the lower 8 bits are used as the STOPTE0L register, the STOPTE0H register can be read/written in 8-bit or 1-bit units, and the STOPTE0L register is read-only in 8-bit units. Cautions 1. Initialize timer 2 when the STFTE bit = 0. Timer 2 cannot be initialized when the STFTE bit = 1. 2. If, following initialization, the value of the STFTE bit is made "1", the initialized state is maintained.
<15> 14 STOPTE0 STFTE 0
13 0
12 0
11 0
10 0
9 0
8 0
7 0
6 0
5 0
4 0
3 0
2 0
1 0
0 0
Address FFFFF640H
After reset 0000H
Bit position 15
Bit name STFTE Stops the operation clock to timer 2. 0: Normal operation 1: Stop operation clock to timer 2
Function
User's Manual U15195EJ3V0UD
321
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3) Timer 2 count clock/control edge selection register 0 (CSE0) The CSE0 register is used to specify the TM2n count clock and the control valid edge (n = 0, 1). This register can be read/written in 16-bit units. When the higher 8 bits of the CSE0 register are used as the CSE0H register, and the lower 8 bits are used as the CSE0L register, they can be read/written in 8-bit or 1-bit units.
15 CSE0 0
14 0
13 0
12 0
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF642H
After reset 0000H
TES1E1 TES1E0 TES0E1 TES0E0 CESE1 CESE0 CSE12 CSE11 CSE10 CSE02 CSE01 CSE00
Bit position 11, 10, 9, 8
Bit name TESnE1, TESnE0
Function Specifies the valid edge of the TM2n internal count clock (TCOUNTEn) signal.
TESnE1 0 0 1 1
TESnE0 0 1 0 1 Falling edge Rising edge Setting prohibited
Valid edge
Both rising and falling edges
7, 6
CESE1, CESE0
Specifies the valid edge of the TM2n external clear input (TCLR2).
CESE1 0 0 1 1
CESE0 0 1 0 1 Falling edge Rising edge
Valid edge
Through input (no clear operation) Both rising and falling edges
5 to 3, 2 to 0
CSEn2, CSEn1, CSEn0
Selects internal count clock (TCOUNTEn) of TM2n.
CSEn2 0 0 0 0 1 1 1 1
CSEn1 0 0 1 1 0 0 1 1
CSEn0 0 1 0 1 0 1 0 1 fCLK/2 fCLK/4 fCLK/8 fCLK/16 fCLK/32 fCLK/64 fCLK/128
Count clock
Selects input signal from external clock input pin (TI2) as clock.
Remark
n = 0, 1 fCLK: Base clock
322
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4) Timer 2 sub-channel input event edge selection register 0 (SESE0) The SESE0 register specifies the valid edge of the external capture signal input (TINEn) for the sub-channel n capture/compare register performing capture (n = 0 to 5). This register can be read/written in 16-bit units. When the higher 8 bits of the SESE0 register are used as the SESE0H register, and the lower 8 bits are used as the SESE0L register, they can be read/written in 8-bit or 1-bit units.
15 SESE0 0
14 0
13 0
12 0
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF644H
After reset 0000H
IESE51 IESE50 IESE41 IESE40 IESE31 IESE30 IESE21 IESE20 IESE11 IESE10 IESE01 IESE00
Bit position 11 to 0
Bit name IESEn1, IESEn0
Function Specifies the valid edge of external capture signal input (TINEn) for sub-channel n capture/compare register performing capture.
IESEn1 0 0 1 1
IESEn0 0 1 0 1 Falling edge Rising edge Setting prohibited
Valid edge
Both rising and falling edges
Remark
n = 0 to 5
User's Manual U15195EJ3V0UD
323
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(5) Timer 2 time base control register 0 (TCRE0) The TCRE0 register controls the operation of TM2n (n = 0, 1). This register can be read/written in 16-bit units. When the higher 8 bits of the TCRE0 register are used as the TCRE0H register, and the lower 8 bits are used as the TCRE0L register, they can be read/written in 8-bit or 1-bit units. Cautions 1. If ECREn = 1 and ECEEn = 1 have been set, it is not possible to input an external clear signal (TCLR2) for TM2n. In this case, first set CLREn = 1, and then clear TM2n by software (n = 0, 1). 2. When clearing is performed using the ECLR signal, the TM2n counter is cleared with a delay of (1 internal count clock set with bits CSEn2 to CSEn0 of the CSE0 register) + 2 base clocks. Therefore, if external clock input is selected as the internal count clock, the counter is not cleared until the external clock (TI2) is input. 3. The ECREn bit and the ECEEn bit cannot be set to 1. 4. If the ECEEn bit is set to 1 and the ECREn bit is set to 0, a down count operation cannot be performed. 5. When UDSEn1, UDSEn0 = 01 and OSTEn = 1, the counter does not count up when the counter value is 0. Therefore, when the counter value is 0, set OSTEn = 0, and after the value of the counter ceases to be 0, set OSTEn = 1. Also, on the application, change the value of OSTEn from 0 to 1 using the sub-channels 0 and 5 interrupt signals. 6. When the TM2n count value is cleared (0) by setting CLREn to 1, the CLREn = 1 setting must be held for at least one of the internal count clocks set by the CSEn2 to CSEn0 bits of the CSE0 register. Example When timer 20 (TM20) is cleared (0) <1> Select fCLK/2 as TM20 internal count clock
15 CSE0 0 14 0 13 0 12 0 11 x 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 0 1 0 0 0
<2> Clear (0) the TM20 count value
7 TCRE0L 0 6 1 5 0 4 0 3 0 2 x 1 x 0 x
<3> Set the conditions required for the TM20 count clock
15 CSE0 x 14 x 13 x 12 x 11 x 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 x 0 x
<4> Start the TM20 count operation
7 TCRE0L 0 6 0 5 1 4 0 3 0 2 x 1 x 0 x
324
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(1/2)
15 <14> <13> 12 11 10 9 8 7 0 <6> <5> 4 3 2 1 0 Address FFFFF646H After reset 0000H
TCRE0 CASE1 CLRE1 CEE1 ECRE1 ECEE1 OSTE1 UDSE11 UDSE10
CLRE0 CEE0 ECRE0 ECEE0 OSTE0 UDSE01 UDSE00
Bit position 15
Bit name CASE1
Function Specifies 32-bit cascade operation mode for TM21 (TM21 counts upon overflow of TM20 (carry count)). 0: Not connected in cascadeNote 1 1: 32-bit cascade operation modeNotes 2, 3
Notes 1. TM21 counts at CT signal input in the count enabled state. 2. TM21 counts at CTC and CASC signal inputs in the count enabled state. 3. Only the capture register mode can be used for the capture/compare register. Cautions 1. When CASE1 = 1, set the TByE1 and TByE0 bits of the CMSEx0 register to 11 (x = 12, 34, y: When x = 12, y = 1, 2, and when x = 34, y = 3, 4). 2. When CASE1 = 0, TCOUNTE1 is selected as the count of TM21. When CASE1 = 1, TCOUNTE0 and the TM20 overflow signal are selected as the count of TM21. 14, 6 CLREn Specifies software clear for TM2n. 0: TM2n operation continued 1: TM2n count value cleared (0)
Caution
Do not perform the software clear and hardware clear operations simultaneously.
13, 5
CEEn
Specifies TM2n count operation enable/disable. 0: Count operation stopped 1: Count operation enabled
12, 4
ECREn
Specifies TM2n external clear (TCLR2) operation enable/disable via ECLR signal input. 0: TM2n external clear (TCLR2) operation not enabled 1: TM2n external clear (TCLR2) operation enabled
Cautions 1. In the 32-bit cascade operation mode (CASE1 = 1), the TM2n external clear operation is not performed. 2. When the count value is cleared by inputting the ECLR signal while ECREn = 1, the ECREn = 1 setting must be held for at least one of the internal count clocks set by the CSEn2 to CSEn0 bits of the CSE0 register. 3. In the 32-bit cascade operation mode (CASE1 = 1), only TM21 is affected by the ECREn bit setting.
Remark
n = 0, 1
User's Manual U15195EJ3V0UD
325
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2/2)
Bit position 11, 3 Bit name ECEEn Function Specifies TM2n count operation enable/disable through ECLR signal input. 0: TM2n count operation not enabled 1: TM2n count operation enabled
Cautions 1. In the 32-bit cascade operation mode (CASE1 = 1), the TM2n count operation using ECLR signal input is not performed. 2. When the ECEEn bit = 1, always set the CESE1 and CESE0 bits of the CSE0 register to 10 (through input). 3. In the 32-bit cascade operation mode (CASE1 = 1), only TM21 is affected by the ECEEn bit setting. 10, 2 OSTEn Specifies stop mode. 0: TM2n count stopped when count value is 0. 1: TM2n count not stopped when count value is 0.
Caution
When the TM2n count stop is cancelled when the OSTE1n bit = 1 (TM2n count is stopped when the count value is 0), TM2n counts up except when the UDSEn1, UDSEn0 bits = 10. The count direction when the UDSEn1 and UDSEn0 bits = 10 is determined by the value of ECLR.
9, 8, 1, 0
UDSEn1, UDSEn0
Specifies TM2n up/down count. UDSEn1 0 UDSEn0 0 Count Perform only up count. Clear TM2n with compare match signal. Count up after TM2n has become 0, and count down after a compare match occurs for sub-channels 0, 5 (triangular wave up/down count). Selects up/down count according to the ECLR signal input. Up count when ECLR = 1 Down count when ECLR = 0 Setting prohibited
0
1
1
0
1
1
Cautions 1. In the 32-bit cascade operation mode (CASE1 bit = 1), set the UDSEn1 and UDSEn0 bits to 00. 2. When the UDSEn1 and UDSEn0 bits = 10, be sure to set the CESE1 and CESE0 bits of the CSE0 register to 10 (through input). 3. When the UDSEn1 and UDSEn0 bits = 10, compare match between TM2n and CVSEx0 has no effect on the TM2n count operation (x: 0 when n = 0, 5 when n = 1).
Remark
n = 0, 1
326
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(6) Timer 2 output control register 0 (OCTLE0) The OCTLE0 register controls timer output from the TO2n pin (n = 1 to 4). This register can be read/written in 16-bit units. When the higher 8 bits of the OCTLE0 register are used as a OCTLE0H register, and the lower 8 bits are used as a OCTLE0L register, they can be read/written in 8-bit or 1-bit units.
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF648H
After reset 0000H
OCTLE0 SWFE ALVE OTME OTME SWFE ALVE OTME OTME SWFE ALVE OTME OTME SWFE ALVE OTME OTME 4 4 41 40 3 3 31 30 2 2 21 20 1 1 11 10
Bit position 15, 11, 7, 3
Bit name SWFEn
Function Fixes the TO2n pin output level according to the setting of ALVEn bit. 0: Output level not fixed. 1: When ALVEn = 0, output level fixed to low level. When ALVEn = 1, output level fixed to high level.
14, 10, 6, 2
ALVEn
Specifies the active level of the TO2n pin output. 0: Active level is high level 1: Active level is low level
13, 12, 9, 8, 5, 4, 1, 0
OTMEn1, OTMEn0
Specifies toggle mode. OTMEn1 0 OTMEn0 0 Toggle mode Toggle mode 0: Reverse output level of TO2n output every time a subchannel n compare match occurs. Toggle mode 1: Upon sub-channel n compare match, set TO2n output to active level, and when TM20 is "0", set TO2n output to inactive level. Toggle mode 2: Upon sub-channel n compare match, set TO2n output to active level, and when TM21 is "0", set TO2n output to inactive level. Toggle mode 3: Upon sub-channel n compare match, set TO2n output to active level, and upon sub-channel n + 1 compare match, set TO2n output to inactive level (when n = "4", n + 1 becomes "1").
0
1
1
0
1
1
Cautions 1. When the OTMEn1 and OTMEn0 bits = 11 (toggle mode 3), if the same output delay operation settings are made when setting the ODLEn2 to ODLEn0 bits of the ODELE0 register, two outputs change simultaneously upon 1 sub-channel n compare match. 2. If two or more signals are input simultaneously to the same output circuit, S/T signal input has a higher priority than RA, RB, and RN signal inputs.
Remark
n = 1 to 4
User's Manual U15195EJ3V0UD
327
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(7) Timer 2 sub-channel 0, 5 capture/compare control register (CMSE050) The CMSE050 register controls the timer 2 sub-channel 0 capture/compare register (CVSE00) and the timer 2 sub-channel 5 capture/compare register (CVSE50). This register can be read/written in 16-bit units.
15 CMSE050 0
14 0
13 EEVE5
12 0
11
10
9 0
8 0
7 0
6 0
5 EEVE0
4 0
3
2
1 0
0 0
Address FFFFF64AH
After reset 0000H
LNKE5 CCSE5
LNKE0 CCSE0
Bit position 13, 5
Bit name EEVEn
Function Enables/disables event detection by sub-channel n capture/compare register. 0: ED1 and ED2 signal inputs ignored (nothing is done even if these signals are input). 1: Operation caused by ED1 and ED2 signal inputs enabled.
11, 3
LNKEn
Specifies capture event signal input from edge selection to ED1 or ED2. 0: In capture register mode, ED1 signal input selected. In compare register mode, LNKEn bit has no influence. 1: In capture register mode, ED2 signal input selected. In compare register mode, LNKEn bit has no influence.
10, 2
CCSEn
Selects capture/compare register operation mode. 0: Operates in capture register mode. The TM20 and TM21 count statuses can be read with sub-channel 0 and sub-channel 5, respectively. 1: Operates in compare register mode. TM2m is cleared upon detection of match between sub-channel n and TM2m.
Remark
m = 0, 1 n = 0, 5
328
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(8) Timer 2 sub-channel 1, 2 capture/compare control register (CMSE120) The CMSE120 register controls the timer 2 sub-channel n sub capture/compare register (CVSEn0) and the timer 2 sub-channel n main capture/compare register (CVPEn0) (n = 1, 2). This register can be read/written in 16-bit units. (1/2)
15 CMSE120 0 14 0 13 12 11 10 9 8 7 0 6 0 5 4 3 2 1 0 Address FFFFF64CH After reset 0000H
EEVE2 BFEE2 LNKE2 CCSE2 TB1E2 TB0E2
EEVE1 BFEE1 LNKE1 CCSE1 TB1E1 TB0E1
Bit position 13, 5
Bit name EEVEn
Function Enables/disables event detection for CMSE120 register. 0: ED1 and ED2 signal inputs ignored (nothing is done even if these signals are input). 1: Operation caused by ED1 and ED2 signal inputs enabled.
12, 4
BFEEn
Specifies the buffer operation of sub-channel n sub capture/compare register (CVSEn0). 0: Sub-channel n sub capture/compare register (CVSEn0) not used as buffer. 1: Sub-channel n sub capture/compare register (CVSEn0) used as buffer. Caution When the BFEEn bit = 1, a compare match occurs on starting the timer in the compare register mode because the values of both the TM2x and CVPEn0 registers are 0 after reset (TM2x = timer/counter selected by TB1En and TB0En bits (n = 1 to 4)). After that, the value of the sub register (CVSEn0) is written to the main register (CVPEn0). Remarks 1. The operations in the capture register mode and compare register mode when the sub-channel n sub capture/compare register (CVSEn0) is not used as a buffer are shown below. * In capture register mode: The CPU can read both the master register (CVPEn0) and slave register (CVSEn0). The next event is ignored until the CPU finishes reading the master register. TM20 capture is performed by the slave register, and TM21 capture is performed by the master register. * In compare register mode: The CPU writes to the slave register (CVSEn0), and immediately after, the same contents as those of the slave register are written to the master register (CVPEn0). 2. The operations in the capture register mode and compare register mode when the sub-channel n sub capture/compare register (CVSEn0) is used as a buffer are shown below. * In capture register mode: When the CPU reads the master register (CVPEn0), the master register updates the value held by the slave register (CVSEn0) immediately before the CPU read operation. When a capture event occurs, the timer/counter value at that time is always saved in the slave register. * In compare register mode: The CPU writes to the slave register (CVSEn0) and these contents are transferred to the master register (CVPEn0) set by the LNKEn bits.
Remark
n = 1, 2
User's Manual U15195EJ3V0UD
329
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2/2)
Bit position 11, 3 Bit name LNKEn Function Selects capture event signal input from edge selection and specifies transfer operation in compare register mode. 0: ED1 signal input selected in capture register mode. In the compare register mode, the data of the CVSEn0 register is transferred to the CVPEn0 register upon occurrence of a TM2x compare match (TM2x = timer/counter selected by bits TB1En, TB0En). 1: ED2 signal input selected in capture register mode. In the compare register mode, the data of the CVSEn0 register is transferred to the CVPEn0 register when the TM2x count value becomes 0 (TM2x = timer/ counter selected by bits TB1En, TB0En). 10, 2 CCSEn Selects capture/compare register operation mode. 0: Capture register mode 1: Compare register mode 9, 8, 1, 0 TB1En, TB0En Sets sub-channel n timer/counter. TB1En 0 0 1 1 TB0En 0 1 0 1 Sub-channel n timer/counter Sub-channel n not used. TM20 set to sub-channel n. TM21 set to sub-channel n. 32-bit modeNote (both TM20 and TM21 selected)
Note In the 32-bit mode, the effect of the BFEEn bit is ignored. Also, the CVSEn0 register cannot be used as a buffer in this mode. Caution When the TB1En, TB0En bits are set to 11, set the CASE1 bit of the TCRE0 register to 1.
Remark
n = 1, 2
330
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(9) Timer 2 sub-channel 3, 4 capture/compare control register (CMSE340) The CMSE340 register controls the timer 2 sub-channel n sub capture/compare register (CVSEn0) and the timer 2 sub-channel n main capture/compare register (CVPEn0). This register can be read/written in 16-bit units. (1/2)
15 CMSE340 0 14 0 13 12 11 10 9 8 7 0 6 0 5 4 3 2 1 0 Address FFFFF64EH After reset 0000H
EEVE4 BFEE4 LNKE4 CCSE4 TB1E4 TB0E4
EEVE3 BFEE3 LNKE3 CCSE3 TB1E3 TB0E3
Bit position 13, 5
Bit name EEVEn
Function Enables/disables event detection by CMSE340 register. 0: ED1 and ED2 signal inputs ignored (nothing is done even if these signals are input). 1: Operation caused by ED1 and ED2 signal inputs enabled. Specifies the sub-channel n sub capture/compare register (CVSEn0) buffer operation. 0: Sub-channel n sub capture/compare register (CVSEn0) not used as buffer 1: Sub-channel n sub capture/compare register (CVSEn0) used as buffer Caution When the BFEEn bit = 1, a compare match occurs on starting the timer in the compare register mode because the values of both the TM2x and CVPEn0 registers are 0 after reset (TM2x = timer/counter selected by TB1En and TB0En bits (n = 1 to 4)). After that, the value of the sub register (CVSEn0) is written to the main register (CVPEn0). Remarks 1. The operations in the capture register mode and compare register mode when the sub-channel n sub capture/compare register (CVSEn0) is not used as a buffer are shown below. * In capture register mode: The CPU can read both the master register (CVPEn0) and slave register (CVSEn0). The next event is ignored until the CPU finishes reading the master register. TM20 capture is performed by the slave register, and TM21 capture is performed by the master register. * In compare register mode: The CPU writes to the slave register (CVSEn0), and immediately after, the same contents as those of the slave register are written to the master register (CVPEn0). 2. The operations in the capture register mode and compare register mode when the sub-channel n sub capture/compare register (CVSEn0) is used as a buffer are shown below. * In capture register mode: When the CPU reads the master register (CVPEn0), the master register updates the value held by the slave register (CVSEn0) immediately before the CPU read operation. When a capture event occurs, the timer/counter value at that time is always saved in the slave register. * In compare register mode: The CPU writes to the slave register (CVSEn0) and these contents are transferred to the master register (CVPEn0) set by the LNKEn bits.
12, 4
BFEEn
Remark
n = 3, 4
User's Manual U15195EJ3V0UD
331
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2/2)
Bit position 11, 3 Bit name LNKEn Function Selects capture event signal input from edge selection and specifies transfer operation in compare register mode. 0: ED1 signal input selected in capture register mode. In the compare register mode, the data of the CVSEn0 register is transferred to the CVPEn0 register upon occurrence of a TM2x compare match (TM2x = timer/ counter selected with bits TB1En, TB0En). 1: ED2 signal input selected in capture register mode. In the compare register mode, the data of the CVSEn0 register is transferred to the CVPEn0 register when the TM2x count value becomes 0 (TM2x = timer/ counter selected by bits TB1En, TB0En). 10, 2 CCSEn Selects capture/compare register operation mode. 0: Capture register mode 1: Compare register mode 9, 8, 1, 0 TB1En, TB0En Sets sub-channel n timer/counter. TB1En 0 0 1 1 TB0En 0 1 0 1 Sub-channel n timer/counter Sub-channel n not used TM20 set to sub-channel n. TM21 set to sub-channel n. 32-bit modeNote (both TM20 and TM21 selected)
Note In the 32-bit mode, the effect of the BFEEn bit is ignored. Also, the CVSEn register cannot be used as a buffer in this mode.
Caution
When the TB1En, TB0En bits are set to 11, set the CASE1 bit of the TCRE0 register to 1.
Remark
n = 3, 4
332
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(10) Timer 2 time base status register 0 (TBSTATE0) The TBSTATE0 register indicates the status of TM2n (n = 0, 1). This register can be read/written in 16-bit units. When the higher 8 bits of the TBSTATE0 register are used as the TBSTATE0H register, and the lower 8 bits are used as the TBSTATE0L register, they can be read/written in 8-bit or 1-bit units. Caution The ECFEn, RSFEn, and UDFEn bits are read-only bits.
15 TBSTATE0 0
14 0
13 0
12 <11> <10> <9> <8> 0 OVFE1 ECFE1 RSFE1 UDFE1
7 0
6 0
5 0
4 0
<3> <2> <1> <0> OVFE0 ECFE0 RSFE0 UDFE0
Address FFFFF664H
After reset 0101H
Bit position 11, 3
Bit name OVFEn Indicates TM2n overflow status. 0: No overflow 1: Overflow Caution
Function
If write access to the TBSTATE0 register is performed when an overflow has not been detected, the OVFEn bit is cleared (0).
10, 2
ECFEn
Indicates the ECLR signal input status. 0: Low level 1: High level
9, 1
RSFEn
Indicates the TM2n count status. 0: TM2n is not counting. 1: TM2n is counting (either up or down)
8, 0
UDFEn
Indicates the TM2n up/down count status. 0: TM2n is in the down count mode. 1: TM2n is in the up count mode.
Remark
n = 0, 1
User's Manual U15195EJ3V0UD
333
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(11) Timer 2 capture/compare 1 to 4 status register 0 (CCSTATE0) The CCSTATE0 register indicates the status of the timer 2 sub-channel sub capture/compare register (CVSEn0) and the timer 2 sub-channel main capture/compare register (CVPEn0) (n = 1 to 4). This register can be read/written in 16-bit units. When the higher 8 bits of the CCSTATE0 register are used as the CCSTATE0H register, and the lower 8 bits are used as the CCSTATE0L register, they can be read/written in 8-bit or 1-bit units. Caution The BFFEn1 and BFFEn0 bits are read-only bits.
15 <14> 13 CCSTATE0 0
12
11 <10> 9 0
8
7 0
<6>
5
4
3 0
<2>
1
0
Address FFFFF666H
After reset 0000H
CEFE4 BFFE41 BFFE40
CEFE3 BFFE31 BFFE30
CEFE2 BFFE21 BFFE20
CEFE1 BFFE11 BFFE10
Bit position 14, 10, 6, 2
Bit name CEFEn
Function Indicates the capture/compare event occurrence status. 0: In capture register mode: No capture operation has occurred. In compare register mode: No compare match has occurred. 1: In capture register mode: At least one capture operation has occurred. In compare register mode: At least one compare match has occurred. Caution The CEFEn bit can be cleared (0) by performing a write access to the CCSTATE0 register when no capture operation or compare match has occurred. When bit manipulation is performed on the CEFE1 (CEFE3) and CEFE2 (CEFE4) bits, both bits are cleared.
13, 12, 9, 8, 5, 4, 1, 0
BFFEn1, BFFEn0
Indicates the capture buffer status. BFFEn1 0 0 BFFEn0 0 1 Capture buffer status No value in buffer Sub-channel n master register (CVPEn0) contains a capture value. Slave register (CVSEn0) does not contain a value. Both sub-channel n master register (CVPEn0) and slave register (CVSEn0) contain a capture value. Unused
1
0
1 Caution
1
The BFFEn1 and BFFEn0 bits return a value only when sub-channel n sub capture/compare register (CVSEn0) buffer operation (bit BFEEn of CMSEm0 register = 1) is selected or when capture register mode (bit CCSEn of CMSEm0 register = 0) is selected. 0 is read when the compare register mode (CCSEn bit = 1) is selected.
Remark
m = 12, 34 n = 1 to 4
334
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(12) Timer 2 output delay register 0 (ODELE0) The ODELE0 register sets the output delay operation synchronized with the clock to the TO2n pin's output delay circuit (n = 1 to 4). This register can be read/written in 16-bit units. When the higher 8 bits of the ODELE0 register are used as the ODELE0H register, and the lower 8 bits are used as the ODELE0L register, they can be read/written in 8-bit or 1-bit units.
15 ODELE0 0
14
13
12
11 0
10
9
8
7 0
6
5
4
3 0
2
1
0
Address FFFFF668H
After reset 0000H
ODLE42 ODLE41 ODLE40
ODLE32 ODLE31 ODLE30
ODLE22 ODLE21 ODLE20
ODLE12 ODLE11 ODLE10
Bit position 14 to 12, 10 to 8, 6 to 4, 2 to 0
Bit name ODLEn2, ODLEn1, ODLEn0 Specifies output delay operation.
Function
ODLEn2 0 0 0 0 1 1 1 1
ODLEn1 0 0 1 1 0 0 1 1
ODLEn0 0 1 0 1 0 1 0 1
Set output delay operation Output delay operation not performed. Sets output delay of 1 system clock. Sets output delay of 2 system clocks. Sets output delay of 3 system clocks. Sets output delay of 4 system clocks. Sets output delay of 5 system clocks. Sets output delay of 6 system clocks. Sets output delay of 7 system clocks.
Remark The ODLEn2, ODLEn1, and ODLEn0 bits are used for EMI countermeasures.
Remark
n = 1 to 4
User's Manual U15195EJ3V0UD
335
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(13) Timer 2 software event capture register (CSCE0) The CSCE0 register sets capture operation by software in the capture register mode. This register can be read/written in 16-bit units.
15 CSCE0 0
14 0
13 0
12 0
11 0
10 0
9 0
8 0
7 0
6 0
5
4
3
2
1
0
Address FFFFF66AH
After reset 0000H
SEVE5 SEVE4 SEVE3 SEVE2 SEVE1 SEVE0
Bit position 5 to 0
Bit name SEVEn
Function Specifies capture operation by software in capture register mode. 0: Normal operation continued. 1: Capture operation performed. Cautions 1. The SEVEn bit ignores the settings of the EEVEn and the LNKEn bits of the CMSEm0 register. 2. The SEVEn bit is automatically cleared (0) at the end of an event. 3. The SEVEn bit ignores all the internal limitation statuses of the timer 2 unit.
Remark
m = 12, 34, 05 n = 0 to 5
336
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.3.5 Operation (1) Edge detection The edge detection timing is shown below. Figure 9-63. Edge Detection Timing
fCLK
Note
00B
01B
10B
11B
TINEx, TCLR2, TCOUNTEn MUXTB0 CT ED1, ED2 ECLR
Note The set values of the TESnE1 and TESnE0 bits and the CESE1 and CESE0 bits of the CSE0 register, and the IESEx1 and IESEx0 bits of the SESE0 register are shown. Remarks 1. fCLK: Base clock 2. CT: TM2n count signal input in the 16-bit mode ECLR: External control signal input from TCLR2 input ED1, ED2: Capture event signal input from edge selector MUXTB0: TM20 multiplex signal TCOUNTEn: Timer 2 count enable signal input TINEx: Timer 2 sub-channel x capture event signal input (x = 0 to 5) 3. n = 0, 1 x = 0 to 5
User's Manual U15195EJ3V0UD
337
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Basic operation of timer 2 Figures 9-64 to 9-67 show the basic operation of timer 2. Figure 9-64. Timer 2 Up Count Timing (When TCRE0 Register's UDSEn1, UDSEn0 Bits = 00B, ECEEn Bit = 0, ECREn Bit = 0, CLREn Bit = 0, CASE1 Bit = 0)
fCLK OSTEn bitNote 1 CEEn bitNote 1 CT CNT RNote 2 INTTM2n (output) CNT = 0 FFFDH (Stop) FFFEH FFFFH 0000H 1234H 1235H 0000H (Stop)
Notes 1. 2.
Bits OSTE, CEE of TCRE0 register Can control TM20/TM21 clear by sub-channel 0/5 compare match or count direction.
Remarks 1. fCLK: Base clock 2. CNT: Count value of timer 2 CT: TM2n count signal input in 16-bit mode R: Compare match signal input (sub-channel 0/5) 3. n = 0, 1
338
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-65. External Control Timing of Timer 2 (When TCRE0 Register's UDSEn1, UDSEn0 Bits = 00B, OSTEn Bit = 0, CEEn Bit = 1, CASE1 Bit = 0)
fCLK CT ECEEn bitNote ECREn bitNote CLREn bitNote ECLR CNT 1234H 1235H 0000H 0001H 0000H
Note Bits ECEEn, ECREn, CLREn of TCRE0 register Remarks 1. fCLK: Base clock 2. CNT: Count value of timer 2 CT: TM2n count signal input in 16-bit mode ECLR: External control signal input from TCLR2 pin input 3. n = 0, 1
User's Manual U15195EJ3V0UD
339
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-66. Operation in Timer 2 Up/Down Count Mode (When TCRE0 Register's ECEEn bit = 0, ECREn Bit = 0, CLREn Bit = 0, OSTEn Bit = 0, CEEn Bit = 1, CASE1 Bit = 0)
fCLK CT UDSEn1, UDSEn0 bitsNote 1 ECLR RNote 2 CNT FFFEH INTTM2n (output) CNT = 0 FFFFH 0000H 0001H 0002H 0001H 0000H 0001H 0002H 0003H 0002H 01B Don't care 10B
Notes 1. 2.
UDSEn1, UDSEn0 bits of TCRE0 register Can control TM20/TM21 clear by sub-channel 0/5 compare match or count direction.
Remarks 1. fCLK: Base clock 2. CNT: Count value of timer 2 CT: TM2n count signal input in 16-bit mode ECLR: External control signal input from TCLR2 pin input R: Compare match signal input (sub-channel 0/5) 3. n = 0, 1
340
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-67. Timing in 32-Bit Cascade Operation Mode (When TCRE0 Register's UDSEn1, UDSEn0 Bits = 00B, ECEEn Bit = 0, ECREn Bit = 0, CLREn Bit = 0, OSTEn Bit = 0, CEEn Bit = 1, CASE1 Bit = 1)
fCLK CTC CASCNote[TB1] CNT[TB0] CNT[TB1] FFFBH FFFCH FFFDH FFFEH FFFFH 0000H 0001H 0002H 1235H 0003H 0004H
1234H
Note If, in the 32-bit mode, CASC (CNT = MAX. for TM20) is input to TM21 and the CTC rising edge is detected, TM21 performs a count operation. Remarks 1. fCLK: Base clock 2. CASC: TM21 count signal input in 32-bit mode CNT: Count value of timer 2 CTC: TM21 count signal input in 32-bit mode TB0: Count value of TM20 TB1: Count value of TM21 3. n = 0, 1
User's Manual U15195EJ3V0UD
341
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3) Operation of capture/compare register (sub-channels 1 to 4) Sub-channels 1 to 4 receive the count value of the timer 2 multiplex count generator. The multiplex count generator is an internal unit of TM2n that supplies the multiplex count value MUXCNT to sub-channels 1 to 4. The count value of TM20 is output to sub-channels 1 to 4 at the rising edge of MUXTB0, and the count value of TM21 is output to sub-channels 1 to 4 at the rising edge of MUXTB1. Figure 9-68 shows the block diagram of the timer 2 multiplex count generator, and Figure 9-69 shows the multiplex count timing. Figure 9-68. Block Diagram of Timer 2 Multiplex Count Generator
fCLK
Multiplex control
MUXTB0 (to sub-channel m capture/compare register) MUXTB1 (to sub-channel m capture/compare register)
CNT (from TM20) CNT (from TM21)
Timer 2 multiplex count generator
MUXCNT (to sub-channel m capture/compare register)
Remarks 1. fCLK: Base clock 2. CNT: Count value of timer 2 MUXTB0, MUXTB1: Multiplex signal of TM20, TM21 MUXCNT: Count value to sub-channel m 3. m = 1 to 4
342
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-69. Multiplex Count Timing
fCLK CNT (0) CNT (1) MUXTB0 MUXTB1 MUXCNT
FFFEH 1234H FFFFH 1234H FFFFH 1234H FFFFH 1234H 0000H 1235H 0000H 1235H 0000H 1235H 0001H 1235H 0001H 1235H 0001H
FFFEH 1234H
FFFFH
0000H 1235H
0001H
TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0
Remarks 1. fCLK: Base clock 2. CNT: Count value of timer 2 MUXTB0, MUXTB1: Multiplex signal of TM20, TM21 MUXCNT: Count value to sub-channel m (m = 1 to 4) TB0: Count value of TM20 TB1: Count value of TM21
Figures 9-70 to 9-75 show the operation of the capture/compare register (sub-channels 1 to 4).
User's Manual U15195EJ3V0UD
343
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-70. Capture Operation: 16-Bit Buffer-Less Mode (When Operation Is Delayed Through Setting of LNKEy Bit of CMSEx0 Register, and CMSEx0 Register's CCSEy Bit = 0, BFEEy Bit = 0, EEVEy Bit = 1, and CSCE0 Register's SEVEy Bit = 0)
fCLK MUXTB0 MUXTB1 MUXCNT TB0Ey bitNote 1 TB1Ey bitNote 1 LNKEy bitNote 1 ED1 ED2 CAPTURE_P CAPTURE_S READ_ENABLE_P CVPEm0 register CVSEm0 register Undefined 2 Undefined 4 11 13
Note 2 Note 2
1 6 2 7 3 8 4 9 5 10 6 11 7 12 8 13 9 14 10 5 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1
Notes 1. 2.
Bits TB0Ey, TB1Ey of CMSEx register If an event occurs at this timing, it is ignored.
Remarks 1. fCLK: Base clock 2. CAPTURE_P: Capture trigger signal of main capture register CAPTURE_S: Capture trigger signal of sub capture register ED1, ED2: Capture event signal input from edge selector MUXCNT: Count value to sub-channel m MUXTB0, MUXTB1: Multiplex signal of TM20, TM21 READ_ENABLE_P: Read timing for CVPEm0 register TB0: Count value of TM20 TB1: Count value of TM21 3. m = 1 to 4, x = 12, 34 y: When x = 12, y = 1, 2, and when x = 34, y = 3, 4
344
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-71. Capture Operation: Mode with 16-Bit Buffer and CSCE0 Register's SEVEy Bit = 0)
Note 1
(When CMSEx0 Register's TByE1
Bit = 0, TByE0 Bit = 1, CCSEy Bit = 0, LNKEy Bit = 0, BFEEy Bit = 1, EEVEy Bit = 1,
fCLK MUXTB0 MUXTB1 MUXCNT ED1 Event CAPTURE_P CAPTURE_S BUFFER READ_ENABLE_P CVPEm0 register CVSEm0 register Capture Undefined Undefined 2 3 Shift 2 4
Note 3
1 6 2 7 3 8 4 9 5 10 6 11 7 12 8 13 9 14 10 5 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0
Note 2
L
New event
4 8
Notes 1.
To operate TM2n in the mode with 16-bit buffer, perform a capture at least twice at the start of an operation and read the CVPEm0 register. Also, read the CVPEm0 register after performing a capture at least once.
2. 3.
A write operation to the CVPEn0 register is not performed at these signal inputs because the CVSEm0 register operates as a buffer. After this timing, a write operation from the CVSEm0 register to the CVPEm0 register is enabled.
Remarks 1. fCLK: Base clock 2. BUFFER: Timing of write operation from CVSEm0 register to CVPEm0 register CAPTURE_P: Capture trigger signal of main capture register CAPTURE_S: Capture trigger signal of sub capture register ED1: Capture event signal input from edge selector MUXCNT: Count value to sub-channel m MUXTB0, MUXTB1: Multiplex signal of TM20, TM21 READ_ENABLE_P: Read timing of CVPEm0 register TB0: Count value of TM20; TB1: Count value of TM21 3. m = 1 to 4, x = 12, 34 y: When x = 12, y = 1, 2, and when x = 34, y = 3, 4
User's Manual U15195EJ3V0UD
345
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-72. Capture Operation: 32-Bit Cascade Operation Mode (When CMSEx Register's TByE1 Bit = 1, TByE0 Bit = 1, CCSEy Bit = 0, LNKEy Bit = 0, BFEEy Bit = Arbitrary, EEVEy Bit = 1, and CSCE0 Register's SEVEy Bit = 0)
fCLK TCOUNTE0 = TCOUNTE1 CNT (0) CNT (1) CASCNote 1 MUXTB0 MUXTB1 MUXCNT ED1
Note 2 Note 2
FFFEH 1234H
FFFFH
0000H 1235H
0001H
FFFEH 1234H FFFFH 1234H FFFFH 1234H
FFFFH 1234H
0000H 1235H
0000H 1235H
0000H 1235H
0001H 1235H
0001H
1235H 0001H
TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0
CAPTURE_S CAPTURE_P READ_ENABLE_P CVSEm0 register CVPEm0 register Undefined Undefined Enable the next capture 0000H 1235H 0001H 1235H
Note 3
Note 3
Notes 1. 2. 3.
TM21 performs a count operation when, in the 32-bit mode, CASC (CNT = MAX. for TM20) is input to TM21 and the rising edge of CTC is detected. If an event occurs during this timing, it is ignored. CPU read access is not performed at this timing (wait status).
Remarks 1. fCLK: Base clock 2. CAPTURE_P: Capture trigger signal of main capture register CAPTURE_S: Capture trigger signal of sub capture register CASC: TM21 count signal in 32-bit mode CNT: Count value of timer 2 ED1: Capture event signal input from edge selector MUXCNT: Count value to sub-channel m MUXTB0, MUXTB1: Multiplex signal of TM20, TM21 READ_ENABLE_P: Read timing of CVPEm0 register TB0: Count value of TM20 TB1: Count value of TM21 TCOUNTE0, TCOUNTE1: Count enable signal input of timer 2 3. m = 1 to 4, x = 12, 34 y: When x = 12, y = 1, 2, and when x = 34, y = 3, 4
346
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-73. Capture Operation: Capture Control by Software and Trigger Timing (When CMSEx0 Register's TByE1 Bit = 0, TByE0 Bit = 1, CCSEy Bit = 0, LNKEy Bit = 0, BFEEy Bit = 1)
fCLK MUXTB0 MUXTB1 MUXCNT EEVEy bitNote 1 SEVEy bitNote 2 ED1 CAPTURE_P CAPTURE_S BUFFER CVSEm0 register CVPEm0 register Undefined Undefined 4 4 9 L
Event detection by EEVEy bit prohibited Set by software Cleared by timer
6 2 7 3 8 4 9 5 10 6 11 7 12 8 13 9 14 10 5 1 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0
Notes 1. 2.
EEVEy bit of CMSEx0 register SEVEy bit of CSCE0 register
Remarks 1. fCLK: Base clock 2. BUFFER: Timing of write operation from CVSEm0 register to CVPEm0 register CAPTURE_P: Capture trigger signal of main capture register CAPTURE_S: Capture trigger signal of sub capture register ED1: Capture event signal input from edge selector MUXCNT: Count value to sub-channel m MUXTB0, MUXTB1: Multiplex signal of TM20, TM21 TB0: Count value of TM20 TB1: Count value of TM21 3. m = 1 to 4, x = 12, 34 y: When x = 12, y = 1, 2, and when x = 34, y = 3, 4
User's Manual U15195EJ3V0UD
347
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-74. Compare Operation: Buffer-Less Mode (When CMSEx0 Register's CCSEy Bit = 1, LNKEy Bit = Arbitrary, BFEEy Bit = 0)
fCLK MUXTB0 MUXTB1 MUXCNT TB0Ey bitNote 1 TB1Ey bitNote 1 WRITE_ENABLE_S RELOAD_PRIMARY CVSEm0 register CVPEm0 register RELOAD1 INTCCm
Note 3 Note 3 Note 3 Note 3 Note 2
6 2 7 3 5 1 TB1 TB0 TB1 TB0 TB1 TB0
7 9 8 10 9 11 TB0 TB1 TB0 TB1 TB0 TB1
6 8 7 9 8 10 TB1 TB0 TB1 TB0 TB1 TB0
2 2
9 9
8 8
Notes 1. 2. 3.
TB1Ey, TB0Ey bits of CMSEx0 register No interrupt is generated due to a compare match with counter differing from that set by the TB1Ey and TB0Ey bits. INTCC2m is generated to match the cycle from the rising edge to the falling edge of MUXTB0.
Remarks 1. fCLK: Base clock 2. MUXCNT: Count value to sub-channel m MUXTB0, MUXTB1: Multiplex signal of TM20, TM21 RELOAD1: Compare match signal RELOAD_PRIMARY: Timing of write operation from CVSEm0 register to CVPEm0 register WRITE_ENABLE_S: Timing of CVSEm0 register write operation TB0: Count value of TM20 TB1: Count value of TM21 3. m = 1 to 4, x = 12, 34
348
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-75. Compare Operation: Mode with Buffer (When Operation Is Delayed Through Setting of LNKEy Bit of CMSEx0 Register, CMSEx0 Register's CCSEy Bit = 1, BFEEy Bit = 1)
fCLK MUXTB0 MUXTB1 MUXCNT LNKEy bitNote WRITE_ENABLE_S RELOAD2A RELOAD1 RELOAD_PRIMARY CVSEm0 register CVPEm0 register INTCC2m (output) 4 4 7 7 1 1 6 2 7 3 8 4 9 5 10 6 11 7 12 0 13 1 14 2 5 1 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0 TB1 TB0
Note LNKEy bit of CMSEx0 register Remarks 1. fCLK: Base clock 2. MUXCNT: Count value to sub-channel m MUXTB0, MUXTB1: Multiplex signal of TM20, TM21 RELOAD1: Compare match signal RELOAD2A: Zero count signal input of TM20 (occurs when TM20 = 0000H) RELOAD_PRIMARY: Timing of write operation from CVSEm0 register to CVPEm0 register WRITE_ENABLE_S: Timing of CVSEm0 register write operation TB0: Count value of TM20 (in this figure, the maximum count value is 7) TB1: Count value of TM21 3. m = 1 to 4, x = 12, 34 y: When x = 12, y = 1, 2, and when x = 34, y = 3, 4
User's Manual U15195EJ3V0UD
349
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4) Operation of capture/compare register (sub-channels 0, 5) Figures 9-76 and 9-77 show the operation of the capture/compare register (sub-channels 0, 5). Figure 9-76. Capture Operation: Timer 2 Count Value Read Timing (When CMSE050 Register's CCSEy Bit = 0, EEVEy Bit = 1, and CSCE0 Register's SEVEy Bit = 0)
fCLK CNT LNKEyNote 1 ED1
Note 2
0
1
2
3
4
5
6
7
8
9
10
ED2 CAPTURE_S READ_ENABLE_S CVSEy0 register Undefined 2 6 9
Note 2
Notes 1. 2.
LNKEy bit of CMSE050 register If an event occurs at this timing, it is ignored.
Remarks 1. fCLK: Base clock 2. CNT: Count value of timer 2 CAPTURE_S: Capture trigger signal of sub capture register ED1, ED2: Capture event signal inputs from edge selector READ_ENABLE_S: Read timing for CVSEy0 register 3. y = 0, 5
350
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-77. Compare Operation: Timing of Compare Match and Write Operation to Register (When CMSE050 Register's CCSEy Bit = 1, EEVEy Bit = Arbitrary, and CSCE0 Register's SEVEy Bit = Arbitrary)
fCLK CNT CPU write C/C CVSEy0 register MATCH RNote 1
Note 2 Note 2 Note 2
0
1
2
3
4
5
6
7
8
9
10
2
4
8
INTCC20, INTCC25 (output)
Note 3 Note 3 Note 3
Notes 1. 2. 3.
Can control TM20/TM21 clear by sub-channel 0/5 compare match and count direction When the MATCH signal occurs, the same waveform as the MATCH signal is generated. The pulse width is always 1 clock.
Remarks 1. fCLK: Base clock 2. CNT: Count value of timer 2 MATCH: CVSEy0 register compare match timing R: Compare match input (sub-channel 0/5)
User's Manual U15195EJ3V0UD
351
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(5) Operation of output circuit Figures 9-78 to 9-81 show the output circuit operation. Figure 9-78. Signal Output Operation: Toggle Mode 0 and Toggle Mode 1 (When OCTLE0 Register's SWFEn Bit = 0, and ODELE0 Register's ODLEn2 to ODLEn0 Bits = 0)
fCLK OTMEn1, OTMEn0 bitsNote 1 S/T RA RB RN TO2n timer output (ALVEn bit = 0Note 2) TO2n timer output (ALVEn bit = 1Note 2) 00B 01B
Notes 1. 2.
OTMEn1, OTMEn0 bits of OCTLE0 register ALVEn bit of OCTLE0 register
Remarks 1. fCLK: Base clock 2. RA: Zero count signal input of TM20 (output circuit reset signal) RB: Zero count signal input of TM21 (output circuit reset signal) RN: Interrupt signal input of sub-channel n (output circuit reset signal) S/T: Interrupt signal input of sub-channel n (output circuit set signal) 3. n = 1 to 4
352
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-79. Signal Output Operation: Toggle Mode 2 and Toggle Mode 3 (When OCTLE0 Register's SWFEn Bit = 0, and ODELE0 Register's ODLEn2 to ODLEn0 Bits = 0)
fCLK OTMEn1, OTMEn0 bitsNote 1 S/T RA RB RN TO2n timer output (ALVEn bit = 0Note 2) TO2n timer output (ALVEn bit = 1Note 2) 10B 11B
Notes 1. 2.
OTMEn1, OTMEn0 bits of OCTLE0 register ALVEn bit of OCTLE0 register
Remarks 1. fCLK: Base clock 2. RA: Zero count signal input of TM20 (output circuit reset signal) RB: Zero count signal input of TM21 (output circuit reset signal) RN: Interrupt signal input of sub-channel n (output circuit reset signal) S/T: Interrupt signal input of sub-channel n (output circuit set signal) 3. n = 1 to 4
Figure 9-80. Signal Output Operation: During Software Control (When OCTLE0 Register's OTMEn1, OTMEn0 Bits = Arbitrary, SWFEn Bit = 1, and ODELE0 Register's ODLEn2 to ODLEn0 Bits = 0)
fCLK ALVEn bitNote TO2n timer output
Note ALVEn bit of OCTLE0 register Remarks 1. fCLK: Base clock 2. n = 1 to 4
User's Manual U15195EJ3V0UD
353
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-81. Signal Output Operation: During Delay Output Operation (When OCTLE0 Register's OTMEn1, OTMEn0 Bits = 0, ALVEn = 0, SWFEn Bit = 0)
fCLK ODELEn2 to ODELEn0 bitsNote S/T TO2n timer output 5 2
Note ODELEn2 to ODELEn0 bits of OCTLE0 register Remarks 1. fCLK: Base clock 2. n = 1 to 4
354
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.4 Timer 3
9.4.1 Features (timer 3) Timer 3 (TM3) is a 16-bit timer/counter that can perform the following operations. * Interval timer function * PWM output * External signal cycle measurement * TO3 output buffer set to off by INTP4 input 9.4.2 Function overview (timer 3)
* * * *
16-bit timer/counter (TM3): 1 channel Capture/compare registers: 2 Count clock division selectable by prescaler (set the frequency of the count clock to 16 MHz or less) Base clock (fCLK): 2 types (set fCLK to 32 MHz or less) fXX and fXX/2 can be selected
* Prescaler division ratio
The following division ratios can be selected according to the base clock (fCLK).
Division Ratio Base Clock (fCLK) fXX Selected 1/2 1/4 1/8 1/16 1/32 1/64 1/128 1/256 fXX/2 fXX/4 fXX/8 fXX/16 fXX/32 fXX/64 fXX/128 fXX/256 fXX/2 Selected fXX/4 fXX/8 fXX/16 fXX/32 fXX/64 fXX/128 fXX/256 fXX/512
* Interrupt request sources
* Capture/compare match interrupt requests: 2 sources In case of capture register: INTCC3n generated by INTP3n input In case of compare register: INTCC3n generated by CC3n match signal * Overflow interrupt request: 1 source INTTM3 generated upon overflow of TM3 register
* Timer/counter count clock sources: 2 types
(Selection of external pulse input, internal system clock cycle)
* One of two operation modes when the timer/counter overflows can be selected: free-running mode or overflow
stop mode
* The timer/counter can be cleared by match of timer/counter and compare register * External pulse output (TO3): 1 * TO3 output buffer set to off by INTP4 input (high-impedance state)
Remarks 1. fXX: Internal system clock 2. n = 0, 1
User's Manual U15195EJ3V0UD
355
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.4.3 Function added to V850E/IA1 Timer 3 (TM3) of the V850E/IA2 has an added function to control TO3 output by using the INTP4 pin. This additional function can be used to forcibly stop TO3 output, if any abnormality is detected, by inputting a signal to the INTP4 pin. This TO3 output stop function can also be used even when the clock supply is stopped. 9.4.4 Basic configuration Table 9-13. Timer 3 Configuration List
Timer Count Clock Note 1 Timer 3 fXX/2, fXX/4, fXX/8, fXX/16, fXX/32, fXX/64, fXX/128, fXX/256 Note 2 fXX/4, fXX/8, fXX/16, fXX/32, fXX/64, fXX/128, fXX/256, fXX/512 TM3 CC30 CC31 Read Read/write Read/write Register Read/Write Generated Interrupt Signal INTTM3 INTCC30 INTC31 Capture Trigger - INTP30 INTP31 Timer Output S/R - TO3 (S) TO3 (R)
Notes 1. 2. Remark
When fXX is selected as the base clock (fCLK) of TM3 When fXX/2 is selected as the base clock (fCLK) of TM3 fXX: Internal system clock S/R: Set/Reset
Figure 9-82 shows the block diagram of timer 3. Figure 9-82. Block Diagram of Timer 3
Selector
fXX
fCLK
fXX/2
1/2 1/4 1/8 1/16 1/32 1/64 1/128 1/256
Clear & start
Selector
TM3 (16-bit)
INTTM3
Clear & start TI3/TCLR3/INTP30 INTP31 CC30 CC31 S R
Note
Q Q
Selector
TO3
INTCC30 INTCC31 INTP4 Noise elimination Edge detection Timer 3 output control register (TO3C)
Note Reset priority Remarks 1. TI3 input and TCLR3 input connected to port immediately before edge detection 2. fCLK: Base clock (32 MHz (MAX.)) fXX: Internal system clock
356
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(1) Timer 3 (TM3) TM3 functions as a 16-bit free-running timer or as an event counter for an external signal. Besides being mainly used for cycle measurement, TM3 can be used as pulse output. TM3 is read-only in 16-bit units. Cautions 1. The TM3 register can only be read. If writing is performed to the TM3 register, the subsequent operation is undefined. 2. If the TM3CAE bit of the TMC30 register is cleared (0), a reset is performed asynchronously. 3. Continuous reading of TM3 is prohibited. If TM3 is continuously read, the second read value may differ from the actual value.
15 TM3
14
13
12
11 10
9
8
7
6
5
4
3
2
1
0
Address FFFFF680H
After reset 0000H
TM3 performs the count-up operations of an internal count clock or external count clock. Timer starting and stopping are controlled by the TM3CE bit of timer control register 30 (TMC30). The internal or external count clock is selected by the ETI bit of timer control register 31 (TMC31). (a) Selection of the external count clock TM3 operates as an event counter. When the ETI bit of timer control register 31 (TMC31) is set (1), TM3 counts the valid edges of the external clock input (TI3), synchronized with the internal count clock. The valid edge is specified by valid edge selection register (SESC). Caution When using the INTP30, TI3, and TCLR3 pins as TI3 andTCLR3, either mask the interrupt signal to INTP30 or set CC3n in compare mode (n = 0 or 1). (b) Selection of the internal count clock TM3 operates as a free-running timer. When an internal clock is specified as a count clock by timer control register 31 (TMC31), TM3 is counted up for each input clock cycle specified by the CS2 to CS0 bits of the TMC30 register. Division by the prescaler can be selected for the count clock from among fCLK/2, fCLK/4, fCLK/8, fCLK/16, fCLK/32, fCLK/64, fCLK/128 and fCLK/256 by the TMC30 register (fCLK: base clock). An overflow interrupt can be generated if the timer overflows. Also, the timer can be stopped following an overflow by setting the OST bit of the TMC31 register to 1. Caution The count clock cannot be changed while the timer is operating.
The conditions when the TM3 register becomes 0000H are shown below. (i) Asynchronous reset * TM3CAE bit of TMC30 register = 0 * Reset input (ii) Synchronous reset * TM3CE bit of TMC30 register = 0 * The CC30 register is used as a compare register, and the TM3 and CC30 registers match when clearing the TM3 register is enabled (CCLR bit of the TMC31 register = 1)
User's Manual U15195EJ3V0UD
357
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Capture/compare registers 30 and 31 (CC30 and CC31) These capture/compare registers 30 and 31 are 16-bit registers. They can be used as capture registers or compare registers according to the CMS1 and CMS0 bit specifications of timer control register 31 (TMC31). These registers can be read/written in 16-bit units (however, write operations can only be performed in compare mode). Caution Continuous reading of CC3n is prohibited. If CC3n is continuously read, the second read value may differ from the actual value. If CC3n must be read twice, be sure to read another register between the first and the second read operation. Correct usage example CC30 read CC31 read CC30 read CC31 read Incorrect usage example CC30 read CC30 read CC31 read CC31 read
15 CC30 15 CC31
14
13
12
11 10
9
8
7
6
5
4
3
2
1
0
Address FFFFF682H
After reset 0000H After reset 0000H
14
13
12
11 10
9
8
7
6
5
4
3
2
1
0
Address FFFFF684H
(a) Setting these registers to capture registers (CMS1 and CMS0 of TMC31 = 0) When these registers are set to capture registers, the valid edges of the corresponding external interrupt signals INTP30 and INTP31 are detected as capture triggers. The timer TM3 is synchronized with the capture trigger, and the value of TM3 is latched in the CC30 and CC31 registers (capture operation). The valid edge of the INTP30 pin is specified (rising, falling, or both edges) according to the IES301 and IES300 bits of the SESC register, and the valid edge of the INTP31 pin is specified according to the IES311 and IES310 bits of the SESC register. The capture operation is performed asynchronously to the count clock. The latched value is held in the capture register until the next capture operation is performed. When the TM3CAE bit of timer control register 30 (TMC30) is 0, 0000H is read. If these registers are specified as capture registers, an interrupt is generated by detecting the valid edge of the INTP30 and INTP31 signals. Caution If the capture operation and the TM3 register count prohibit setting (TM3CE bit of TMC30 register = 0) timings conflict, the captured data becomes undefined, and no INTCC3n interrupt is generated (n = 0, 1).
358
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(b) Setting these registers to compare registers (CMS1 and CMS0 of TMC31 = 1) When these registers are set to compare registers, the TM3 and register values are compared for each count clock, and an interrupt is generated by a match. If the CCLR bit of timer control register 31 (TMC31) is set (1), the TM3 value is cleared (0) at the same time as a match with the CC30 register (it is not cleared (0) by a match with the CC31 register). A compare register is equipped with a set/reset output function. The corresponding timer output (TO3) is set or reset, synchronized with the generation of a match signal. The interrupt selection source differs according to the function of the selected register. Cautions 1. To write to capture/compare registers 30 and 31 (CC30, CC31), always set the TM3CAE bit to 1 first. When the TM3CAE bit is 0, even if writing to registers CC30 and CC31, the data that is written will be invalid because the reset is asynchronous. 2. Perform a write operation to capture/compare registers 30 and 31 after setting them to compare registers according to the TMC30 or TMC31 register setting. If they are set to capture registers (CMS1 and CMS0 bits of TMC31 register = 0), no data is written even if a write operation is performed to CC30 and CC31. 3. When these registers are set to compare registers, INTP30 and INTP31 cannot be used as external interrupt input pins.
User's Manual U15195EJ3V0UD
359
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.4.5 Control registers (1) Timer 3 clock selection register (PRM03) The PRM03 register is used to select the base clock (fCLK) of timer 3 (TM3). This register can be read/written in 8-bit or 1-bit units. Cautions 1. Always set this register before using the timer. 2. Set fCLK to 32 MHz or less.
7 PRM03 0
6 0
5 0
4 0
3 0
2 0
1 0
0 PRM3
Address FFFFF690H
After reset 00H
Bit position 0
Bit name PRM3
Function Specifies the base clock (fCLK) of timer 3 (TM3). 0: fXX/2 (when fXX > 32 MHz) 1: fXX (when fXX 32 MHz)
Remark
fXX: Internal system clock
360
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Timer control register 30 (TMC30) The TMC30 register controls the operation of TM3. This register can be read/written in 8-bit or 1-bit units. Cautions 1. The TM3CAE bit and other bits cannot be set at the same time. Be sure to set the TM3CAE bit and then set the other bits and the other registers of TM3. When using an external pin related to the timer function when using timer 3, be sure to set (1) the CAE bit after setting the external pin to the control mode. 2. If occurrence of an overflow contends with writing to the TMC30 register, the value of the TM3OVF bit is the value written to the TMC30 register. (1/2)
<7> TMC30 TM3OVF 6 CS2 5 CS1 4 CS0 3 0 2 0 <1> TM3CE <0> TM3CAE Address FFFFF686H After reset 00H
Bit position 7
Bit name TM3OVF
Function Flag that indicates TM3 overflow. 0: No overflow 1: Overflow The TM3OVF bit becomes 1 when TM3 changes from FFFFH to 0000H. An overflow interrupt request (INTTM3) is generated at the same time. However, if CC30 is set to the compare mode (CMS0 bit of the TMC31 register = 1) and match clear during comparison of TM3 and CC30 is enabled (CCLR bit of TMC31 register = 1), and TM3 is cleared to 0000H following match at FFFFH, TM3 is considered to have been cleared and the TM3OVF bit does not become 1, nor is the INTTM3 interrupt generated. The TM3OVF bit holds a "1" until 0 is written to it or an asynchronous reset is applied while the TM3CAE bit = 0. Interrupts by overflow and the TM3OVF bit are independent, and even if the TM3OVF bit is manipulated, this does not affect the interrupt request flag for INTTM3 (TM3IF0). If an overflow occurs while the TM3OVF bit is being read, the value of the flag changes and the value is returned at the next read.
User's Manual U15195EJ3V0UD
361
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2/2)
Bit position 6 to 4 Bit name CS2 to CS0 Function Selects the internal count clock for TM3.
CS2 0 0 0 0 1 1 1 1 Caution
CS1 0 0 1 1 0 0 1 1
CS0 0 1 0 1 0 1 0 1 fCLK/2 fCLK/4 fCLK/8 fCLK/16 fCLK/32 fCLK/64 fCLK/128 fCLK/256
Count clock
Do not change the CS2 to CS0 bits during timer operation. If they are to be changed, they must be changed after setting the TM3CE bit to 0. If the CS2 to CS0 bits are overwritten during timer operation, the operation is not guaranteed.
Remark fCLK: Base clock 1 TM3CE Controls the operation of TM3. 0: Count disabled (timer stopped at 0000H and does not operate) 1: Count operation performed. Caution If TM3CE = 0, the external pulse output (TO3) becomes inactive level (The active level of TO3 output is set with the ALV bit of the TMC31 register).
0
TM3CAE
Controls the internal count clock. 0: Entire TM3 unit asynchronously reset. Stop base clock supply to TM3 unit. 1: Base clock (fCLK) supplied to TM3 unit. Cautions 1. When TM3CAE = 0 is set, the TM3 unit can be reset asynchronously. 2. When TM3CAE = 0, the TM3 unit is in a reset state. To operate TM3, first set TM3CAE = 1. 3. When the TM3CAE bit is changed from 1 to 0, all the registers of the TM3 unit are initialized. When again setting TM3CAE = 1, be sure to then again set all the registers of the TM3 unit.
362
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3) Timer control register 31 (TMC31) The TMC31 register controls the operation of TM3. This register can be read/written in 8-bit or 1-bit units. Cautions 1. Do not change the bits of the TMC31 register during timer operation. If they are to be changed, they must be changed after setting the TM3CE bit of the TMC30 register to 0. If the TMC31 register is overwritten during timer operation, the operation is not guaranteed. 2. If the ENT1 bit and the ALV bit are changed simultaneously, a glitch (spike-shaped noise) may be generated in the TO3 pin output. Either design a circuit that will not malfunction even if a glitch is generated, or make sure that the ENT1 bit and the ALV bit do not change at the same time. 3. TO3 output remains unchanged by external interrupt signals (INTP30, INTP31). When using the TO3 signal, set the capture/compare register to the compare register (CMS1, CMS0 bits of TMC31 register = 1). Remarks 1. A reset takes precedence for the flip-flop of the TO3 output. 2. When the A/D converter is set to the timer trigger mode, the match interrupt of the compare register becomes a start trigger for A/D conversion, and conversion begins. At this time, the compare register match interrupt also functions as a compare register match interrupt for the CPU. To prevent the generation of a compare register match interrupt for the CPU, disable interrupts with the interrupt mask bits (CC3MK0, CC3MK1) of the interrupt control registers (CC3IC0, CC3IC1).
User's Manual U15195EJ3V0UD
363
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
7 TMC31 OST
6 ENT1
5 ALV
4 ETI
3 CCLR
2 ECLR
1 CMS1
0 CMS0
Address FFFFF688H
After reset 20H
Bit position 7
Bit name OST
Function Sets the operation when TM3 overflows. 0: Count operation continues after overflow (free-running mode) 1: After overflow, timer holds 0000H and stops count operation (overflow stop mode). At this time, the TM3CE bit of TMC30 remains 1. The count operation is resumed by again writing 1 to the TM3CE bit.
6
ENT1
Enables/disables output of external pulse output (TO3). 0: Disable external pulse output. Output of inactive level of ALV bit to TO3 pin is fixed. TO3 pin level remains unchanged even if match signal from corresponding compare register is generated. 1: Enable external pulse output. Compare register match causes TO3 output to change. However, in capture mode, TO3 output does not change. An ALV bit inactive level is output from when timer output is enabled until a match signal is generated. Caution If either CC30 or CC31 is specified as a capture register, the ENT1 bit must be set to 0.
5
ALV
Specifies active level of external pulse output (TO3). 0: Active level is low level. 1: Active level is high level. Caution The initial value of the ALV bit is "1".
4
ETI
Switches count clock between external clock and internal clock. 0: Specifies input clock (internal). The count clock can be selected with bits CS2 to CS0 of TMC30. 1: Specifies external clock (TI3). Valid edge can be selected with bits TES31, TES30 of SESC. Enables/disables TM3 clearing during compare operation. 0: Clearing disabled. 1: Clearing enabled (TM3 is cleared when CC30 and TM3 match during compare operation). Enables TM3 clearing by external clear input (TCLR3). 0: Clearing by TCLR3 disabled. 1: Clearing by TCLR3 enabled (counting resumes after clearing). Selects operation mode of capture/compare register (CC31). 0: Register operates as capture register. 1: Register operates as compare register. Selects operation mode of capture/compare register (CC30). 0: Register operates as capture register. 1: Register operates as compare register.
3
CCLR
2
ECLR
1
CMS1
0
CMS0
364
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4) Valid edge selection register (SESC) This register specifies the valid edge of external interrupt requests (TI3, TCLR3, INTP30, INTP31) from an external pin. The rising edge, the falling edge, or both rising and falling edges can be specified as the valid edge independently for each pin. This register can be read/written in 8-bit or 1-bit units. Caution Do not change the bits of the SESC register during timer operation. If they are to be
changed, they must be changed after setting the TM3CE bit of the TMC30 register to 0. If the SESC register is overwritten during timer operation, the operation is not guaranteed.
7 SESC TES31 TI3
6 TES30
5 CES31
4 CES30
3 IES311
2 IES310
1 IES301
0 IES300
Address FFFFF689H
After reset 00H
TCLR3
INTP31
INTP30
Bit position 7, 6
Bit name TES31, TES30
Function Specifies the valid edge of INTP30, INTP31 pins, TCLR3, and TI3 pins.
5, 4
CES31, CES30
xESn1 0
xESn0 0 1 0 1 Falling edge Rising edge Setting prohibited
Operation
3, 2
IES311, IES310
0 1
1, 0
IES301, IES300
1
Both rising and falling edges
Remark
n = 3, 30, 31
User's Manual U15195EJ3V0UD
365
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(5) Timer 3 output control register (TO3C) TO3C is a register that controls output of the TO3 pin. This register can be read/written in 8-bit or 1-bit units. Caution The TO3 output stop status can be canceled by writing 0 to the TO3SP bit of this register.
7 TO3C 0
6 0
5 0
4 0
3 0
2 0
1 0
<0> TO3SP
Address FFFFF6A0H
After reset 00H
Bit position 0
Bit name TO3SP
Function Validates or invalidates output stop control of the TO3 pin by INTP4 pin input. 0: Invalidates INTP4 pin input (TO3 output (the output buffer of the TO3 pin is on)). 1: Validates INTP4 pin input (TO3 output is stopped by the valid edge of the INTP4 pin (the output buffer of the TO3 pin is off and the TO3 pin goes into a high-impedance state)).
The following table indicates the relationship between the setting of each register and the status of the TO3, P27, and INTP31 pins. Table 9-14. Relationship Between Setting of Each Register and Status of TO3, P27, and INTP31 Pins
PMC27 Bit 0 0 1 1 1 PFC27 Bit x x 0 1 1 PM27 Bit 0 1 x x x TO3SP Bit x x x 0 1 TO3/P27/INTP31 Operation Mode of Pin Output port mode Input port mode INTP31 input mode TO3 output mode Output Buffer Status On Off Off On On/off
Note
Pin Function Output port Input port INTP31 TO3 TO3/Hi-ZNote
Note If the TO3SP bit is set to 1 in TO3 output mode (PMC27 bit = 1 and PFC27 bit = 1), the output buffer of the TO3 pin is turned off and the TO3 pin goes into a high-impedance state if the specified valid interrupt edge is generated on the INTP4 pin. To avoid turning off the output drive by valid edge input to the INTP4 pin, be sure to clear the TO3SP bit to 0. The valid edge of the INTP4 pin is specified by bit 0 (ES40) and bit 1 (ES41) of the INTM2 register. Specifying the valid edge of the INTP4 pin (changing the ES40 and ES41 bits) is prohibited while timer 3 is operating. Remark x: Don't care (does not have to be set)
366
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.4.6 Operation (1) Count operation Timer 3 can function as a 16-bit free-running timer or as an external signal event counter. The setting for the type of operation is specified by timer control register 3n (TMC3n) (n = 0, 1). When it operates as a free-running timer, if the CC30 or CC31 register and the TM3 count value match, an interrupt signal is generated and the timer output signal (TO3) can be set or reset. Also, a capture operation that holds the TM3 count value in the CC30 or CC31 register is performed, synchronized with the valid edge that was detected from the external interrupt request input pin as an external trigger. The capture value is held until the next capture trigger is generated. Caution When using the INTP30, TI3, and TCLR3 pins as TI3 and TCLR3, either mask the interrupt signal to INTP30 or set the CC3n register to compare mode (n = 0 or 1). Figure 9-83. Basic Operation of Timer 3
Count clock
TM3
0000H 0001H 0002H 0003H Count start TM3CE 1
FBFEH FBFFH
0000H
0001H 0002H
Count disabled TM3CE 0
Count start TM3CE 1
User's Manual U15195EJ3V0UD
367
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Overflow When the TM3 register has counted the count clock from FFFFH to 0000H, the TM3OVF bit of the TMC30 register is set (1), and an overflow interrupt (INTTM3) is generated at the same time. However, if the CC30 register is set to compare mode (CMS0 bit = 1) and to the value FFFFH when match clearing is enabled (CCLR bit = 1), then the TM3 register is considered to be cleared and the TM3OVF bit is not set (1) when the TM3 register changes from FFFFH to 0000H. Also, the overflow interrupt (INTTM3) is not generated . When the TM3 register is changed from FFFFH to 0000H because the TM3CE bit changes from 1 to 0, the TM3 register is considered to be cleared, but the TM3OVF bit is not set (1) and no INTTM3 interrupt is generated. Also, timer operation can be stopped after an overflow by setting the OST bit of the TMC31 register to 1. When the timer is stopped due to an overflow, the count operation is not restarted until the TM3CE bit of the TMC30 register is set (1). Operation is not affected even if the TM3CE bit is set (1) during a count operation. Figure 9-84. Operation After Overflow (When OST = 1)
Overflow FFFFH
Overflow FFFFH
Count start TM3 0
OST 1 INTTM3
TM3CE 1
TM3CE 1
368
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3) Capture operation The TM3 register has two capture/compare registers. These are the CC30 register and the CC31 register. A capture operation or a compare operation is performed according to the settings of both the CMS1 and CMS0 bits of the TMC31 register. If the CMS1 and CMS0 bits of the TMC31 register are set to 0, the register operates as a capture register. A capture operation that captures and holds the TM3 count value asynchronously relative to the count clock is performed synchronized with an external trigger. The valid edge that is detected from an external interrupt request input pin (INTP30 or INTP31) is used as an external trigger (capture trigger). The TM3 count value during counting is captured and held in the capture register, synchronized with that capture trigger signal. The capture register value is held until the next capture trigger is generated. Also, an interrupt request (INTCC30 or INTCC31) is generated by INTP30 or INTP31 signal input. The valid edge of the capture trigger is set by valid edge selection register (SESC). If both the rising and falling edges are set as capture triggers, the input pulse width from an external source can be measured. Also, if only one of the edges is set as the capture trigger, the input pulse cycle can be measured. Figure 9-85. Capture Operation Example
n TM3 0
TM3CE
CC31 (Capture register)
n
INTP31 (Capture trigger) (Capture trigger)
Remarks 1. When the TM3CE bit is 0, no capture operation is performed even if INTP31 is input. 2. Valid edge of INTP31: Rising edge
User's Manual U15195EJ3V0UD
369
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-86. TM3 Capture Operation Example (When Both Edges Are Specified)
(TM3 count values)
D1
D0 TM3 Count start TM3CE 1 Overflow TM3OVF 1
D2
Interrupt request (INTP31)
Capture register (CC31)
D0
D1
D2
Remark
D0 to D2: TM3 count values
370
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(4) Compare operation The TM3 register has two capture/compare registers. These are the CC30 register and the CC31 register. A capture operation or a compare operation is performed according to the settings of both the CMS1 and CMS0 bits of the TMC31 register. If 1 is set in the CMS1 and CMS0 bits of the TMC31 register, the register operates as a compare register. A compare operation that compares the value that was set in the compare register and the TM3 count value is performed. If the TM3 count value matches the value of the compare register, which had been set in advance, a match signal is sent to the output controller. The match signal causes the timer output pin (TO3) to change and an interrupt request signal (INTCC30, INTCC31) to be generated at the same time. If the CC30 or CC31 register is set to 0000H, "0000H" after the TM3 register counts up from FFFFH to 0000H is judged as a match. In this case, the value of the TM3 register is cleared to 0 at the next count timing, but 0000H is not judged as a match at that time. 0000H when the TM3 register begins counting is not judged as a match either. If match clearing is enabled (CCLR bit = 1) for the CC30 register, the TM3 register is cleared when a match with the TM3 register occurs during a compare operation. Figure 9-87. Compare Operation Example (1/2)
(a) If CCLR bit = 1 and CC30 register is value other than 0000H
Count up
TM3
n-1
n
0000H
0001H
Compare register (CC30)
n
Match detection (INTCC30)
Remarks 1. The match is detected immediately after the count up, and the match detection signal is generated. 2. n 0000H
User's Manual U15195EJ3V0UD
371
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-87. Compare Operation Example (2/2)
(b) If CCLR bit = 1 and CC30 register is 0000H
Count up
TM3
FFFFH
0000H
0000H
0001H
Compare register (CC30)
0000H
INTTM3
Match detection (INTCC30)
Remark
The match is detected immediately after the count up, and the match detection signal is generated.
372
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(5) External pulse output Timer 3 has one timer output pin (TO3). An external pulse output (TO3) is generated when a match of the two compare registers (CC30 and CC31) and the TM3 register is detected. If a match is detected when the TM3 count value and the CC30 value are compared, the output level of the TO3 pin is set. Also, if a match is detected when the TM3 count value and the CC31 value are compared, the output level of the TO3 pin is reset. The output level of the TO3 pin can be specified by the TMC31 register. Table 9-15. TO3 Output Control
ENT1 ALV External Pulse Output 0 0 1 0 1 0 Disable Disable Enable High level Low level When the CC30 register is matched: Low level When the CC31 register is matched: High level When the CC30 register is matched: High level When the CC31 register is matched: Low level TO3 Output Output Level
1
1
Enable
Figure 9-88. TM3 Compare Operation Example (Set/Reset Output Mode)
FFFFH CC31 CC31
FFFFH
CC30 TM3 count value 0 Count start TM3CE 1
CC30
CC30
Overflow TM3OVF 1
Overflow TM3OVF 1
Interrupt request (INTCC30)
Interrupt request (INTCC31)
TO3 pin ENT1 1 ALV 1
User's Manual U15195EJ3V0UD
373
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(6) TO3 output control function by INTP4 pin Output of the TO3 pin can be forcibly stopped by inputting a signal to the INTP4 pin if an abnormality is detected in the power system of a motor. If the TO3 output mode is set (PMC27 = 1 and PFC27 = 1) and if the specified valid edge is generated on the INTP4 pin after the TO3SP bit of the timer 3 output control register (TO3C) has been set to 1, the output buffer of the TO3 pin can be turned off (the TO3 pin goes into a high-impedance state). To resume output of the TO3 pin (output buffer = on) after output of the TO3 pin has been stopped (output buffer = off) by the valid edge of the INTP4 pin, rewrite the TO3SP bit from "1" to "0". The valid edge of the INTP4 pin can be specified by the ES40 and ES41 bits of the external interrupt mode register 2 (INTM2). Figure 9-89. Example of Operation of TO3 Output Control Function by INTP4 Pin (in TO3 Output Mode (PMC27 Bit = 1 and PFC27 Bit = 1))
TO3C register
0000H
0001H
0000H
INTP4 (When rising edge is specified) Edge detection Note Note
TO3 pin
Output buffer = on (output data) Output buffer = off (high impedance)
Output buffer = on (output data)
Note Analog delay
374
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.4.7 Application examples (1) Interval timer By setting the TMC30 and TMC31 registers as shown in Figure 9-90, timer 3 operates as an interval timer that repeatedly generates interrupt requests with the value that was set in advance in the CC30 register as the interval. When the counter value of the TM3 register matches the setting value of the CC30 register, the TM3 register is cleared (0000H) and an interrupt request signal (INTCC30) is generated at the same time that the count operation resumes. Figure 9-90. Contents of Register Settings When Timer 3 Is Used as Interval Timer
TM3OVF CS2 TMC30 0/1 0/1
CS1 0/1
CS0 0/1 0 0
TM3CE TM3CAE 1 1 Supply input clocks to internal units Enable count operation
OST TMC31 0
ENT 0/1
ALV 0/1
ETI 0/1
CCLR ECLR CMS1 CMS0 1 0/1 0/1 1
Use CC30 register as compare register Clear TM3 register due to match with CC30 register Continue counting after TM3 register overflows
Remark
0/1: Set to 0 or 1 as necessary
User's Manual U15195EJ3V0UD
375
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-91. Interval Timer Operation Timing Example
t Count clock
TM3 register
0000H 0001H Count start
p
0000H 0001H Clear p
p
0000H 0001H
p
Clear p p
CC30 register INTCC30 interrupt
p
Interval time
Interval time
Interval time
Remark
p: Setting value of CC30 register (0000H to FFFFH) t: Count clock cycle Interval time = (p + 1) x t
376
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) PWM output By setting the TMC30 and TMC31 registers as shown in Figure 9-92, timer 3 can output a PWM of the frequency determined by the setting of the CS2 to CS0 bits of the TMC30 register with the values that were set in advance in the CC30 and CC31 registers as the intervals. When the counter value of the TM3 register matches the setting value of the CC30 register, the TO3 output becomes active. Then, when the counter value of the TM3 register matches the setting value of the CC31 register, the TO3 output becomes inactive. The TM3 register continues counting, and when an overflow occurs, clears the count value to 0000H and continues counting. This enables a PWM of the frequency determined by the setting of the CS2 to CS0 bits of the TMC30 register to be output. When the setting value of the CC30 register and the setting value of the CC31 register are the same, the TO3 output remains inactive and does not change. The active level of TO3 output can be set by the ALV bit of the TMC31 register.
Figure 9-92. Contents of Register Settings When Timer 3 Is Used for PWM Output
TM3OVF CS2 TMC30 0/1 0/1
CS1 0/1
CS0 0/1 0 0
TM3CE TM3CAE 1 1 Supply input clocks to internal units Enable count operation
OST ENT1 TMC31 0 1
ALV 0/1
ETI 0/1
CCLR ECLR CMS1 CMS0 0 0/1 1 1
Use CC30 register as compare register Use CC31 register as compare register Disable clearing of TM3 register due to match with CC30 register Enable external pulse output (TO3) Continue counting after TM3 register overflows
Remark
0/1: Set to 0 or 1 as necessary
User's Manual U15195EJ3V0UD
377
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-93. PWM Output Operation Timing Example
t Count clock
TM3 register
0000H 0001H Count start
p
q
FFFFH 0000H 0001H Clear
p
q
CC30 register CC31 register INTCC30 interrupt INTCC31 interrupt TO3 (output)
p
p
p
p
p
q
q
q
q
q
Remarks 1. p: Setting value of CC30 register (0000H to FFFFH) q: Setting value of CC31 register (0000H to FFFFH) pq t: Count clock cycle PWM cycle = 65536 x t Duty = q-p 65536
2. In this example, the active level of TO3 output is set to high level.
378
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(3) Cycle measurement By setting the TMC30 and TMC31 registers as shown in Figure 9-94, timer 3 can measure the cycle of signals input to the INTP30 pin or INTP31 pin. The valid edge of the INTP30 pin is selected according to the IES301 and IES300 bits of the SESC register, and the valid edge of the INTP31 pin is selected according to the IES311 and IES310 bits of the SESC register. Either the rising edge, the falling edge, or both edges can be selected as the valid edges of both pins. If the CC30 register is set to a capture register and TM3 is started, the valid edge input of the INTP30 pin is set as the trigger for capturing the TM3 register value in the CC30 register. When this value is captured, an INTCC30 interrupt is generated. Similarly, if the CC31 register is set to a capture register and TM3 is started, the valid edge input of the INTP31 pin is set as the trigger for capturing the TM3 register value in the CC31 register. When this value is captured, an INTCC31 interrupt is generated. The cycle of signals input to the INTP30 pin is calculated by obtaining the difference between the TM3 register's count value (Dx) that was captured in the CC30 register according to the x-th valid edge input of the INTP30 pin and the TM3 register's count value (D(x+1)) that was captured in the CC30 register according to the (x+1)-th valid edge input of the INTP30 pin and multiplying the value of this difference by the cycle of the clock control signal. The cycle of signals input to the INTP31 pin is calculated by obtaining the difference between the TM3 register's count value (Dx) that was captured in the CC31 register according to the x-th valid edge input of the INTP31 pin and the TM3 register's count value (D(x+1)) that was captured in the CC31 register according to the (x+1)-th valid edge input of the INTP31 pin and multiplying the value of this difference by the cycle of the clock control signal. Figure 9-94. Contents of Register Settings When Timer 3 Is Used for Cycle Measurement
TM3OVF CS2 TMC30 0/1 0/1
CS1 0/1
CS0 0/1 0 0
TM3CE TM3CAE 1 1 Supply input clocks to internal units Enable count operation
OST ENT1 TMC31 0 0/1
ALV 0/1
ETI 0/1
CCLR ECLR CMS1 CMS0 0/1 0/1 0 0 Use CC30 register as capture register (when measuring the cycle of INTP30 input) Use CC31 register as capture register (when measuring the cycle of INTP31 input) Continue counting after TM3 register overflows
Remark
0/1: Set to 0 or 1 as necessary
User's Manual U15195EJ3V0UD
379
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-95. Cycle Measurement Operation Timing Example
t Count clock TM3 register
0000H 0001H Count start
D0
D1
FFFFH 0000H 0001H Clear
D2
D3
INTP30 (input) CC30 register INTCC30 interrupt INTTM3 interrupt (D1 - D0) x t No overflow {(10000H - D1) + D2} x tNote Overflow occurs (D3 - D2) x t No overflow D0 D1 D2 D3
Note When an overflow occurs once. Remarks 1. D0 to D3: TM3 register count values t: Count clock cycle 2. In this example, the valid edge of INTP30 input has been set to both edges (rising and falling).
380
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.4.8 Cautions Various cautions concerning timer 3 are shown below. (1) If a conflict occurs between the reading of the CC30 register and a capture operation when the CC30 register is used in capture mode, an external trigger (INTP30) valid edge is detected and an external interrupt request signal (INTCC30) is generated, but the timer value is not stored in the CC30 register. (2) If a conflict occurs between the reading of the CC31 register and a capture operation when the CC31 register is used in capture mode, an external trigger (INTP31) valid edge is detected and an external interrupt request signal (INTCC31) is generated, but the timer value is not stored in the CC31 register. (3) The following bits and registers must not be rewritten during operation (TMC30 register TM3CE = 1). * CS2 to CS0 bits of TMC30 register * TMC31 register * SESC register (4) The TM3CAE bit of the TMC30 register is a TM3 reset signal. To use TM3, first set (1) the TM3CAE bit. (5) The analog noise elimination time + two cycles of the input clock are required to detect a valid edge of the external interrupt input (INTP30 or INTP31) and external clock input (TI3). Therefore, edge detection will not be performed normally for changes that are less than the analog noise elimination time + two cycles of the input clock. For the analog noise elimination, refer to 12.4 Noise Eliminator. (6) The operation of an external interrupt output (INTCC30 or INTCC31) is automatically determined according to the operating state of the capture/compare registers 30, 31 (CC30, CC31). When the capture/compare register is used for a capture mode, the external trigger (INTP30, INTP31) is used for valid edge detection. When the capture/compare register is used for a compare mode, the external interrupt output is used for a match interrupt indicating a match with the TM3 register. (7) If the ENT1 and ALV bits of the TMC31 register are changed at the same time, a glitch (spike shaped noise) may be generated in the TO3 pin output. Either create a circuit configuration that will not malfunction even if a glitch is generated or make sure that the ENT1 and ALV bits do not change at the same time.
User's Manual U15195EJ3V0UD
381
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.5 Timer 4
9.5.1 Features (timer 4) Timer 4 (TM4) functions as a 16-bit interval timer. 9.5.2 Function overview (timer 4)
* 16-bit interval timer: 1 channel * Compare register: 1 * Count clock selected from divisions of internal system clock (set the frequency of the count clock to 16 MHz or
less)
* Base clock (fCLK): 1 type (set fCLK to 32 MHz or less)
fXX/2
* Prescaler division ratio
The following division ratios can be selected according to the base clock (fCLK).
Division Ratio 1/2 1/4 1/8 1/16 1/32 1/64 1/128 1/256 Base Clock (fCLK) fXX/4 fXX/8 fXX/16 fXX/32 fXX/64 fXX/128 fXX/256 fXX/512
* Interrupt request source: 1
* Compare match interrupt INTCM4 generated by CM4 match signal
* Timer clear
The TM4 register can be cleared by a CM4 register match. Remark fXX: Internal system clock
382
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.5.3 Basic configuration Table 9-16. Timer 4 Configuration List
Timer Count Clock Register Read/Write Generated Interrupt Signal - INTCM4 Capture Trigger - - Timer Output S/R - - Other Functions - -
Timer 4
fXX/4, fXX/8, fXX/16, fXX/32, fXX/64, fXX/128, fXX/256, fXX/512
TM4 CM4
Read Read/write
Remark
fXX: Internal system clock S/R: Set/Reset
Figure 9-96 shows the block diagram of timer 4. Figure 9-96. Block Diagram of Timer 4
fCLK fXX/2
1/2 1/4 1/8 1/16 1/32 1/64 1/128 1/256
TM4 (16-bit)
Clear & start
CM4
INTCM4
Remark
fCLK: Base clock (32 MHz (MAX.)) fXX: Internal system clock
User's Manual U15195EJ3V0UD
383
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(1) Timer 4 (TM4) TM4 is a 16-bit timer. It is mainly used as an interval timer for software. Starting and stopping TM4 is controlled by the TM4CE0 bit of timer control register 4 (TMC4). Division by the prescaler can be selected for the count clock from among fXX/4, fXX/8, fXX/16, fXX/32, fXX/64, fXX/128, fXX/256, and fXX/512 by the CS2 to CS0 bits of the TMC4 register (fXX: Internal system clock). TM4 is read-only in 16-bit units.
15 TM4
14
13
12
11 10
9
8
7
6
5
4
3
2
1
0
Address FFFFF540H
After reset 0000H
The conditions under which the TM4 register becomes 0000H are shown below.
* * * * *
Reset input TM4CAE0 bit = 0 TM4CE0 bit = 0 Match of TM4 register and CM4 register Overflow Cautions 1. If the TM4CAE0 bit of the TMC4 register is cleared (0), a reset is performed asynchronously. 2. If the TM4CE0 bit of the TMC4 register is cleared (0), a reset is performed, synchronized with the internal clock. Similarly, a synchronized reset is performed after a match with the CM4 register and after an overflow. 3. The count clock must not be changed during a timer operation. If it is to be overwritten, it should be overwritten after the TM4CE0 bit is cleared (0). 4. Up to 4 clocks are required after a value is set in the TM4CE0 bit until the set value is transferred to internal units. When a count operation begins, the count cycle from 0000H to 0001H differs from subsequent count cycles. 5. After a compare match is generated, the timer is cleared at the next count clock. Therefore, if the division ratio is large, the timer value may not be zero even if the timer value is read immediately after a match interrupt is generated.
384
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
(2) Compare register 4 (CM4) CM4 and the TM4 register count value are compared, and an interrupt request signal (INTCM4) is generated when a match occurs. TM4 is cleared, synchronized with this match. If the TM4CAE0 bit of the TMC4 register is set to 0, a reset is performed asynchronously, and the registers are initialized. The CM4 register has a master/slave configuration. When a write operation to a CM4 register is performed, data is first written to the master register and then the master register data is transferred to the slave register. In a compare operation, the slave register value is compared with the count value of the TM4 register. When a read operation to the CM4 register is performed, data on the master side is read out. CM4 can be read/written in 16-bit units. Cautions 1. A write operation to the CM4 register requires 4 clocks until the value that was set in the CM4 register is transferred to internal units. When writing continuously to the CM4 register, be sure to reserve a time interval of at least 4 clocks. 2. The CM4 register can be overwritten only once in a single TM4 register cycle (from 0000H until an INTCM4 interrupt is generated due to a match of the TM4 register and CM4 register). If this cannot be secured by the application, make sure that the CM4 register is not overwritten during timer operation. 3. Note that an INTCM4 interrupt will be generated after an overflow if a value less than the counter value is written in the CM4 register during TM4 register operation (Figure 9-97).
15 CM4
14
13
12
11 10
9
8
7
6
5
4
3
2
1
0
Address FFFFF542H
After reset 0000H
User's Manual U15195EJ3V0UD
385
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-97. Example of Timing During TM4 Operation
(a) When TM4 < CM4
TM4 M TM4CAE0 TM4CE0 CM4 INTCM4 N N N
Remark
M = TM4 value when overwritten N = CM4 value after overwrite M CM4
TM4 M TM4CAE0 TM4CE0 CM4 INTCM4 N FFFFH N N
Remark
M = TM4 value when overwritten N = CM4 value after overwrite M>N
386
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.5.4 Control register (1) Timer control register 4 (TMC4) The TMC4 register controls the operation of timer 4. This register can be read/written in 8-bit or 1-bit units. Caution The TM4CAE0 bit and other bits cannot be set at the same time. TM4CAE0 bit and then set the other bits and the other registers of TM4. Be sure to set the
7 TMC4 0
6 CS2
5 CS1
4 CS0
3 0
2 0
<1>
<0>
Address FFFFF544H
After reset 00H
TM4CE0 TM4CAE0
Bit position 6 to 4
Bit name CS2 to CS0 Selects the TM4 count clock. CS2 0 0 0 0 1 1 1 1 CS1 0 0 1 1 0 0 1 1 CS0 0 1 0 1 0 1 0 1
Function
Count clock fXX/4 fXX/8 fXX/16 fXX/32 fXX/64 fXX/128 fXX/256 fXX/512
Caution Do not change the CS2 to CS0 bits during timer operation. If they are to be changed, they must be changed after setting the TM4CE0 bit to 0. If the CS2 to CS0 bits are overwritten during timer operation, the operation is not guaranteed. 1 TM4CE0 Controls the operation of TM4. 0: Count disabled (timer stopped at 0000H and does not operate) 1: Count operation performed Caution The TM4CE0 bit is not cleared even if a match is detected by the compare operation. To stop the count operation, clear the TM4CE0 bit. 0 TM4CAE0 Controls the internal count clock. 0: Entire TM4 unit asynchronously reset. Base clock (fCLK) supply to TM4 unit stopped. 1: Base clock (fCLK) supplied to TM4 unit. Cautions 1. When TM4CAE0 = 0 is set, the TM4 unit can be reset asynchronously. 2. When TM4CAE0 = 0, the TM4 unit is in a reset state. To operate TM4, first set TM4CAE0 = 1. 3. When the TM4CAE0 bit is changed from 1 to 0, all the registers of the TM4 unit are initialized. When again setting TM4CAE0 = 1, be sure to then set all the registers of the TM4 unit again.
User's Manual U15195EJ3V0UD
387
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.5.5 Operation (1) Compare operation TM4 can be used for a compare operation in which the value that was set in the compare register (CM4) is compared with the TM4 count value. If a match is detected by the compare operation, an interrupt (INTCM4) is generated. The generation of the interrupt causes TM4 to be cleared (0) at the next count timing. This function enables timer 4 to be used as an interval timer. CM4 can also be set to 0. In this case, when an overflow occurs and TM4 becomes 0, a match is detected and INTCM4 is generated. Although the TM4 value is cleared (0) at the next count timing, INTCM4 is not generated by this match. Figure 9-98. TM4 Compare Operation Example (1/2)
(a) When CM4 is set to n (non-zero)
Count clock
Count up
TM4 clear Clear TM4 n 0 1
CM4
n
Match detection (INTCM4)
Remark
Interval time = (n + 1) x Count clock cycle n = 1 to 65536 (FFFFH)
388
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
Figure 9-98. TM4 Compare Operation Example (2/2)
(b) When CM4 is set to 0
Count clock
Count up
TM4 clear Clear TM4 FFFFH 0 0 1
CM4
0
Match detection (INTCM4) Overflow
Remark
Interval time = (FFFFH + 2) x Count clock cycle
User's Manual U15195EJ3V0UD
389
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.5.6 Application example (1) Interval timer This section explains an example in which timer 4 is used as an interval timer with 16-bit precision. Interrupt requests (INTCM4) are output at equal intervals (refer to Figure 9-98 TM4 Compare Operation Example). The setting procedure is shown below. <1> Set (1) the TM4CAE0 bit. <2> Set each register. * Select the count clock using the CS2 to CS0 bits of the TMC4 register. * Set the compare value in the CM4 register. <3> Start counting by setting (1) the TM4CE0 bit. <4> If the TM4 register and CM4 register values match, the INTCM4 interrupt is generated. <5> INTCM4 interrupts are generated thereafter at equal intervals. 9.5.7 Cautions Various cautions concerning timer 4 are shown below. (1) To operate TM4, first set (1) the TM4CAE0 bit of the TMC4 register. (2) Up to 4 clocks are required after a value is set in the TM4CE0 bit of the TMC4 register until the set value is transferred to internal units. When a count operation begins, the count cycle from 0000H to 0001H differs from subsequent count cycles. (3) To initialize the TM4 register status and start counting again, clear (0) the TM4CE0 bit and then set (1) the TM4CE0 bit after an interval of 4 clocks has elapsed. (4) Up to 4 clocks are required until the value that was set in the CM4 register is transferred to internal units. When writing continuously to the CM4 register, be sure to secure a time interval of at least 4 clocks. (5) The CM4 register can be overwritten only once during a timer/counter operation (from 0000H until the INTCM4 interrupt is generated due to a match of the TM4 register and CM4 register). If this cannot be secured, make sure that the CM4 register is not overwritten during a timer/counter operation. (6) The count clock must not be changed during a timer operation. operation cannot be guaranteed. (7) An INTCM4 interrupt will be generated after an overflow if a value less than the counter value is written in the CM4 register during TM4 register operation. If it is to be overwritten, it should be
overwritten after the TM4CE0 bit is cleared (0). If the count clock is overwritten during a timer operation,
390
User's Manual U15195EJ3V0UD
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.6 Timer Connection Function
9.6.1 Overview The V850E/IA2 provides a function to connect timer 1 and timer 2. Figure 9-99. Block Diagram of Timer Connection Function
Timer connection selector Capture 0 Capture 1 Timer 1 INTCM100 INTCM0
Timer 2 CVSE10/ CVPE10 CVSE20/ CVPE20
INTCM101
INTCM1
TMIC0
TMIC1
TMIC2
TMIC3
TMIC0 register
User's Manual U15195EJ3V0UD
391
CHAPTER 9 TIMER/COUNTER FUNCTION (REAL-TIME PULSE UNIT)
9.6.2 Control register (1) Timer connection selection register 0 (TMIC0) The TMIC0 register enables/disables input of the INTCM100 and INTCM101 signals to the CVSEn0/CVPEn0 registers (n = 1, 2). This register can be read/written in 8-bit or 1-bit units.
7 TMIC0 0
6 0
5 0
4 0
3 TMIC3
2 TMIC2
1 TMIC1
0 TMIC0
Address FFFFF620H
After reset 00H
Bit position 3
Bit name TMIC3
Function Enables/disables input of INTCM101 signal to CVSE20/CVPE20 registers. 0: INTCM101 signal not input to CVSE20/CVPE20 registers. 1: INTCM101 signal input to CVSE20/CVPE20 registers. Enables/disables input of INTCM100 signal to CVSE20/CVPE20 registers. 0: INTCM100 signal not input to CVSE20/CVPE20 registers. 1: INTCM100 signal input to CVSE20/CVPE20 registers. Enables/disables input of INTCM101 signal to CVSE10/CVPE10 registers. 0: INTCM101 signal not input to CVSE10/CVPE10 registers. 1: INTCM101 signal input to CVSE10/CVPE10 registers. Enables/disables input of INTCM100 signal to CVSE10/CVPE10 registers. 0: INTCM100 signal not input to CVSE10/CVPE10 registers. 1: INTCM100 signal input to CVSE10/CVPE10 registers.
2
TMIC2
1
TMIC1
0
TMIC0
392
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.1 Features
The serial interface function provides two types of serial interfaces combining a total of four transmit/receive channels. Three of these channels can be used simultaneously. The two interface formats are as follows. (1) Asynchronous serial interfaces (UART0, UART1): 2 channels (2) Clocked serial interfaces (CSI0, CSI1): 2 channels UART0, UART1, in which one byte of serial data is transmitted/received following a start bit, support full-duplex communication. In the UART1 interface, one higher bit is added to 8 bits of transmit/receive data, enabling communication using 9-bit data. CSI0 and CSI1 perform data transfer according to three types of signals: serial clocks (SCK0, SCK1), serial inputs (SI0, SI1), and serial outputs (SO0, SO1) (3-wire serial I/O).
User's Manual U15195EJ3V0UD
393
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.1.1 Selecting UART1 or CSI1 mode UART1 and CSI1 of the V850E/IA2 share pins, and therefore these interfaces cannot be used at the same time. Select UART1 or CSI1 in advance by using the port 3 mode control register (PMC3) and port 3 function control register (PFC3) (refer to 12.3.4 Port 3). Caution UART1 or CSI1 transmission/reception operations are not guaranteed if the mode is changed during transmission or reception. Be sure to disable the operation of the unit that is not used. Figure 10-1. Selecting Mode of UART1 or CSI1
7 PMC3 0
6 0
5 0
4 PMC34
3 PMC33
2 PMC32
1 PMC31
0 PMC30
Address FFFFF446H
After reset 00H
7 PFC3 0
6 0
5 0
4 PFC34
3 PFC33
2 PFC32
1 0
0 0
Address FFFFF466H
After reset 00H
PFC3n 0 0 1 1
PMC3n 0 1 0 1
Operation mode Port I/O mode UART1 mode Port I/O mode CSI1 mode
Remark
n = 2 to 4
394
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.2 Asynchronous Serial Interface 0 (UART0)
10.2.1 Features * Transfer rate: 300 bps to 1,250 kbps (using a dedicated baud rate generator and an internal system clock of 40 MHz) * Full-duplex communications On-chip reception buffer register 0 (RXB0) On-chip transmission buffer register 0 (TXB0) * Two-pin configuration
Note
TXD0: Transmit data output pin RXD0: Receive data input pin * Reception error detection functions * Parity error * Framing error * Overrun error * Interrupt sources: 3 types * Reception error interrupt (INTSER0): * Reception completion interrupt (INTSR0): Interrupt is generated according to the logical OR of the three types of reception errors Interrupt is generated when receive data is transferred from the shift register to reception buffer register 0 after serial transfer is completed during a reception enabled state * Transmission completion interrupt (INTST0): Interrupt is generated when the serial transmission of transmit data (8 or 7 bits) from the shift register is completed * The character length of transmit/receive data is specified by to the ASIM0 register * Character length: 7 or 8 bits * Parity functions: Odd, even, 0, or none * Transmission stop bits: 1 or 2 bits * On-chip dedicated baud rate generator Note The SCK and CTS pins are not available for UART0.
User's Manual U15195EJ3V0UD
395
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.2.2 Configuration UART0 is controlled by asynchronous serial interface mode register 0 (ASIM0), asynchronous serial interface status register 0 (ASIS0), and asynchronous serial interface transmission status register 0 (ASIF0). Receive data is maintained in reception buffer register 0 (RXB0), and transmit data is written to transmission buffer register 0 (TXB0). Figure 10-2 shows the configuration of asynchronous serial interface 0 (UART0). (1) Asynchronous serial interface mode register 0 (ASIM0) The ASIM0 register is an 8-bit register for specifying the operation of the asynchronous serial interface. (2) Asynchronous serial interface status register 0 (ASIS0) The ASIS0 register consists of a set of flags that indicate the error contents when a reception error occurs. The various reception error flags are set (1) when a reception error occurs and are reset (0) when the ASIS0 register is read. (3) Asynchronous serial interface transmission status register 0 (ASIF0) The ASIF0 register is an 8-bit register that indicates the status when a transmit operation is performed. This register consists of a transmission buffer data flag, which indicates the hold status of TXB0 data, and the transmission shift register data flag, which indicates whether transmission is in progress. (4) Reception control parity check The receive operation is controlled according to the contents set in the ASIM0 register. A check for parity errors is also performed during a receive operation, and if an error is detected, a value corresponding to the error contents is set in the ASIS0 register. (5) Reception shift register This is a shift register that converts the serial data that was input to the RXD0 pin to parallel data. One byte of data is received, and if a stop bit is detected, the receive data is transferred to the reception buffer register 0 (RXB0). This register cannot be directly manipulated. (6) Reception buffer register 0 (RXB0) RXB0 is an 8-bit buffer register for holding receive data. When 7 characters are received, 0 is stored in the MSB. During a reception enabled state, receive data is transferred from the reception shift register to the RXB0, synchronized with the end of the shift-in processing of one frame. Also, the reception completion interrupt request (INTSR0) is generated by the transfer of data to the RXB0. (7) Transmission shift register This is a shift register that converts the parallel data that was transferred from the transmission buffer register 0 (TXB0) to serial data. When one byte of data is transferred from the TXB0, the shift register data is output from the TXD0 pin. This register cannot be directly manipulated.
396
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(8) Transmission buffer register 0 (TXB0) TXB0 is an 8-bit buffer for transmit data. A transmit operation is started by writing transmit data to TXB0. The transmission completion interrupt request (INTST0) is generated synchronized with the completion of transmission of one frame. (9) Addition of transmission control parity A transmit operation is controlled by adding a start bit, parity bit, or stop bit to the data that is written to the TXB0 register, according to the contents that were set in the ASIM0 register. Figure 10-2. Asynchronous Serial Interface 0 Block Diagram
Internal bus
Asynchronous serial interface mode register 0 (ASIM0)
Reception buffer register 0 (RXB0)
Transmission buffer register 0 (TXB0)
RXD0 TXD0
Reception shift register
Transmission shift register
Reception control parity check Parity Framing Overrun
Addition of transmission control parity
INTST0 INTSR0
INTSER0 BRG0
User's Manual U15195EJ3V0UD
397
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.2.3 Control registers (1) Asynchronous serial interface mode register 0 (ASIM0) The ASIM0 register is an 8-bit register that controls the UART0 transfer operation. This register can be read/written in 8-bit or 1-bit units. Caution When using UART0, be sure to set the external pins related to UART0 functions to the control made before setting clock select register 0 (CKSR0) and the baud rate generator control register (BRGC0), and then set the UARTCAE0 bit to 1. Then set the other bits. (1/3)
<7> ASIM0 UARTCAE0 <6> TXE0 <5> RXE0 4 PS1 3 PS0 2 CL 1 SL 0 ISRM Address FFFFFA00H After reset 01H
Bit position 7
Bit name UARTCAE0 Controls the operating clock. 0: Stops clock supply to UART0. 1: Supplies clock to UART0.
Function
Cautions 1. If UARTCAE0 = 0, UART0 is asynchronously reset. 2. If UARTCAE0 = 0, UART0 is reset. To operate UART0, first set UARTCAE0 to 1. 3. If the UARTCAE0 bit is changed from 1 to 0, all the registers of UART0 are initialized. To set UARTCAE0 to 1 again, be sure to re-set the registers of UART0.
The output of the TXD0 pin goes high when transmission is disabled, regardless of the setting of the UARTCAE0 bit. 6 TXE0 Enables/disables transmission. 0: Disables transmission 1: Enables transmission Cautions 1. Set the TXE0 bit to 1 after setting the UARTCAE0 bit to 1 at startup. Set the UARTCAE0 bit to 0 after setting the TXE0 bit to 0 to stop. 2. To initialize the transmission unit, clear (0) the TXE0 bit, and after letting 2 Clock cycles (base clock) elapse, set (1) the TXE0 bit again. If the TXE0 bit is not set again, initialization may not be successful. (For details about the base clock, refer to 10.2.6 (1) (a) Base clock (Clock).)
398
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(2/3)
Bit position 5 Bit name RXE0 Enables/disables reception. 0: Disables reception 1: Enables reception Cautions 1. Set the RXE0 bit to 1 after setting the UARTCAE0 bit to 1 at startup. Set the UARTCAE0 bit to 0 after setting the RXE0 bit to 0 to stop. 2. To initialize the reception unit status, clear (0) the RXE0 bit, and after letting 2 Clock cycles (base clock) elapse, set (1) the RXE0 bit again. If the RXE0 bit is not set again, initialization may not be successful. (For details about the base clock, refer to 10.2.6 (1) (a) Base clock (Clock).) 4, 3 PS1, PS0 Controls parity bit. Function
PS1 0 0 1 1
PS0 0 1 0 1
Transmit operation Don't output parity bit Output 0 parity Output odd parity Output even parity
Receive operation Receive with no parity Receive as 0 parity Judge as odd parity Judge as even parity
Cautions 1. To overwrite the PS1 and PS0 bits, first clear (0) the TXE0 and RXE0 bits. 2. If "0 parity" is selected for reception, no parity judgment is performed. Therefore, no error interrupt is generated because the PE bit of the ASIS0 register is not set. * Even parity If the transmit data contains an odd number of bits with the value "1", the parity bit is set (1). If it contains an even number of bits with the value "1", the parity bit is cleared (0). This controls the number of bits with the value "1" contained in the transmit data and the parity bit so that it is an even number. During reception, the number of bits with the value "1" contained in the receive data and the parity bit is counted, and if the number is odd, a parity error is generated. * Odd parity In contrast to even parity, odd parity controls the number of bits with the value "1" contained in the transmit data and the parity bit so that it is an odd number. During reception, the number of bits with the value "1" contained in the receive data and the parity bit is counted, and if the number is even, a parity error is generated.
Remark
When reception is disabled, the reception shift register does not detect a start bit. No shift-in processing or transfer processing to reception buffer register 0 (RXB0) is performed, and the contents of the RXB0 register are retained. When reception is enabled, the reception shift operation starts, synchronized with the detection of the start bit, and when the reception of one frame is completed, the contents of the reception shift register are transferred to the RXB0 register. A reception completion interrupt (INTSR0) is also generated in synchronization with the transfer to the RXB0 register.
User's Manual U15195EJ3V0UD
399
CHAPTER 10 SERIAL INTERFACE FUNCTION
(3/3)
Bit position 4, 3 Bit name PS1, PS0 Function * 0 parity During transmission, the parity bit is cleared (0) regardless of the transmit data. During reception, no parity error is generated because no parity bit is checked. * No parity No parity bit is added to transmit data. During reception, the receive data is considered to have no parity bit. No parity error is generated because there is no parity bit. 2 CL Specifies character length of 1 frame of transmit/receive data. 0: 7 bits 1: 8 bits
Caution To overwrite the CL bit, first clear (0) the TXE0 and RXE0 bits. 1 SL Specifies stop bit length of transmit data. 0: 1 bit 1: 2 bits
Cautions 1. To overwrite the SL bit, first clear (0) the TXE0 bit. 2. Since reception is always done with a stop bit length of 1, the SL bit setting does not affect receive operations. 0 ISRM Enables/disables generation of reception completion interrupt requests when an error occurs. 0: Generate a reception error interrupt request (INTSER0) as an interrupt when an error occurs. In this case, no reception completion interrupt request (INTSR0) is generated. 1: Generate a reception completion interrupt request (INTSR0) as an interrupt when an error occurs. In this case, no reception error interrupt request (INTSER0) is generated. Caution To overwrite the ISRM bit, first clear (0) the RXE0 bit.
400
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(2) Asynchronous serial interface status register 0 (ASIS0) The ASIS0 register, which consists of 3-bit error flags (PE, FE and OVE), indicates the error status when UART0 reception is complete. The status flag, which indicates a reception error, always indicates the status of the error that occurred most recently. That is, if the same error occurred several times before the receive data was read, this flag would hold only the status of the error that occurred last. The ASIS0 register is cleared to 00H by a read operation. When a reception error occurs, reception buffer register 0 (RXB0) should be read and the error flag should be cleared after the ASIS0 register is read. This register is read-only in 8-bit units. Caution When the UARTCAE0 bit or RXE0 bit of the ASIM0 register is set to 0, or when the ASIS0 register is read, the PE, FE, and OVE bits of the ASIS0 register are cleared (0).
7 ASIS0 0
6 0
5 0
4 0
3 0
2 PE
1 FE
0 OVE
Address FFFFFA03H
After reset 00H
Bit position 2
Bit name PE
Function This is a status flag that indicates a parity error. 0: When the ASIM0 register's UARTCAE0 and RXE0 bits are both set to 0, or when the ASIS0 register has been read 1: When reception was completed, the transmit data parity did not match the parity bit Caution The operation of the PE bit differs according to the settings of the PS1 and PS0 bits of the ASIM0 register.
1
FE
This is a status flag that indicates a framing error. 0: When the ASIM0 register's UARTCAE0 and RXE0 bits are both set to 0, or when the ASIS0 register has been read 1: When reception was completed, no stop bit was detected Caution For receive data stop bits, only the first bit is checked regardless of the stop bit length.
0
OVE
This is a status flag that indicates an overrun error. 0: When the ASIM0 register's UARTCAE0 and RXE0 bits are both 0, or when the ASIS0 register has been read. 1: UART0 completed the next receive operation before reading the RXB0 receive data. Caution When an overrun error occurs, the next receive data value is not written to the RXB0 register and the data is discarded.
User's Manual U15195EJ3V0UD
401
CHAPTER 10 SERIAL INTERFACE FUNCTION
(3) Asynchronous serial interface transmission status register 0 (ASIF0) The ASIF0 register, which consists of 2-bit status flags, indicates the status during transmission. By writing the next data to the TXB0 register after data is transferred from the TXB0 register to the transmission shift register, transmit operations can be performed continuously without suspension even during an interrupt interval. When transmission is performed continuously, data should be written after referencing the TXBF0 bit of the ASIF0 register to prevent writing to the TXB0 register by mistake. This register is read-only in 8-bit or 1-bit units.
7 ASIF0 0
6 0
5 0
4 0
3 0
2 0
<1> TXBF0
<0> TXSF0
Address FFFFFA05H
After reset 00H
Bit position 1
Bit name TXBF0
Function This is a transmission buffer data flag. 0: Data to be transferred next to TXB0 register does not exist (When the ASIM0 register's UARTCAE0 or TXE0 bits is 0, or when data has been transferred to the transmission shift register) 1: Data to be transferred next exists in TXB0 register (Data exists in TXB0 register when the TXB0 register has been written to) Caution When transmission is performed continuously, data should be written to the TXB0 register after confirming that this flag is 0. If writing to TXB0 register is performed when this flag is 1, transmit data cannot be guaranteed.
0
TXSF0
This is a transmission shift register data flag. It indicates the transmission status of UART0. 0: Initial status or a waiting transmission (When the ASIM0 register's UARTCAE0 or TXE0 bits is set to 0, or when following transfer completion, the next data transfer from the TXB0 register is not performed) 1: Transmission in progress (When data has been transferred from the TXB0 register) Caution When the transmission unit is initialized, initialization should be executed after confirming that this flag is 0 following the occurrence of a transmission completion interrupt. If initialization is performed when this flag is 1, transmit data cannot be guaranteed.
402
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(4) Reception buffer register (RXB0) The RXB0 register is an 8-bit buffer register for storing parallel data that had been converted by the reception shift register. When reception is enabled (RXE0 bit = 1 in the ASIM0 register), receive data is transferred from the reception shift register to the RXB0 register, synchronized with the completion of the shift-in processing of one frame. Also, a reception completion interrupt request (INTSR0) is generated by the transfer to the RXB0 register. For information about the timing for generating this interrupt request, refer to 10.2.5 (4) Receive operation. If reception is disabled (RXE0 bit = 0 in the ASIM0 register), the contents of the RXB0 register are retained, and no processing is performed for transferring data to the RXB0 register even when the shift-in processing of one frame is completed. Also, no reception completion interrupt is generated. When 7 bits is specified for the data length, bits 6 to 0 of the RXB0 register are transferred for the receive data and the MSB (bit 7) is always 0. However, if an overrun error (OVE) occurs, the receive data at that time is not transferred to the RXB0 register. Except when a reset is input, the RXB0 register becomes FFH even when UARTCAE0 bit = 0 in the ASIM0 register. This register is read-only in 8-bit units.
7 RXB0 RXB7
6 RXB6
5 RXB5
4 RXB4
3 RXB3
2 RXB2
1 RXB1
0 RXB0
Address FFFFFA02H
After reset FFH
Bit position 7 to 0
Bit name RXB7 to RXB0
Function Stores receive data. 0 can be read for RXB7 when 7-bit or character data is received.
User's Manual U15195EJ3V0UD
403
CHAPTER 10 SERIAL INTERFACE FUNCTION
(5) Transmission buffer register 0 (TXB0) The TXB0 register is an 8-bit buffer register for setting transmit data. When transmission is enabled (TXE0 bit = 1 in the ASIM0 register), the transmit operation is started by writing data to TXB0 register. When transmission is disabled (TXE0 bit = 0 in the ASIM0 register), even if data is written to TXB0 register, the value is ignored. The TXB0 register data is transferred to the transmission shift register, and a transmission completion interrupt request (INTST0) is generated, synchronized with the completion of the transmission of one frame from the transmission shift register. For information about the timing for generating this interrupt request, refer to 10.2.5 (2) Transmit operation. When TXBF0 bit = 1 in the ASIF0 register, writing must not be performed to TXB0 register. This register can be read or written in 8-bit units.
7 TXB0 TXB7
6 TXB6
5 TXB5
4 TXB4
3 TXB3
2 TXB2
1 TXB1
0 TXB0
Address FFFFFA04H
After reset FFH
Bit position 7 to 0
Bit name TXB7 to TXB0 Writes transmit data.
Function
404
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.2.4 Interrupt requests The following three types of interrupt requests are generated from UART0. * Reception error interrupt (INTSER0) * Reception completion interrupt (INTSR0) * Transmission completion interrupt (INTST0) The default priorities among these three types of interrupt requests is, from high to low, reception error interrupt, reception completion interrupt, and transmission completion interrupt. Table 10-1. Generated Interrupts and Default Priorities
Interrupt Reception error Reception completion Transmission completion Priority 1 2 3
(1) Reception error interrupt (INTSER0) When reception is enabled, a reception error interrupt is generated according to the logical OR of the three types of reception errors explained for the ASIS0 register. Whether a reception error interrupt (INTSER0) or a reception completion interrupt (INTSR0) is generated when an error occurs can be specified according to the ISRM bit of the ASIM0 register. When reception is disabled, no reception error interrupt is generated. (2) Reception completion interrupt (INTSR0) When reception is enabled, a reception completion interrupt is generated when data is shifted in to the reception shift register and transferred to reception buffer register 0 (RXB0). A reception completion interrupt request can be generated in place of a reception error interrupt according to the ISRM bit of the ASIM0 register even when a reception error has occurred. When reception is disabled, no reception completion interrupt is generated. (3) Transmission completion interrupt (INTST0) A transmission completion interrupt is generated when one frame of transmit data containing 7-bit or 8-bit characters is shifted out from the transmission shift register.
User's Manual U15195EJ3V0UD
405
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.2.5 Operation (1) Data format Full-duplex serial data transmission and reception can be performed. The transmit/receive data format consists of one data frame containing a start bit, character bits, a parity bit, and stop bits as shown in Figure 10-3. The character bit length within one data frame, the type of parity, and the stop bit length are specified according to asynchronous serial interface mode register 0 (ASIM0). Also, data is transferred with LSB first. Figure 10-3. Asynchronous Serial Interface Transmit/Receive Data Format
1 data frame
Start bit
D0
D1
D2
D3
D4
D5
D6
D7
Parity bit
Stop bits
Character bits
* Start bit *** 1 bit * Character bits *** 7 bits or 8 bits * Parity bit *** Even parity, odd parity, 0 parity, or no parity * Stop bits *** 1 bit or 2 bits
406
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(2) Transmit operation When the UARTCAE0 bit is set to 1 in the ASIM0 register, a high level is output from the TXD0 pin. Then, when the TXE0 bit is set to 1 in the ASIM0 register, transmission is enabled, and the transmit operation is started by writing transmit data to transmission buffer register 0 (TXB0). (a) Transmission enabled state This state is set by the TXE0 bit in the ASIM0 register. * TXE0 = 1: Transmission enabled state * TXE0 = 0: Transmission disabled state Since UART0 does not have a CTS (transmission enabled signal) input pin, a port should be used to confirm whether the destination is in a reception enabled state. (b) Starting a transmit operation In the transmission enabled state, a transmit operation is started by writing transmit data to transmission buffer register 0 (TXB0). transmission shift register. are added automatically. (c) Transmission interrupt request When the transmission shift register becomes empty, a transmission completion interrupt request (INTST0) is generated. bit is output. If the data to be transmitted next has not been written to the TXB0 register, the transmit operation is suspended. Caution Normally, when the transmission shift register becomes empty, a transmission completion interrupt (INTST0) is generated. the input of RESET. However, no transmission completion interrupt (INTST0) is generated if the transmission shift register becomes empty due to The timing for generating the INTST0 interrupt differs according to the specification of the stop bit length. The INTST0 interrupt is generated at the same time that the last stop When a transmit operation is started, the data in TXB0 is transferred to Then, the transmission shift register outputs data to the TXD0 pin (the
transmit data is transferred sequentially starting with the start bit). The start bit, parity bit, and stop bits
User's Manual U15195EJ3V0UD
407
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-4. Asynchronous Serial Interface Transmission Completion Interrupt Timing
(a) Stop bit length: 1
TXD0 (output)
Start
D0
D1
D2
D6
D7
Parity
Stop
INTST0 (output)
(b) Stop bit length: 2
TXD0 (output)
Start
D0
D1
D2
D6
D7
Parity
Stop
INTST0 (output)
408
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(3) Continuous transmission operation UART0 can write the next transmit data to the TXB0 register at the timing that the transmission shift register starts the shift operation. This enables an efficient transmission rate to be realized by continuously transmitting data even during the INTST0 interrupt service after the transmission of one data frame. In addition, reading the TXSF0 bit of the ASIF0 register after the occurrence of a transmission completion interrupt enables the TXB0 register to be efficiently written twice (2 bytes) without waiting for the transmission of 1 data frame. When continuous transmission is performed, data should be written after referencing the ASIF0 register to confirm the transmission status and whether or not data can be written to the TXB0 register.
TXBF0 0 1 Whether or Not Writing to TXB0 Register Is Enabled Writing is enabled Writing is not enabled
Caution
When transmission is performed continuously, write the first transmit data (first byte) to the TXB0 register and confirm that the TXBF0 bit is 0, and then write the next transmit data (second byte) to TXB0 register. If writing to the TXB0 register is performed when the TXBF0 bit is 1, transmit data cannot be guaranteed.
While transmission is being performed continuously, whether writing to the TXB0 register later is enabled can be judged by confirming the TXSF0 bit after the occurrence of a transmission completion interrupt.
TXSF0 0 Transmission Status Transmission is completed. However, the cautions concerning the TXBF0 bit must be observed. Writing transmit data can be performed twice (2 bytes). Under transmission. Transmit data can be written once (1 byte).
1
Cautions 1.
When initializing the transmission unit when continuous transmission is completed, confirm that the TXBF0 bit is 0 after the occurrence of the transmission completion interrupt, and then execute initialization. If initialization is performed when the TXBF0 bit is 1, transmit data cannot be guaranteed.
2. While transmission is being performed continuously, an overrun error may occur if the next transmission is completed before the INTST0 interrupt servicing following the transmission of 1 data frame is executed. TXSF0 bit. An overrun error can be detected by embedding a program that can count the number of transmit data and referencing
User's Manual U15195EJ3V0UD
409
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-5. Continuous Transmission Processing Flow
Set registers
Write transmit data to TXB0 register
No
When reading ASIF0 register, TXBF0 = 0? Yes Interrupt occurrence
Required number of transfers performed? No
Yes
No
When reading ASIF0 register, TXSF0 = 1? Yes
When reading ASIF0 register, TXSF0 = 0? Yes
No
Write transmit data to TXB0 register
Wait for interrupt
End of transmission processing
410
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(a) Starting procedure The procedure to start continuous transmission is shown below. Figure 10-6. Continuous Transmission Starting Procedure
TXD0 (output) <1> INTST0 (output)
Start bit <2>
Data (1)
Stop bit <3>
Start bit <4>
Data (2)
Stop bit <5>
TXB0 register
FFH
Data (1)
Data (2)
Data (3)
TXS0 register ASIF0 register (TXBF0, TXSF0 bits)
FFH
Data (1)
Data (2)
Data (3)
00
10 Note
01
11
01
11
01
11
Note Since this period is a transition period from 10 to 01, when reading the TXBF0 and TXSF0 bits of the ASIF0 register simultaneously, 11 or 00 may be read. Thus, whether writing to the TXB0 register is enabled or not should be judged only for the TXBF0 bit.
Transmission Starting Procedure
Internal Operation
ASIF0 Register TXBF0 TXSF0 0 0 1/0Note 1/0Note 1 1 1
* Set transmission mode * Write data (1)
<1> Start transmission unit
0 1
<2> Generate start bit
1 0
Start data (1) transmission * Read ASIF0 register (confirm that TXBF0 bit = 0) * Write data (2) <> <3> INTST0 interrupt occurs * Read ASIF0 register (confirm that TXBF0 bit = 0) * Write data (3) <4> Generate start bit Start data (2) transmission <> <5> INTST0 interrupt occurs * Read ASIF0 register (confirm that TXBF0 bit = 0) * Write data (4)
0 0 1
0 0 1
1 1 1
0 0 1
1 1 1
Note Transition period
User's Manual U15195EJ3V0UD
411
CHAPTER 10 SERIAL INTERFACE FUNCTION
(b) Ending procedure The procedure for ending continuous transmission is shown below. Figure 10-7. Continuous Transmission End Procedure
TXD0 (output) <6> INTST0 (output) <7>
Start bit <8>
Data (m - 1)
Stop bit <9>
Start bit <10>
Data (m) <11>
Stop bit
TXB0 register
Data (m - 1) Data (m - 1)
Data (m)
TXS0 register ASIF0 register (TXBF0, TXSF0 bits)
Data (m)
FFH
11
01
11
01
00
UARTCAE0 bit or TXE0 bit
Transmission End Procedure
Internal Operation
ASIF0 Register TXBF0 TXSF0 1
<6> Transmission of data (m - 2) is in progress <7> INTST0 interrupt occurs * Read ASIF0 register (confirm that TXBF0 bit = 0) * Write data (m) <8> Generate start bit Start data (m - 1) transmission <> <9> INTST0 interrupt occurs * Read ASIF0 register (confirm that TXSF0 bit = 1) There is no write data <10> Generate start bit Start data (m) transmission <> <11> Generate INTST0 interrupt * Read ASIF0 register (confirm that TXSF0 bit = 0) * Clear (0) the UARTCAE0 bit or TXE0 bit Initialize internal circuits
1
0 0 1
1 1 1
0 0
1 1
0 0
0 0
412
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(4) Receive operation The awaiting reception state is set by setting the UARTCAE0 bit to 1 in the ASIM0 register and then setting the RXE0 bit to 1 in the ASIM0 register. To start the receive operation, first perform start bit detection. The start bit is detected by sampling the RXD0 pin. When the receive operation begins, serial data is stored sequentially in the reception shift register according to the baud rate that was set. A reception completion interrupt (INTSR0) is generated each time the reception of one frame of data is completed. Normally, the receive data is transferred from reception buffer register 0 (RXB0) to memory by this interrupt servicing. (a) Reception enabled state The receive operation is set to the reception enabled state by setting the RXE0 bit in the ASIM0 register to 1. * RXE0 bit = 1: Reception enabled state * RXE0 bit = 0: Reception disabled state In reception disabled state, the reception hardware stands by in the initial state. At this time, the contents of reception buffer register 0 (RXB0) are retained, and no reception completion interrupt or reception error interrupt is generated. (b) Starting a receive operation A receive operation is started by the detection of a start bit. The RXD0 pin is sampled using the serial clock from baud rate generator 0 (BRG0). (c) Reception completion interrupt When RXE0 = 1 in the ASIM0 register and the reception of one frame of data is completed (the stop bit is detected), a reception completion interrupt (INTSR0) is generated and the receive data within the reception shift register is transferred to RXB0 at the same time. Also, if an overrun error (OVE) occurs, the receive data at that time is not transferred to reception buffer register 0 (RXB0), and either a reception completion interrupt (INTSR0) or a reception error interrupt (INTSER0) is generated (the receive data within the reception shift register is transferred to RXB0) according to the ISRM bit setting in the ASIM0 register. Even if a parity error (PE) or framing error (FE) occurs during a reception operation, the receive operation continues until stop bit is received, and after reception is completed, either a reception completion interrupt (INTSR0) or a reception error interrupt (INTSER0) is generated according to the ISRM bit setting in the ASIM0 register. If the RXE0 bit is reset (0) during a receive operation, the receive operation is immediately stopped. The contents of reception buffer register 0 (RXB0) and of the asynchronous serial interface status register (ASIS0) at this time do not change, and no reception completion interrupt (INTSR0) or reception error interrupt (INTSER0) is generated. No reception completion interrupt is generated when RXE0 = 0 (reception is disabled).
User's Manual U15195EJ3V0UD
413
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-8. Asynchronous Serial Interface Reception Completion Interrupt Timing
RXD0 (input)
Start
D0
D1
D2
D6
D7
Parity
Stop
INTSR0 (output)
RXB0 register
Cautions 1. Be sure to read reception buffer register 0 (RXB0) even when a reception error occurs. If RXB0 is not read, an overrun error will occur at the next data reception and the reception error status will continue infinitely. 2. Reception is always performed assuming a stop bit length of 1. A second stop bit is ignored.
(5) Reception error The three types of errors that can occur during a receive operation are a parity error, framing error, and overrun error. As a result of data reception, the various flags of the ASIS0 register are set (1), and a reception error interrupt (INTSER0) or a reception completion interrupt (INTSR0) is generated at the same time. The ISRM bit of the ASIM0 register specifies whether INTSER0 or INTSR0 is generated. The type of error that occurred during reception can be detected by reading the contents of the ASIS0 register during the INTSER0 or INTSR0 interrupt servicing. The contents of the ASIS0 register are reset (0) by reading the ASIS0 register. Table 10-2. Reception Error Causes
Error Flag PE Reception Error Parity error Cause The parity specification during transmission did not match the parity of the reception data No stop bit was detected The reception of the next data was completed before data was read from reception buffer register 0 (RXB0)
FE OVE
Framing error Overrun error
414
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(a) Separation of reception error interrupt A reception error interrupt can be separated from the INTSR0 interrupt and generated as the INTSER0 interrupt by clearing the ISRM bit of the ASIM0 register to 0. Figure 10-9. When Reception Error Interrupt Is Separated from INTSR0 Interrupt (ISRM Bit = 0)
(a) No error occurs during reception
(b) An error occurs during reception
INTSR0 (output) (Reception completion interrupt) INTSER0 (output) (Reception error interrupt)
INTSR0 (output) (Reception completion interrupt) INTSER0 (output) (Reception error interrupt)
INTSR0 does not occur
Figure 10-10. When Reception Error Interrupt Is Included in INTSR0 Interrupt (ISRM Bit = 1)
(a) No error occurs during reception
(b) An error occurs during reception
INTSR0 (output) (Reception completion interrupt) INTSER0 (output) (Reception error interrupt)
INTSR0 (output) (Reception completion interrupt) INTSER0 (output) (Reception error interrupt)
INTSER0 does not occur
User's Manual U15195EJ3V0UD
415
CHAPTER 10 SERIAL INTERFACE FUNCTION
(6) Parity types and corresponding operation A parity bit is used to detect a bit error in communication data. Normally, the same type of parity bit is used on the transmission and reception sides. (a) Even parity (i) During transmission The parity bit is controlled so that the number of bits with the value "1" within the transmit data including the parity bit is even. The parity bit value is as follows. * If the number of bits with the value "1" within the transmit data is odd: 1 * If the number of bits with the value "1" within the transmit data is even: 0 (ii) During reception The number of bits with the value "1" within the receive data including the parity bit is counted, and a parity error is generated if this number is odd. (b) Odd parity (i) During transmission In contrast to even parity, the parity bit is controlled so that the number of bits with the value "1" within the transmit data including the parity bit is odd. The parity bit value is as follows. * If the number of bits with the value "1" within the transmit data is odd: 0 * If the number of bits with the value "1" within the transmit data is even: 1 (ii) During reception The number of bits with the value "1" within the receive data including the parity bit is counted, and a parity error is generated if this number is even. (c) 0 parity During transmission the parity bit is set to "0" regardless of the transmit data. During reception, no parity bit check is performed. Therefore, no parity error is generated regardless of whether the parity bit is "0" or "1". (d) No parity No parity bit is added to the transmit data. During reception, the receive operation is performed as if there were no parity bit. Since there is no parity bit, no parity error is generated.
416
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(7) Receive data noise filter The RXD0 signal is sampled at the rising edge of the prescaler output base clock (Clock). If the same sampling value is obtained twice, the match detector output changes, and this output is sampled as input data. Therefore, data not exceeding one clock width is judged to be noise and is not delivered to the internal circuit (see Figure 10-12). Refer to 10.2.6 (1) (a) Base clock (Clock) regarding the base clock. Also, since the circuit is configured as shown in Figure 10-11, internal processing during a receive operation is delayed by up to 2 clocks according to the external signal status. Figure 10-11. Noise Filter Circuit
Clock
RXD0
In
Q
Internal signal A
In LD_EN
Q
Internal signal B
Match detector
Figure 10-12. Timing of RXD0 Signal Judged as Noise
Clock
RXD0 (input)
Internal signal A
Match
Mismatch (judged as noise)
Match
Mismatch (judged as noise)
Internal signal B
User's Manual U15195EJ3V0UD
417
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.2.6 Dedicated baud rate generator 0 (BRG0) A dedicated baud rate generator, which consists of a source clock selector and an 8-bit programmable counter, generates serial clocks during transmission/reception by UART0. The dedicated baud rate generator output can be selected as the serial clock for each channel. Separate 8-bit counters exist for transmission and for reception. (1) Baud rate generator 0 (BRG0) configuration Figure 10-13. Configuration of Baud Rate Generator 0 (BRG0)
UARTCAE0
fXX fXX/2 fXX/4 fXX/8 fXX/16 fXX/32 fXX/64 fXX/128 fXX/256 fXX/512 fXX/1,024 fXX/2,048 Match detector 1/2 Baud rate Selector Clock (fCLK) 8-bit counter UARTCAE0 and TXE0 (or RXE0)
CKSR0: TPS3 to TPS0
BRGC0: MDL7 to MDL0
Remark
fXX: Internal system clock
(a) Base clock (Clock) When the UARTCAE0 bit = 1 in the ASIM0 register, the clock selected according to the TPS3 to TPS0 bits of the CKSR0 register is supplied to the transmission/reception unit. This clock is called the base clock (Clock), and its frequency is referred to as fCLK. When UARTCAE0 = 0, Clock is fixed to low level.
418
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(2) Serial clock generation A serial clock can be generated according to the settings of the CKSR0 and BRGC0 registers. The base clock to the 8-bit counter is selected by the TPS3 to TPS0 bits of the CKSR0 register. The 8-bit counter divisor value can be set by the MDL7 to MDL0 bits of the BRGC0 register. (a) Clock select register 0 (CKSR0) The CKSR0 register is an 8-bit register for selecting the basic block using the TPS3 to TPS0 bits. The clock selected by the TPS3 to TPS0 bits becomes the base clock (Clock) of the transmission/ reception module. Its frequency is referred to as fCLK. This register can be read or written in 8-bit units. Cautions 1. The maximum allowable frequency of the base clock (fCLK) is 20 MHz. Therefore, when the system clock's frequency is 40 MHz, TPS3 to TPS0 bits cannot be set to 0000B. At 40 MHz, set the TPS3 to TPS0 bits to a value other than 0000B, and set the UARTCAE0 bit of the ASIM0 register to 1. 2. Set the UARTCAE0 bit of the ASIM0 register to 0 before rewriting the TPS3 to TPS0 bits.
7 CKSR0 0
6 0
5 0
4 0
3 TPS3
2 TPS2
1 TPS1
0 TPS0
Address FFFFFA06H
After reset 00H
Bit position 3 to 0
Bit name TPS3 to TPS0 Specifies the base clock
Function
TPS3 0 0 0 0 0 0 0 0 1 1 1 1 1
TPS2 0 0 0 0 1 1 1 1 0 0 0 0 1
TPS1 0 0 1 1 0 0 1 1 0 0 1 1
TPS0 0 1 0 1 0 1 0 1 0 1 0 1 fXX fXX/2 fXX/4 fXX/8 fXX/16 fXX/32 fXX/64 fXX/128 fXX/256 fXX/512 fXX/1,024 fXX/2,048
Base clock (fCLK)
Arbitrary Arbitrary Setting prohibited
Remark fXX: Internal system clock
User's Manual U15195EJ3V0UD
419
CHAPTER 10 SERIAL INTERFACE FUNCTION
(b) Baud rate generator control register 0 (BRGC0) The BRGC0 register is an 8-bit register that controls the baud rate (serial transfer speed) of UART0. This register can be read or written in 8-bit units. Caution If the MDL7 to MDL0 bits are to be overwritten, the TXE0 and RXE0 bits should be set to 0 in the ASIM0 register first.
7 BRGC0 MDL7
6 MDL6
5 MDL5
4 MDL4
3 MDL3
2 MDL2
1 MDL1
0 MDL0
Address FFFFFA07H
After reset FFH
Bit position 7 to 0
Bit name MDL7 to MDL0
Function Specifies the 8-bit counter's division value.
MDL7 MDL6 MDL5 MDL4 MDL3 MDL2 MDL1 MDL0
Division value (k) -
Serial clock
0
0
0
0
0
x 0 0 0
x 0 0 1
x 0 1 0
Setting prohibited fCLK/8 fCLK/9 fCLK/10
0 0 0
0 0 0
0 0 0
0 0 0
1 1 1
8 9 10
1 1 1 1 1 1
Remarks 1. fCLK: Frequency [Hz] of base clock (Clock) selected by TPS3 to TPS0 bits of CKSR0register 2. k: Value set by MDL7 to MDL0 bits (k = 8, 9, 10, ..., 255) 3. The baud rate is the output clock for the 8-bit counter divided by 2 4. x: Don't care
...
...
1 1 1 1 1 1
1 1 1 1 1 1
...
1 1 1 1 1 1
...
1 1 1 1 1 1
...
...
0 0 1 1 1 1
...
1 1 0 0 1 1
0 1 0 1 0 1
...
250 251 252 253 254 255
...
fCLK/250 fCLK/251 fCLK/252 fCLK/253 fCLK/254 fCLK/255
...
420
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(c) Baud rate The baud rate is the value obtained by the following formula.
Baud rate =
fCLK 2xk
[bps]
fCLK = Frequency [Hz] of base clock (Clock) selected by TPS3 to TPS0 bits of CKSR0 register. k = Value set by MDL7 to MDL0 bits of BRGC0 register (k = 8, 9, 10, ..., 255)
(d) Baud rate error The baud rate error is obtained by the following formula.
Actual baud rate (baud rate with error) Error (%) = Desired baud rate (normal baud rate) - 1 x 100 [%] Cautions 1. Make sure that the baud rate error during transmission does not exceed the allowable error of the reception destination. 2. Make sure that the baud rate error during reception is within the allowable baud rate range during reception, which is described in (4) Allowable baud rate during reception.
Example: Base clock frequency = 20 MHz = 20,000,000 Hz Setting of MDL7 to MDL0 bits in BRGC0 register = 01000001B (k = 65) Target baud rate = 153,600 bps Baud rate = 20M/(2 x 65) = 20,000,000/(2 x 65) = 153,846 [bps] Error = (153,846/153,600 - 1) x 100 = 0.160 [%]
User's Manual U15195EJ3V0UD
421
CHAPTER 10 SERIAL INTERFACE FUNCTION
(3) Baud rate setting example Table 10-3. Baud Rate Generator Setting Data
fXX = 40 MHz fCLK fXX/2
10
Baud Rate (bps) 300 600 1200 2400 4800 9600 19200 31250 38400 76800 153600 312500 625000 1250000
fXX = 33 MHz ERR 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0 0.16 0.16 0.16 0 0 0 fCLK fXX/2 fXX/2 fXX/2
8
fXX = 10 MHz ERR fCLK fXX/2 fXX/2 fXX/2
7
k 65 65 65 65 65 65 80 65 65 65 65 32 16 8
k 215 215 215 215 215 215 215 132 215 107 54 26 13 8
k 130 130 130 130 130 130 130 80 130 65 33 16 8 -
ERR 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0 0.16 0.16 -1.36 0 0 -
-0.07 -0.07 -0.07 -0.07 -0.07 -0.07 -0.07 0 -0.07 0.39 -0.54 1.54 1.54 -17.5
fXX/2 fXX/2
9
7
6
8
6
5
fXX/27 fXX/2 fXX/2 fXX/2 fXX/2 fXX/2 fXX/2 fXX/2
6
fXX/25 fXX/2 fXX/2 fXX/2 fXX/2 fXX/2 fXX/2 fXX/2
4
fXX/24 fXX/2 fXX/2 fXX/2 fXX/2 fXX/2 fXX/2 fXX/2
3
5
3
2
4
2
1
3
2
1
3
1
0
2
1
0
1
1
0
fXX/21 fXX/2 fXX/2
1
fXX/21 fXX/2 fXX/2
1
fXX/20 fXX/2 -
0
1
1
Caution The maximum allowable frequency of the base clock (fCLK) is 20 MHz. Remarks fXX: fCLK: k: ERR: Internal system clock frequency Base clock frequency Setting values of MDL7 to MDL0 bits in BRGC0 register Baud rate error [%]
422
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(4) Allowable baud rate range during reception The degree to which a discrepancy from the transmission destination's baud rate is allowed during reception is shown below. Caution The equations described below should be used to set the baud rate error during reception so that it always is within the allowable error range. Figure 10-14. Allowable Baud Rate Range During Reception
Latch timing UART0 transfer rate
Start bit
Bit 0 FL
Bit 1
Bit 7
Parity bit
Stop bit
1 data frame (11 x FL)
Minimum allowable transfer rate
Start bit
Bit 0
Bit 1
Bit 7
Parity bit
Stop bit
FLmin
Maximum allowable transfer rate
Start bit
Bit 0
Bit 1
Bit 7
Parity bit
Stop bit
FLmax
As shown in Figure 10-14, after the start bit is detected, the receive data latch timing is determined according to the counter that was set by the BRGC0 register. If all data up to the final data (stop bit) is in time for this latch timing, the data can be received normally. If this is applied to 11-bit reception, the following is theoretically true. FL = (Brate)
-1
Brate: UART0 baud rate k: FL: BRGC0 register setting value 1-bit data length
When the latch timing margin is 2 base clocks (Clock), the minimum allowable transfer rate (FLmin) is as follows. FL min = 11x FL - k-2 2k x FL = 21k + 2 2k
FL
User's Manual U15195EJ3V0UD
423
CHAPTER 10 SERIAL INTERFACE FUNCTION
Therefore, the transfer destination's maximum receivable baud rate (BRmax) is as follows.
BRmax = (FLmin/11)- =
1
22k 21k + 2 Brate
Similarly, the maximum allowable transfer rate (FLmax) can be obtained as follows. 21k - 2 k+2 10 FL x FL = x FL max = 11x FL - 2xk 2xk 11 21k - 2 FL x 11 FL max = 20k Therefore, the transfer destination's minimum receivable baud rate (BRmin) is as follows.
BRmin = (FLmax/11)- =
1
20k 21k - 2
Brate
The allowable baud rate error of UART0 and the transfer destination can be obtained as follows from the expressions described above for computing the minimum and maximum baud rate values. Table 10-4. Maximum and Minimum Allowable Baud Rate Error
Division Ratio (k) Maximum Allowable Baud Rate Error +3.53% +4.26% +4.56% +4.66% +4.72% Minimum Allowable Baud Rate Error -3.61% -4.31% -4.58% -4.67% -4.73%
8 20 50 100 255
Remarks 1. The reception precision depends on the number of bits in one frame, the base clock frequency, and the division ratio (k). The higher the base clock frequency and the larger the division ratio (k), the higher the precision. 2. k: BRGC0 setting value
424
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(5) Transfer rate during continuous transmission During continuous transmission, the transfer rate from a stop bit to the next start bit is extended two clocks of the base clock (Clock) longer than normal. However, on the reception side, the transfer result is not affected since the timing is initialized by the detection of the start bit. Figure 10-15. Transfer Rate During Continuous Transmission
1 data frame
Start bit of second byte Bit 7 FL Parity bit FL Stop bit FLstp Start bit FL Bit 0 FL
Start bit FL
Bit 0 FL
Bit 1 FL
Representing the 1-bit data length by FL, the stop bit length by FLstp, and the base clock frequency by fCLK yields the following equation. FLstp = FL + 2/fCLK Therefore, the transfer rate during continuous transmission is as follows. Transfer rate = 11 x FL = 2/fCLK 10.2.7 Cautions Cautions to be observed when using UART0 are shown below. (1) When the supply of clocks to UART0 is stopped (for example, in IDLE or STOP mode), operation stops with each register retaining the value it had immediately before the supply of clocks was stopped. The TXD0 pin output also holds and outputs the value it had immediately before the supply of clocks was stopped. However, operation is not guaranteed after the supply of clocks is restarted. Therefore, after the supply of clocks is restarted, the circuits should be initialized by setting UARTCAE0 = 0, RXE0 = 0, and TXE0 = 0 in the ASIM0 register. (2) UART0 has a 2-stage buffer configuration consisting of transmission buffer register 0 (TXB0) and the transmission shift register, and has status flags (the TXBF0 and TXSF0 bits of the ASIF0 register) that indicate the status of each buffer. If the TXBF0 and TXSF0 bits are read in continuous transmission, the value changes from 10 to 01, but since this change timing is in the period in which data is shifted from TXB0 to the transmission shift register, 11 or 00 may be read, depending on the timing. Thus, read only the TXBF0 bit during continuous transmission.
User's Manual U15195EJ3V0UD
425
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.3 Asynchronous Serial Interface 1 (UART1)
10.3.1 Features
* Clocked (synchronous) mode/asynchronous mode can be selected * Operation clock
Synchronous mode: Baud rate generator/external clock selectable Asynchronous mode: Baud rate generator
* Transfer rate
300 bps to 153,600 bps (in asynchronous mode, fXX = 40 MHz)
* Full-duplex communications (LSB first)
On-chip reception buffer register 1 (RXB1)
* Three-pin configuration
TXD1: RXD1: Transmit data output pin Receive data input pin
ASCK1: Synchronous serial clock I/O
* Reception error detection function
* Parity error * Framing error * Overrun error
* Interrupt sources: 2 types
* Reception completion interrupt (INTSR1): Interrupt is generated when receive data is transferred from the shift register to reception buffer register 1 (RXB1) after serial transfer is completed during a reception enabled state. * Transmission completion interrupt (INTST1): Interrupt is generated when the serial transmission of transmit data (8/7 bits) from the shift register is completed.
* The character length of transmit/receive data is specified by the ASIM10 register (extension bits are specified
by the ASIM11 register)
* Character length: 7 or 8 bits
9 bits (when extension bit is added)
* * * *
Parity functions: Odd, even, 0, or no parity Transmission stop bits: 1 or 2 bits Communication mode: 1-frame transfer or 2-frame continuous transfer enabled On-chip dedicated baud rate generator fXX: Internal system clock
Remark
426
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.3.2 Configuration UART1 is controlled by asynchronous serial interface mode register 10 and 11 (ASIM10 and ASIM11) and asynchronous serial interface status register 1 (ASIS1). Receive data is held in the reception buffer registers (RXB1 and RXBL1), and transmit data is held in the transmission shift registers (TXS1 and TXSL1). Figure 10-16 shows the configuration of asynchronous serial interface 1 (UART1). (1) Asynchronous serial interface mode registers 10, 11 (ASIM10, ASIM11) The ASIM10 and ASIM11 registers are 8-bit registers that specify the operation of the asynchronous serial interface. (2) Asynchronous serial interface status register 1 (ASIS1) The ASIS1 register consists of a transmission status flag (SOT1), reception status flag (SIR1), a bit (RB8) that indicates the 9th bit when extension bit addition is enabled, and 3-bit error flags (PE1, FE1, OVE1) that indicate the error status at reception end. (3) Reception control parity check The receive operation is controlled according to the contents set in the ASIM10 and ASIM11 registers. A check for parity errors is also performed during receive operation, and if an error is detected, a value corresponding to the error contents is set in the ASIS1 register. (4) 2-frame continuous reception buffer register (RXB1)/reception buffer register (RXBL1) RXB1 is a 16-bit (during 2-frame continuous reception, 9-bit extension data reception) buffer register that holds receive data. During 7 or 8 bit character reception, 0 is stored in the MSB. For 16-bit access to this register, specify RXB1, and for access to the lower 8 bits, specify RXBL1. In the reception enabled state, receive data is transferred from the reception shift register to the reception buffer in synchronization with the completion of shift-in processing of one frame. A reception completion interrupt request (INTSR1) is generated upon transfer to the reception buffer (when 2frame continuous reception is specified, reception buffer transmission of the second frame). (5) 2-frame continuous transmission shift register (TXS1)/transmission shift registers (TXSL1) TXS1 is a 9-bit/2-frame continuous transmission processing shift register. Transmission is started by writing data to this register. A transmission completion interrupt request (INTST1) is generated in synchronization with the end of transmission of 1 frame or 2 frames including the TXS1 data. For 16-bit access to this register, specify TXS1, and for access to the lower 8 bits, specify TXSL1. (6) Addition of transmission control parity A transmission operation is controlled by adding a start bit, parity bit, or stop bit to the data that is written to the TXS1 or TXSL1 register, according to the contents set in the ASIM10, ASIM11 registers. (7) Selector The selector selects the serial clock source.
User's Manual U15195EJ3V0UD
427
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-16. Block Diagram of Asynchronous Serial Interface 1
Internal bus
Reception buffers 1, L1 (RXB1, RXBL1)
PE1 FE1 OVE1
Asynchronous serial interface mode registers 10, 11 (ASIM10, ASIM11)
Asynchronous serial interface status registers 1 (ASIS1)
RXD1 TXD1
Reception shift register
Transmission shift registers (TXS1, TXSL1)
Reception control parity check
Transmission control parity addition
INTST1 INTSR1
SIR1 flag MOD bit Selector
1 16
SOT1 flag Selector
1 16
Selector ASCK1
BRG1
Remark
The TXD1, RXD1, and ASCK1 pins function alternately as the SO1, SI1, and SCK1 pins.
428
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.3.3 Control registers Because UART1 shares its pins with CSI1, the UART1 mode must be preset by using the PMC3 and RFC3 registers (refer to 10.1.1 Selecting UART1 or CSI1 mode). (1) Asynchronous serial interface mode register 10 (ASIM10) The ASIM10 register is an 8-bit register that controls the UART1 transfer operation. This register can be read/written in 8-bit or 1-bit units. Cautions 1. If the contents of the ASIM10 register are changed during UART1 transmission or reception, the UART1 operation cannot be guaranteed. 2. Set the ASIM10 register when the UART1 operation is stopped (when RXE1 = 0 and transmission is completed). Do not change the port 3 mode control register (PMC3) after setting the ASIM10 register. 3. In the case of serial clock output in the clocked (synchronous) mode, ensure that nodes do not output to one another causing conflict.
User's Manual U15195EJ3V0UD
429
CHAPTER 10 SERIAL INTERFACE FUNCTION
7 ASIM10 1
<6> RXE1
5 PS1
4 PS0
3 CL
2 SL
1 0
0 SCLS
Address FFFFFA28H
After reset 81H
Bit position 6
Bit name RXE1 Enables/disables reception. 0: Disables reception 1: Enables reception Specify parity bit length
Function
5, 4
PS1, PS0
PS1 0 0
PS0 0 1
Operation No parity, extension bit operation 0 parity Transmit side Transmission with parity bit = 0 Receive side No parity error generated during reception Odd parity Even parity
1 1
0 1
3
CL
Specifies character length of transmit data (1 frame). 0: 7 bits 1: 8 bits Specifies stop bit length of transmit data. 0: 1 bit 1: 2 bits Specifies serial clock source.
2
SL
0
SCLS
SCLS
Operation In asynchronous mode In synchronous mode External clock input
0 1
Internal baud rate generator
430
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(2) Asynchronous serial interface mode register 11 (ASIM11) The ASIM11 register is an 8-bit register that controls the UART1 transfer mode. This register can be read/written in 8-bit or 1-bit units
7 ASIM11 0
6 0
5 0
4 0
3 MOD
2 UMST
1 UMSR
0 EBS
Address FFFFFA2AH
After reset 00H
Bit position 3
Bit name MOD
Function Specifies operation mode (asynchronous/synchronous mode) 0: Asynchronous mode 1: Synchronous mode Specifies number of continuous frame transmissions. 0: 1-frame data transmission 1: 2-frame continuous data transmission Specifies number of continuous frame receptions. 0: 1-frame data reception 1: 2-frame continuous data reception Specifies extension bit operation for transmit/receive data when no parity is specified (PS0 = PS1 = 0). 0: Disables extension bit addition 1: Enables extension bit addition When the extension bit is specified, 1 data bit is added on top of the 8 bits of transmit/receive data, enabling 9-bit data communication. Extension bit specification is valid only when no parity (ASIM10 register's PS0 bit = PS1 bit = 0) and 1-frame data transmission (UMST = 0) are specified. When 0 parity, odd parity, or even parity are specified, or when 2-frame continuous data transmission (UMST bit = 1) is specified, the EBS bit setting becomes invalid and extension bit addition is not performed. Extension bit addition (EBS bit = 1) and 2-frame continuous data reception (UMSR bit = 1) cannot be set simultaneously.
2
UMST
1
UMSR
0
EBS
User's Manual U15195EJ3V0UD
431
CHAPTER 10 SERIAL INTERFACE FUNCTION
(3) Asynchronous serial interface status register 1 (ASIS1) The ASIS1 register is a register that is configured of a UART1 transmission status flag (SOT1), reception status flag (SIR1), a bit (RB8) indicating the 9th bit when extension bit addition is enabled, and 3-bit error flags (PE1, FE1, OVE1) that indicate the error status at reception end. The status flag that indicates reception errors always indicates the most recent error status. In other words, if the same error occurs several times before receive data is read, this flag holds only the status of the error that occurred last. Each time the ASIS1 register is read after a reception completion interrupt (INTSR1), read the reception buffer (RXB1 or RXBL1). The error flag is cleared when the reception buffer (RXB1 or RXBL1) is read. Also, clear the error flag by reading the reception buffer (RXB1 or RXBL1) when a reception error occurs. This register is read-only in 8-bit or 1-bit units.
432
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
<7> ASIS1 SOT1
<6> SIR1
5 0
4 RB8
3 0
<2> PE1
<1> FE1
<0> OVE1
Address FFFFFA2CH
After reset 00H
Bit position 7
Bit name SOT1
Function Status flag indicating transmission status. 0: Transmission end timing (when INTST1 is generated) 1: Indicates transmission statusNote Note The transmission status is the status until the specified number of stop bits has been transmitted following write operation to the transmit register. During 2-frame continuous transmission, this status is until the stop bit of the 2nd frame has been transmitted.
6
SIR1
Status flag indicating reception status. 0: Reception end timing (when INTSR1 is generated) 1: Indicates reception statusNote Note The reception status is the status until stop bit detection from the start bit detection timing.
4
RB8
Indicates contents of receive data extension bit (1 bit) when 9-bit extended format is specified (EBS bit of ASIM11 register = 1) Status flag indicating parity error 0: Processing to read data from reception buffer 1: When transmit parity and receive parity don't match Caution No parity error is generated if no parity is specified or 0 parity is specified by the PS1, PS0 bits of the ASIM10 register.
2
PE1
1
FE1
Status flag indicating framing error 0: Processing to read data from reception buffer 1: When stop bit is not detected Status flag indicating overrun error 0: Processing to read data from reception buffer 1: When UART1 has completed next reception processing prior to loading receive data from reception buffer Since the contents of the reception shift register are transferred to the reception buffer (RXB1, RXBL1) every time 1 frame is received, the next receive data is overwritten to the reception buffer (RXB1, RXBL1) and the previous receive data is discarded.
0
OVE1
User's Manual U15195EJ3V0UD
433
CHAPTER 10 SERIAL INTERFACE FUNCTION
(4) 2-frame continuous reception buffer register 1 (RXB1)/reception buffer register L1 (RXBL1) The RXB1 register is a 16-bit buffer register that holds receive data (during 2-frame continuous reception (UMSR bit of ASIM11 register = 1), during 9-bit extended data reception (EBS bit of ASIM11 register = 1)). During 7 or 8 bit character reception, 0 is stored in the MSB. For 16-bit access to this register, specify RXB1, and for access to the lower 8 bits, specify RXBL1. In the receive enabled status, receive data is transferred from the reception shift register to the reception buffer in synchronization with the end of shift-in processing for 1 frame of data. The reception completion interrupt request (INTSR1) is generated upon transfer of data to the reception buffer (when 2-frame reception is specified, reception buffer transmission of the second frame). In the reception disabled status, transfer processing to the reception buffer is not performed even if shift-in processing for 1 frame of data has been completed, and the contents of the reception buffer are held. Neither is a reception completion interrupt request generated. The RXB1 register can be read in 16-bit units, and the RXBL1 register can be read in 8-bit units.
[2-frame continuous buffer register 1]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Address After reset
RXB1 RXB15 RXB14 RXB13 RXB12 RXB11 RXB10 RXB9 RXB8 RXB7 RXB6 RXB5 RXB4 RXB3 RXB2 RXB1 RXB0 FFFFFA20H Undefined
[Reception buffer register L1]
7 6 5 4 3 2 1 0 Address After reset
RXBL1 RXB7 RXB6 RXB5 RXB4 RXB3 RXB2 RXB1 RXB0 FFFFFA22H Undefined
Bit position 15 to 0
Bit name RXB15 to RXB0
Function Stores receive data. 0 can be read for the RXB1 register when 7 or 8 bit character data is received. When an extension bit is set during 9 bit character data reception, the extension bit (RXB8) is stored in RB8 of the ASIS1 register simultaneously with saving to the reception buffer. 0 can be read for the RXB7 bit of the RXBL1 register during 7 bit character data reception.
434
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(a) When 2-frame continuous reception is set
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RXB1 RXB15 RXB14 RXB13 RXB12 RXB11 RXB10 RXB9 RXB8 RXB7 RXB6 RXB5 RXB4 RXB3 RXB2 RXB1 RXB0 7-/8-bit data of 1st frame 7-/8-bit data of 2nd frame
(b) When 9-bit extension reception is set
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RXB1 RXB15 RXB14 RXB13 RXB12 RXB11 RXB10 RXB9 RXB8 RXB7 RXB6 RXB5 RXB4 RXB3 RXB2 RXB1 RXB0 9-bit extended data
When 9-bit extension is set, the extension bit (RXB8) is stored in the RB8 bit of the ASIS1 register simultaneously with saving to the reception buffer.
User's Manual U15195EJ3V0UD
435
CHAPTER 10 SERIAL INTERFACE FUNCTION
(c) Cautions <1> Operation upon occurrence of overrun error during 2-frame continuous reception * During normal operation Reception completion interrupt (INTSR1) generated at end of reception of 2nd frame, no error RXD1 Frame 1 Frame 2
* Reception of 3rd frame started before performing reception processing Reception completion interrupt (INTSR1) generated at end of reception of 2nd frame, no error RXD1 Frame 1 Frame 2
Reception interrupt not generated at end of reception of 3rd frame, occurrence of error RXD1 Frame 3 Frame 3
Value of OVE1 bit of ASIS1 register becomes 1. * Start of reception of 3rd frame and 4th frame before performing reception processing Reception completion interrupt (INTSR1) generated at end of reception of 2nd frame, no error RXD1 Frame 1 Frame 2
No reception completion interrupt generated at end of reception of 3rd frame, occurrence of error RXD1 Frame 3 Frame 3 Value of OVE1 bit of ASIS1 register becomes 1. Reception completion interrupt (INTSR1) generated at end of reception of 4th frame, no error RXD1 Frame 3 Frame 4
Value of OVE1 frame of ASIS1 register remains 1. * Start of reception of 3rd frame before performing reception processing, start of reception of 4th frame after reception processing Reception completion interrupt (INTSR1) generated at end of reception of 2nd frame, no error RXD1 Frame 1 Frame 2
Reception completion interrupt not generated at end of reception of 3rd frame, occurrence of error RXD1 Frame 3 Frame 3
Value of OVE1 bit of ASIS1 register becomes 1. Value of OVE1 flag becomes 0 during reception processing. Reception completion interrupt (INTSR1) generated at end of reception of 4th frame, no error RXD1 Frame 3 Frame 4
No occurrence of error
436
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(5) 2-frame continuous transmission shift register 1 (TXS1)/transmission shift register L1 (TXSL1) The TXS1 register is a 9-bit/2-frame continuous transmission processing shift register. started by writing data to this register. A transmission completion interrupt request (INTST1) is generated in synchronization with the end of transmission of 1 frame or 2 frames including the TXS1 data. For 16-bit access to this register, specify TXS1, and for access to the lower 8 bits, specify TXSL1. The TXS1 register is write-only in 16-bit units, and the TXSL1 register is write-only in 8-bit units. Caution TXS1, TXSL1 can be read, but since shifting is done in synchronization with the shift clock, the data that is read cannot be guaranteed. Transmission is
[2-frame continuous transmission shift register 1]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Address After reset
TXS1 TXS15 TXS14 TXS13 TXS12 TXS11 TXS10 TXS9 TXS8 TXS7 TXS6 TXS5 TXS4 TXS3 TXS2 TXS1 TXS0 FFFFFA24H Undefined
[Transmission shift register L1]
7 6 5 4 3 2 1 0 Address After reset
TXSL1 TXS7 TXS6 TXS5 TXS4 TXS3 TXS2 TXS1 TXS0 FFFFFA26H Undefined
Bit position 15 to 0
Bit name TXB15 to TXB0 Write transmit data.
Function
User's Manual U15195EJ3V0UD
437
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.3.4 Interrupt requests The following two types of interrupt request are generated from UART1. * * Reception completion interrupt (INTSR1) Transmission completion interrupt (INTST1)
The reception completion interrupt has higher default priority than the transmission completion interrupt. Table 10-5. Default Priority of Generated Interrupts Interrupt Reception completion Transmission completion Priority 1 2
(1) Reception completion interrupt (INTSR1) In the reception enabled state, the reception completion interrupt (INTSR1) is generated when data in the reception shift register undergoes shift-in processing and is transferred to the reception buffer. The reception completion interrupt request (INTSR1) is generated following stop-bit sampling and upon the occurrence of an error. In the reception disabled state, no reception completion interrupt is generated. Caution A reception completion interrupt (INTSR1) is generated when the last bit of receive data (stop bit) is received. (2) Transmission completion interrupt (INTST1) Since UART1 does not have a transmission buffer, a transmission completion interrupt request (INTST1) is generated when one frame of data containing 7-bit or 8-bit characters or two frames of data containing 9-bit characters are shifted out from the transmission shift register (TXS1, TXSL1).
438
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.3.5 Operation (1) Data format Full-duplex serial data is transmitted and received. Figure 10-17 shows the format of transmit/receive data. One data frame consists of a start bit, character bits, a parity bit, and a stop bit(s). When 2 data frame transfer is set, both frames have the above-described format. Specification of the character bit length in one data frame, parity selection, and specification of the stop bit length is done using asynchronous serial interface mode register 10 (ASIM10). Specification of the number of frames and specification of the extension bit is mode using asynchronous serial interface mode register 11 (ASIM11). Data is transmitted LSB first. Figure 10-17. Asynchronous Serial Interface Transmit/Receive Data Format (a) 1-frame format
1 frame Data Start bit D0 D1 D2 D3 D4 D5 D6 D7
Parity/ extension bit
Stop bit
(b) 2-frame format
Higher frame Data
Lower frame
Start D8 D9 D10 D11 D12 D13 D14 D15 Parity Stop Start D0 D1 D2 D3 D4 D5 D6 D7 Parity Stop bit bit bit bit bit bit
* 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
Caution The extension bit is invalid in the 2-frame continuous mode or when a parity bit is added.
User's Manual U15195EJ3V0UD
439
CHAPTER 10 SERIAL INTERFACE FUNCTION
Table 10-6. ASIM10, ASIM11 Register Settings and Data Format
ASIM10, ASIM11 Register Settings CL Bit 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 PS1 Bit 0 PS0 Bit 0 SL Bit 0 EBS Bit 0 D0 to D6 DATA DATA DATA DATA 1 0 DATA DATA DATA DATA 0 1 DATA DATA DATA DATA 1 1 DATA DATA DATA DATA D7 Stop bit Parity bit DATA DATA Stop bit Parity bit DATA DATA Stop bit Parity bit DATA DATA Stop bit Parity bit DATA DATA Data Format D8 Stop bit Stop bit Parity bit Stop bit Stop bit Stop bit Parity bit Stop bit DATA Parity bit Stop bit Stop bit DATA Parity bit D9 Stop bit Stop bit Stop bit Stop bit Stop bit Stop bit Stop bit Stop bit Stop bit D10 Stop bit Stop bit Stop bit
Other than PS1 = PS0 = 0 0 0
Other than PS1 = PS0 = 0 0 0
Other than PS1 = PS0 = 0 0 0
Other than PS1 = PS0 = 0 0 0
Other than PS1 = PS0 = 0 0 0
Other than PS1 = PS0 = 0 0 0
Other than PS1 = PS0 = 0 0 0
Other than PS1 = PS0 = 0
440
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(2) Transmission operation The transmission operation is started by writing data to 2-frame continuous transmission shift register 1 (TXS1)/transmission shift register L1 (TXSL1). Following data write, the start bit is transmitted from the next shift timing. Since the UART1 does not have a CTS (transmission enable signal) input pin, use a port when the other party confirms the reception enabled status. (a) Transmission operation start The transmission operation is started by writing transmit data to 2-frame continuous transmission shift register 1 (TXS1)/transmission shift register L1 (TXSL1). Then data is output in sequence from LSB to the TXD1 pin (transmission in sequence from the start bit). A start bit, parity bit, and stop bit(s) are automatically added. (b) Transmission interrupt request When the transmission shift register becomes empty upon completion of the transmission of 1 or 2 frames of data, a transmission completion interrupt request (INTST1) is generated. The INTST1 interrupt generation timing differs depending on the specification of the stop bit length. The INTST1 interrupt is generated at the same time that the last stop bit is output. The transmission operation remains stopped until the data to be transmitted next has been written to the TXS1/TXSL1 registers. Figure 10-18 shows the INTST1 interrupt generation timing. Cautions 1. Normally, the transmission completion interrupt (INTST1) is generated when the transmission shift register becomes empty. However, if the transmission shift register has become empty due to input of RESET, no transmission completion interrupt (INTST1) is generated. 2. No data can be written to the TXS1 or TXSL1 registers during a transmission operation until INTST1 is generated. Even if data is written, this does not affect the transmission operation.
User's Manual U15195EJ3V0UD
441
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-18. Asynchronous Serial Interface Transmission Completion Interrupt Timing
(a) When stop bit length = 1 bit
TXD1 (output)
Start
D0
D1
D2
D6
D7
Parity
Stop
INTST1 interrupt
Flag in transmission (SOT1)
(b) When stop bit length = 2 bits
TXD1 (output)
Start
D0
D1
D2
D6
D7
Parity
Stop
INTST1 interrupt
Flag in transmission (SOT1)
(c) In 2-frame continuous transmission mode
TXD1 (output)
Start
D0
D1
Parity
Stop
Start
D1
D5
D6
D7 Parity
Stop
1st frame INTST1 interrupt
2nd frame
Flag in transmission (SOT1)
442
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(3) Continuous transmission of 3 or more frames In addition to the 1-frame/2-frame transmission function, UART1 also enables continuous transmission of 3 or more frames, using the method shown below. (a) How to continuously transmit 3 or more frames (when the stop bit is 1 bit (SL bit = 0)) Three frames can be continuously transmitted by writing transmit data to the TXS1/TXSL1 register in the period between the generation of the transmission completion interrupt request (INTST1) and 4 x 2/fXX before the output of the last stop bit. The INTST1 interrupt becomes high level 2/fXX after being output and returns to low level 2/fXX later. TXS1/TXSL1 can only be written after the INTST1 interrupt level has fallen. The time from INTST1 interrupt generation to the completion of transmit data writing (t) is therefore indicated by the following expression. t = (Time of one stop bit) - (2 x 2/fXX + 4 x 2/fXX) fXX = Internal system clock Caution 4 x 2/fXX has a margin of double the clock that can actually be used for operation. Example Count clock frequency = 32 MHz = 32,000,000 Hz Target baud rate in synchronous mode = 9,600 bps t = (1/9615.385) - ( (4 + 8) /32,000,000) = 104.000 - 0.375 = 103.625 [s] Therefore, be sure to write transmit data to TXS1/TXSL1 within 103 s of the generation of the INTST1 interrupt. Note, however, that because writing to TXS1/TXSL1 may be delayed depending on the priority order of the interrupt or the interrupt servicing time, be sure to allow sufficient time for writing transmit data after the INTST1 interrupt has been generated. If there is not enough time for continuous transmission due to a delay in writing to TXS1/TXSL1, a 1-bit high level is transmitted. Note also that if the stop bit length is 2 bits (SL = 1), the INTST1 interrupt will be generated when the second stop bit is output. Figure 10-19. Continuous Transmission of 3 or More Frames
2/fXX
Stop bit
INTST1 interrupt 4 x 2/fXX
2/fXX 2/fXX
TXS1/TXSL1 write period for 3-frame continuous transmission
User's Manual U15195EJ3V0UD
443
CHAPTER 10 SERIAL INTERFACE FUNCTION
(4) Reception operation The reception wait status is entered by setting the RXE1 bit of the ASIM10 register to 1. To start the reception operation, first perform start bit detection. Start bit detection is done by performing sampling of the RXD1 pin. When the reception operation is started, serial data is stored in the reception shift register in order at the set baud rate. Each time reception of 2 frames or 1 frame of RXB1 or RXBL1 data has been completed, a reception completion interrupt (INTSR1) is generated. Receive data is transmitted from the reception buffer (RXB1/RXBL1) to memory when this interrupt is serviced. (a) Reception enabled status The reception operation is enabled by setting (1) the RXE1 bit of the ASIM10 register. * RXE1 = 1: Reception enabled status * RXE1 = 0: Reception disabled status In the reception disabled status, the reception hardware is in standby in an initialized state. At this time, no reception completion interrupt is generated, and the contents of the reception buffer are held. (b) Start of reception operation The reception operation is started by detection of the start bit. * In asynchronous mode (MOD bit of ASIM11 register = 0) The RXD1 pin is sampled using the serial clock from the baud rate generator. After 8 serial clocks have been output following detection of the falling edge of the RXD1 pin, the RXD1 pin is again sampled. If a low level is detected at this time, the falling edge of the RXD1 pin is interpreted as a start bit, the operation shifts to reception processing, and the RXD1 pin input is sampled from this point on in units of 16 serial clock output. If the high level is detected during sampling after 8 serial clocks from detection of the falling edge of the RXD1 pin, this falling edge is not recognized as a start bit. The serial clock counter that generates the sample timing is initialized and stops, and input of the next falling edge is waited for. * In synchronous mode (MOD bit of ASIM11 register = 1) The RXD1 pin is sampled using the serial clock from the baud rate generator or at the rising edge of serial clock input/output. If the RXD1 pin is low level at this time, this is interpreted as a start bit and reception processing starts. If reception data is interrupted at the fixed low level during reception, reception of this receive data (including error detection) is completed and reception completion interrupt is generated. However, even if the RXD line is fixed at low level, the next reception operation is not started (start bit detection is not performed). Be sure to set the high level when restarting the reception operation. If the high level is not set, the start bit detection position becomes undefined, and correct reception operation cannot be performed.
444
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(c) Reception completion interrupt request When reception of one frame of data has been completed (stop bit detection) when the RXE1 bit of the ASIM10 register = 1, the receive data in the shift register is transferred to RXB1/RXBL1 and a reception completion interrupt request (INTSR1) is generated after 1 frame or 2 frames of data have been transferred to RXB1/RXBL1. A reception completion interrupt is also generated upon detection of an error. When the RXE1 bit = 0 (reception disabled), no reception completion interrupt is generated.
User's Manual U15195EJ3V0UD
445
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-20. Asynchronous Serial Interface Reception Completion Interrupt Timing
(a) When stop bit length = 1 bit
RXD1 (input)
Start
D0
D1
D2
D6
D7
Parity
Stop
INTSR1 interrupt
Flag in reception (SIR1)
(b) When stop bit length = 2 bits
RXD1 (input)
Start
D0
D1
D2
D6
D7
Parity
Stop
INTSR1 interrupt
Flag in reception (SIR1)
(c) In 2-frame continuous transmission mode
RXD1 (input)
Start
D0
D1
Parity
Stop
Start
D1
D5
D6
D7 Parity
Stop
1st frame INTSR1 interrupt
2nd frame
Flag in reception (SIR1)
Cautions 1. Even if a reception error occurs, be sure to read 2-frame continuous reception buffer register 1 (RXB1)/reception buffer register 1 (RXBL1). If the RXB1 or RXBL1 register is not read, an overrun error will occur at the next data reception, and the reception error state will continue indefinitely. 2. Reception is always performed with a stop bit length of 1 bit. A second stop bit is ignored.
446
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(5) Reception errors The flags for the three types of errors: parity errors, framing errors, and overrun errors, are affected in synchronization with reception operation. As a result of data reception, the PE1, FE1, and OVE1 flags of the ASIS1 register are set (1) and a reception completion interrupt request (INTSR1) is generated at the same time. The contents of error that occurred during reception can be detected by reading the contents of the PE1, FE1, and OVE1 flags of the ASIS1 register during the INTSR1 interrupt servicing. The contents of the ASIS1 register are reset (0) by reading the ASIS1 register (if the next receive data contains an error, the corresponding error flag is set (1)). Table 10-7. Reception Error Causes
Error Flag PE1 Reception Error Parity error Causes The parity specification during transmission did not match the parity of the reception data No stop bit was detected The reception of the next data was completed before data was read from the reception buffer
FE1 OVE1
Framing error Overrun error
(6) Parity types and corresponding operation A parity bit is used to detect a bit error in communication data. Normally, the same type of parity bit is used at the transmission and reception sides. (a) Even parity <1> During transmission The parity bit is controlled so that number of bits with the value "1" within the transmit data including the parity bit is even. The parity bit value is as follows. * If the number of bits with the value "1" within the transmit data is odd: 1 * If the number of bits with the value "1" within the transmit data is even: 0 <2> During reception The number of bits with the value "1" within the receive data including the parity bit is counted, and a parity error is generated if this number is odd.
User's Manual U15195EJ3V0UD
447
CHAPTER 10 SERIAL INTERFACE FUNCTION
(b) Odd parity <1> During transmission In contrast to even parity, the parity bit is controlled so that the number of bits with the value "1" within the transmit data including the parity bit is odd. The parity bit value is as follows. * If the number of bits with the value "1" within the transmit data is odd: 0 * If the number of bits with the value "1" within the transmit data is even: 1 <2> During reception The number of bits with the value "1" within the receive data including the parity bit is counted, and a parity error is generated if this number is even. (c) 0 parity During transmission, the parity bit is set to "0" regardless of the transmit data. During reception, no parity bit check is performed. Therefore, no parity error is generated regardless of whether the parity bit is "0" or "1". (d) No parity No parity bit is added to the transmit data. During reception, the receive operation is performed as if there were no parity bit. Since there is no parity bit, no parity error is generated.
448
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.3.6 Synchronous mode The synchronous mode can be set with the ASCK1 pin, which is the serial clock I/O pin. The synchronous mode is set with the MOD bit of the ASIM11 register, and the serial clock to be used for synchronization is selected with the SCLS bit of the ASIM10 register. In the synchronous mode, external clock input is selected when the value of the SCLS bit is 0 (default), and the serial clock output is selected in the case of all other settings. Therefore, when performing settings, make sure that outputs between connection nodes do not conflict. In the synchronous mode, the falling edge of the serial clock is used as the transmission timing, and the rising edge as the reception timing, but transmit data is output with a delay of 1 system clock (serial clock) (in the external clock synchronous mode, the maximum delay is 2.5 system clocks). Figure 10-21. Transmission/Reception Timing in Synchronous Mode
ASCK1
Output data (TXD1) Input data (RXD1)
Start
D0
D1
D2
D3
D4
D5
D6
D7
Parity
Stop
Start
D0
D1
D2
D3
D4
D5
D6
D7
Parity
Stop
On the data output side, the data changes at the falling edge of the serial clock output. On the data input side, the data is latched at the rising edge of the serial clock output. Serial clock output continues as long as the setting is not canceled.
User's Manual U15195EJ3V0UD
449
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-22. Transmission/Reception Timing Chart for Synchronous Mode (1/3)
(a) In 1-frame transmission/reception mode
Serial clock
Transmit data Stop bit Transmission register write signal Flag in transmission (SOT1) Transmission completion interrupt (INTST1) Flag in reception (SIR1) Reception completion interrupt (INTSR1) Reception buffer (RXB1) Reception buffer (RXBL1)
Undefined (hold previous value)
005AH
Undefined (hold previous value)
5AH
450
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-22. Transmission/Reception Timing Chart for Synchronous Mode (2/3)
(b) In 2-frame continuous transmission/reception mode
Serial clock
Transmit data Transmission register write signal
Stop bit
Stop bit
Flag in transmission (SOT1) Transmission completion interrupt (INTST1)
Flag in reception (SIR1) Reception completion interrupt (INTSR1) Reception buffer (RXBL1)
Undefined (hold previous value)
5A5AH
5A15H
Reception buffer (RXBL1)
Undefined (hold previous value)
5AH
15H
User's Manual U15195EJ3V0UD
451
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-22. Transmission/Reception Timing Chart for Synchronous Mode (3/3)
(c) Transmission/reception timing and transmit data timing during serial clock output
Serial clock (output) System clock Transmit data Transmission timing Reception timing
Note
Note The transmit data is delayed by 1 system clock in relation to the serial clock.
(d) Transmission/reception timing and transmit data timing using external serial clock
External serial clock System clock Transmit data Transmission timing Reception timing
Note
Note Since, during external serial clock synchronization, synchronization is done with the internal system clock when feeding the external serial clock to the internal circuit, a delay ranging from 1 system clock to a maximum of 2.5 system clocks results.
452
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-23. Reception Completion Interrupt and Error Interrupt Generation Timing During Synchronous Mode Reception
(a) During normal operation (in 1-frame reception mode)
Receive data Flag in reception (SIR1) Reception completion interrupt (INTSR1) Error interrupt START STOP
(b) In 2-frame continuous reception mode
Receive data Flag in reception (SIR1) Reception completion interrupt (INTSR1) Error interrupt (2) (3) START STOP START STOP (1)
(1) If the start bit of the second frame is not detected, no reception completion interrupt is generated. (2) If an error occurs in the first frame, an error interrupt is generated following detection of the stop bit of the first frame (at the calculated position). (3) If an error occurs in the second frame, an error interrupt is generated simultaneously with a reception completion interrupt. If an error occurs in the first frame, no error interrupt is generated even if an error occurs in the second frame.
User's Manual U15195EJ3V0UD
453
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.3.7 Dedicated baud rate generator 1 (BRG1) (1) Configuration of baud rate generator 1 (BRG1) For UART1, the serial clock can be selected from the dedicated baud rate generator output or internal system clock (fXX) for each channel. The serial clock source is specified by register ASIM10. If dedicated baud rate generator output is specified, BRG1 is selected as the clock source. Since the same serial clock can be shared for transmission and reception for one channel, baud rate is the same for the transmission/reception. Figure 10-24. Block Diagram of Baud Rate Generator 1 (BRG1)
fXX/2
Selector
fXX/4
8-bit timer counter
fXX/8
fXX/16 Match detector 1/2 UART1
BGCS1, BGCS0 PRSCM1
Remark
fXX: Internal system clock
454
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(2) Dedicated baud rate generator 1 (BRG1) BRG1 is configured of an 8-bit timer counter for baud rate signal generation, a prescaler mode register that controls the generation of the baud rate signal (PRSM1), a prescaler compare register that sets the value of the 8-bit timer counter (PRSCM1), and a prescaler. (a) Input clock The internal system clock (fXX) is input to BRG1. (b) Prescaler mode register 1 (PRSM1) The PRSM1 register controls generation of the UART1 baud rate signal. These registers can be read/written in 8-bit or 1-bit units. Cautions 1. Do not change the values of the BGCS1 and BGCS0 bits during transmission/ reception operations. 2. Set PRSM1 bits other than the UARTCE1 bit prior to setting the UARTCE1 bit to 1.
<7> PRSM1 UARTCE1
6 0
5 0
4 0
3 0
2 0
1 BGCS1
0 BGCS0
Address FFFFFA2EH
After reset 00H
Bit position 7
Bit name UARTCE1
Function Enables baud rate counter operation. 0: Stops baud rate counter operation and fixes baud rate output signal to 0. 1: Enables baud rate counter operation and starts baud rate output. Selects count clock to baud rate counter.
1, 0
BGCS1, BGCS0
BGCS1 0 0 1 1
BGCS0 0 1 0 1 fXX/2 fXX/4 fXX/8 fXX/16
Count clock selection
Remark fXX: Internal system clock
User's Manual U15195EJ3V0UD
455
CHAPTER 10 SERIAL INTERFACE FUNCTION
(c) Prescaler compare register 1 (PRSCM1) PRSCM1 is an 8-bit compare register that sets the value of the 8-bit timer counter. This register can be read/written in 8-bit units. Cautions 1. The internal timer counter is cleared by writing to the PRSCM1 register. Therefore, do not overwrite the PRSCM1 register during a transmission operation. 2. Perform PRSCM1 register settings prior to setting the UARTCE1 bit to 1. If the contents of the PRSCM1 register are overwritten when the value of the UARTCE1 bit is 1, the cycle of the baud rate signal is not guaranteed.
7
6
5
4
3
2
1
0
Address
After reset 00H
PRSCM1 PRSCM7 PRSCM6 PRSCM5 PRSCM4 PRSCM3 PRSCM2 PRSCM1 PRSCM0 FFFFFA30H
(d) Baud rate generation First, when the UARTCE1 bit of the PRSM1 register is overwritten by 1, the 8-bit timer counter for baud rate signal generation starts counting up with the clock selected by bits BGCS1 and BGCS0 of the PRSM1 register. The count value of the 8-bit timer counter is compared with the value of the PRSCM1 register, and if these values match, a timer count clock pulse of 1 cycle is output to the output controller for the baud rate. The output controller for the baud rate reverses the baud rate signal in synchronization with the rising edge of the timer count clock when this pulse is "1". (e) Cycle of baud rate signal The cycle of the baud rate signal is calculated as follows. * * When setting value of PRSCM1 register is 00H (Cycle of signal selected by bits BGCS1, BGCS0 of PRSM1 register) x 256 x 2 In cases other than above (Cycle of signal selected by bits BGCS1, BGCS0 of PRSM1 register) x (setting value of PRSCM1 register) x 2
456
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(f) Baud rate setting value The formulas for calculating the baud rate in the asynchronous mode and the synchronous mode and the formula for calculating the error are as follows. <1> Formula for calculating baud rate in asynchronous mode
Baud rate =
fXX 2 x m x 2 x 16
k
[bps]
fXX = Internal system clock frequency [Hz] = CPU clock/2 [Hz] m: Setting value of PRSCM1 register (1 m 256
Note
)
k: Value set by bits BGCS1, BGCS0 of PRSM1 register (k = 0, 1, 2, 3)
Note The setting of m = 256 is performed by writing 00H to the PRSCM1 register.
<2> Formula for calculating the baud rate in synchronous mode
Baud rate =
fXX 2xmx2
k
[bps]
fXX = Internal system clock frequency [Hz] = CPU clock/2 [Hz] m: Setting value of PRSCM1 register (1 m 256
Note
)
k: Value set by bits BGCS1, BGCS0 of PRSM1 register (k = 0, 1, 2, 3)
Note The setting of m = 256 is performed by writing 00H to the PRSCM1 register.
<3> Formula for calculating error
Error [%] =
Actual baud rate - Desired baud rate Desired baud rate
x 100
Example (9,520 - 9,600)/9,600 x 100 = -0.833 [%]
Remark
Actual baud rate: Baud rate with error Desired baud rate: Normal baud rate
User's Manual U15195EJ3V0UD
457
CHAPTER 10 SERIAL INTERFACE FUNCTION
<4> Baud rate setting example In an actual system, the output of a prescaler module, etc. is connected to the input clock. Table 108 shows the baud rate generator setting data at this time. Table 10-8. Baud Rate Generator Setting Data (BRG = fXX/2) (a) When fXX = 32 MHz
Desired Baud Rate Synchronous Mode 4,800 9,600 19,200 38,400 76,800 153,600 166,400 307,200 614,400 1,228,800 2,457,600 Asynchronous Mode 300 600 1,200 2,400 4,800 9,600 10,400 19,200 38,400 76,800 153,600 Actual Baud Rate Synchronous Mode 4,807.692 9,615.385 19,230.77 38,461.54 76,923.08 153,846.2 166,666.7 307,692.3 615,384.6 1,142,857 2,666,667 Asynchronous Mode 300.4808 600.9615 1,201.923 2,403.846 4,807.692 9,615.385 10,416.67 19,230.77 38,461.54 71,428.57 166,666.7 BGCSm Bit (m = 0, 1) PRSCM1 Register Setting Value 208 104 52 26 13 13 24 13 13 7 3 Error
3 3 3 3 3 2 1 1 0 0 0
0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 0.16 -6.99 8.51
(b) When fXX = 40 MHz
Desired Baud Rate Synchronous Mode 4,800 9,600 19,200 38,400 76,800 153,600 166,400 307,200 614,400 1,228,800 2,457,600 Asynchronous Mode 300 600 1,200 2,400 4,800 9,600 10,400 19,200 38,400 76,800 153,600 Actual Baud Rate Synchronous Mode 4,882.813 9,615.385 19,230.77 38,461.54 76,923.08 153,846.2 166,666.7 303,030.3 625,000 1,250,000 2,500,000 Asynchronous Mode 305.1758 600.9615 1,201.923 2,403.846 4,807.692 9,615.385 10,416.67 18,939.39 39,062.5 78,125 156,250 BGCSm Bit (m = 0, 1) PRSCM1 Register Setting Value 256 130 65 65 65 65 60 33 16 8 4 Error
3 3 3 2 1 0 0 0 0 0 0
1.73 0.16 0.16 0.16 0.16 0.16 0.16 -1.36 1.73 1.73 1.73
458
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(3) Allowable baud rate range during reception The degree to which a discrepancy from the transmission destination's baud rate is allowed during reception is shown below. Caution The equations described below should be used to set the baud rate error during reception so that it always is within the allowable error range. Figure 10-25. Allowable Baud Rate Range During Reception
Latch timing UART1 transfer rate
Start bit
Bit 0 FL
Bit 1
Bit 7
Parity bit
Stop bit
1 data frame (11 x FL)
Minimum allowable transfer rate
Start bit
Bit 0
Bit 1
Bit 7
Parity bit
Stop bit
FLmin
Maximum allowable transfer rate
Start bit
Bit 0
Bit 1
Bit 7
Parity bit
Stop bit
FLmax
As shown in Figure 10-25, after the start bit is detected, the receive data latch timing is determined according to the counter that was set by the PRSCM1 register. If all data up to the final data (stop bit) is in time for this latch timing, the data can be received normally. If this is applied to 11-bit reception, the following is theoretically true. FL = (Brate)
-1
Brate: UART1 baud rate k: FL: PRSCM1 register setting value 1-bit data length
When the latch timing margin is 2 clocks of fXX/2, the minimum allowable transfer rate (FLmin) is as follows (fXX: Internal system clock). FL min = 11x FL - k-2 2k x FL = 21k + 2 2k
FL
User's Manual U15195EJ3V0UD
459
CHAPTER 10 SERIAL INTERFACE FUNCTION
Therefore, the transfer destination's maximum receivable baud rate (BRmax) is as follows.
BRmax = (FLmin/11)- =
1
22k 21k + 2 Brate
Similarly, the maximum allowable transfer rate (FLmax) can be obtained as follows. 21k - 2 k+2 10 FL x FL = x FL max = 11x FL - 2xk 2xk 11 21k - 2 FL x 11 FL max = 20k Therefore, the transfer destination's minimum receivable baud rate (BRmin) is as follows.
BRmin = (FLmax/11)- =
1
20k 21k - 2
Brate
(4) Transfer rate in 2-frame continuous reception In 2-frame continuous reception, the timing is initialized by detecting the start bit of the second frame, so the transfer results are not affected.
460
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.4 Clocked Serial Interfaces 0, 1 (CSI0, CSI1)
10.4.1 Features
* * * * * * *
High-speed transfer: Maximum 4 Mbps Half-duplex communications Master mode or slave mode can be selected Transmission data length: 8 bits or 16 bits can be set Transfer data direction can be switched between MSB first and LSB first Eight clock signals can be selected (7 master clocks and 1 slave clock) 3-wire type SOn: SIn: SCKn: Serial transmit data output Serial receive data input Serial clock I/O
* Interrupt sources: 1 type
* Transmission/reception completion interrupt (INTCSIn)
* Transmission/reception mode and reception-only mode can be specified * Two transmission buffers (SOTBFn/SOTBFLn, SOTBn/SOTBLn) and two reception buffers (SIRBn/SIRBLn,
SIRBEn/SIRBELn) are provided on chip
* Single transfer mode and repeat transfer mode can be specified
Remark n = 0, 1
User's Manual U15195EJ3V0UD
461
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.4.2 Configuration CSIn is controlled via the clocked serial interface mode register (CSIMn) (n = 0, 1). Transmission/reception of data is performed by reading/writing the SIOn register (n = 0, 1). (1) Clocked serial interface mode registers 0, 1 (CSIM0, CSIM1) The CSIMn register is an 8-bit register that specifies the operation of CSIn. (2) Clocked serial interface clock selection registers 0, 1 (CSIC0, CSIC1) The CSICn register is an 8-bit register that controls the CSIn serial transfer operation. (3) Serial I/O shift registers 0, 1 (SIO0, SIO1) The SIOn register is a 16-bit shift register that converts parallel data into serial data. The SIOn register is used for both transmission and reception. Data is shifted in (reception) and shifted out (transmission) from the MSB or LSB side. The actual transmission/reception operations are started up by accessing the buffer register. (4) Serial I/O shift registers L0, L1 (SIOL0, SIOL1) The SIOLn register is an 8-bit shift register that converts parallel data into serial data. The SIOLn register is used for both transmission and reception. Data is shifted in (reception) and shifted out (transmission) from the MSB or LSB side. The actual transmission/reception operations are started up by access of the buffer register . (5) Clocked serial interface reception buffer registers 0, 1 (SIRB0, SIRB1) The SIRBn register is a 16-bit buffer register that stores receive data. (6) Clocked serial interface reception buffer registers L0, L1 (SIRBL0, SIRBL1) The SIRBLn register is an 8-bit buffer register that stores receive data. (7) Clocked serial interface read-only reception buffer registers 0, 1 (SIRBE0, SIRBE1) The SIRBEn register is a 16-bit buffer register that stores receive data. The SIRBEn register is the same as the SIRBn register. It is used to read the contents of the SIRBn register. (8) Clocked serial interface read-only reception buffer registers L0, L1 (SIRBEL0, SIRBEL1) The SIRBELn register is an 8-bit buffer register that stores receive data. The SIRBELn register is the same as the SIRBLn register. It is used to read the contents of the SIRBLn register. (9) Clocked serial interface transmission buffer registers 0, 1 (SOTB0, SOTB1) The SOTBn register is a 16-bit buffer register that stores transmit data. (10) Clocked serial interface transmission buffer registers L0, L1 (SOTBL0, SOTBL1) The SOTBLn register is an 8-bit buffer register that stores transmit data. (11) Clocked serial interface initial transmission buffer registers (SOTBF0, SOTBF1) The SOTBFn register is a 16-bit buffer register that stores the initial transmit data in the repeat transfer mode.
462
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(12) Clocked serial interface initial transmission buffer register L (SOTBFL0, SOTBFL1) The SOTBFLn register is an 8-bit buffer register that stores initial transmit data in the repeat transfer mode. (13) Selector The selector selects the serial clock to be used. (14) Serial clock controller Controls the serial clock supply to the shift register. Also controls the clock output to the SCKn pin when the internal clock is used. (15) Serial clock counter Counts the serial clock output or input during transmission/reception operation, and checks whether 8-bit or 16-bit data transmission/reception has been performed. (16) Interrupt controller Controls the interrupt request timing.
User's Manual U15195EJ3V0UD
463
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-26. Block Diagram of Clocked Serial Interface
fXX/27 fXX/26 fXX/25 fXX/24 fXX/23 fXX/22 BRG3 SCKn Selector
Serial clock controller Clock start/stop control & clock phase control SCKn
Interrupt controller
INTCSIn
Transmission control
Transmission data control
Initial transmit buffer register (SOTBFn/SOTBFLn)
Control signal
SO selection
SOn
Transmit buffer register (SOTBn/SOTBLn)
SIn
Shift register (SIOn/SIOLn)
SO latch
Receive buffer register (SIRBn/SIRBLn)
Remarks 1. n = 0, 1 2. fXX: Internal system clock 3. The SO1, SI1, and SCK1 pins function alternately as the TXD1, RXD1, and ASCK1 pins.
464
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.4.3 Control registers Because CSI1 shares its pins with UART1, the CSI1 mode must be preset by using the PMC3 and RFC3 registers (refer to 10.1.1 Selecting mode of UART1 or CSI1). (1) Clocked serial interface mode registers 0, 1 (CSIM0, CSIM1) The CSIMn register controls the CSIn operation (n = 0, 1). These registers can be read/written in 8-bit or 1-bit units (however, bit 0 is read-only). Caution Overwriting the TRMDn, CCL, DIRn, CSIT, and AUTO bits of the CSIMn register can be done only when the CSOTn bit = 0. If these bits are overwritten at any other time, the operation cannot be guaranteed.
User's Manual U15195EJ3V0UD
465
CHAPTER 10 SERIAL INTERFACE FUNCTION
<7>
<6>
5 CCL 5 CCL
<4> DIR0 <4> DIR1
3 CSIT 3 CSIT
2 AUTO 2 AUTO
1 0 1 0
<0> CSOT0 <0> CSOT1
Address FFFFF900H Address FFFFF910H
After reset 00H After reset 00H
CSIM0 CSICAE0 TRMD0 <7> <6>
CSIM1 CSICAE1 TRMD1
Bit position 7
Bit name CSICAEn Enables/disables CSIn operation. 0: Enables CSIn operation. 1: Disables CSIn operation.
Function
The internal CSIn circuit can be reset asynchronously by setting the CSICAEn bit to 0. For the SCKn and SOn pin output status when the CSICAEn bit = 0, refer to 10.4.5 Output pins. 6 TRMDn Specifies transmission/reception mode. 0: Receive-only mode 1: Transmission/reception mode When the TRMDn bit = 0, receive-only transfer is performed and the SOn pin output is fixed to low level. Data reception is started by reading the SIRBn register. When the TRMDn bit = 1, transmission/reception is started by writing data to the SOTBn register. 5 CCL Specifies data length. 0: 8 bits 1: 16 bits Specifies transfer direction mode (MSB/LSB). 0: First bit of transfer data is MSB 1: First bit of transfer data is LSB Controls delay of interrupt request signal. 0: No delay 1: Delay mode (interrupt request signal is delayed 1/2 cycle). The delay mode (CSIT bit = 1) is valid only in the master mode (CKS2 to CSK0 bits of the CSICn register are not 11B). In the slave mode (CKS2 to CKS0 bits are 11B), do not set the delay mode. Caution The delay mode (CSIT bit = 1) is valid only in the master mode (CKS2 to CSK0 bits of the CSICn register are not 111B). In the slave mode (CKS2 to CKS0 bits are 111B), do not set the delay mode. 2 AUTO Specifies single transfer mode or repeat transfer mode. 0: Single transfer mode 1: Repeat transfer mode Flag indicating transfer status. 0: Idle status 1: Transfer execution status
4
DIRn
3
CSIT
0
CSOTn
Caution The CSOTn bit is cleared (0) by writing 0 to the CSICAEn bit.
Remark
n = 0, 1
User's Manual U15195EJ3V0UD
466
CHAPTER 10 SERIAL INTERFACE FUNCTION
(2) Clocked serial interface clock selection registers 0, 1 (CSIC0, CSIC1) The CSICn register is an 8-bit register that controls the CSIn transfer operation (n = 0, 1). These registers can be read/written in 8-bit or 1-bit units. Caution The CSICn register can be overwritten only when the CSICAEn bit of the CSIMn register = 0.
User's Manual U15195EJ3V0UD
467
CHAPTER 10 SERIAL INTERFACE FUNCTION
7 CSIC0 0 7 CSIC1 0
6 0 6 0
5 0 5 0
4 CKP 4 CKP
3 DAP 3 DAP
2 CKS2 2 CKS2
1 CKS1 1 CKS1
0 CKS0 0 CKS0
Address FFFFF901H Address FFFFF911H
After reset 00H After reset 00H
Bit position 4, 3
Bit name CKP, DAP Specifies operation mode. CKP 0 DAP 0
SCKn (I/O) SOn (output) SIn (input)
Function
Operation mode
DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0 DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0
0
1
SCKn (I/O) SOn (output) SIn (input) DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0 DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0
1
0
SCKn (I/O) SOn (output) SIn (input) DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0 DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0
1
1
SCKn (I/O) SOn (output) SIn (input) DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0 DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0
Remark
2 to 0 CKS2 to CKS0
n = 0, 1
Specifies input clock.
CKS2 0 0 0 0 1 1 1 1
CKS1 0 0 1 1 0 0 1 1
CKS0 0 1 0 1 0 1 0 1
Input clock fXX/2 fXX/2 fXX/2 fXX/2 fXX/2 fXX/2
7
Mode Master mode Master mode Master mode Master mode Master mode Master mode Master mode Slave mode
6
5
4
3
2
Clock generated by BRG3 External clock (SCKn)
Remark
fXX: Internal system clock frequency n = 0, 1
468
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(3) Clocked serial interface reception buffer registers 0, 1 (SIRB0, SIRB1) The SIRBn register is a 16-bit buffer register that stores receive data (n = 0, 1). When the receive-only mode is set (TRMDn bit of CSIMn register = 0), the reception operation is started by reading data from the SIRBn register. These registers are read-only, in 16-bit units. In addition to reset input, these registers can also be initialized by clearing (0) the CSICAEn bit of the CSIMn register. Cautions 1. Read the SIRBn register only when the 16-bit data length has been set (CCL bit of CSIMn register = 1). 2. When the single transfer mode has been set (AUTO bit of CSIMn register = 0), perform a read operation only in the idle state (CSOTn bit of CSIMn register = 0). If the SIRBn register is read during data transfer, the data cannot be guaranteed.
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address
After reset 0000H
SIRB0 SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB FFFFF902H 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address
After reset 0000H
SIRB1 SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB SIRB FFFFF912H 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position 15 to 0
Bit name SIRB15 to SIRB0 Stores receive data.
Function
User's Manual U15195EJ3V0UD
469
CHAPTER 10 SERIAL INTERFACE FUNCTION
(4) Clocked serial interface reception buffer registers L0, L1 (SIRBL0, SIRBL1) The SIRBLn register is an 8-bit buffer register that stores receive data (n = 0, 1). When the receive-only mode is set (TRMDn bit of CSIMn register = 0), the reception operation is started by reading data from the SIRBLn register. These registers are read-only, in 8-bit or 1-bit units. In addition to reset input, these registers can also be initialized by clearing (0) the CSICAEn bit of the CSIMn register. The SIRBLn register is the same as the lower bytes of the SIRBn register. Cautions 1. Read the SIRBLn register only when the 8-bit data length has been set (CCL bit of CSIMn register = 0). 2. When the single transfer mode is set (AUTO bit of CSIMn register = 0), perform a read operation only in the idle state (CSOTn bit of CSIMn register = 0). If the SIRBLn register is read during data transfer, the data cannot be guaranteed.
7 SIRBL0 SIRB7
6 SIRB6
5 SIRB5
4 SIRB4
3 SIRB3
2 SIRB2
1 SIRB1
0 SIRB0
Address FFFFF902H
After reset 00H
7 SIRBL1 SIRB7
6 SIRB6
5 SIRB5
4 SIRB4
3 SIRB3
2 SIRB2
1 SIRB1
0 SIRB0
Address FFFFF912H
After reset 00H
Bit position 7 to 0
Bit name SIRB7 to SIRB0 Stores receive data.
Function
470
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(5) Clocked serial interface read-only reception buffer registers 0, 1 (SIRBE0, SIRBE1) The SIRBEn register is a 16-bit buffer register that stores receive data (n = 0, 1). These registers are read-only, in 16-bit units. In addition to reset input, this register can also be initialized by clearing (0) the CSICAEn bit of the CSIMn register. The SIRBEn register is the same as the SIRBn register. It is used to read the contents of the SIRBn register. Cautions 1. The receive operation is not started even if data is read from the SIRBEn register. 2. The SIRBEn register can be read only if the 16-bit data length is set (CCL bit of CSIMn register = 1).
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address
After reset 0000H
SIRBE0 SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE FFFFF906H 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address
After reset 0000H
SIRBE1 SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE SIRBE FFFFF916H 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position 15 to 0
Bit name SIRBE15 to SIRBE0 Stores receive data.
Function
User's Manual U15195EJ3V0UD
471
CHAPTER 10 SERIAL INTERFACE FUNCTION
(6) Clocked serial interface read-only reception buffer registers L0, L1 (SIRBEL0, SIRBEL1) The SIRBELn register is an 8-bit buffer register that stores receive data (n = 0, 1). These registers are read-only, in 8-bit or 1-bit units. In addition to reset input, this register can also be initialized by clearing (0) the CSICAEn bit of the CSIMn register. The SIRBELn register is the same as the SIRBLn register. It is used to read the contents of the SIRBLn register. Cautions 1. The receive operation is not started even if data is read from the SIRBELn register. 2. The SIRBELn register can be read only if the 8-bit data length has been set (CCL bit of CSIMn register = 0).
7 SIRBEL0 SIRBE7
6 SIRBE6
5 SIRBE5
4 SIRBE4
3 SIRBE3
2 SIRBE2
1 SIRBE1
0 SIRBE0
Address FFFFF906H
After reset 00H
7 SIRBEL1 SIRBE7
6 SIRBE6
5 SIRBE5
4 SIRBE4
3 SIRBE3
2 SIRBE2
1 SIRBE1
0 SIRBE0
Address FFFFF916H
After reset 00H
Bit position 7 to 0
Bit name SIRBE7 to SIRBE0 Stores receive data.
Function
472
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(7) Clocked serial interface transmission buffer registers 0, 1 (SOTB0, SOTB1) The SOTBn register is a 16-bit buffer register that stores transmit data (n = 0, 1). When the transmission/reception mode is set (TRMDn bit of CSIMn register = 1), the transmission operation is started by writing data to the SOTBn register. This register can be read/written in 16-bit units. Cautions 1. Access the SOTBn register only when the 16-bit data length is set (CCL bit of CSIMn register = 1). 2. When the single transfer mode is set (AUTO bit of CSIMn register = 0), perform access only in the idle state (CSOTn bit of CSIMn register = 0). accessed during data transfer, the data cannot be guaranteed. If the SOTBn register is
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address
After reset 0000H
SOTB0 SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB FFFFF904H 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address
After reset 0000H
SOTB1 SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB SOTB FFFFF914H 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position 15 to 0
Bit name SOTB15 to SOTB0 Stores transmit data.
Function
User's Manual U15195EJ3V0UD
473
CHAPTER 10 SERIAL INTERFACE FUNCTION
(8) Clocked serial interface transmission buffer registers L0, L1 (SOTBL0, SOTBL1) The SOTBLn register is an 8-bit buffer register that stores transmit data (n = 0, 1). When the transmission/reception mode is set (TRMDn bit of CSIMn register = 1), the transmission operation is started by writing data to the SOTBLn register. These registers can be read/written in 8-bit or 1-bit units. The SOTBLn register is the same as the lower bytes of the SOTBn register. Cautions 1. Access the SOTBLn register only when the 8-bit data length has been set (CCL bit of CSIMn register = 0). 2. When the single transfer mode is set (AUTO bit of CSIMn register = 0), perform access only in the idle state (CSOTn bit of CSIMn register = 0). If the SOTBLn register is accessed during data transfer, the data cannot be guaranteed.
7 SOTBL0 SOTB7
6 SOTB6
5 SOTB5
4 SOTB4
3 SOTB3
2 SOTB2
1 SOTB1
0 SOTB0
Address FFFFF904H
After reset 00H
7 SOTBL1 SOTB7
6 SOTB6
5 SOTB5
4 SOTB4
3 SOTB3
2 SOTB2
1 SOTB1
0 SOTB0
Address FFFFF914H
After reset 00H
Bit position 7 to 0
Bit name SOTB7 to SOTB0 Stores transmit data.
Function
474
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(9) Clocked serial interface initial transmission buffer registers 0, 1 (SOTBF0, SOTBF1) The SOTBFn register is a 16-bit buffer register that stores initial transmission data in the repeat transfer mode (n = 0, 1). The transmission operation is not started even if data is written to the SOTBFn register. These registers can be read/written in 16-bit units. Caution Access the SOTBFn register only when the 16-bit data length has been set (CCL bit of CSIMn register = 1), and only in the idle state (CSOTn bit of CSIMn register = 0). If the SOTBFn register is accessed during data transfer, the data cannot be guaranteed.
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address
After reset 0000H
SOTBF0 SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF FFFFF908H 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address
After reset 0000H
SOTBF1 SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF SOTBF FFFFF918H 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position 15 to 0
Bit name SOTBF15 to SOTBF0
Function Stores initial transmission data in repeat transfer mode.
User's Manual U15195EJ3V0UD
475
CHAPTER 10 SERIAL INTERFACE FUNCTION
(10)
Clocked serial interface initial transmission buffer registers L0, L1 (SOTBFL0, SOTBFL1) The SOTBFLn register is an 8-bit buffer register that stores initial transmission data in the repeat transfer mode (n = 0, 1). The transmission operation is not started even if data is written to the SOTBFLn register. These registers can be read/written in 8-bit or 1-bit units. The SOTBFLn register is the same as the lower bytes of the SOTBFn register. Caution Access the SOTBFLn register only when the 8-bit data length has been set (CCL bit of CSIMn register = 0), and only in the idle state (CSOTn bit of CSIMn register = 0). If the SOTBFLn register is accessed during data transfer, the data cannot be guaranteed.
7
6
5
4
3
2
1
0
Address
After reset 00H
SOTBFL0 SOTBF7 SOTBF6 SOTBF5 SOTBF4 SOTBF3 SOTBF2 SOTBF1 SOTBF0 FFFFF908H
7
6
5
4
3
2
1
0
Address
After reset 00H
SOTBFL1 SOTBF7 SOTBF6 SOTBF5 SOTBF4 SOTBF3 SOTBF2 SOTBF1 SOTBF0 FFFFF918H
Bit position 7 to 0
Bit name SOTBF7 to SOTBF0
Function Stores initial transmission data in repeat transfer mode.
476
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(11)
Serial I/O shift registers 0, 1 (SIO0, SIO1) The SIOn register is a 16-bit shift register that converts parallel data into serial data (n = 0, 1). The transfer operation is not started even if the SIOn register is read. These registers are read-only, in 16-bit units. In addition to reset input, this register can also be initialized by clearing (0) the CSICAEn bit of the CSIMn register. Caution Access the SIOn register only when the 16-bit data length has been set (CCL bit of CSIMn register = 1), and only in the idle state (CSOTn bit of CSIMn register = 0). If the SIOn register is accessed during data transfer, the data cannot be guaranteed.
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF90AH
After reset 0000H
SIO0 SIO15 SIO14 SIO13 SIO12 SIO11 SIO10 SIO9 SIO8 SIO7 SIO6 SIO5 SIO4 SIO3 SIO2 SIO1 SIO0
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF91AH
After reset 0000H
SIO1 SIO15 SIO14 SIO13 SIO12 SIO11 SIO10 SIO9 SIO8 SIO7 SIO6 SIO5 SIO4 SIO3 SIO2 SIO1 SIO0
Bit position 15 to 0
Bit name SIO15 to SIO0
Function Data is shifted in (reception) or shifted out (transmission) from the MSB or LSB side.
User's Manual U15195EJ3V0UD
477
CHAPTER 10 SERIAL INTERFACE FUNCTION
(12)
Serial I/O shift registers L0, L1 (SIOL0, SIOL1) The SIOLn register is an 8-bit shift register that converts parallel data into serial data (n = 0, 1). The transfer operation is not started even if the SIOLn register is read. These registers are read-only, in 8-bit or 1-bit units. In addition to reset input, this register can also be initialized by clearing (0) the CSICAEn bit of the CSIMn register. The SIOLn register is the same as the lower bytes of the SIOn register. Caution Access the SIOLn register only when the 8-bit data length has been set (CCL bit of CSIMn register = 0), and only in the idle state (CSOTn bit of CSIMn register = 0). If the SIOLn register is accessed during data transfer, the data cannot be guaranteed.
7 SIOL0 SIO7
6 SIO6
5 SIO5
4 SIO4
3 SIO3
2 SIO2
1 SIO1
0 SIO0
Address FFFFF90AH
After reset 00H
7 SIOL1 SIO7
6 SIO6
5 SIO5
4 SIO4
3 SIO3
2 SIO2
1 SIO1
0 SIO0
Address FFFFF91AH
After reset 00H
Bit position 7 to 0
Bit name SIO7 to SIO0
Function Data is shifted in (reception) or shifted out (transmission) from the MSB or LSB side.
478
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.4.4 Operation (1) Single transfer mode (a) Usage In the receive-only mode (TRMDn bit of CSIMn register = 0), transfer is started by reading data buffer register (SIRBn/SIRBLn) (n = 0, 1). In the transmission/reception mode (TRMDn bit of CSIMn register = 1), transfer is started by writing to the transmit data buffer register (SOTBn/SOTBLn). In the slave mode, the operation must be enabled beforehand (CSICAEn bit of CSIMn register = 1). When transfer is started, the value of the CSOTn bit of the CSIMn register becomes 1 (transmission execution status). Upon transfer completion, the transmission/reception completion interrupt (INTCSIn) is set (1), and the CSOTn bit is cleared (0). The next data transfer request is then waited for. Notes 1. When the 16-bit data length (CCL bit of CSIMn register = 1) has been set, read the SIRBn register. When the 8-bit data length (CCL bit of CSIMn register = 0) has been set, read the SIRBLn register. 2. When the 16-bit data length (CCL bit of CSIMn register = 1) has been set, write to the SOTBn register. When the 8-bit data length (CCL bit of CSIMn register = 0) has been set, write to the SOTBLn register. Caution When the CSOTn bit of the CSIMn register = 1, do not manipulate the CSIn register.
Note 2 Note 1
the receive
User's Manual U15195EJ3V0UD
479
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-27. Timing Chart in Single Transfer Mode (1/2)
(a) In transmission/reception mode, data length: 8 bits, transfer direction: MSB first, no interrupt delay, single transfer mode, operation mode: CKP bit = 0, DAP bit = 0
SCKn (I/O) SOn (output) SIn (input) 0 1 0 1 0 1 0 1 (55H)
1
0
1
0
1
0
1
0
(AAH)
Reg_R/W SOTBLn register SIOLn register SIRBLn register CSOTn bit INTCSIn interrupt
Write 55H to SOTBLn register
55H (transmit data)
ABH
56H
ADH
5AH
B5H
6AH
D5H
AAH
AAH
Remarks 1. n = 0, 1 2. Reg_R/W: Internal signal. performed. This signal indicates that receive data buffer register (SIRBn/ SIRBLn) read or transmit data buffer register (SOTBn/SOTBLn) write was
480
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-27. Timing Chart in Single Transfer Mode (2/2)
(b) In transmission/reception mode, data length: 8 bits, transfer direction: MSB first, no interrupt delay, single transfer mode, operation mode: CKP bit = 0, DAP bit = 1
SCKn (I/O) SOn (output) SIn (input) Reg_R/W SOTBLn register SIOLn register SIRBLn register CSOTn bit INTCSIn interrupt ABH 56H 0 1 0 1 0 1 0 1 (55H)
1
0
1
0
1
0
1
0
(AAH)
Write 55H to SOTBLn register
55H (transmit data)
ADH
5AH
B5H
6AH
D5H
AAH
AAH
Remarks 1. n = 0, 1 2. Reg_R/W: Internal signal. performed. This signal indicates that receive data buffer register (SIRBn/ SIRBLn) read or transmit data buffer register (SOTBn/SOTBLn) write was
User's Manual U15195EJ3V0UD
481
CHAPTER 10 SERIAL INTERFACE FUNCTION
(b) Clock phase selection The following shows the timing when changing the conditions for clock phase selection (CKP bit of CSICn register) and data phase selection (DAP bit of CSICn register) under the following conditions. * Data length = 8 bits (CCL bit of CSIMn register = 0) * First bit of transfer data = MSB (DIRn bit of CSIMn register = 0) * No interrupt request signal delay control (CSIT bit of CSIMn register = 0) Figure 10-28. Timing Chart According to Clock Phase Selection (1/2)
(a) When CKP bit = 0, DAP bit = 0
SCKn (I/O) SIn (input) SOn (output) Reg_R/W INTCSIn interrupt CSOTn bit DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0
DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0
(b) When CKP bit = 1, DAP bit = 0
SCKn (I/O) SIn (input) SOn (output) Reg_R/W INTCSIn interrupt CSOTn bit DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0
DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0
Remarks 1. n = 0, 1 2. Reg_R/W: Internal signal. performed. This signal indicates that receive data buffer register (SIRBn/ SIRBLn) read or transmit data buffer register (SOTBn/SOTBLn) write was
482
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-28. Timing Chart According to Clock Phase Selection (2/2)
(c) When CKP bit = 0, DAP bit = 1
SCKn (I/O) SIn (input) SOn (output) Reg_R/W INTCSIn interrupt CSOTn bit DI7 DO7 DI6 DI5 DI4 DI3 DI2 DI1 DI0
DO6 DO5 DO4 DO3 DO2 DO1 DO0
(d) When CKP bit = 1, DAP bit = 1
SCKn (I/O) SIn (input) SOn (output) Reg_R/W INTCSIn interrupt CSOTn bit DI7 DO7 DI6 DI5 DI4 DI3 DI2 DI1 DI0
DO6 DO5 DO4 DO3 DO2 DO1 DO0
Remarks 1. n = 0, 1 2. Reg_R/W: Internal signal. performed. This signal indicates that receive data buffer register (SIRBn/ SIRBLn) read or transmit data buffer register (SOTBn/SOTBLn) write was
User's Manual U15195EJ3V0UD
483
CHAPTER 10 SERIAL INTERFACE FUNCTION
(c) Transmission/reception completion interrupt request signals (INTCSI0, INTCSI1) INTCSIn is set (1) upon completion of data transmission/reception. Caution The delay mode (CSIT bit = 1) is valid only in the master mode (bits CKS2 to CKS0 of the CSICn register are not 111B). The delay mode cannot be set when the slave mode is set (bits CKS2 to CKS0 = 111B). Figure 10-29. Timing Chart of Interrupt Request Signal Output in Delay Mode (1/2)
(a) When CKP bit = 0, DAP bit = 0
Input clock
SCKn (I/O)
SIn (input)
DI7
DI6
DI5
DI4
DI3
DI2
DI1
DI0
SOn (output)
DO7
DO6
DO5
DO4
DO3
DO2
DO1
DO0
Reg_R/W
INTCSIn interrupt
CSOTn bit Delay
Remarks 1. n = 0, 1 2. Reg_R/W: Internal signal. performed. This signal indicates that receive data buffer register (SIRBn/ SIRBLn) read or transmit data buffer register (SOTBn/SOTBLn) write was
484
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-29. Timing Chart of Interrupt Request Signal Output in Delay Mode (2/2)
(b) When CKP bit = 1, DAP bit = 1
Input clock
SCKn (I/O)
SIn (input)
DI7
DI6
DI5
DI4
DI3
DI2
DI1
DI0
SOn (output)
DO7
DO6
DO5
DO4
DO3
DO2
DO1
DO0
Reg_R/W
INTCSIn interrupt
CSOTn bit Delay
Remarks 1. n = 0, 1 2. Reg_R/W: Internal signal. performed. This signal indicates that receive data buffer register (SIRBn/ SIRBLn) read or transmit data buffer register (SOTBn/SOTBLn) write was
User's Manual U15195EJ3V0UD
485
CHAPTER 10 SERIAL INTERFACE FUNCTION
(2) Repeat transfer mode (a) Usage (receive-only) <1> Set the repeat transfer mode (AUTO bit of CSIMn register = 1) and the receive-only mode (TRMDn bit of CSIMn register = 0). <2> Read the SIRBn register (start transfer with dummy read). <3> Wait for the transmission/reception completion interrupt request (INTCSIn). <4> When the transmission/reception completion interrupt request (INTCSIn) has been set (1), read the SIRBn register
Note
(reserve next transfer).
<5> Repeat steps <3> and <4> (N - 2) times. (N: Number of transfer data) <6> Following output of the last transmission/reception completion interrupt request (INTCSIn), read the SIRBEn register and the SIOn register
Note
.
Note When transferring N number of data, receive data is loaded by reading the SIRBn register from the first data to the (N - 2)th data. The (N - 1)th data is loaded by reading the SIRBEn register, and the Nth (last) data is loaded by reading the SIOn register.
486
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-30. Repeat Transfer (Receive-Only) Timing Chart
SCKn (I/O) SIn (input) SIOLn register SIRBLn register Reg_RD CSOTn bit INTCSIn interrupt SOn (output) rq_clr trans_rq <1> <2> <3> <4> <3> <5> Period during which next transfer can be reserved <4> <3> <4> <6> L SIRBn (dummy) din-1 din-2 din-3 din-4 din-5 din-5 din-1 SIRBn (d1) din-2 din-3 SIRBn (d2) din-4 SIRBn (d3) SIRBEn (d4) SIOn (d5)
Remarks 1. n = 0, 1 2. Reg_RD: Internal signal. This signal indicates that the receive data buffer register (SIRBn/ SIRBLn) has been read. rq_clr: Internal signal. Transfer request clear signal. trans_rq: Internal signal. Transfer request signal.
In the case of the repeat transfer mode, two transfer requests are set at the start of the first transfer. Following the transmission/reception completion interrupt request (INTCSIn), transfer is continued if the SIRBn register can be read within the next transfer reservation period. If the SIRBn register cannot be read, transfer ends and the SIRBn register does not receive the new value of the SIOn register. The last data can be obtained by reading the SIOn register following completion of the transfer.
User's Manual U15195EJ3V0UD
487
CHAPTER 10 SERIAL INTERFACE FUNCTION
(b) Usage (transmission/reception) <1> Set the repeat transfer mode (AUTO bit of CSIMn register = 1) and the transmission/reception mode (TRMDn bit of CSIMn register = 1) <2> Write the first data to the SOTBFn register. <3> Write the 2nd data to the SOTBn register (start transfer). <4> Wait for the transmission/reception completion interrupt request (INTCSIn). <5> When the transmission/reception completion interrupt request (INTCSIn) has been set (1), write the next data to the SOTBn register (reserve next transfer), and read the SIRBn register to load the receive data. <6> Repeat steps <4> and <5> as long as data to be sent remains. <7> Wait for the INTCSIn interrupt. When the interrupt request signal is set (1), read the SIRBn register to load the (N - 1)th receive data (N: Number of transfer data). <8> Following the last transmission/reception completion interrupt request (INTCSIn), read the SIOn register to load the Nth (last) receive data.
488
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-31. Repeat Transfer (Transmission/Reception) Timing Chart
SCKn (I/O) SOn (output) SIn (input) SOTBFLn register SOTBLn register SIOLn register SIRBLn register dout-1 dout-2 dout-3 dout-4 dout-5 din-5 din-1 SOTBn (d3) SIRBn (d1) din-2 din-3 SOTBn (d4) SIRBn (d2) din-4 SOTBn (d5) SIRBn (d3) SIRBn (d4) SIOn (d5) dout-1 din-1 dout-2 din-2 dout-3 din-3 dout-4 din-4 dout-5 din-5
SOTBFn (d1) Reg_WR SOTBn (d2) Reg_RD
CSOTn bit INTCSIn interrupt rq_clr trans_rq <1> <2> <3> <4> <5> <4> <6> Period during which next transfer can be reserved <5> <4> <5> <7> <8>
Remarks 1. n = 0, 1 2. Reg_WR: Internal signal. This signal indicates that the transmit data buffer register (SOTBn/ SOTBLn) has been written. Reg_RD: Internal signal. This signal indicates that the receive data buffer register (SIRBn/ SIRBLn) has been read. rq_clr: Internal signal. Transfer request clear signal. trans_rq: Internal signal. Transfer request signal.
In the case of the repeat transfer mode, two transfer requests are set at the start of the first transfer. Following the transmission/reception completion interrupt request (INTCSIn), transfer is continued if the SOTBn register can be written within the next transfer reservation period. If the SOTBn register cannot be written, transfer ends and the SIRBn register does not receive the new value of the SIOn register. The last receive data can be obtained by reading the SIOn register following completion of the transfer.
User's Manual U15195EJ3V0UD
489
CHAPTER 10 SERIAL INTERFACE FUNCTION
(c) Next transfer reservation period In the repeat transfer mode, the next transfer must be prepared with the period shown in Figure 10-32. Figure 10-32. Timing Chart of Next Transfer Reservation Period (1/2)
(a) When data length: 8 bits, operation mode: CKP bit = 0, DAP bit = 0
SCKn (I/O)
INTCSIn interrupt Reservation period: 7 SCKn cycles
(b) When data length: 16 bits, operation mode: CKP bit = 0, DAP bit = 0
SCKn (I/O)
INTCSIn interrupt Reservation period: 15 SCKn cycles
Remark
n = 0, 1
490
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
Figure 10-32. Timing Chart of Next Transfer Reservation Period (2/2)
(c) When data length: 8 bits, operation mode: CKP bit = 0, DAP bit = 1
SCKn (I/O) INTCSIn interrupt Reservation period: 6.5 SCKn cycles
(d) When data length: 16 bits, operation mode: CKP bit = 0, DAP bit = 1
SCKn (I/O) INTCSIn interrupt Reservation period: 14.5 SCKn cycles
Remark
n = 0, 1
User's Manual U15195EJ3V0UD
491
CHAPTER 10 SERIAL INTERFACE FUNCTION
(d) Cautions To continue repeat transfers, it is necessary to either read the SIRBn register or write to the SOTBn register during the transfer reservation period. If access is performed to the SIRBn register or the SOTBn register when the transfer reservation period is over, the following occurs. (i) In case of conflict between transfer request clear and register access Since request cancellation has higher priority, the next transfer request is ignored. transfer is interrupted, and normal data transfer cannot be performed. Figure 10-33. Transfer Request Clear and Register Access Conflict Therefore,
Transfer reservation period SCKn (I/O) INTCSIn interrupt
rq_clr
Reg_R/W
Remarks 1. n = 0, 1 2. rq_clr: Internal signal. Transfer request clear signal. Reg_R/W: Internal signal. This signal indicates that the receive data buffer register (SIRBn/ SIRBLn) read or transmit data buffer register (SOTBn/SOTBLn) write was performed.
492
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(ii) In case of conflict between interrupt request and register access Since continuous transfer has stopped once, executed as a new repeat transfer. In the slave mode, a bit phase error transfer error results (refer to Figure 10-34). In the transmission/reception mode, the value of the SOTBFn register is retransmitted, and illegal data is sent. Figure 10-34. Interrupt Request and Register Access Conflict
Transfer reservation period SCKn (I/O) INTCSIn interrupt
0
1
2
3
4
rq_clr
Reg_R/W
Remarks 1. n = 0, 1 2. rq_clr: Internal signal. Transfer request clear signal. Reg_R/W: Internal signal. performed. This signal indicates that receive data buffer register (SIRBn/ SIRBLn) read or transmit data buffer register (SOTBn/SOTBLn) write was
User's Manual U15195EJ3V0UD
493
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.4.5 Output pins (1) SCKn pin When the CSIn operation is disabled (CSICAEn bit of CSIMn register = 0), the SCKn pin output status is as follows (n = 0, 1). Table 10-9. SCKn Pin Output Status
CKP 0 1 CKS2 Don't care 1 CKS1 Don't care 1 CKS0 Don't care 1 SCKn Pin Output Fixed to high level Fixed to high level Fixed to low level
Other than above
Remarks 1. n = 0, 1 2. When any of the CKP and CKS2 to CKS0 bits of the CSICn register is overwritten, the SCKn pin output changes. (2) SOn pin When the CSIn operation is disabled (CSICAEn bit of CSIMn register = 0), the SOn pin output status is as follows (n = 0, 1). Table 10-10. SOn Pin Output Status
TRMDn 0 1 DAP Don't care 0 1 AUTO Don't care Don't care 0 CCL Don't care Don't care 0 DIRn Don't care Don't care 0 1 1 0 1 1 0 0 1 1 0 1 SOn Pin Output Fixed to low level SO latch value (low level) SOTB7 value SOTB0 value SOTB15 value SOTB0 value SOTBF7 value SOTBF0 value SOTBF15 value SOTBF0 value
Remarks 1. n = 0, 1 2. When any of the TRMDn, CCL, DIRn, and AUTO bits of the CSIMn register or DAP bit of the CSICn register is overwritten, the SOn pin output changes. 3. SOTBm: Bit m of SOTBn register (m = 0, 7, 15) 4. SOTBFm: Bit m of SOTBFn register (m = 0, 7, 15)
494
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
10.4.6 Dedicated baud rate generator 3 (BRG3) (1) Configuration of baud rate generator 3 (BRG3) Dedicated baud rate generator output or the internal system clock (fXX) can be selected for the CSI0 and CSI1 serial clocks. The serial clock source is specified by registers CSIC0 and CSIC1. If dedicated baud rate generator output is specified, BRG3 is selected as the clock source. Since the same serial clock can be shared for transmission and reception, baud rate is the same for both transmission and reception. Figure 10-35. Block Diagram of Baud Rate Generator 3 (BRG3)
fXX/4
Selector
fXX/8
8-bit timer counter
fXX/16
fXX/32 Match detector 1/2 CSIn
BGCS1, BGCS0 PRSCM3
Remark
fXX: Internal system clock n = 0, 1
User's Manual U15195EJ3V0UD
495
CHAPTER 10 SERIAL INTERFACE FUNCTION
(2) Dedicated baud rate generator 3 (BRG3) BRG3 is configured by an 8-bit timer counter that generates the baud rate signal, prescaler mode register 3 (PRSM3), which controls baud rate signal generation, prescaler compare register 3 (PRSCM3), which sets the value of the 8-bit timer counter, and a prescaler. (a) Input clock The internal system clock (fXX) is input to BRG3. (b) Prescaler mode register 3 (PRSM3) The PRSM3 register controls generation of the CSI0 and CSI1 baud rate signals. This register can be read/written in 8-bit or 1-bit units. Cautions 1. Do not change the value of the BGCS1, BGCS0 bits during a transmission/ reception operation. 2. Set the PRSM3 register prior to setting the CSICAEn bit of the CSIMn register to 1 (n = 0, 1).
7 PRSM3 0
6 0
5 0
4 CE
3 0
2 0
1 BGCS1
0 BGCS0
Address FFFFF920H
After reset 00H
Bit position 4
Bit name CE
Function Enables baud rate counter operation. 0: Stops baud rate counter operation and fixes baud rate output signal to 0. 1: Enables baud rate counter operation and starts baud rate output operation. Selects count clock for baud rate counter.
1, 0
BGCS1, BGCS0
BGCS1 0 0 1 1
BGCS0 0 1 0 1 fXX/4 fXX/8 fXX/16 fXX/32
Count clock selection
Remark fXX: Internal system clock
496
User's Manual U15195EJ3V0UD
CHAPTER 10 SERIAL INTERFACE FUNCTION
(c) Prescaler compare register 3 (PRSCM3) PRSCM3 is an 8-bit compare register that sets the value of the 8-bit timer counter. This register can be read/written in 8-bit units. Cautions 1. The internal timer counter is cleared by writing to the PRSM3 register. Therefore, do not write to the PRSCM3 register during transmission. 2. Set the PRSCM3 register prior to setting the CSICAEn bit of the CSIMn register to 1 (n = 0, 1). If the contents of the PRSCM3 register are overwritten when the value of the CSICAEn bit is 1, the cycle of the baud rate signal is not guaranteed.
7
6
5
4
3
2
1
0
Address
After reset 00H
PRSCM3 PRSCM7 PRSCM6 PRSCM5 PRSCM4 PRSCM3 PRSCM2 PRSCM1 PRSCM0 FFFFF922H
(d) Baud rate signal cycle The baud rate signal cycle is calculated as follows. * * When setting value of PRSCM3 register is 00H (Cycle of signal selected by bits BGCS1, BGCS0 of PRSM3 register) x 256 x 2 In cases other than above (Cycle of signal selected by bits BGCS1, BGCS2 of PRSM3 register) x (setting value of PRSCM3 register) x 2
User's Manual U15195EJ3V0UD
497
CHAPTER 10 SERIAL INTERFACE FUNCTION
(e) Baud rate setting value Table 10-11. Baud Rate Generator Setting Data (a) When fXX = 32 MHz
BGCS1 0 0 0 0 0 0 0 0 0 1 BGCS0 0 0 0 0 0 0 0 0 1 0 PRSCM Register Value 1 2 4 8 16 40 80 160 200 200 Clock (Hz) 4,000,000 2,000,000 1,000,000 500,000 250,000 100,000 50,000 25,000 10,000 5,000
(b) When fXX = 40 MHz
BGCS1 0 0 0 0 0 0 0 0 1 BGCS0 0 0 0 0 0 0 0 1 0 PRSCM Register Value 2 5 10 20 50 100 200 250 250 Clock (Hz) 2,500,000 1,000,000 500,000 250,000 100,000 50,000 25,000 10,000 5,000
Caution Set the transfer clock so that it does not fall below the minimum value of 200 ns of the SCKn cycle (tCYSK1) prescribed in the electrical specifications.
498
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
11.1 Features
* Two 10-bit resolution on-chip A/D converters (A/D converter 0 and 1) Simultaneous sampling by two circuits is possible. * Analog input: Total of 14 channels for two circuits A/D converter 0: 6 channels A/D converter 1: 8 channels * On-chip A/D conversion result registers 0m, 1n (ADCR0m, ADCR1n) 10 bits x 6 registers + 10 bits x 8 registers * A/D conversion trigger mode A/D trigger mode A/D trigger polling mode Timer trigger mode External trigger mode * Successive approximation technique * Voltage detection mode Remark m = 0 to 5, n = 0 to 7
11.2 Configuration
A/D converters 0 and 1, which employ a successive approximation technique, perform A/D conversion operations using A/D scan mode registers 00, 01, 10, and 11 (ADSCM00, ADSCM01, ADSCM10, and ADSCM11) and registers ADCR0m and ADCR1n (m = 0 to 5, n = 0 to 7). (1) Input circuit The input circuit selects an analog input (ANI0m or ANI1n) according to the mode set in the ADSCM00 or ADSCM10 register and sends it to the sample and hold circuit (m = 0 to 5, n = 0 to 7). (2) Sample and hold circuit The sample and hold circuit individually samples analog inputs sent sequentially from the input circuit and sends them to the comparator. It holds sampled analog inputs during A/D conversion. (3) Voltage comparator The voltage comparator compares the analog input voltage that was input with the output voltage of the D/A converter.
User's Manual U15195EJ3V0UD
499
CHAPTER 11 A/D CONVERTER
(4) D/A converter The D/A converter is used to generate the voltage that matches the analog input. The output voltage of the D/A converter is controlled by the successive approximation register (SAR). (5) Successive approximation register (SAR) The SAR is a 10-bit register that controls the output value of the D/A converter for comparing with the analog input voltage value. When an A/D conversion ends, the current contents of the SAR (conversion result) are stored in an A/D conversion result register (ADCR0m, ADCR1n) (m = 0 to 5, n = 0 to 7). When all specified A/D conversions end, an A/D conversion end interrupt (INTAD0, INTAD1) is also generated. (6) A/D conversion result registers 0m, 1n (ADCR0m, ADCR1n) ADCR0m and ADCR1n are 10-bit registers that hold A/D conversion results (m = 0 to 5, n = 0 to 7). Whenever an A/D conversion ends, the conversion result from the successive approximation register (SAR) is loaded. RESET input sets these registers to 0000H. (7) Controller The controller selects an analog input, generates sample and hold circuit operation timing, controls conversion triggers, and specifies the conversion operation time according to the mode set by the ADSCMn0 or ADSCMn1 register. (8) ANI0m, ANI1n pins (m = 0 to 5, n = 0 to 7) The ANI0n and ANI1n pins are the analog input pins of each channel (total of 14 channels for two circuits) for analog converters 0 and 1. They input analog signals to be A/D converted. Caution Make sure that the voltages input to ANI0m and ANI1n are within the range of the ratings. In particular, if a voltage (including noise) higher than AVDD0 and AVDD1 or lower than AVSS0 and AVSS1 (even if within the range of absolute maximum ratings) is input, the conversion value of that channel is invalid, and the conversion values of other channels may also be affected. (9) AVSS0, AVSS1 pins The AVSS0 and AVSS1 pins are the ground voltage pins of A/D converters 0 and 1. Even if not using A/D converters 0 and 1, always ensure these pins have the same potential as the VSS pin. (10) AVDD0, AVDD1 pins The AVDD0 and AVDD1 pins are the analog power supply pins of A/D converters 0 and 1. These pins are also used as pins that input a reference voltage (equivalent to the AVREF0 and AVREF1 pins of the V850E/IA1). Therefore, the signals input to the ANI0m and ANI1n pins are converted into digital signals, based on the voltage applied between AVDD0 and AVSS0 and between AVDD1 and AVSS1 (m = 0 to 5, n = 0 to 7). Even if not using A/D converters 0 and 1, always ensure these pins have the same potential as the VDD pin.
500
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
Figure 11-1. Block Diagram of A/D Converter 0 or 1
ANIn0 ANIn1 ANIn2 ANIn3 ANIn4 ANIn5 ANI16 ANI17
Input circuit
Sample and hold circuit
Comparator and D/A converter
AVDDn AVSSn
SAR (10) fXX/2 INTADn ITRG0 ADTRGn Trigger source switching circuit in timer trigger mode (See Figure 11-2) 15 0 15 0 15 0 15 0 Controller 9 ADCRn0 ADCRn1 ADCRn2 ADCRn3 ADCRn4 ADCRn5 ADCR16 ADCR17 10 0
INTDETn
ADSCMn0 (16)
16
ADSCMn1 (16)
16
ADETM0 (16)
16
ADETM1 (16) 10
16
Internal bus
Remark
n = 0, 1 fXX: Internal system clock
Cautions 1. Noise at an analog input pin (ANI0m, ANI1n) or reference voltage input pin (AVDD0, AVDD1) may give rise to an invalid conversion result (m = 0 to 5, n = 0 to 7). Software processing is needed in order to prevent this invalid conversion result from adversely affecting the system. The following are examples of software processing. * Use the average value of the results of multiple A/D conversions as the A/D conversion result. * Perform A/D conversion several times consecutively and use conversion results omitting any abnormal conversion results that are obtained. * If an A/D conversion result from which it is judged that an abnormality occurred in the system is obtained, be sure to recheck the abnormality occurrence before performing malfunction processing. 2. Be sure that voltages outside the range [AVSS0 to AVDD0, AVSS1 to AVDD1] are not applied to pins being used as A/D converter 0 and 1 input pins.
User's Manual U15195EJ3V0UD
501
CHAPTER 11 A/D CONVERTER
Figure 11-2. Block Diagram of Trigger Source Switching Circuit in Timer Trigger Made
ADTRG0 000 001 01X 100 101 11X ITRG13 ITRG12 ITRG11 000 001 01X 100 101 11X Trigger
Selector
INTCM003 INTCM013
Selector
0 1
A/D converter 0
Trigger
ITRG10
ADTRG1 Trigger
Selector
A/D converter 1
INTTM00 INTTM01
1
INTCM005
01 1X
INTCM015
01 1X
ITRG1
0
0
ITRG41 ITRG40
Selector
INTCM014
00
Selector
INTCM004
00
Selector
0
Trigger
0
0
ITRG31 ITRG30
ITRG0 ITRG23 ITRG22 ITRG21 ITRG20 ITRG13 ITRG12 ITRG11 ITRG10
Internal bus
Caution For the selection of the trigger source in timer trigger mode, refer to Table 11-4 Timer Trigger Source Selection of A/D Converters 0 and 1. Remark X: Don't care
502
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
11.3 Functions Added to V850E/IA2
(1) Addition of INTCM004, INTCM005, INTCM014, INTCM015 as timer trigger sources The timer trigger source (INTTM0n, INTCM0n3 to INTCM0n5) is selected using A/D internal trigger selection registers 0 and 1 (ITRG0 and ITRG1) when the timer trigger mode is set by A/D scan mode registers 00 and 10 (ADSCM00 and ADSCM10). With the V850E/IA2, bit 3 (ITRG13) and bit 7 (ITRG23) of the ITRG0 register, as well as the ITRG1 register have been added. (2) Changing analog input to a total of 14 channels for two circuits (3) Multiplexing AVREF0 and AVREF1 with AVDD0 and AVDD1
User's Manual U15195EJ3V0UD
503
CHAPTER 11 A/D CONVERTER
11.4 Control Registers
(1) A/D scan mode registers 00 and 10 (ADSCM00, ADSCM10) The ADSCMn0 registers are 16-bit registers that select analog input pins, specify operation modes, and control conversion operations. They can be read or written in 16-bit units. When the higher 8 bits of the ADSCMn0 register are used as the ADSCMn0H register and the lower 8 bits are used as the ADSCMn0L register, they can be read/written in 8-bit or 1-bit units. However, writing to the ADSCMn0 register during A/D conversion initializes conversion and starts the conversion operation from the beginning. Caution Clear (0) the ADCEn bit before changing the trigger mode using the ADPLMn and TRG2 to TRG0 bits (n = 0, 1). If the changing of the trigger mode and clearing of the ADCEn bits are performed simultaneously (same instruction), operation is not guaranteed. perform register access twice. (1/2)
<15> <14> 13 <12> <11> 10 ADSCM00 AD AD 0 AD AD 9 8 7 6 5 4 3 2 1 0 Address FFFFF200H After reset 0000H
Be sure to
TRG2 TRG1 TRG0 SANI3 SANI2 SANI1 SANI0 ANIS3 ANIS2 ANIS1 ANIS0
CE0 CS0
MS0 PLM0
<15> <14> 13 <12> <11> 10 ADSCM10 AD AD 0 AD AD
9
8
7
6
5
4
3
2
1
0
Address FFFFF240H
After reset 0000H
TRG2 TRG1 TRG0 SANI3 SANI2 SANI1 SANI0 ANIS3 ANIS2 ANIS1 ANIS0
CE1 CS1
MS1 PLM1
Bit position 15
Bit name ADCEn
Function Specifies enabling or disabling A/D conversion. 0: Disable 1: Enable Shows status of A/D converter 0 or 1. This bit is read-only. 0: Stopped 1: Operating ADCSn bit is 0 during the period of 6 x fXX/2 immediately after the start of A/D conversion, and then set to 1. This operation is performed each time an analog input pin has been switched for A/D conversion in the scan mode.
14
ADCSn
12
ADMSn
Specifies operation mode of A/D converter 0 or 1. 0: Scan mode 1: Select mode ADPLMn: Specifies polling mode. TRG2 to TRG0: Specifies trigger mode.
11 to 8
ADPLMn, TRG2 to TRG0
ADPLMn 0 0 0 1
TRG2 0 0 1 0
TRG1 0 0 1 0
TRG0 0 1 1 0
Trigger mode A/D trigger mode Timer trigger mode External trigger mode A/D trigger polling mode Setting prohibited
Other than above
Remark
n = 0, 1
User's Manual U15195EJ3V0UD
504
CHAPTER 11 A/D CONVERTER
(2/2)
Bit position 7 to 4 Bit name SANI3 to SANI0 Function Specifies conversion start analog input pin in scan mode. These bits are ignored in select mode.
SANI3 0 0 0 0 0 0 0 0
SANI2 0 0 0 0 1 1 1 1
SANI1 0 0 1 1 0 0 1 1
SANI0 0 1 0 1 0 1 0 1 ANIn0 ANIn1 ANIn2 ANIn3 ANIn4 ANIn5 ANI16 ANI17
Scan start analog input pin
Other than above
Setting prohibited
Caution Always set the conversion start analog input pin number that is set by bits SANI3 to SANI0 to a smaller pin number than the conversion end analog input pin number that is set by bits ANIS3 to ANIS0.
3 to 0 ANIS3 to ANIS0 Specifies analog input pin in select mode. In scan mode, specifies conversion termination analog input pin.
ANIS3 0 0 0 0 0 0 0 0
ANIS2 0 0 0 0 1 1 1 1
ANIS1 0 0 1 1 0 0 1 1
ANIS0 0 1 0 1 0 1 0 1
In select mode ANIn0 ANIn1 ANIn2 ANIn3 ANIn4 ANIn5 ANI16 ANI17 Setting prohibited
In scan mode ANIn0 SANI ANIn1 SANI ANIn2 SANI ANIn3 SANI ANIn4 SANI ANIn5 SANI ANI16 SANI ANI17
Other than above
Remark SANI < ANInm Where n = 0: m = 1 to 5 Where n = 1: m = 1 to 7 Remark n = 0, 1
User's Manual U15195EJ3V0UD
505
CHAPTER 11 A/D CONVERTER
(2) A/D scan mode registers 01 and 11 (ADSCM01, ADSCM11) The ADSCMn1 registers are 16-bit registers that set the conversion time of the A/D converter. They can be read or written in 16-bit units. When the higher 8 bits of the ADSCMn1 register are used as the ADSCMn1H register, and the lower 8 bits are used as the ADSCMn1L register, the ADSCMn1H register can be read/written in 8-bit units, and the ADSCMn1L register is read-only in 8-bit units. Caution Do not write to the ADSCMn1 registers during an A/D conversion operation. If a write is performed, the conversion operation is suspended and subsequently terminates.
15 ADSCM01 0
14 0
13 0
12 0
11 0
10
9
8
7 0
6 0
5 0
4 0
3 0
2 0
1 0
0 0
Address FFFFF202H
After reset 0000H
FR2 FR1 FR0
15 ADSCM11 0
14 0
13 0
12 0
11 0
10
9
8
7 0
6 0
5 0
4 0
3 0
2 0
1 0
0 0
Address FFFFF242H
After reset 0000H
FR2 FR1 FR0
Bit position 10 to 8
Bit name FR2 to FR0 Specifies conversion time.
Function
FR2
FR1
FR0
Conversion clocks
Conversion time (s)Note fXX = 40 MHz fXX = 33 MHz - 7.51 5.33 - - - -
0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1
344 248 176 128 104 80 56 Setting prohibited
8.60 6.20 - - - - - -
Note This is the time from sampling until conversion end. Sampling time = (Conversion clocks - 8)/6 x fXX Caution Be sure to secure the conversion time within a range of 5 to 10 s. Conversion time = fXX x Conversion clocks
Remark fXX: Internal system clock
506
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
(3) A/D voltage detection mode registers 0 and 1 (ADETM0, ADETM1) The ADETMn registers are 16-bit registers that set the voltage detection mode. In the voltage detection mode, the analog input pin for which voltage detection is being performed and a reference voltage value are compared and an interrupt is set in response to the comparison result. These registers can be read or written in 16-bit units. When the higher 8 bits of the ADETMn register are used as the ADETMnH register, and the lower 8 bits are used as the ADETMnL register, they can be read/written in 8-bit or 1-bit units. Caution Do not write to an ADETMn register during an A/D conversion operation. performed, conversion is suspended and it subsequently terminates. If a write is
<15> <14> 13 ADETM0
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF204H
After reset 0000H
ADET ADET DET DET DET DET DET DET DET DET DET DET DET DET DET DET EN0 LH0 ANI3 ANI2 ANI1 ANI0 CMP9 CMP8 CMP7 CMP6 CMP5 CMP4 CMP3 CMP2 CMP1 CMP0
<15> <14> 13 ADETM1
12
11
10
9
8
7
6
5
4
3
2
1
0
Address FFFFF244H
After reset 0000H
ADET ADET DET DET DET DET DET DET DET DET DET DET DET DET DET DET EN1 LH1 ANI3 ANI2 ANI1 ANI0 CMP9 CMP8 CMP7 CMP6 CMP5 CMP4 CMP3 CMP2 CMP1 CMP0
Bit position 15
Bit name ADETENn Specifies voltage detection mode. 0: Operates in normal mode 1: Operates in voltage detection mode
Function
14
ADETLHn
Sets voltage comparison detection. 0: Generates INTDETn interrupt if reference voltage value > analog input pin voltage. 1: Generates INTDETn interrupt if reference voltage value < analog input pin voltage. Selects analog input pin to compare to reference voltage value set by DETCMP9 to DETCMP0 when in voltage detection mode.
13 to 10
DETANI3 to DETANI0
DETANI3 0 0 0 0 0 0 0 0 1 Remark 9 to 0 DETCMP9 to DETCMP0
DETANI2 0 0 0 0 1 1 1 1 x
DETANI1 0 0 1 1 0 0 1 1 x
DETANI0 0 1 0 1 0 1 0 1 x
Voltage detection analog input pin ANIn0 ANIn1 ANIn2 ANIn3 ANIn4 ANIn5 ANI16 ANI17 Setting prohibited
x: Don't care
Sets reference voltage value to compare with analog input pin selected by DETANI3 to DETANI0.
Remark n = 0, 1
User's Manual U15195EJ3V0UD
507
CHAPTER 11 A/D CONVERTER
(4) A/D conversion result registers 00 to 05 and 10 to 17 (ADCR00 to ADCR05, ADCR10 to ADCR17) The ADCR0m and ADCR1n registers are 10-bit registers that hold the results of A/D conversions (m = 0 to 5, n = 0 to 7). A/D converter 0 has six 10-bit registers for six channels and A/D converter 1 has eight 10-bit registers for eight channels. In all, fourteen 10-bit registers are available. These registers are read-only in 16-bit units. When reading 10 bits of data of an A/D conversion result from the ADCR0m or ADCR1n register, only the lower 10 bits are valid and the higher 6 bits are always read as 0.
15 ADCR0m (m = 0 to 5) 15 ADCR1n (n = 0 to 7) 0 0
14 0
13 0
12 0
11 0
10 0
9
8
7
6
5
4
3
2
1
0
Address
After reset 0000H
ADCRm9 ADCRm8 ADCRm7 ADCRm6 ADCRm5 ADCRm4 ADCRm3 ADCRm2 ADCRm1 ADCRm0 See Table 11-1
14 0
13 0
12 0
11 0
10 0
9
8
7
6
5
4
3
2
1
0
Address
After reset 0000H
ADCRn9 ADCRn8 ADCRn7 ADCRn6 ADCRn5 ADCRn4 ADCRn3 ADCRn2 ADCRn1 ADCRn0 See Table 11-2
Table 11-1. Correspondence Between ADCR0m (m = 0 to 5) Register Names and Addresses
Register Name ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05 Address FFFFF210H FFFFF212H FFFFF214H FFFFF216H FFFFF218H FFFFF21AH
Table 11-2. Correspondence Between ADCR1n (n = 0 to 7) Register Names and Addresses
Register Name ADCR10 ADCR11 ADCR12 ADCR13 ADCR14 ADCR15 ADCR16 ADCR17 Address FFFFF250H FFFFF252H FFFFF254H FFFFF256H FFFFF258H FFFFF25AH FFFFF25CH FFFFF25EH
508
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
The correspondence between the analog input pins and the ADCR0m and ADCR1n registers is shown below. Table 11-3. Correspondence Between Analog Input Pins and ADCR0m and ADCR1n Registers
A/D Converter A/D converter 0 Analog Input Pin ANI00 ANI01 ANI02 ANI03 ANI04 ANI05 A/D converter 1 ANI10 ANI11 ANI12 ANI13 ANI14 ANI15 ANI16 ANI17 A/D Conversion Result Register ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05 ADCR10 ADCR11 ADCR12 ADCR13 ADCR14 ADCR15 ADCR16 ADCR17
(5) A/D internal trigger selection registers 0, 1 (ITRG0, ITRG1) The ITRGn register switches the trigger source in timer trigger mode. converters 0 and 1 can be set using the ITRGn register. This register can be read or written in 8-bit or 1-bit units. The timer trigger source of A/D
7 ITRG0 ITRG23
6 ITRG22
5 ITRG21
4 ITRG20
3 ITRG13
2 ITRG12
1 ITRG11
0 ITRG10
Address FFFFF280H
After reset 00H
7 ITRG1 0
6 0
5 ITRG41
4 ITRG40
3 0
2 0
1 ITRG31
0 ITRG30
Address FFFFF288H
After reset 00H
Bit position 7 to 0 (ITRG0) 5, 4, 1, 0 (ITRG1)
Bit name ITRG23 to ITRG20, ITRG13 to ITRG10 (ITRG0) ITRG41, ITRG40, ITRG31, ITRG30 (ITRG1)
Function Specifies timer trigger source of A/D converters 0 and 1 (refer to Table 11-4 Timer Trigger Source Selection of A/D Converters 0 and 1).
User's Manual U15195EJ3V0UD
509
CHAPTER 11 A/D CONVERTER
Table 11-4. Timer Trigger Source Selection of A/D Converters 0 and 1 (1/3)
ITRGm3 ITRGm2 ITRGm1 ITRG41 ITRG40 ITRG31 ITRG30 ITRG20 ITRG10 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 0 0 1 1 x x x x 0 0 0 1 1 1 x x x x x x x x x x x x x x x x x x x x x x 0 0 1 0 x x x x x x x x x x x 0 1 x 0 x x x x x x x x 0 0 1 x x x 0 x x x x x x x x 0 1 x x x x 0 x x 0 1 0 0 1 1 x x x x x x 0 0 1 x x 0 1 0 1 x x x x x x 0 Trigger Source of A/D Converter n Selects INTCM003 Selects INTCM013 Selects INTTM00 Selects INTTM01 Selects INTCM003, INTTM00 Selects INTCM013, INTTM00 Selects INTCM003, INTTM01 Selects INTCM013, INTTM01 Selects INTCM004 Selects INTCM005 Selects INTCM004, INTCM005 Selects INTCM014 Selects INTCM015 Selects INTCM014, INTCM015 Selects INTCM003, INTTM00, INTCM004, INTCM014 Selects INTCM013, INTTM00, INTCM004, INTCM014 Selects INTCM003, INTTM01, INTCM004, INTCM014 Selects INTCM013, INTTM01, INTCM004, INTCM014 Selects INTCM003, INTTM00, INTCM005, INTCM014 Selects INTCM013, INTTM00, INTCM005, INTCM014 Selects INTCM003, INTTM01, INTCM005, INTCM014 Selects INTCM013, INTTM01, INTCM005, INTCM014 Selects INTCM003, INTTM00, INTCM004, INTCM005, INTCM014 Selects INTCM013, INTTM00, INTCM004, INTCM005, INTCM014 Selects INTCM003, INTTM01, INTCM004, INTCM005, INTCM014
1
1
0
0
0
0
0
1
1
1
0
0
0
0
1
0
1
1
0
0
0
0
1
1
1
1
0
0
0
1
0
0
1
1
0
0
0
1
0
1
1
1
0
0
0
1
1
0
1
1
0
0
0
1 x x x
1
1
1
1
0
0
1
0
0
1
1
0
0
1
0
1
1
1
0
0
1
1
0
Remarks 1. n = 0, 1 Where n = 0: m = 1 Where n = 1: m = 2 2. x: Don't care
510
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
Table 11-4. Timer Trigger Source Selection of A/D Converters 0 and 1 (2/3)
ITRGm3 ITRGm2 ITRGm1 ITRG41 ITRG40 ITRG31 ITRG30 ITRG20 ITRG10 1 1 x x x x x x x x x x x x x x x x x x x x 0 0 1 x 1 1 Trigger Source of A/D Converter n Selects INTCM013, INTTM01, INTCM004, INTCM005, INTCM014 Selects INTCM003, INTTM00, INTCM004, INTCM015 Selects INTCM013, INTTM00, INTCM004, INTCM015 Selects INTCM003, INTTM01, INTCM004, INTCM015 Selects INTCM013, INTTM01, INTCM004, INTCM015 Selects INTCM003, INTTM00, INTCM005, INTCM015 Selects INTCM013, INTTM00, INTCM005, INTCM015 Selects INTCM003, INTTM01, INTCM005, INTCM015 Selects INTCM013, INTTM01, INTCM005, INTCM015 Selects INTCM003, INTTM00, INTCM004, INTCM005, INTCM015 Selects INTCM013, INTTM00, INTCM004, INTCM005, INTCM015 Selects INTCM003, INTTM01, INTCM004, INTCM005, INTCM015 Selects INTCM013, INTTM01, INTCM004, INTCM005, INTCM015 Selects INTCM003, INTTM00, INTCM004, INTCM014, INTCM015 Selects INTCM013, INTTM00, INTCM004, INTCM014, INTCM015 Selects INTCM003, INTTM01, INTCM004, INTCM014, INTCM015 Selects INTCM013, INTTM01, INTCM004, INTCM014, INTCM015 Selects INTCM003, INTTM00, INTCM005, INTCM014, INTCM015 Selects INTCM013, INTTM00, INTCM005, INTCM014, INTCM015 Selects INTCM003, INTTM01, INTCM005, INTCM014, INTCM015
1
1
0
1
0
0
0
0
1
1
0
1
0
0
0
1
1
1
0
1
0
0
1
0
1
1
0
1
0
0
1
1
1
1
0
1
0
1
0
0
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
0
1
1
0
1
0
1 x x x x 0
1
1
1
1
0
1
1
0
0
1
1
0
1
1
0
1
1
1
0
1
1
1
0
1
1
0
1 x x x x x x x
1
1
1
1
1
1
0
0
0
1
1
1
0
0
0
1
1
1
1
0
0
1
0
1
1
1
0
0
1
1
1
1
1
0
1
0
0
1
1
1
0
1
0
1
1
1
1
0
1
1
0
Remarks 1. n = 0, 1 Where n = 0: m = 1 Where n = 1: m = 2 2. x: Don't care
User's Manual U15195EJ3V0UD
511
CHAPTER 11 A/D CONVERTER
Table 11-4. Timer Trigger Source Selection of A/D Converters 0 and 1 (3/3)
ITRGm3 ITRGm2 ITRGm1 ITRG41 ITRG40 ITRG31 ITRG30 ITRG20 ITRG10 1 1 x x 1 x x 0 1 x 1 1 Trigger Source of A/D Converter n Selects INTCM013, INTTM01, INTCM005, INTCM014, INTCM015 Selects INTCM003, INTTM00, INTCM004, INTCM005, INTCM014, INTCM015 Selects INTCM013, INTTM00, INTCM004, INTCM005, INTCM014, INTCM015 Selects INTCM003, INTTM01, INTCM004, INTCM005, INTCM014, INTCM015 Selects INTCM013, INTTM01, INTCM004, INTCM005, INTCM014, INTCM015
1
1
1
1
0
0
1
1
x
1
x
1
x
0
1
1
1
x
1
x
1
x
1
0
1
1
x
1
x
1
x
1
1
Remarks 1. n = 0, 1 Where n = 0: m = 1 Where n = 1: m = 2 2. x: Don't care
512
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
The relationship between the analog voltage input to an analog input pin (ANI0m or ANI1n) and the value of the A/D conversion result register (ADCR0m or ADCR1n) is as follows (m = 0 to 5, n = 0 to 7): VIN ADCR = INT ( AVDD Or, (ADCR - 0.5) x AVDD 1,024 VIN < (ADCR + 0.5) x AVDD 1,024 x1,024 + 0.5)
INT ( ): Function that returns integer of value in ( ) VIN: AVDD: Analog input voltage AVDD0 or AVDD1 pin voltage
ADCR: Value of A/D conversion result register (ADCR0m or ADCR1n) Figure 11-3 illustrates the relationship between the analog input voltages and A/D conversion results. Figure 11-3. Relationship Between Analog Input Voltages and A/D Conversion Results
1,023
1,022
A/D conversion result 1,021 (ADCRx)
3
2
1
0
1 1 3 2 5 3 2,048 1,024 2,048 1,024 2,048 1,024
2,043 1,022 2,045 1,023 2,047 1 2,048 1,024 2,048 1,024 2,048
Input voltage/AVDDm
Remark
m = 0, 1 x = 00 to 05, 10 to 17
User's Manual U15195EJ3V0UD
513
CHAPTER 11 A/D CONVERTER
11.5 Interrupt Requests
A/D converters 0 and 1 generate two kinds of interrupts. * A/D conversion end interrupts (INTAD0, INTAD1) * Voltage detection interrupts (INTDET0, INTDET1) (1) A/D conversion end interrupts (INTAD0, INTAD1) In the A/D conversion enabled status, an A/D conversion end interrupt is generated when a specified number of A/D conversions have been completed.
A/D Converter 0 1 A/D Conversion End Interrupt Signal Generates INTAD0 Generates INTAD1
(2) Voltage detection interrupt (INTDET0, INTDET1) In the voltage detection mode (ADETEN0 or ADETEN1 bit of ADETM0 or ADETM1 = 1), the value of the ADCR0m or ADCR1n register of the relevant analog input pin is compared with the reference voltage set in the DETCMP9 to DETCMP0 bits of the ADETM0 or ADETM1 register and a voltage detection interrupt is generated in response to the value of the ADETLH0 or ADETLH1 bit of the ADETM0 or ADETM1 register (m = 0 to 5, n = 0 to 7).
A/D Converter 0 1 Voltage Detection Interrupt Signal Generates INTDET0 Generates INTDET1
514
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
11.6 A/D Converter Operation
11.6.1 A/D converter basic operation A/D conversion is performed using the following procedure. (1) Set the analog input selection and the operation mode and trigger mode specifications using the ADSCM00 or ADSCM10 register
Note 1
. Setting (1) the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register when
Note 2
in A/D trigger mode or A/D trigger polling mode starts A/D conversion. In timer trigger mode or external trigger mode, the status becomes trigger standby .
(2) When A/D conversion starts, compare the analog input with the voltage generated by the D/A converter. (3) When 10-bit comparison ends, store the conversion result in the ADCR0m or ADCR1n register. When the specified number of A/D conversions have ended, generate the A/D conversion end interrupt (INTAD0, INTAD1) (m = 0 to 5, n = 0 to 7). Notes 1. If the contents of the ADSCM00 or ADSCM10 register are changed during an A/D conversion operation, the A/D conversion operation preceding the change stops and a conversion result is not stored in the ADCR0m or ADCR1n register. The conversion operation is initialized and conversion starts from the beginning. 2. In timer trigger mode or external trigger mode, there is a transition to trigger standby status when the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register is set to 1. An A/D conversion operation is activated by a trigger signal and there is a return to trigger standby status when the A/D conversion operation ends. The timer trigger is selected by the ITRG0 and ITRG1 registers.
User's Manual U15195EJ3V0UD
515
CHAPTER 11 A/D CONVERTER
11.6.2 Operation modes and trigger modes Diverse conversion operations can be specified for A/D converters 0 and 1 by specifying the operation mode and trigger mode. The operation mode and trigger mode are set using the ADSCM00 or ADSCM10 register. The relationship between the operation mode and the trigger mode is shown below.
Trigger Mode Operation Mode ADSCM00 AD trigger Select Scan AD trigger polling Select Scan Timer trigger Select Scan External trigger Select Scan XX010000XXXXXXXXB XX000000XXXXXXXXB XX011000XXXXXXXXB XX001000XXXXXXXXB XX010001XXXXXXXXB XX000001XXXXXXXXB XX010111XXXXXXXXB XX000111XXXXXXXXB Setting ADSCM10 XX010000XXXXXXXXB XX000000XXXXXXXXB XX011000XXXXXXXXB XX001000XXXXXXXXB XX010001XXXXXXXXB XX000001XXXXXXXXB XX010111XXXXXXXXB XX000111XXXXXXXXB
(1) Trigger modes Four trigger modes that serve as the start timing of A/D conversion processing are available: A/D trigger mode, A/D trigger polling mode, timer trigger mode, and external trigger mode. These trigger modes are set using the ADSCM00 and ADSCM10 registers. (a) A/D trigger mode A/D trigger mode, which starts the conversion timing for the analog input set for the ANI0m or ANI1n pin (m = 0 to 5, n = 0 to 7), is a mode in which A/D conversion is started by setting the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register to 1. In this mode, it is necessary to set the ADCE0 or ADCE1 bit to 1 as an A/D conversion restart operation after the INTAD0 or INTAD1 interrupt (ADCS0, ADCS1 = 0). (b) A/D trigger polling mode A/D trigger polling mode, which starts the conversion timing of the analog input set for the ANI0m or ANI1n pin (m = 0 to 5, n = 0 to 7), is a mode in which A/D conversion is started by setting the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register to 1. In this mode, it is not necessary to set the ADCE0 or ADCE1 bit to 1 as an A/D conversion restart operation after the INTAD0 or INTAD1 interrupt (ADCS0, ADCS1 = 1). The specified analog input is converted serially until the ADCE0 or ADCE1 bit is set to 0. The INTAD0 or INTAD1 interrupt occurs each time a conversion ends. (c) Timer trigger mode Timer trigger mode, which starts the conversion timing of the analog input set for the ANI0m or ANI1n pin (m = 0 to 5, n = 0 to 7), is a mode governed by the trigger specified by the A/D internal trigger selection registers 0 and 1 (ITRG0, ITRG1). (d) External trigger mode External trigger mode, which starts the conversion timing of the analog input set using the ANI0m and ANI1n pins, is a mode specified using the ADTRG0 or ADTRG1 pin (m = 0 to 5, n = 0 to 7).
516
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
(2) Operation modes The two operation modes, which are the modes that set the ANI00 to ANI05 and ANI10 to ANI17 pins, are select mode and scan mode. These modes are set using the ADSCM00 and ADSCM10 registers. (a) Select mode In select mode, one analog input specified by the ADSCM00 or ADSCM10 register is A/D converted. The conversion result is stored in the ADCR0m or ADCR1n register corresponding to the analog input (ANI0m or ANI1n) (m = 0 to 5, n = 0 to 7). Figure 11-4. Example of Select Mode Operation Timing (ANI01): For A/D Converter 0
ANI01 (input) Data 1 Data 2 Data 3
Data 4
Data 5 Data 6 Data 7
A/D conversion
Data 1 (ANI01)
Data 2 (ANI01)
Data 3 (ANI01)
Data 4 (ANI01)
Data 5 (ANI01)
Data 6 (ANI01)
Data 7 (ANI01)
ADCR01 register
Data 1 (ANI01)
Data 2 (ANI01)
Data 3 (ANI01)
Data 4 (ANI01)
Data 6 (ANI01)
INTAD0 interrupt
Conversion start (ADSCM0 register setting)
ADCE0 bit set
ADCE0 bit set
ADCE0 bit set
ADCE0 ADCE0 bit set bit set Conversion start (ADSCM0 register setting)
Analog input ANI00 ANI01 ANI02 ANI03 ANI04 ANI05 A/D converter 0
ADCR0m register ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05
User's Manual U15195EJ3V0UD
517
CHAPTER 11 A/D CONVERTER
(b) Scan mode In scan mode, pins from the A/D conversion start analog input pin to the A/D conversion termination analog input pin specified by the ADSCM00 or ADSCM10 register are sequentially selected and A/D converted. The A/D conversion result is stored in the ADCR0m or ADCR1n register corresponding to the analog input (m = 0 to 5, n = 0 to 7). When the specified analog input conversion ends, the A/D conversion end interrupt (INTAD0 or INTAD1) is generated. Figure 11-5. Example of Scan Mode Operation Timing: For A/D Converter 0 (4-Channel Scan (ANI00 to ANI03))
ANI00 (input) Data 1 ANI01 (input) Data 2 ANI02 (input) ANI03 (input) A/D conversion Data 1 (ANI00) Data 2 (ANI01) Data 3 (ANI02) Data 6 Data 5
Data 3 Data 4 Data 4 (ANI03) Data 5 (ANI00) Data 6 (ANI01)
ADCR0n register
Data 1 Data 2 Data 3 (ANI00) (ANI01) (ANI02) ADCR00 ADCR01 ADCR02 Data 1 (ANI00)
Data 4 (ANI03) ADCR03
Data 5 (ANI00) ADCR00
INTAD0 interrupt
Conversion start (ADSCM00 register setting)
Conversion start (ADSCM00 register setting)
Analog input ANI00 ANI01 ANI02 ANI03 ANI04 ANI05 A/D converter 0
ADCR0m register ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05
518
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
11.7 Operation in A/D Trigger Mode
Setting the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register to 1 starts A/D conversion. 11.7.1 Operation in select mode One analog input specified by the ADSCM00 or ADSCM10 register is A/D converted at a time and the result is stored in the ADCR0m or ADCR1n register. Analog inputs correspond one-to-one with the ADCR0m or ADCR1n register (m = 0 to 5, n = 0 to 7). The A/D conversion end interrupt (INTAD0, INTAD1) is generated at the end of each A/D conversion, which terminates A/D conversion (ADCS0, ADCS1 bit = 0).
Analog Input ANIx A/D Conversion Result Register ADCRx
Remark
x = 00 to 05, 10 to 17
To restart A/D conversion, write 1 in the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register. This is optimal for an application that reads a result for each A/D conversion. Figure 11-6. Example of Select Mode (A/D Trigger Select) Operation (ANI02): For A/D Converter 0
ADSCM00
ANI00 ANI01 ANI02 ANI03 ANI04 ANI05 A/D converter 0
ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05
(1) ADCE0 bit of ADSCM00 = 1 (Enabled) (2) A/D conversion of ANI02 (3) Store conversion result in ADCR02 (4) Generate INTAD0 interrupt
User's Manual U15195EJ3V0UD
519
CHAPTER 11 A/D CONVERTER
11.7.2 Operation in scan mode Pins from the conversion start analog input pin to the conversion termination analog input pin specified by ADSCM00 or ADSCM10 register are sequentially selected and A/D converted. An A/D conversion result is stored in the ADCR0m or ADCR1n register corresponding to the analog input (m = 0 to 5, n = 0 to 7). When conversion ends for all analog inputs up to the conversion termination analog input pin, the A/D conversion end interrupt (INTAD0, INTAD1) is generated, which terminates A/D conversion (ADCS0 or ADCS1 bit of ADSCM0 or ADSCM1 register = 0).
Analog Input ANIxNote 1 | ANIx
Note 2
A/D Conversion Result Register ADCRx | ADCRx
Notes 1.
Set using the SANI3 to SANI0 bits of the ADSCM00 or ADSCM10 register. Be sure to set a pin number that is smaller than the conversion termination analog input pin number set according to Note 2.
2. Remark
Set using the ANIS3 to ANIS0 bits of the ADSCM00 or ADSCM10 register. x = 00 to 05, 10 to 17
To restart A/D conversion, write 1 in the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register. This is optimal for an application that regularly monitors multiple analog inputs. Figure 11-7. Example of Scan Mode (A/D Trigger Scan) Operation (ANI02 to ANI05): For A/D Converter 0
ADSCM00
ANI00 ANI01 ANI02 ANI03 ANI04 ANI05 A/D converter 0
ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05
(1) ADCE0 bit of ADSCM00 = 1 (Enabled) (2) A/D conversion of ANI02 (3) Store conversion result in ADCR02 (4) A/D conversion of ANI03 (5) Store conversion result in ADCR03
(6) A/D conversion of ANI04 (7) Store conversion result in ADCR04 (8) A/D conversion of ANI05 (9) Store conversion result in ADCR05 (10) Generate INTAD0 interrupt
520
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
11.8 Operation in A/D Trigger Polling Mode
Setting the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register to 1 starts A/D conversion. Both select mode and scan mode are available in A/D trigger polling mode. Since the ADCS0 or ADCS1 bit of the ADSCM00 or ADSCM10 register remains 1 after the INTAD0 or INTAD1 interrupt in this mode, it is not necessary to write 1 in the ADCE0 or ADCE1 bit as an A/D conversion restart operation. 11.8.1 Operation in select mode The analog input specified in the ADSCM00 or ADSCM10 register is A/D converted. The conversion result is stored in the ADCR0m or ADCR1n register (m = 0 to 5, n = 0 to 7). One analog input is A/D converted at a time and the result is stored in one ADCR0m or ADCR1n register. Analog inputs correspond one-to-one with the ADCR0m or ADCR1n register. An A/D conversion end interrupt (INTAD0 or INTAD1) is generated at the end of each A/D conversion. A/D conversion operations are repeated until the ADCE0 or ADCE1 bit = 0 (ADCS0, ADCS1 bit = 1).
Analog Input ANIx A/D Conversion Result Register ADCRx
Remark
x = 00 to 05, 10 to 17
In A/D trigger polling mode, it is not necessary to write 1 in the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register as an A/D conversion restart operation
Note
.
This is optimal for applications that regularly read A/D conversion values. Note In A/D trigger polling mode, the fact that the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register is 0 means that A/D conversion does not stop as long as the ADCS0 or ADCS1 bit is not 0. Therefore, if the ADCR0m or ADCR1n register is not read before the next A/D conversion, it is overwritten. Figure 11-8. Example of Select Mode (A/D Trigger Polling Select) Operation (ANI02): For A/D Converter 0
ADSCM00
ANI00 ANI01 ANI02 ANI03 ANI04 ANI05 A/D converter 0
ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05 (4) Generate INTAD0 interrupt (5) Return to (2)
(1) ADCE0 bit of ADSCM00 = 1 (Enabled) (2) A/D conversion of ANI02 (3) Store conversion result in ADCR02
User's Manual U15195EJ3V0UD
521
CHAPTER 11 A/D CONVERTER
11.8.2 Operation in scan mode Pins from the conversion start analog input pin to the conversion termination analog input pin specified by the ADSCM00 or ADSCM10 register are sequentially selected and A/D converted. The A/D conversion result is stored in the ADCR0m or ADCR1n register corresponding to the analog input (m = 0 to 5, n = 0 to 7). When conversion ends for all analog inputs up to the conversion termination analog input pin, the A/D conversion end interrupt (INTAD0, INTAD1) is generated. A/D conversion repeats until the ADCE0 or ADCE1 bit = 0 (ADCS0, ADCS1 bit = 1).
Analog Input ANIxNote 1 | ANIx
Note 2
A/D Conversion Result Register ADCRx | ADCRx
Notes 1.
Set using the SANI3 to SANI0 bits of the ADSCM00 or ADSCM10 register. Be sure to set a pin number that is smaller than the conversion termination analog input pin number set according to Note 2.
2. Remark
Set using the ANIS3 to ANIS0 of the ADSCM00 or ADSCM10 register. x = 00 to 05, 10 to 17
It is not necessary to write 1 in the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register as an A/D conversion restart operation in A/D trigger polling mode
Note
.
This is optimal for applications that regularly read A/D conversion values. Note In A/D trigger polling mode, the fact that the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register is 0 means that A/D conversion operation does not stop as long as the ADCS0 or ADCS1 bit is not 0. Therefore, if the ADCR0m or ADCR1n register is not read before the next A/D conversion, it is overwritten. Figure 11-9. Example of Scan Mode (A/D Trigger Polling Scan) Operation (ANI02 to ANI05) : For A/D Converter 0
ADSCM00
ANI00 ANI01 ANI02 ANI03 ANI04 ANI05 A/D converter 0
ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05 (7) Store conversion result in ADCR04 (8) A/D conversion of ANI05 (9) Store conversion result in ADCR05 (10) Generate INTAD0 interrupt (11) Return to (2)
(1) ADCE0 bit of ADSCM00 = 1 (Enabled) (2) A/D conversion of ANI02 (3) Store conversion result in ADCR02 (4) A/D conversion of ANI03 (5) Store conversion result in ADCR03 (6) A/D conversion of ANI04
522
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
11.9 Operation in Timer Trigger Mode
A/D converters 0 and 1 have a total of 14 channels of analog inputs (ANI00 to ANI05 and ANI10 to ANI17). For these channels, an interrupt signal specified by A/D internal trigger selection registers 0 and 1 (ITRG0, INTRG1) can be set as a conversion trigger. The eight interrupt signals that can be selected as triggers are the TM0n timer 0 register underflow interrupt signals (INTTM00 and INTTM01) and the CM003 to CM005 and CM013 to CM015 match interrupt signals (INTCM003 to INTCM005 and INTCM013 to INTCM015) (n = 0, 1). 11.9.1 Operation in select mode Taking the interrupt signal specified by A/D internal trigger selection registers 0 and 1 (ITRG0, ITRG1) as a trigger, one analog input (ANI00 to ANI05, ANI10 to ANI17) specified by the ADSCM00 or ADSCM10 register is A/D converted once. The conversion result is stored in the ADCR0m or ADCR1n register corresponding to the analog input (m = 0 to 5, n = 0 to 7). The A/D conversion end interrupt (INTAD0 or INTAD1) is generated at the end of each A/D conversion, which terminates A/D conversion (ADCS0, ADCS1 = 0). This is optimal for applications that read A/D conversion values synchronized to a timer trigger.
Trigger Interrupt specified by ITRG0, ITRG1 register ANIx Analog Input A/D Conversion Result Register ADCRx
Remark
n = 00 to 05, 10 to 17
After the end of A/D conversion, A/D converter 0 or 1 changes to the trigger wait status (ADCE0, ADCE1 = 1). A/D conversion is performed again when the interrupt signal specified by the ITRG0 or ITRG1register is generated. Figure 11-10. Example of Timer Trigger Select Mode Operation (ANI04): For A/D Converter 0
(a) When selecting INTTM00 by ITRG0, ITRG1 register
ANI00 ANI01 INTTM00 ANI02 ANI03 ANI04 ANI05 A/D converter 0 ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05
(1) ADCE0 bit of ADSCM00 = 1 (Enabled) (2) INTTM00 interrupt generation (3) A/D conversion of ANI04
(4) Store conversion result in ADCR04 (5) INTAD0 interrupt generation
User's Manual U15195EJ3V0UD
523
CHAPTER 11 A/D CONVERTER
11.9.2 Operation in scan mode Using the interrupt signal specified by A/D internal trigger selection registers 0 and 1 (ITRG0, ITRG1) as a trigger, pins from the conversion start analog input pin to the conversion termination analog input pin specified by the ADSCM00 or ADSCM10 register are sequentially selected and A/D converted. Conversion results are stored in the ADCR0m or ADCR1n register corresponding to the analog input (m = 0 to 5, n = 0 to 7). When all of the specified A/D conversions are complete, the A/D conversion end interrupt (INTAD0 or INTAD1) is generated, which terminates A/D conversion (ADCS0, ADCS1 = 0). This is optimal for applications that regularly monitor multiple analog inputs in synchronization with a timer trigger.
Trigger Interrupt specified by ITRG0, ITRG1 register ANIn0 ANIn1 ANIn2 ANIn3 ANIn4 ANIn5 ANI16 ANI17 Analog Input A/D Conversion Result Register ADCRn0 ADCRn1 ADCRn2 ADCRn3 ADCRn4 ADCRn5 ADCR16 ADCR17
Remark n = 0, 1 After all of the specified A/D conversions have ended, the A/D converter changes to the trigger wait status (ADCE0, ADCE1 = 1). A/D conversion is performed again when the interrupt signal specified by the ITRG0 or ITRG1 register is generated. Figure 11-11. Example of Timer Trigger Scan Mode Operation (For A/D Converter 0) : INTTM00 Selected by ITRG0, ITRG1 Register
(a) Set to scan ANI01 to ANI04
ANI00 ANI01 INTM00 ANI02 ANI03 ANI04 ANI05 (1) ADCE0 bit of ADSCM00 = 1 (Enabled) (2) INTTM00 interrupt generation (3) A/D conversion of ANI01 (4) Store conversion result in ADCR01 (5) A/D conversion of ANI02 (6) Store conversion result in ADCR02 (7) A/D conversion of ANI03 (8) Store conversion result in ADCR03 (9) A/D conversion of ANI04 (10) Store conversion result in ADCR04 (11) INTAD0 interrupt generation A/D converter 0 ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05
524
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
11.10 Operation in External Trigger Mode
In external trigger mode, an analog input (ANI00 to ANI05, ANI10 to ANI17) is A/D converted at the ADTRG0 or ADTRG1 pin input timing. The valid edge of an external input signal in external trigger mode can be specified as the rising edge, falling edge, or both rising and falling edges using the ES21 or ES20 bit of the INTM1 register for A/D converter 0 and the ES31 or ES30 bit of the INTM1 register for A/D converter 1. 11.10.1 Operation in select mode One analog input (ANI00 to ANI05, ANI10 to ANI17) specified by the ADSCM00 or ADSCM10 register is A/D converted. The conversion result is stored in the ADCR0m or ADCR1n register (m = 0 to 5, n = 0 to 7). Using the ADTRG0 or ADTRG1 signal as a trigger, one analog input is A/D converted at a time and the result is stored in the ADCR0m or ADCR1n register. Analog inputs correspond one-to-one with A/D conversion result registers. For each A/D conversion, an A/D conversion end interrupt (INTAD0 or INTAD1) is generated, which terminates A/D conversion (ADCS0, ADCS1 bit = 0).
Trigger ADTRGm signal ANImn Analog Input A/D Conversion Result Register ADCRmn
Remark
m = 0, 1 n: 0 to 5 when m = 0, or 0 to 7 when m = 1
To restart A/D conversion, a trigger must be input again from the ADTRGn pin (n = 0, 1). This is optimal for applications that read results each time there is an A/D conversion in synchronization with an external trigger. Figure 11-12. Example of Select Mode (External Trigger Select) Operation (ANI02): For A/D Converter 0
ANI00 ANI01 ADTRG0 ANI02 ANI03 ANI04 ANI05 (1) ADCE0 bit of ADSCM00 = 1 (Enabled) (2) External trigger generation (3) A/D conversion of ANI02 (4) Store conversion result in ADCR02 (5) INTAD0 interrupt generation A/D converter 0
ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05
User's Manual U15195EJ3V0UD
525
CHAPTER 11 A/D CONVERTER
11.10.2 Operation in scan mode Using the ADTRG0 or ADTRG1 signal as a trigger, pins from the conversion start analog input pin to the conversion termination analog input pin specified by the ADSCM00 or ADSCM10 register are sequentially selected and A/D converted. A/D conversion results are stored in the ADCR0m or ADCRN1n register corresponding to the analog input (m = 0 to 5, n = 0 to 7). When conversion ends for all of the specified analog inputs, an INTAD0 or INTAD1 interrupt is generated, which terminates A/D conversion (ADCS0, ADCS1 = 0).
Trigger ADTRGn signal ANIn0 ANIn1 ANIn2 ANIn3 ANIn4 ANIn5 ANI16 ANI17 Analog Input A/D Conversion Result Register ADCRn0 ADCRn1 ADCRn2 ADCRn3 ADCRn4 ADCRn5 ADCR16 ADCR17
Remark
n = 0, 1
After all specified A/D conversions have ended, A/D conversion is restarted when an external trigger signal occurs. This is optimal for applications that regularly monitor multiple analog inputs in synchronization with an external trigger. Figure 11-13. Example of Scan Mode (External Trigger Scan) Operation: For A/D Converter 0
(a) When setting to scan ANI01 to ANI04
ANI00 ANI01 ANI02 ADTRG0 ANI03 ANI04 ANI05 (1) ADCE0 bit of ADSCM00 = 1 (Enabled) (2) External trigger generation (3) A/D conversion of ANI01 (4) Store conversion result in ADCR01 (5) A/D conversion of ANI02 (6) Store conversion result in ADCR02 (7) A/D conversion of ANI03 (8) Store conversion result in ADCR03 (9) A/D conversion of ANI04 (10) Store conversion result in ADCR04 (11) INTAD0 interrupt generation A/D converter 0 ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05
526
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
11.11 Operation Cautions
11.11.1 Stopping A/D conversion operation If 0 is written in the ADCE0 or ADCE1 bit of the ADSCM00 or ADSCM10 register during A/D conversion, it stops the A/D conversion operation and an A/D conversion result is not stored in the ADCR0m or ADCR1n register (m = 0 to 5, n = 0 to 7). 11.11.2 Trigger input during A/D conversion operation If a trigger is input during A/D conversion, that trigger input is ignored. 11.11.3 External or timer trigger interval Make the trigger interval (input time interval) in external or timer trigger mode longer than the conversion time specified by the FR2 to FR0 bits of the ADSCM01 or ADSCM11 register. (1) When interval = 0 If multiple triggers are input simultaneously, the analog input whose ANI0m or ANI1n pin number is smallest is converted. The other trigger signals input at the same time are ignored (m = 0 to 5, n = 0 to 7). (2) When 0 < interval < conversion time If an external or timer trigger is input during A/D conversion, that trigger input is ignored. (3) When interval = conversion time If an external or timer trigger is input at the same time as the end of A/D conversion (conflict of compare termination signal and trigger), interrupt generation and storage of the value at which conversion ended in the ADCR0m or ADCR1n register is performed correctly (m = 0 to 5, n = 0 to 7). 11.11.4 Operation in standby modes (1) HALT mode A/D conversion is suspended. If released by NMI or maskable interrupt input, the ADSCM00, ADSCM10, ADSCM01, or ADSCM11 register and ADCR0m or ADCR1n register maintain their values (m = 0 to 5, n = 0 to 7). If released by RESET input, the ADCR0m and ADCR1n registers are initialized. (2) IDLE mode, software STOP mode Since clock provision to A/D converter 0 or 1 stops, A/D conversion is not performed. If released by NMI or maskable interrupt input, the ADSCM00, ADSCM10, ADSCM01, or ADSCM11 register and ADCR0m or ADCR1n register maintain their values (m = 0 to 5, n = 0 to 7). However, if IDLE mode or software STOP mode is set during an A/D conversion operation, the A/D conversion operation stops. If released by RESET input, the ADCR0m and ADCR1n registers are initialized. 11.11.5 Compare match interrupt in timer trigger mode The TM0n timer 0 register underflow interrupt (INTTM00 or INTTM01) and CM003 to CM005 or CM013 to CM015 match interrupt (INTCM003 to INTCM005 or INTCM013 to INTCM015) are A/D conversion start triggers that start a conversion operation (n = 0,1). At this time, the CM003 to CM005 or CM013 to CM015 match interrupt (INTCM003 to INTCM005 or INTCM013 to INTCM015) also functions as a compare register match interrupt for the CPU. In order not to generate these match interrupts for the CPU, disable interrupts using the mask bits (TM0MK0, TM0MK1, CM03MK0 to CM05MK0, CM03MK1 to CM05MK1) of the interrupt control registers (TM0IC0, TM0IC1, CM03IC0 to CM05IC0, CM03IC1 to CM05IC1).
User's Manual U15195EJ3V0UD
527
CHAPTER 11 A/D CONVERTER
11.11.6 Timing that makes the A/D conversion result undefined If the timing of the end of A/D conversion and the timing of the stop of operation of the A/D converter conflict, the A/D conversion value may be undefined. Because of this, be sure to read the A/D conversion result while the A/D converter is in operation. Furthermore, when reading an A/D conversion result after the A/D converter operation has stopped, be sure to have done so by the time the next conversion result is complete. The conversion result read timing is shown in Figures 11-14 and 11-15 below. Figure 11-14. Conversion Result Read Timing (When Conversion Result Is Undefined)
A/D conversion end
A/D conversion end
ADCRnm
Normal conversion result
Undefined value
INTADn ADCEn
Normal conversion result read
A/D operation stopped
Undefined value read
Remark
n = 0, 1 When n = 0: m = 0 to 5 When n = 1: m = 0 to 7
Figure 11-15. Conversion Result Read Timing (When Conversion Result Is Normal)
A/D conversion end
ADCRnm
Normal conversion result
INTADn ADCEn
A/D operation stopped
Normal conversion result read
Remark
n = 0, 1 When n = 0: m = 0 to 5 When n = 1: m = 0 to 7
528
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
11.12 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). %FSR indicates the ratio of analog input voltage that can be converted as a percentage, and is always represented by the following formula regardless of the resolution. 1%FSR = (Max. value of analog input voltage that can be converted - Min. value of analog input voltage that can be converted)/100 = (AVDDn - 0)/100 = AVDDn/100 Remark n = 0, 1 1LSB is as follows when the resolution is 10 bits. 1LSB = 1/2 = 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, linearity error and 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. Figure 11-16. Overall Error
10
1......1
Ideal line
Digital output
Overall error
0......0 0 Analog input AVDDn (n = 0, 1)
User's Manual U15195EJ3V0UD
529
CHAPTER 11 A/D CONVERTER
(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 11-17. Quantization Error
1......1
Digital output
1/2LSB
Quantization error 1/2LSB
0......0 0 Analog input AVDDn (n = 0, 1)
(4) Zero-scale error This shows the difference between the actual measurement value of the analog input voltage and the theoretical value (1/2 LSB) when the digital output changes from 0......000 to 0......001. Figure 11-18. Zero-Scale Error
111
Digital output (Lower 3 bits)
Ideal line 100 Zero-scale error 011
010 001 000 -1 0 1 2 3 Analog input (LSB) AVDDn (n = 0, 1)
530
User's Manual U15195EJ3V0UD
CHAPTER 11 A/D CONVERTER
(5) Full-scale error This shows the difference between the actual measurement value of the analog input voltage and the theoretical value (3/2LSB) when the digital output changes from 1......110 to 1......111. Figure 11-19. Full-Scale Error
Full-scale error
Digital output (Lower 3 bits)
111 100 011 010
000 0 AVDDn-3 AVDDn-2 AVDDn-1 AVDDn (n = 0, 1) Analog input (LSB)
(6) 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 11-20. Differential Linearity Error
1......1 Ideal 1LSB width
Digital output
Differential linearity error 0......0 0 Analog input AVDDn (n = 0, 1)
User's Manual U15195EJ3V0UD
531
CHAPTER 11 A/D CONVERTER
(7) 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. Figure 11-21. Integral Linearity Error
1......1 Ideal line
Digital output
0......0 0
Integral linearity error AVDDn (n = 0, 1)
Analog input
(8) Conversion time This expresses the time from when the analog input voltage was applied to the time when the digital output was 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. Figure 11-22. Sampling Time
Sampling time
Conversion time
532
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
12.1 Features
* Input-only ports: I/O ports: 6 47
* Ports function alternately as I/O pins of other peripheral functions * Input or output can be specified in bit units
12.2 Basic Configuration of Ports
The V850E/IA2 has a total of 53 on-chip I/O ports (ports 0 to 4, DH, DL, CT, CM), of which 6 are input-only ports. The port configuration is shown below.
P00 Port 0 P05
PDH0 Port DH PDH5
P10 Port 1 P12
PDL0 Port DL PDL15
P20 Port 2 P27
PCT0 PCT1 PCT4 PCT6
Port CT
P30 Port 3 P34
PCM0 PCM1
Port CM
P40 Port 4 P42
(1) Functions of each port The V850E/IA2 has the ports shown below. Any port can operate in 8-bit or 1-bit units and can provide a variety of controls. Moreover, besides its function as a port, each has functions as the I/O pins of on-chip peripheral I/O in control mode. Refer to (3) Port block diagrams for a block diagram of the block type of each port.
User's Manual U15195EJ3V0UD
533
CHAPTER 12 PORT FUNCTIONS
Port Name Port 0
Pin Name P00 to P05
Port Function 6-bit input
Function in Control Mode NMI input Real-time pulse unit (RPU) output stop signal input External interrupt input A/D converter (ADC) external trigger input Timer 3 output stop signal input Real-time pulse unit (RPU) I/O External interrupt input Real-time pulse unit (RPU) I/O External interrupt input Serial interface I/O (UART0, UART1/CSI1) Serial interface I/O (CSI0) External address bus (A16 to A21) External address data bus (AD0 to AD15) External bus interface control signal output E
Block Type
Port 1
P10 to P12
3-bit I/O
B, K
Port 2
P20 to P27
8-bit I/O
B, K, L
Port 3 Port 4 Port DH Port DL Port CT
P30 to P34 P40 to P42 PDH0 to PDH5 PDL0 to PDL15 PCT0 PCT1, PCT4, PCT6 PCM0, PCM1
5-bit I/O 3-bit I/O 6-bit I/O 16-bit I/O 4-bit I/O
A, C, F, G, H A, C, J N M I
Port CM
2-bit I/O
Wait insertion signal input Internal system clock output
D, I
Cautions 1. When switching to the control mode, be sure to set ports that operate as output pins or I/O pins in the control mode using the following procedure. <1> Set the inactive level for the signal output in the control mode in the corresponding bits of port n (n = 0 to 4, CM, CS, CT, DH, and DL). <2> Switch to the control mode using the port n mode control register (PMCn). If <1> above is not performed, the contents of port n may be output for a moment when switching from the port mode to the control mode. 2. When port manipulation is performed by a bit manipulation instruction (SET1, CLR1, or NOT1), perform byte data read for the port and process the data of only the bits to be manipulated, and write the byte data after conversion back to the port. For example, in ports in which input and output are mixed, because the contents of the output latch are overwritten to bits other than the bits for manipulation, the output latch of the input pin becomes undefined (in the input mode, however, the pin status does not change because the output buffer is off). Therefore, when switching the port from input to output, set the output expected value to the corresponding bit, and then switch to the output port. This is the same as when the control mode and output port are mixed. 3. The state of the port pin can be read by setting the port n mode register (PMn) to the input mode regardless of the settings of the PMCn register. When the PMn register is set to the output mode, the value of the port n register (Pn) can be read in the port mode while the output state of the alternate function can be read in the control mode.
534
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(2) Functions of each port pin after reset and registers that set port or control mode
Port Name Pin Name Pin Function After Reset Single-Chip Mode Port 0 P00/NMI P01/ESO0/INTP0 P02/ESO1/INTP1 P03/ADTRG0/INTP2 P04/ADTRG1/INTP3 P05/INTP4/TO3OFF Port 1 P10/TIUD10/TO10 P11/TCUD10/INTP100 P12/TCLR10/INTP101 Port 2 P20/TI2/INTP20 P21/TO21/INTP21 P22/TO22/INTP22 P23/TO23/INTP23 P24/TO24/INTP24 P25/TCLR2/INTP25 P26/TI3/TCLR3/INTP30 P27/TO3/INTP31 Port 3 P30/RXD0 P31/TXD0 P32/RXD1/SI1 P33/TXD1/SO1 P34/ASCK1/SCK1 Port 4 P40/SI0 P41/SO0 P42/SCK0 Port CM PCM0/WAIT PCM1/CLKOUT Port CT PCT0/LWR PCT1/UWR PCT4/RD PCT6/ASTB Port DH Port DL PDH0/A16 to PDH5/A21 PDL0/AD0 to PDL15/AD15 P00 (Input mode) P01 (Input mode) P02 (Input mode) P03 (Input mode) P04 (Input mode) P05 (Input mode) P10 (Input mode) P11 (Input mode) P12 (Input mode) P20 (Input mode) P21 (Input mode) P22 (Input mode) P23 (Input mode) P24 (Input mode) P25 (Input mode) P26 (Input mode) P27 (Input mode) P30 (Input mode) P31 (Input mode) P32 (Input mode) P33 (Input mode) P34 (Input mode) P40 (Input mode) P41 (Input mode) P42 (Input mode) PCM0 (Input mode) PCM1 (Input mode) PCT0 (Input mode) PCT1 (Input mode) PCT4 (Input mode) PCT6 (Input mode) PDH0 to PDH5 (Input mode) PDL0 to PDL7 (Input mode) WAIT CLKOUT LWR LWR RD ASTB A16 to A21 AD0 to AD15 PMCCT PMCCT PMCDH PMCDL PMCCT PMCCM PMC4 PMC2, PFC2 PMC3 PMC2 PMC2 PMC2, PFC2 PMC1, PFC1 PMC1 ROMless Mode Mode-Setting Register -
User's Manual U15195EJ3V0UD
535
CHAPTER 12 PORT FUNCTIONS
(3) Port block diagrams Figure 12-1. Type A Block Diagram
WRPMC PMCmn WRPM PMmn
Internal bus
WRPORT
Selector
Output signal in control mode Pmn
Pmn
Selector
RDIN
Address
Remark
m: Port number n: Bit number
536
User's Manual U15195EJ3V0UD
Selector
CHAPTER 12 PORT FUNCTIONS
Figure 12-2. Type B Block Diagram
WRPMC PMCmn WRPM PMmn
Internal bus
WRPORT Pmn Pmn
Selector
Address RDIN Input signal in control mode Noise elimination Edge detection
Remark
m: Port number n: Bit number
Selector
User's Manual U15195EJ3V0UD
537
CHAPTER 12 PORT FUNCTIONS
Figure 12-3. Type C Block Diagram
WRPMC PMCmn WRPM PMmn
Internal bus
WRPORT Pmn Pmn
Selector
Address RDIN Input signal in control mode
Remark
m: Port number n: Bit number
538
User's Manual U15195EJ3V0UD
Selector
CHAPTER 12 PORT FUNCTIONS
Figure 12-4. Type D Block Diagram
Set/reset control of PMC WRPMC PMCCM0 WRPM
Internal bus
PMCM0 WRPORT PCM0 PCM0
Selector
Address RDIN Input signal in control mode
Selector
User's Manual U15195EJ3V0UD
539
CHAPTER 12 PORT FUNCTIONS
Figure 12-5. Type E Block Diagram
Selector
Internal bus
1 Noise elimination Pmn
RDIN Input signal in control mode
Address
Edge detection
Remark
m: Port number n: Bit number
Figure 12-6. Type F Block Diagram
WRPFC PFC33 WRPMC PMC33 WRPM
Internal bus
PM33
Selector
WRPORT P33
Selector
Output signal in control mode
P33
Selector
RDIN
Address
540
User's Manual U15195EJ3V0UD
Selector
CHAPTER 12 PORT FUNCTIONS
Figure 12-7. Type G Block Diagram
WRPFC PFC32 WRPMC PMC32 WRPM
Internal bus
PM32
WRPORT P32 P32
Selector
Address RDIN Input signal in control modeNote
Selector
Note The signal level of the input signal is as follows in control mode.
PMC32 bit (PMC3 register) 0 1 1 PFC32 bit (PFC3 register) x 0 1 Input signal in control mode RXD1 H Pin level H SI1 L L Pin level
H: High level L: Low level x: Don't care
Selector
User's Manual U15195EJ3V0UD
541
CHAPTER 12 PORT FUNCTIONS
Figure 12-8. Type H Block Diagram
ASCK1 output enable signal WRPFC PFC34 WRPMC PMC34 WRPM
Internal bus
SCK1 output enable signal 1
Selector
PM34 Output signal 1 in control mode Output signal 2 1 in control mode WRPORT P34
Selector
1
Selector
P34
Selector
Address RDIN Input signal in control modeNote
Selector
Note The signal level of the input signal is as follows in control mode.
PMC34 bit (PMC3 register) 0 1 1 PFC34 bit (PFC3 register) x 0 1 Input signal in control mode ASCK1 L Pin level L SCK1 L L Pin level
H: High level L: Low level x: Don't care
542
User's Manual U15195EJ3V0UD
Selector
CHAPTER 12 PORT FUNCTIONS
Figure 12-9. Type I Block Diagram
Set/reset control of PMC WRPMC PMCmn WRPM PMmn
Internal bus
WRPORT
Selector
Output signal in control mode Pmn
1 Pmn
Selector
Selector
1
Address RDIN
Remark
m: Port number n: Bit number
User's Manual U15195EJ3V0UD
543
CHAPTER 12 PORT FUNCTIONS
Figure 12-10. Type J Block Diagram
WRPMC PMC42 WRPM PM42
SCK0 output enable signal
Internal bus
Selector
WRPORT
Output signal in control mode P42
P42
Selector
Address RDIN Input signal in control mode
544
User's Manual U15195EJ3V0UD
Selector
CHAPTER 12 PORT FUNCTIONS
Figure 12-11. Type K Block Diagram
WRPFC PFCmn WRPMC PMCmn WRPM
Internal bus
PMmn
Selector
WRPORT
Output signal in control mode Pmn
Pmn
Selector
Address RDIN Input signal in control mode Noise elimination Edge detection
Remark
m: Port number n: Bit number
Selector
User's Manual U15195EJ3V0UD
545
CHAPTER 12 PORT FUNCTIONS
Figure 12-12. Type L Block Diagram
WRPFC PFC27 WRPMC PMC27 WRPM TO3SP
Internal bus
PM27 R Q D WRPORT Output signal in control mode P27 INTP4Note
Selector
P27
Selector
Address RDIN Input signal in control mode Noise elimination Edge detection
Note Output signal after an edge on the INTP4 pin has been detected.
546
User's Manual U15195EJ3V0UD
Selector
CHAPTER 12 PORT FUNCTIONS
Figure 12-13. Type M Block Diagram
Set/reset control of PMC
Selector
WRPMC PMCmn WRPM PMmn
PSTPOFF BOENx
1
Internal bus
WRPORT
Selector
Output signal in control mode Pmn
1 Pmn
Selector
Selector
1
Address
RDIN Input signal in control mode
BOENx
BOENx
Remarks 1. m: Port number n: Bit number 2. x = 0, 1 3. PSTPOFF: Signal in IDLE/software STOP mode BOENx: A/D output signal
User's Manual U15195EJ3V0UD
547
CHAPTER 12 PORT FUNCTIONS
Figure 12-14. Type N Block Diagram
Set/reset control of PMC WRPMC PSTPOFF PMCmn WRPM
Internal bus
PMmn
WRPORT
Selector
Output signal in control mode Pmn
1
Selector
1
Pmn
Selector
Address
RDIN
Remarks 1. m: Port number n: Bit number 2. PSTPOFF: Signal in IDLE/software STOP mode
548
User's Manual U15195EJ3V0UD
Selector
CHAPTER 12 PORT FUNCTIONS
12.3 Pin Functions of Each Port
12.3.1 Port 0 Port 0 is a 6-bit input-only port in which all pins are fixed to input.
7 P0 -
6 -
5 P05
4 P04
3 P03
2 P02
1 P01
0 P00
Address FFFFF400H
After reset Undefined
Besides functioning as an input port, in control mode, it can also operate as the real-time pulse unit (RPU) output stop signal input, external interrupt request input, A/D converter (ADC) external trigger input, and timer 3 output stop signal input. Although this port is also used as NMI, ESO0/INTP0, ESO1/INTP1, ADTRG0/INTP2, ADTRG1/INTP3, and INTP4/TO3OFF, these functions cannot be switched with input port functions. The status of each pin is read by reading the port. (1) Operation in control mode
Port Port 0 P00 P01 P02 P03 P04 P05 Alternate Pin Name NMI ESO0/INTP0 ESO1/INTP1 ADTRG0/INTP2 ADTRG1/INTP3 INTP4/TO3OFF Remarks Non-maskable interrupt request input Real-time pulse unit (RPU) output stop signal input or external interrupt request input A/D converter (ADC) external trigger input or external interrupt request input External interrupt request input/timer 3 output stop signal input Block Type E
User's Manual U15195EJ3V0UD
549
CHAPTER 12 PORT FUNCTIONS
12.3.2 Port 1 Port 1 is a 3-bit I/O port in which input or output can be specified in 1-bit units.
7 P1 -
6 -
5 -
4 -
3 -
2 P12
1 P11
0 P10
Address FFFFF402H
After reset Undefined
Bit position 2 to 0
Bit name P1n (n = 2 to 0) I/O port
Function
Besides functioning as a port, in control mode, it can also operate as the real-time pulse unit (RPU) I/O and external interrupt request input. (1) Operation in control mode
Port Port 1 P10 P11 P12 Alternate Pin Name TIUD10/TO10 TCUD10/INTP100 TCLR10/INTP101 Remarks Real-time pulse unit (RPU) I/O Real-time pulse unit (RPU) input or external interrupt request input Block Type K B
(2) Setting in I/O mode and control mode Port 1 is set in I/O mode using the port 1 mode register (PM1). In control mode, it is set using the port 1 mode control register (PMC1) and port function control register 1 (PFC1). (a) Port 1 mode register (PM1) This register can be read or written in 8-bit or 1-bit units. Write 1 in bits 3 to 7.
7 PM1 1
6 1
5 1
4 1
3 1
2 PM12
1 PM11
0 PM10
Address FFFFF422H
After reset FFH
Bit position 2 to 0
Bit name PM1n (n = 2 to 0)
Function Specifies input/output mode of P1n pin. 0: Output mode (output buffer on) 1: Input mode (output buffer off)
550
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(b) Port 1 mode control register (PMC1) This register can be read or written in 8-bit or 1-bit units. Write 0 in bits 3 to 7. Caution The PMC11 and PMC12 bits are also used as external interrupts (INTP100 and INTP101). When not using them as external interrupts, mask interrupt requests (refer to 7.3.4 Interrupt control registers (xxICn)).
7 PMC1 0
6 0
5 0
4 0
3 0
2 PMC12
1 PMC11
0 PMC10
Address FFFFF442H
After reset 00H
Bit position 2
Bit name PMC12
Function Specifies operation mode of P12 pin. 0: I/O port mode 1: TCLR10 input mode or external interrupt request (INTP101) input mode Specifies operation mode of P11 pin. 0: I/O port mode 1: TCUD10 input mode or external interrupt request (INTP100) input mode Specifies operation mode of P10 pin. 0: I/O port mode 1: TIUD10 input mode or TO10 output mode
1
PMC11
0
PMC10
(c) Port 1 function control register (PFC1) This register can be read or written in 8-bit or 1-bit units. Write 0 in bits other than 0. Caution When port mode is specified by the port 1 mode control register (PMC1), the setting of this register is invalid.
7 PFC1 0
6 0
5 0
4 0
3 0
2 0
1 0
0 PFC10
Address FFFFF462H
After reset 00H
Bit position 0
Bit name PFC10
Function Specifies operation mode of P10 pin in control mode. 0: TIUD10 input mode 1: TO10 output mode
User's Manual U15195EJ3V0UD
551
CHAPTER 12 PORT FUNCTIONS
12.3.3 Port 2 Port 2 is an 8-bit I/O port in which input or output can be specified in 1-bit units.
7 P2 P27
6 P26
5 P25
4 P24
3 P23
2 P22
1 P21
0 P20
Address FFFFF404H
After reset Undefined
Bit position 7 to 0
Bit name P2n (n = 7 to 0) I/O port
Function
Besides functioning as a port, in control mode, it also can operate as the real-time pulse unit (RPU) I/O and external interrupt request input. (1) Operation in control mode
Port Port 2 P20 Alternate Pin Name TI2/INTP20 Remarks Real-time pulse unit (RPU) input or external interrupt request input Real-time pulse unit (RPU) output or external interrupt request input Real-time pulse unit (RPU) input or external interrupt request input Real-time pulse unit (RPU) output or external interrupt request input Block Type B
P21 to 24
TO21/INTP21 to TO24/INTP24 TCLR2/INTP25 TI3/TCLR3/INTP30 TO3/INTP31
K
P25 P26 P27
B
L
(2) Setting in I/O mode and control mode Port 2 is set in I/O mode using the port 2 mode register (PM2). In control mode, it is set using the port 2 mode control register (PMC2) and port 2 function control register (PFC2). (a) Port 2 mode register (PM2) This register can be read or written in 8-bit or 1-bit units.
7 PM2 PM27
6 PM26
5 PM25
4 PM24
3 PM23
2 PM22
1 PM21
0 PM20
Address FFFFF424H
After reset FFH
Bit position 7 to 0
Bit name PM2n (n = 7 to 0)
Function Specifies input/output mode of P2n pin. 0: Output mode (output buffer on) 1: Input mode (output buffer off)
552
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(b) Port 2 mode control register (PMC2) This register can be read or written in 8-bit or 1-bit units. Caution The PMC20, PMC25, and PMC26 bits also serve as external interrupts (INTP20, INTP25, and INTP30). When not using them as external interrupts, mask interrupt requests (refer to 7.3.4 Interrupt control registers (xxICn)).
7 PMC2 PMC27
6 PMC26
5 PMC25
4 PMC24
3 PMC23
2 PMC22
1 PMC21
0 PMC20
Address FFFFF444H
After reset 00H
Bit position 7
Bit name PMC27
Function Specifies operation mode of P27 pin 0: I/O port mode 1: TO3 output mode or external interrupt request (INTP31) input mode Specifies operation mode of P26 pin 0: I/O port mode 1: RPU (TI3, TCLR3) input mode or external interrupt request (INTP30) input mode Specifies operation mode of P25 pin 0: I/O port mode 1: TCLR2 input mode or external interrupt request (INTP25) input mode Specify operation mode of P24 to P21 pins 0: I/O port mode 1: TO24 to TO21 output mode or external interrupt request (INTP24 to INTP21) input mode Specifies operation mode of P20 pin 0: I/O port mode 1: TI2 input mode or external interrupt request (INTP20) input mode
6
PMC26
5
PMC25
4 to 1
PMC24 to PMC21
0
PMC20
(c) Port 2 function control register (PFC2) This register can be read or written in 8-bit or 1-bit units. Write 0 in bits 0, 5, and 6. Caution When port mode is specified by the port 2 mode control register (PMC2), the setting of this register is invalid.
7 PFC2 PFC27
6 0
5 0
4 PFC24
3 PFC23
2 PFC22
1 PFC21
0 0
Address FFFFF464H
After reset 00H
Bit position 7
Bit name PFC27
Function Specifies operation mode of P27 pin in control mode 0: External interrupt request (INTP31) input mode 1: TO3 output mode Specify operation mode of P24 to P21 pins in control mode 0: External interrupt request (INTP24 to INTP21) input mode 1: TO24 to TO21 output mode
4 to 1
PFC24 to PFC21
User's Manual U15195EJ3V0UD
553
CHAPTER 12 PORT FUNCTIONS
12.3.4 Port 3 Port 3 is a 5-bit I/O port in which input or output can be specified in 1-bit units
7 P3 -
6 -
5 -
4 P34
3 P33
2 P32
1 P31
0 P30
Address FFFFF406H
After reset Undefined
Bit position 4 to 0
Bit name P3n (n = 4 to 0) I/O port
Function
Besides functioning as a port, in control mode, it also can operate as the serial interface (UART0, UART1/CSI1) I/O. (1) Operation in control mode
Port Port 3 P30 P31 P32 P33 P34 Alternate Pin Name RXD0 TXD0 RXD1/SI1 TXD1/SO1 ASCK1/SCK1 Remarks Serial interface (UART0, UART1/CSI1) I/O Block Type C A G F H
(2) Setting in I/O mode and control mode Port 3 is set in I/O mode using the port 3 mode register (PM3). In control mode, it is set using the port 3 mode control register (PMC3) and the port 3 function control register (PFC3). (a) Port 3 mode register (PM3) This register can be read or written in 8-bit or 1-bit units.
7 PM3 -
6 -
5 -
4 PM34
3 PM33
2 PM32
1 PM31
0 PM30
Address FFFFF426H
After reset FFH
Bit position 4 to 0
Bit name PM3n (n = 4 to 0)
Function Specifies input/output mode of P3n pin. 0: Output mode (output buffer on) 1: Input mode (output buffer off)
554
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(b) Port 3 mode control register (PMC3) This register can be read or written in 8-bit or 1-bit units.
7 PMC3 0
6 0
5 0
4 PMC34
3 PMC33
2 PMC32
1 PMC31
0 PMC30
Address FFFFF446H
After reset 00H
Bit position 4
Bit name PMC34 Specifies operation mode of P34 pin 0: I/O port mode 1: ASCK1/SCK1 I/O mode Specifies operation mode of P33 pin 0: I/O port mode 1: TXD1/SO1 output mode Specifies operation mode of P32 pin 0: I/O port mode 1: RXD1/SI1 input mode Specifies operation mode of P31 pin 0: I/O port mode 1: TXD0 output mode Specifies operation mode of P30 pin 0: I/O port mode 1: RXD0 input mode
Function
3
PMC33
2
PMC32
1
PMC31
0
PMC30
(c) Port 3 function control register (PFC3) This register can be read or written in 8-bit or 1-bit units. Write 0 in bits other than 2 to 4. Caution When port mode is specified by the port 3 mode control register (PMC3), the setting of this register is invalid.
7 PFC3 0
6 0
5 0
4 PFC34
3 PFC33
2 PFC32
1 0
0 0
Address FFFFF466H
After reset 00H
Bit position 4
Bit name PFC34
Function Specifies operation mode of P34 pin in control mode 0: ASCK1 I/O mode 1: SCK1 I/O mode Specifies operation mode of P33 pin in control mode 0: TXD1 output mode 1: SO1 output mode Specifies operation mode of P32 pin in control mode 0: RXD1 input mode 1: SI1 input mode
3
PFC33
2
PFC32
User's Manual U15195EJ3V0UD
555
CHAPTER 12 PORT FUNCTIONS
12.3.5 Port 4 Port 4 is a 3-bit I/O port in which input or output can be specified in 1-bit units.
7 P4 -
6 -
5 -
4 -
3 -
2 P42
1 P41
0 P40
Address FFFFF408H
After reset Undefined
Bit position 2 to 0
Bit name P4n (n = 2 to 0) I/O port
Function
Besides functioning as a port, in control mode, it also can operate as the serial interface (CSI0) I/O. (1) Operation in control mode
Port Port 4 P40 P41 P42 Alternate Pin Name SI0 SO0 SCK0 Remarks Serial interface (CSI0) I/O Block Type C A J
556
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(2) Setting in I/O mode and control mode Port 4 is set in I/O mode using the port 4 mode register (PM4). In control mode, it is set using the port 4 mode control register (PMC4). (a) Port 4 mode register (PM4) This register can be read or written in 8-bit or 1-bit units.
7 PM4 1
6 1
5 1
4 1
3 1
2 PM42
1 PM41
0 PM40
Address FFFFF428H
After reset FFH
Bit position 2 to 0
Bit name PM4n (n = 2 to 0)
Function Specifies input/output mode of P4n pin. 0: Output mode (output buffer on) 1: Input mode (output buffer off)
(b) Port 4 mode control register (PMC4) This register can be read or written in 8-bit or 1-bit units.
7 PMC4 0
6 0
5 0
4 0
3 0
2 PMC42
1 PMC41
0 PMC40
Address FFFFF448H
After reset 00H
Bit position 2
Bit name PMC42 Specifies operation mode of P42 pin 0: I/O port mode 1: SCK0 I/O mode Specifies operation mode of P41 pin 0: I/O port mode 1: SO0 output mode Specifies operation mode of P40 pin 0: I/O port mode 1: SI0 input mode
Function
1
PMC41
0
PMC40
User's Manual U15195EJ3V0UD
557
CHAPTER 12 PORT FUNCTIONS
12.3.6 Port DH Port DH is a 6-bit I/O port in which input or output can be specified in 1-bit units.
7 PDH -
6 -
5 PDH5
4 PDH4
3 PDH3
2 PDH2
1 PDH1
0 PDH0
Address FFFFF006H
After reset Undefined
Bit position 5 to 0
Bit name PDHn (n = 5 to 0) I/O port
Function
Besides functioning as a port, in control mode, this can operate as an address bus when memory is expanded externally. (1) Operation in control mode
Port Port DH PDH5 to PDH0 Alternate Pin Name A21 to A16 Remarks Memory expansion address bus Block Type N
558
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(2) Setting in I/O mode and control mode Port DH is set in I/O mode using the port DH mode register (PMDH). In control mode, it is set using the port DH mode control register (PMCDH). (a) Port DH mode register (PMDH) This register can be read or written in 8-bit or 1-bit units.
7 PMDH 1
6 1
5 PMDH5
4 PMDH4
3 PMDH3
2 PMDH2
1 PMDH1
0 PMDH0
Address FFFFF026H
After reset FFH
Bit position 5 to 0
Bit name PMDHn (n = 5 to 0)
Function Specifies input/output mode of PDHn pin. 0: Output mode (output buffer on) 1: Input mode (output buffer off)
(b) Port DH mode control register (PMCDH) This register can be read or written in 8-bit or 1-bit units. Caution Set bits 7 and 6 as follows.
Operation Mode Single-chip mode ROMless mode Bit 7 0 1 Bit 6 0 1
7 PMCDH
6
5
4
3
2
1
0
Address FFFFF046H
After resetNote 00H/FFH
PMCDH7 PMCDH6 PMCDH5 PMCDH4 PMCDH3 PMCDH2 PMCDH1 PMCDH0
Note 00H: Single-chip mode FFH: ROMless mode
Bit position 5 to 0 Bit name PMCDHn (n = 5 to 0) Function Specifies operation mode of PDHn pin 0: I/O port mode 1: A21 to A16 output mode
User's Manual U15195EJ3V0UD
559
CHAPTER 12 PORT FUNCTIONS
12.3.7 Port DL Port DL is a 16-bit I/O port in which input or output can be specified in 1-bit units. When using the higher 8 bits of PDL as PDLH and the lower 8 bits as PDLL, it can be used as an 8-bit I/O port that can specify input/output in 1-bit units.
15 PDL PDL15
14 PDL14
13 PDL13
12 PDL12
11 PDL11
10 PDL10
9 PDL9
8 PDL8
Address FFFFF005H
After reset Undefined
7 PDL7
6 PDL6
5 PDL5
4 PDL4
3 PDL3
2 PDL2
1 PDL1
0 PDL0
Address FFFFF004H
Bit position 15 to 0
Bit name PDLn (n = 15 to 0) I/O port
Function
Besides functioning as a port, in control mode, this can operate as an address and data bus when memory is expanded externally. (1) Operation in control mode
Port Port DL PDL15 to PDL0 Alternate Pin Name AD15 to AD0 Remarks Memory expansion address and data bus Block Type M
560
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(2) Setting in I/O mode and control mode Port DL is set in I/O mode using the port DL mode register (PMDL). In control mode, it is set using the port DL mode control register (PMCDL). (a) Port DL mode register (PMDL) The PMDL register can be read or written in 16-bit units. When using the higher 8 bits of the PMDL register as the PMDLH register and the lower 8 bits as the PMDLL register, it can be read or written in 8-bit or 1-bit units.
15 PMDL
14
13
12
11
10
9 PMDL9
8 PMDL8
Address FFFFF025H
After reset FFFFH
PMDL15 PMDL14 PMDL13 PMDL12 PMDL11 PMDL10
7 PMDL7
6 PMDL6
5 PMDL5
4 PMDL4
3 PMDL3
2 PMDL2
1 PMDL1
0 PMDL0
Address FFFFF024H
Bit position 15 to 0
Bit name PMDLn (n = 15 to 0)
Function Specifies input/output mode of PDLn pin. 0: Output mode (output buffer on) 1: Input mode (output buffer off)
(b) Port DL mode control register (PMCDL) The PMCDL register can be read or written in 16-bit units. When using the higher 8 bits of the PMCDL register as the PMCDLH register and the lower 8 bits as the PMCDLL register, it can be read or written in 8-bit or 1-bit units.
15 PMCDL
14
13
12
11
10
9
8
Address
After resetNote
PMCDL15 PMCDL14 PMCDL13 PMCDL12 PMCDL11 PMCDL10 PMCDL9 PMCDL8
FFFFF045H 0000H/FFFFH
7
6
5
4
3
2
1
0
Address FFFFF044H
PMCDL7 PMCDL6 PMCDL5 PMCDL4 PMCDL3 PMCDL2 PMCDL1 PMCDL0
Note 0000H : Single-chip mode FFFFH: ROMless mode
Bit position 15 to 0 Bit name PMCDLn (n = 15 to 0) Function Specifies operation mode of PDLn pin. 0: I/O port mode 1: AD15 to AD0 I/O mode
User's Manual U15195EJ3V0UD
561
CHAPTER 12 PORT FUNCTIONS
12.3.8 Port CT Port CT is a 4-bit I/O port in which input or output can be specified in 1-bit units.
7 PCT -
6 PCT6
5 -
4 PCT4
3 -
2 -
1 PCT1
0 PCT0
Address FFFFF00AH
After reset Undefined
Bit position 6, 4, 1, 0
Bit name PCTn (n = 6, 4, 1, 0) I/O port
Function
Besides functioning as a port, in control mode, this can operate as control signal outputs when memory is expanded externally. (1) Operation in control mode
Port Port CT PCT0 PCT1 PCT4 PCT6 Alternate Pin Name LWR UWR RD ASTB Read strobe signal output Address strobe signal output Remarks Write strobe signal output Block Type I
562
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(2) Setting in I/O mode and control mode Port CT is set in I/O mode using the port CT mode register (PMCT). In control mode, it is set using the port CT mode control register (PMCCT). (a) Port CT mode register (PMCT) This register can be read or written in 8-bit or 1-bit units.
7 PMCT 1
6 PMCT6
5 1
4 PMCT4
3 1
2 1
1 PMCT1
0 PMCT0
Address FFFFF02AH
After reset FFH
Bit position 6, 4, 1, 0
Bit name PMCTn (n = 6, 4, 1, 0)
Function Specifies input/output mode of PCTn pin. 0: Output mode (output buffer on) 1: Input mode (output buffer off)
(b) Port CT mode control register (PMCCT) This register can be read or written in 8-bit or 1-bit units.
7 PMCCT 0
6 PMCCT6
5 0
4 PMCCT4
3 0
2 0
1
0
Address FFFFF04AH
After resetNote 00H/53H
PMCCT1 PMCCT0
Note 00H: Single-chip mode 53H: ROMless mode
Bit position 6 Bit name PMCCT6 Function Specifies operation mode of PCT6 pin 0: I/O port mode 1: ASTB output mode Specifies operation mode of PCT4 pin 0: I/O port mode 1: RD output mode Specifies operation mode of PCT1 pin 0: I/O port mode 1: UWR output mode Specifies operation mode of PCT0 pin 0: I/O port mode 1: LWR output mode
4
PMCCT4
1
PMCCT1
0
PMCCT0
User's Manual U15195EJ3V0UD
563
CHAPTER 12 PORT FUNCTIONS
12.3.9 Port CM Port CM is a 2-bit I/O port in which input or output can be specified in 1-bit units.
7 PCM -
6 -
5 -
4 -
3 -
2 -
1 PCM1
0 PCM0
Address FFFFF00CH
After reset Undefined
Bit position 1, 0
Bit name PCMn (n = 1, 0) I/O port
Function
Besides functioning as a port, in control mode, this can operate as the wait insertion signal input and internal system clock output. (1) Operation in control mode
Port Port CM PCM0 PCM1 Alternate Pin Name WAIT CLKOUT Remarks Wait insertion signal input Internal system clock output Block Type D I
564
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(2) Setting in I/O mode and control mode Port CM is set in I/O mode using the port CM mode register (PMCM). In control mode, it is set using the port CM mode control register (PMCCM). (a) Port CM mode register (PMCM) This register can be read or written in 8-bit or 1-bit units.
7 PMCM 1
6 1
5 1
4 1
3 1
2 1
1 PMCM1
0 PMCM0
Address FFFFF02CH
After reset FFH
Bit position 1, 0
Bit name PMCMn (n = 1, 0)
Function Specifies input/output mode of PCMn pin. 0: Output mode (output buffer on) 1: Input mode (output buffer off)
(b) Port CM mode control register (PMCCM) This register can be read or written in 8-bit or 1-bit units.
7 PMCCM 0
6 0
5 0
4 0
3 0
2 0
1
0
Address FFFFF04CH
After resetNote 00H/03H
PMCCM1 PMCCM0
Note 00H: Single-chip mode 03H: ROMless mode
Bit position 1 Bit name PMCCM1 Function Specifies operation mode of PCM1 pin 0: I/O port mode 1: CLKOUT output mode Specifies operation mode of PCM0 pin 0: I/O port mode 1: WAIT input mode
0
PMCCM0
User's Manual U15195EJ3V0UD
565
CHAPTER 12 PORT FUNCTIONS
12.4 Noise Eliminator
12.4.1 Interrupt pins A timing controller to guarantee the noise elimination time shown below is added to the pins that operate as NMI and valid edge inputs in port control mode. A signal input that changes in less than this elimination time is not accepted internally.
Pin P00/NMI P01/ESO0/INTP0, P02/ESO1/INTP1 P03/ADTRG0/INTP2, P04/ADTRG1/INTP3 P05/INTP4/TO3OFF Noise Elimination Time Analog delay (Approx. 10 ns)
Cautions 1. The above non-maskable/maskable interrupt pins are used to release standby mode. A clock control timing circuit is not used since the internal system clock is stopped in standby mode. 2. The noise eliminator is valid only in control mode.
12.4.2 Timer 10, timer 3 input pins Noise filtering using the clock sampling shown below is added to the pins that operate as valid edge inputs to timer 10 and timer 3. A signal input that changes in less than these elimination times is not accepted internally.
Pin Timer 10 P10/TIUD10/TO10 P11/TCUD10/INTP100 P12/TCLR10/INTP101 Noise Elimination Time 4 to 5 clocks Sampling Clock Select from fXXTM10 fXXTM10/2 fXXTM10/4 fXXTM10/8 Select from fXXTM3/2 fXXTM3/4 fXXTM3/8 fXXTM3/16 Select from fXXTM3/32 fXXTM3/64 fXXTM3/128 fXXTM3/256
Timer 3
P26/TI3/INTP30/TCLR3
P27/TO3/INTP31
Cautions
1. Since the above pin noise filtering uses clock sampling, input signals are not received when the CPU clock is stopped. 2. The noise eliminator is valid only in control mode.
Remark
fXXTM10: Clock of TM10 selected in PRM02 register (be sure to set PRM02 = 01H) fXXTM3: Clock of TM3 selected in PRM03 register
566
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
Figure 12-15. Example of Noise Elimination Timing
Noise elimination clock
Input signal
2 clocks 2 clocks 3 clocks 3 clocks 4 clocks 4 clocks 5 clocks 5 clocks
Internal signal
Timers 1, 2, 3 rising edge detection Timers 1, 2, 3 falling edge detection
Caution If there are three or less noise elimination clocks while the timer 1 or 3 input signal is high level (or low level), the input pulse is eliminated as noise. If it is sampled at least four times, the edge is detected as valid input.
User's Manual U15195EJ3V0UD
567
CHAPTER 12 PORT FUNCTIONS
(1) Timer 10 noise elimination time selection register (NRC10) The NRC10 register is used to set the clock source of timer 10 input pin noise elimination time. It can be read or written in 8-bit or 1-bit units.
7 NRC10 0
6 0
5 0
4 0
3 0
2 0
1
0
Address FFFFF5F8H
After reset 00H
NRC101 NRC100
Bit position 1, 0
Bit name NRC101, NRC100
Function Selects the TIUD10/TO10, TCUD10/INTP100, and TCLR10/INTP101 pin noise elimination clocks.
NRC101 0 0 1 1
NRC100 0 1 0 1 fXXTM10/8 fXXTM10/4 fXXTM10/2 fXXTM10
Noise elimination clocks
Remark fXXTM10: Clock of TM10 selected by PRM02 register (be sure to set PRM02 = 01H)
568
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(2) Timer 3 noise elimination time selection register (NRC3) The NRC3 register is used to set the clock source of the timer 3 input pin noise elimination time. It can be read or written in 8-bit or 1-bit units.
7 NRC3 0
6 0
5 0
4 0
3 NRC33
2 NRC32
1 NRC31
0 NRC30
Address FFFFF698H
After reset 00H
Bit position 3, 2
Bit name NRC33, NRC32
Function Selects the TO3/INTP31 pin noise elimination clock.
NRC33 0 0 1 1
NRC32 0 1 0 1 fXXTM3/256 fXXTM3/128 fXXTM3/64 fXXTM3/32
Noise elimination clock
Remark 1, 0 NRC31, NRC30
fXXTM3: Clock of TM3 selected by PRM03 register
Selects the TI3/INTP30/TCLR3 pin noise elimination clock.
NRC31 0 0 1 1
NRC30 0 1 0 1 fXXTM3/16 fXXTM3/8 fXXTM3/4 fXXTM3/2
Noise elimination clocks
Remark
fXXTM3: Clock of TM3 selected by PRM03 register
User's Manual U15195EJ3V0UD
569
CHAPTER 12 PORT FUNCTIONS
12.4.3 Timer 2 input pins A noise eliminator using analog filtering and digital filtering using clock sampling are added to the timer 2 input pins. A signal input that changes in less than this elimination time is not accepted internally.
Pin Analog Filter Noise Elimination Time 10 to 100 ns Digital Filter Noise Elimination Time 4 to 5 clocks Sampling Clock fXXTM2
P20/TI2/INTP20 P21/TO21/INTP21 to P24/TO24/INTP24 P25/TCLR2/INTP25
Cautions
1. Since digital filtering uses clock sampling, if it is selected, input signals are not received when the CPU clock is stopped. 2. The noise eliminator is valid only in control mode. 3. Refer to Figure 12-13 for an example of a noise eliminator.
Remark
fXXTM2: Clock of TM20 and TM21 selected in PRM02 register (be sure to set PRM02 = 01H)
570
User's Manual U15195EJ3V0UD
CHAPTER 12 PORT FUNCTIONS
(1) Timer 2 input filter mode registers 0 to 5 (FEM0 to FEM5) The FEMn registers are used to specify timer 2 input pin filtering and to set the clock source of noise elimination time and the input valid edge. It can be read or written in 8-bit or 1-bit units. Cautions 1. Be sure to clear (0) the STFTE bit of timer 2 clock stop register 0 (STOPTE0) even when using the TI2/INTP20, TO21/INTP21, TO22/INTP22, TO23/INTP23, TO24/INTP24, and TCLR2/INTP25 pins as INTP20, INTP21, INTP22, INTP23, INTP24, and INTP25, respectively, and not using timer 2. 2. Setting the trigger mode of the INTP2n pin should be performed after setting the PMC2 register. If the PMC2 register is set after setting the FEMn register, an invalid interrupt may occur when the PMC2 register is set (n = 0 to 5). (1/2)
7 FEM0 DFEN00 6 0 5 0 4 0 3 2 1 0 TMS000 Address FFFFF630H After reset 00H
EDGE010 EDGE000 TMS010 INTP20
7 FEM1 DFEN01
6 0
5 0
4 0
3
2
1
0 TMS001
Address FFFFF631H
After reset 00H
EDGE011 EDGE001 TMS011 INTP21
7 FEM2 DFEN02
6 0
5 0
4 0
3
2
1
0 TMS002
Address FFFFF632H
After reset 00H
EDGE012 EDGE002 TMS012 INTP22
7 FEM3 DFEN03
6 0
5 0
4 0
3
2
1
0 TMS003
Address FFFFF633H
After reset 00H
EDGE013 EDGE003 TMS013 INTP23
7 FEM4 DFEN04
6 0
5 0
4 0
3
2
1
0 TMS004
Address FFFFF634H
After reset 00H
EDGE014 EDGE004 TMS014 INTP24
7 FEM5 DFEN05
6 0
5 0
4 0
3
2
1
0 TMS005
Address FFFFF635H
After reset 00H
EDGE015 EDGE005 TMS015 INTP25
Bit position 7
Bit name DFEN0n Specifies the INTP2n pin filter. 0: Analog filter 1: Digital filter
Function
Caution When the DFEN0n bit = 1, the sampling clock of the digital filter is fXXTM2 (clock selected by the PRM02 register).
Remark
n = 0 to 5
User's Manual U15195EJ3V0UD
571
CHAPTER 12 PORT FUNCTIONS
(2/2)
Bit position 3, 2 Bit name EDGE01n, EDGE00n Specifies the INTP2n pin valid edge. Function
EDGE01n 0 0 1 1
EGE00n 0 1 0 1
Operation Interrupt due to INTCC2nNote Rising edge Falling edge Both rising and falling edges
Note
Specify when selecting INTCC2n according to a match of TM20, TM21 and the subchannel compare registers (TMS01n, TMS00n bit settings) (n = 0 to 5).
1, 0
TMS01n, TMS00n
Selects capture inputNote.
TMS01n 0 0 1 1
TMS00n 0 1 0 1 Used as pin
Operation
Digital filter (noise eliminator specification) Capture to subchannel 1 according to timer Capture to subchannel 2 according to timer
Note
Capture input according to INTCM100 and INTCM101 can be selected only for the FEM1 and FEM2 registers. Set the values of the TMS01m and TMS00m bits in the FEMm register to 00B or 01B. Settings other than these are prohibited (m = 1, 3 to 5). Capture according to INTP21, INTP22 and INTCM100, INTCM101 is possible for subchannel 1 and subchannel 2 of timer 2. Examples are shown below. (a) Capture subchannel 1 on INTCM101 FEM1 register = xxxxxx10B TMIC0 register = 00000010B (b) Capture subchannel 2 on INTCM101 FEM2 register = xxxxxx11B TMIC0 register = 00001000B
Remark
n = 0 to 5
572
User's Manual U15195EJ3V0UD
CHAPTER 13 RESET FUNCTION
When a low level is input to the RESET pin, the system is reset and each hardware item of the V850E/IA2 is initialized to its initial status. When the RESET pin changes from low level to high level, the reset status is released and the CPU starts program execution. Initialize the contents of various registers as needed within the program.
13.1 Features
* Noise elimination using analog delay (approx. 60 ns) at reset pin (RESET)
13.2 Pin Functions
During a system reset period, most pin output is high impedance (all pins except CLKOUT VSS, VSS3, CVSS, RVDD, REGOUT, REGIN, AVDD0, AVDD1, AVSS0, and AVSS1 pins). Thus, if memory is extended externally, a pull-up (or pull-down) resistor must be attached to each pin of ports DH, DL, CT, and CM. If there are no resistors, the external memory that is connected may be destroyed when these pins become high impedance. Similarly, perform pin processing so that on-chip peripheral I/O function signal outputs and output ports are not affected. Note In ROMless mode, CLKOUT signals are also output during a reset period. In single-chip mode, CLKOUT signals are not output until the PMCCM register is set. Table 13-1 shows the operation status of each pin during a reset period. Table 13-1. Operation Status of Each Pin During Reset Period
Pin Name In Single-Chip Mode External access pin A16 to A21, AD0 to AD15, LWR, UWR, RD, ASTB, WAIT CLKOUT High impedance (Input port mode) High impedance (Input port mode) High impedance (Input port mode) High impedance (Input port mode) High impedance Refer to the description of the external access pin. (control mode) Pin Status In ROMless Mode High impedance Operation
Note
, RESET, X2, VDD,
Port pin
Note
Port 0 to 4
Ports CM, CT, DH, DL
Dedicated function pin
TO0n0 to TO0n5 (Pins dedicated to timer 0 output) ANI00 to ANI05, ANI10 to ANI17 (Pins dedicated to A/D converter input)
High impedance (A/D converter input)
Note The names of the control pins that function alternately as port pins are omitted. Remark n = 0, 1
User's Manual U15195EJ3V0UD
573
CHAPTER 13 RESET FUNCTION
(1) Reset signal acknowledgment
RESET Analog delay Analog delay Analog delay
Elimination as noise Internal system reset signal Reset acknowledgment Note
Reset release
Note The internal system reset signal remains active for a period of at least 4 system clocks after the timing of a reset release by the RESET pin.
(2) Reset at power-on <1> Reset circuit
Regulator control (REGRES5) 5V 5V 5V
RESET 3.3 V Note
5 V reset generator 3.3 V 3.3 V reset generator
Pin high-impedance control (RES5)
Internal circuit control (RES3)
Note Apply 5 V initially. If 5 V is not applied initially, this level cannot be determined, and a reset will not occur. Caution Apply power in the following sequence. <1> 5 V power supply <2> 3.3 V power supply
574
User's Manual U15195EJ3V0UD
CHAPTER 13 RESET FUNCTION
<2> Reset timing
VDD (5 V)
REGIN (3.3 V)
RESET (input)
Active low
Internal REGRES5 (5 V)
Undefined
Active low
Internal RES5 (5 V)
Undefined
Active high
Internal RES3 (3.3 V)
Undefined
Active high Analog delay Regulator output stabilization time Oscillation stabilization time Note Reset release
Note The internal system reset signal stays active for at least 4 system clocks after the reset status caused by the RESET pin is released.
<3> Description A reset operation at power-on (power supply application) must guarantee "regulator output stabilization time + oscillation stabilization time" from power-on until reset acknowledgment due to the low level width of the RESET signal. Cautions 1. The V850E/IA2 has an internal regulator that generates 3.3 V from a 5 V system power supply. Therefore, 3.3 V system power is supplied after the lapse of the regulator output stabilization time after 5 V power was supplied. When supplying the two power supplies from external supplies with the regulator turned off, be sure to supply 5 V system power first. 2. The V850E/IA2 is internally reset after 3.3 V system power has been supplied. During the regulator output stabilization time, the internal circuits may not be reset when only 5 V system power is being supplied. Consequently, the pins may output undefined levels. For this reason, the V850E/IA2 makes the pins listed in (a) below that may affect the application system (mainly the I/O pins of the internal timers) go into a high-impedance state (refer to (b) and (c) below).
User's Manual U15195EJ3V0UD
575
CHAPTER 13 RESET FUNCTION
(a) Pins to be controlled TO000 to TO005, TO010 to TO015, P10/TO10/TIUD10, P11/INTP100/TCUD10, P12/INTP101/TCLR10, P20/INTP20/TI2, P21/INTP21/TO21, P22/INTP22/TO22, P23/INTP23/TO23, P24/INTP24/TO24, P25/INTP25/TCLR2, P26/TCLR3/INTP30/TI3, P27/INTP31/TO3 (b) Circuit of above pins
VDD I/O control signal of pin VDD Output buffer enable signal 0: Output buffer off 1: Output buffer on (at 3.3 V system reset)
5 V system reset (RES5) 1: Reset
Level shifter Output buffer
Pin to be controlled
(c) Internal reset of 5 V system/3.3 V system power supply (i) Operation on turning ON/OFF power
VDD (5 V system)
REGIN (3.3 V system) Controlled by external reset IC
RESET (input)
Internal RES5 (5 V system)
Internal RES3 (3.3 V system) Analog delay
Note
Pin to be controlled
Low level because power is off
High impedance
Operates
Low level because power is off
Pin manipulation instruction
Note The internal system reset signal stays active for at least 4 system clocks after the reset status caused by the RESET pin is released.
576
User's Manual U15195EJ3V0UD
CHAPTER 13 RESET FUNCTION
(ii) Reset during normal operation
VDD (5 V system) H
REGIN (3.3 V system) H
RESET (input)
Internal RES5 (5 V system)
Internal RES3 (3.3 V system)
Note 1 Note 1 Note 1 Note 2
Pin to be controlled
Operates
High impedance
Operates
Pin manipulation instruction
Notes 1. 2.
Analog delay The internal system reset signal stays active for at least 4 system clocks after the reset status caused by the RESET pin is released.
User's Manual U15195EJ3V0UD
577
CHAPTER 13 RESET FUNCTION
13.3 Initialization
Initialize the contents of each register as needed within the program. Table 13-2 shows the initial values of the CPU, internal RAM, and on-chip peripheral I/O after reset. Table 13-2. Initial Values of CPU, Internal RAM, and On-Chip Peripheral I/O After Reset (1/5)
On-Chip Hardware CPU Program registers Register Name General-purpose register (r0) General-purpose registers (r1 to r31) Program counter (PC) System registers Status save registers during interrupt (EIPC, EIPSW) Status save registers during NMI (FEPC, FEPSW) Interrupt cause register (ECR) Program status word (PSW) Status save registers during CALLT execution (CTPC, CTPSW) Status save registers during exception/debug trap (DBPC, DBPSW) CALLT base pointer (CTBP) Internal RAM On-chip peripheral I/O Bus control function - Chip area selection control register n (CSCn) (n = 0, 1) Bus size configuration register (BSC) System wait control register (VSWC) Memory control function Bus cycle type configuration register n (BCTn) (n = 0,1) Data wait control register n (DWCn) (n = 0,1) Address wait control register (AWC) Bus cycle control register (BCC) DMA function DMA source address register nL (DSAnL) (n = 0 to 3) DMA source address register nH (DSAnH) (n = 0 to 3) DMA destination address register nL (DDAnL) (n = 0 to 3) DMA destination address register nH (DDAnH) (n = 0 to 3) DMA transfer count register n (DBCn) (n = 0 to 3) DMA addressing control register n (DADCn) (n = 0 to 3) DMA channel control register n (DCHCn) (n = 0 to 3) DMA disable status register (DDIS) DMA restart register (DRST) DMA trigger source register n (DTFRn) (n = 0 to 3) Interrupt/ exception control function In service priority register (ISPR) External interrupt mode register n (INTMn) (n = 0 to 2) Interrupt mask register n (IMRn) (n = 0 to 3) Interrupt mask register nL (IMRnL) (n = 0 to 3) Interrupt mask register nH (IMRnH) (n = 0 to 3) Signal edge selection register 10 (SESA10) Initial Value After Reset 00000000H Undefined 00000000H Undefined Undefined 00000000H 00000020H Undefined Undefined Undefined Undefined 2C11H 5555H 77H CCCCH 3333H 0000H AAAAH Undefined Undefined Undefined Undefined Undefined 0000H 00H 00H 00H 00H 00H 00H FFFFH FFH FFH 00H
578
User's Manual U15195EJ3V0UD
CHAPTER 13 RESET FUNCTION
Table 13-2. Initial Values of CPU, Internal RAM, and On-Chip Peripheral I/O After Reset (2/5)
On-Chip Hardware On-chip peripheral I/O Interrupt/ exception control function Register Name Valid edge selection register (SESC) Timer 2 input filter mode register n (FEMn) (n = 0 to 5) Interrupt control registers (P0IC0 to P0IC4, DETIC0, DETIC1, TM0IC0, TM0IC1, TM2IC0, TM2IC1, TM3IC0, CC10IC0, CC10IC1, CC2IC0 to CC2IC5, CC3IC0, CC3IC1, CM00IC1, CM01IC1, CM02IC1, CM03IC0, CM03IC1, CM04IC0, CM04IC1, CM05IC0, CM05IC1, CM10IC0, CM10IC1, CM4IC0, DMAIC0 to DMAIC3, CSIIC0, CSIIC1, SEIC0, SRIC0, SRIC1, STIC0, STIC1, ADIC0, ADIC1) Power save control function Command register (PRCMD) Power save control register (PSC) Clock control register (CKC) Power save mode register (PSMR) Lock register (LOCKR) System control Peripheral command register (PHCMD) Peripheral status register (PHS) Timer 0 Dead time timer reload register n (DTRRn) (n = 0,1) Buffer registers CM0n, CM1n (BFCM0n, BFCM1n) (n = 0 to 5) Timer control register 0n (TMC0n) (n = 0,1) Timer control register 0nL (TMC0nL) (n = 0, 1) Timer control register 0nH (TMC0nH) (n = 0, 1) Timer unit control register 0n (TUC0n) (n = 0,1) Timer output mode register n (TOMRn) (n = 0,1) PWM software timing output register n (PSTOn) (n = 0,1) PWM output enable register n (POERn) (n = 0,1) TOMR write enable register n (SPECn) (n = 0,1) Timer 0 clock selection register (PRM01) Timer 1 Timer 10 (TM10) Compare register 1n (CM1n) (n = 00, 01) Capture/compare register 1n (CC1n) (n = 00, 01) Capture/compare control register 0 (CCR0) Timer unit mode register 0 (TUM0) Timer control register 10 (TMC10) Signal edge selection register 10 (SESA10) Prescaler mode register 10 (PRM10) Status register 0 (STATUS0) Timer connection selection register 0 (TMIC0) Timer 1/timer 2 clock selection register (PRM02) CC101 capture input selection register (CSL10) Timer 10 noise elimination time selection register (NRC10) Initial Value After Reset 00H 00H 47H
Undefined 00H 00H 00H 0000000xB Undefined 00H 0FFFH FFFFH 0508H 08H 05H 01H 00H 00H 00H 0000H 00H 0000H 0000H 0000H 00H 00H 00H 00H 07H 00H 00H 00H 00H 00H
User's Manual U15195EJ3V0UD
579
CHAPTER 13 RESET FUNCTION
Table 13-2. Initial Values of CPU, Internal RAM, and On-Chip Peripheral I/O After Reset (3/5)
On-Chip Hardware On-chip peripheral I/O Timer 2 Register Name Timer 2 clock stop register 0 (STOPTE0) Timer 2 clock stop register 0L (STOPTE0L) Timer 2 clock stop register 0H (STOPTE0H) Timer 2 count clock/control edge selection register 0 (CSE0) Timer 2 count clock/control edge selection register 0L (CSE0L) Timer 2 count clock/control edge selection register 0H (CSE0H) Timer 2 subchannel input event edge selection register 0 (SESE0) Timer 2 subchannel input event edge selection register 0L (SESE0L) Timer 2 subchannel input event edge selection register 0H (SESE0H) Timer 2 time base control register 0 (TCRE0) Timer 2 time base control register 0L (TCRE0L) Timer 2 time base control register 0H (TCRE0H) Timer 2 output control register 0 (OCTLE0) Timer 2 output control register 0L (OCTLE0L) Timer 2 output control register 0H (OCTLE0H) Timer 2 subchannels 0 and 5 capture/compare control register (CMSE050) Timer 2 subchannels 1 and 2 capture/compare control register (CMSE120) Timer 2 subchannels 3 and 4 capture/compare control register (CMSE340) Timer 2 subchannel n secondary capture/compare register (CVSEn0) (n = 0 to 4) Timer 2 subchannel n main capture/compare register (CVPEn0) (n = 0 to 4) Timer 2 subchannel n capture/compare register (CVSEn0) (n = 0, 5) Timer 2 time base status register 0 (TBSTATE0) Timer 2 time base status register 0L (TBSTATE0L) Timer 2 time base status register 0H (TBSTATE0H) Timer 2 capture/compare 1 to 4 status register 0 (CCSTATE0) Timer 2 capture/compare 1 to 4 status register 0L (CCSTATE0L) Timer 2 capture/compare 1 to 4 status register 0H (CCSTATE0H) Timer 2 output delay register 0 (ODELE0) Timer 2 output delay register 0L (ODELE0L) Timer 2 output delay register 0H (ODELE0H) Timer 2 software event capture register 0 (CSCE0) Timer 3 Timer 3 (TM3) Capture/compare register 3n (CC3n) (n = 0,1) Timer control register 30 (TMC30) Timer control register 31 (TMC31) Initial Value After Reset 0000H 00H 00H 0000H 00H 00H 0000H 00H 00H 0000H 00H 00H 0000H 00H 00H 0000H 0000H 0000H 0000H 0000H
0000H 0101H 01H 01H 0000H 00H 00H 0000H 00H 00H 0000H 0000H 0000H 00H 20H
580
User's Manual U15195EJ3V0UD
CHAPTER 13 RESET FUNCTION
Table 13-2. Initial Values of CPU, Internal RAM, and On-Chip Peripheral I/O After Reset (4/5)
On-Chip Hardware On-chip peripheral I/O Timer 3 Register Name Valid edge selection register (SESC) Timer 3 clock selection register (PRM03) Timer 3 noise elimination time selection register (NRC3) Timer 3 output control register (TOC3) Timer 4 Timer 4 (TM4) Compare register 4 (CM4) Timer control register 4 (TMC4) Serial interface function (CSI0, CSI1) Clocked serial interface mode register n (CSIMn) (n = 0,1) Clocked serial interface clock selection register n (CSICn) (n = 0,1) Clocked serial interface receive buffer register n (SIRBn) (n = 0,1) Clocked serial interface receive buffer register Ln (SIRBLn) (n = 0, 1) Clocked serial interface transmit buffer register n (SOTBn) (n = 0,1) Clocked serial interface transmit buffer register Ln (SOTBLn) (n = 0, 1) Clocked serial interface read-only receive buffer register n (SIRBEn) (n = 0,1) Clocked serial interface read-only receive buffer register Ln (SIRBELn) (n = 0, 1) Clocked serial interface first stage transmit buffer register n (SOTBFn) (n = 0,1) Clocked serial interface first stage transmit buffer register Ln (SOTBFLn) (n = 0, 1) Serial I/O shift register n (SIOn) (n = 0,1) Serial I/O shift register Ln (SIOLn) (n = 0, 1) Prescaler mode register 3 (PRSM3) Prescaler compare register 3 (PRSCM3) Serial interface function (UART0) Asynchronous serial interface mode register 0 (ASIM0) Receive buffer register 0 (RXB0) Asynchronous serial interface status register 0 (ASIS0) Transmit buffer register 0 (TXB0) Asynchronous serial interface transmit status register 0 (ASIF0) Baud rate generator control register 0 (BRGC0) Clock selection register 0 (CKSR0) Serial interface function (UART1) Asynchronous serial interface mode register 10 (ASIM10) Asynchronous serial interface mode register 11 (ASIM11) Asynchronous serial interface status register 1 (ASIS1) 2-frame consecutive receive buffer register 1 (RXB1) Receive buffer register L1 (RXBL1) 2-frame consecutive transmit shift register 1 (TXS1) Transmit shift register L1 (TXSL1) Initial Value After Reset 00H 00H 00H 00H 0000H 0000H 00H 00H 00H 0000H 00H 0000H 00H 0000H 00H 0000H 00H
0000H 00H 00H 00H 01H FFH 00H FFH 00H FFH 00H 81H 00H 00H Undefined Undefined Undefined Undefined
User's Manual U15195EJ3V0UD
581
CHAPTER 13 RESET FUNCTION
Table 13-2. Initial Values of CPU, Internal RAM, and On-Chip Peripheral I/O After Reset (5/5)
On-Chip Hardware On-chip peripheral I/O Serial interface function (UART1) A/D converter Register Name Prescaler mode register 1 (PRSM1) Prescaler compare register 1 (PRSCM1) A/D scan mode register n0 (ADSCMn0) (n = 0,1) A/D scan mode register n0L (ADSCMn0L) (n = 0, 1) A/D scan mode register n0H (ADSCMn0H) (n = 0, 1) A/D scan mode register n1 (ADSCMn1) (n = 0,1) A/D scan mode register n1L (ADSCMn1L) (n = 0, 1) A/D scan mode register n1H (ADSCMn1H) (n = 0, 1) A/D voltage detection mode register n (ADETMn) (n = 0,1) A/D voltage detection mode register nL (ADETMnL) (n = 0, 1) A/D voltage detection mode register nH (ADETMnH) (n = 0, 1) A/D conversion result register 0n (ADCR0n) (n = 0 to 5) A/D conversion result register 1n (ADCR1n) (n = 0 to 7) A/D internal trigger selection register n (ITRGn) (n = 0, 1) Port function Ports (P0 to P4, PDH, PCT, PCM) Port (PDL) Port (PDLL) Port (PDLH) Mode registers (PM1 to PM4, PMDH, PMCT, PMCM) Mode register (PMDL) Mode register (PMDLL) Mode register (PMDLH) Mode control registers (PMC1 to PMC4) Mode control registers (PMCDH) Mode control register (PMCDL) Mode control register (PMCDLL) Mode control register (PMCDLH) Mode control register (PMCCT) Mode control register (PMCCM) Function control registers (PFC1, PFC2, PFC3) Regulator Regulator control register (REGC) Initial Value After Reset 00H 00H 0000H 00H 00H 0000H 00H 00H 0000H 00H 00H 0000H 0000H 00H Undefined Undefined Undefined Undefined FFH FFFFH FFH FFH 00H 00H/FFH 0000H/FFFFH 00H/FFH 00H/FFH 00H/53H 00H/03H 00H 00H
Caution
In the table above, "Undefined" means either undefined at the time of a power-on reset or undefined due to data destruction when RESET input and data write timing are synchronized. For a RESET other than this, data is maintained in its previous status.
582
User's Manual U15195EJ3V0UD
CHAPTER 14 REGULATOR
14.1 Features
* Two power supplies, one for the internal CPU and one for the peripheral interface, are not necessary. * A 5 V single power supply system can be configured by connecting an N-ch transistor (2SD1950 (VL standard product, surface mount type) or 2SD1581 (independent type) is recommended). * If a 3.3 V power supply is available, it can be directly connected to the REGIN pin.
14.2 Functional Outline
The V850E/IA2 has an internal regulator that can be used to configure a 5 V single power supply system. To use this regulator, connect an N-ch transistor (2SD1950 (VL standard product, surface mount type) or 2SD1581 (independent type) is recommended) to the REGOUT pin, and the REGIN pin to CVSS via a capacitor for stabilizing the regulator output (refer to 14.3 Connection Example). If two power supplies (5 V system for the peripheral interface and 3.3 V system for the internal CPU) are available on the system, the regulator can be stopped by the regulator control register (REGC). The regulator always operates in each operation mode (normal operation, HALT, IDLE, and software STOP mode). If the 3.3 V power supply is provided separately, setting REGC = 01H suppresses the current consumption (several 10 A) of the on-chip regulator.
User's Manual U15195EJ3V0UD
583
CHAPTER 14 REGULATOR
14.3 Connection Example
(1) When using an on-chip regulator An on-chip regulator is used connected to an N-ch transistor. An example of connection when using an N-ch transistor and the mount pad dimensions when mounted on the 2SD1950 (VL standard product) (when using a glass epoxy board) are shown below. Figure 14-1. Example of Connection When Using N-ch Transistor
V850E/IA2 RVDD
VDD (4.5 to 5.5 V)
Regulator
REGOUT N-ch transistor R
REGIN (3.3 V)
22 F (recommended) CVSS REGOFF generator
Internal circuit
Remark
The 2SD1950 (VL standard product, surface mount type) or 2SD1581 (independent type) is recommended as the N-ch transistor. 110 k is recommended for R. An electrolytic capacitor of 22 F is recommended.
584
User's Manual U15195EJ3V0UD
CHAPTER 14 REGULATOR
Figure 14-2. Mount Pad Dimensions When Mounted on 2SD1950 (VL Standard Product) (Glass Epoxy Board) (Unit: mm)
2.2
45
0.9
2.2
45
0.9
1.5
1.0 1.5
1.0 1.5
1.0
(2) When using an external regulator When an on-chip regulator is not used, an external regulator can be used. An example of connection when using an external regulator application is shown below. Figure 14-3. Connection When Using External Regulator
Power supply V850E/IA2 VDD 5V regulator
RVDD
REGOUT
(Open)
REGIN
3.3 V regulator
CVSS
Remark
Connect a capacitor or inductance to the regulator I/O as required.
User's Manual U15195EJ3V0UD
585
CHAPTER 14 REGULATOR
14.4 Control Register
(1) Regulator control register (REGC) The REGC register controls the operation of the regulator. This register can be read/written in 8-bit or 1-bit units. Cautions 1. Change the value of the REGC register only once after the system has been reset for system stabilization. 2. Make sure that the pins are set as follows when the REGC0 bit = 1 (when the regulator is stopped). * REGOUT pin: Leave open * REGIN pin: Supply 3.3 V (3.0 to 3.6 V) to this pin. 3. Also make sure that the pins are set as follows when the REGC0 bit = 0 (regulator operating) (for details of the connection method, refer to 14.3 Connection Example). * REGOUT pin: Connect this pin to the base of the external transistor. * REGIN pin: Connect this pin to the emitter of the external transistor and to an electrolytic capacitor. * Connect a bias resistor between the base and emitter of the external transistor.
7 REGC 0
6 0
5 0
4 0
3 0
2 0
1 0
0 REGC0
Address FFFFF300H
After reset 00H
Bit position 0
Bit name REGC0
Function Controls the operation of the regulator. 0: Regulator operates. 1: Regulator stops.
586
User's Manual U15195EJ3V0UD
CHAPTER 15 FLASH MEMORY (PD70F3114)
The PD70F3114 is the flash memory version of the V850E/IA2 and has an on-chip 128 KB flash memory. 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 on the commercial samples (CS) (not engineering samples (ES)) of the mask ROM versions. Writing to flash memory can be performed with the memory mounted on the target system (on board). A dedicated flash programmer is connected to the target system to perform writing. The following can be considered as the development environment and the applications of flash memory. * Software can be changed after the V850E/IA2 is solder-mounted on the target system. * Small scale production of various models is made easier by differentiating software. * Data adjustment in starting mass production is made easier.
15.1 Features
* All area batch erase * Communication via serial interface from the dedicated flash programmer * Erase/write voltage: VPP = 7.8 V * On-board programming
15.2 Writing Using Flash Programmer
Writing can be performed either on-board or off-board using a dedicated flash programmer. Caution When writing flash memory using the flash programmer, be sure to operate the V850E/IA2 at x5 frequency in PLL mode. (1) On-board programming The contents of the flash memory are rewritten after the V850E/IA2 is mounted on the target system. Mount connectors, etc., on the target system to connect the dedicated flash programmer. (2) Off-board programming Writing to flash memory is performed by the dedicated program adapter (FA series), etc., before mounting the V850E/IA2 on the target system. Remark The FA series is a product of Naito Densei Machida Mfg. Co., Ltd.
User's Manual U15195EJ3V0UD
587
CHAPTER 15 FLASH MEMORY (PD70F3114)
When the flash writing adapter (FA-100GC-8EU) and dual-power-supply adapter (FA-TVC) are used for writing to the PD70F3114GC, connect the pins as follows. Table 15-1. Connection of V850E/IA2 Flash Writing Adapter (FA-100GC-8EU)
Name Marked on FA-100GC8EU PWB SI SO SCK X1 X2 /RESET VPP RESERVE/HS VDD
Note 3
V850E/IA2 When UART0 Used Pin Name TXD0/P31 RXD0/P30 - X1 X2 RESET MODE1/VPP - VDD AVDD0 AVDD1 MODE0 RVDD 39, 64, 86 94 2 12 14 13, 63 38, 87 95 20 3 74 21 17
Note 1
When CSI0 Used Pin Name SO0/P41 SI0/P40 SCK0/P42 X1 X2 RESET MODE1/VPP A16/PDH0 VDD AVDD0 AVDD1 MODE0 RVDD VSS3 VSS AVSS0 CVSS AVSS1 NMI/P00 CKSEL
Note 2
Pin No. 26 25
Pin No. 23 22 24 17Note 1 18Note 1 19 62 56 39, 64, 86 94 2 12 14 13, 63 38, 87 95 20 3 74 21
18Note 1 19 62
GNDNote 3
VSS3 VSS AVSS0 CVSS AVSS1 NMI/P00
Note 4
CKSEL
Notes 1.
The clock amplitude of X1 and X2 is 3.3 V. Configure the oscillator on the FA-100GC-8EU board using a resonator and a capacitor. The following figure shows an example of the oscillator. Example
CVSS X1 X2
2. 3. 4.
Connection is not required for this pin when not using a handshake. Use the dual-power-supply adapter (FA-TVC) for generating 3.3 V on the FA-100GC-8EU board. In this case, the 2SD1950 or 2SD1581 is not required. In PLL mode: In direct mode: GND VDD
Remark
-: Leave open
588
User's Manual U15195EJ3V0UD
CHAPTER 15 FLASH MEMORY (PD70F3114)
When the flash writing adapter (FA-100GF-3BA) and dual-power-supply adapter (FA-TVC) are used for writing to the PD70F3114GF, connect the pins as follows. Table 15-2. Connection of V850E/IA2 Flash Writing Adapter (FA-100GF-3BA)
Name Marked on FA-100GF3BA PWB SI SO SCK X1 X2 /RESET VPP RESERVE/HS VDD
Note 3
V850E/IA2 When UART0 Used Pin Name TXD0/P31 RXD0/P30 - X1 X2 RESET MODE1/VPP - VDD AVDD0 AVDD1 MODE0 RVDD 41, 66, 88 96 4 14 16 15, 65 40, 89 97 22 5 76 23 19
Note 1
When CSI0 Used Pin Name SO0/P41 SI0/P40 SCK0/P42 X1 X2 RESET MODE1/VPP A16/PDH0 VDD AVDD0 AVDD1 MODE0 RVDD VSS3 VSS AVSS0 CVSS AVSS1 NMI/P00 CKSEL
Note 2
Pin No. 28 27
Pin No. 25 24 26 19Note 1 20Note 1 21 64 58 41, 66, 88 96 4 14 16 15, 65 40, 89 97 22 5 76 23
20Note 1 21 64
GNDNote 3
VSS3 VSS AVSS0 CVSS AVSS1 NMI/P00
Note 4
CKSEL
Notes 1.
The clock amplitude of X1 and X2 is 3.3 V. Configure the oscillator on the FA-100GF-3BA board using a resonator and a capacitor. The following figure shows an example of the oscillator. Example
CVSS X1 X2
2. 3. 4.
Connection is not required for this pin when not using a handshake. Use the dual-power-supply adapter (FA-TVC) for generating 3.3 V on the FA-100GF-3BA board. In this case, the 2SD1950 or 2SD1581 is not required. In PLL mode: In direct mode: GND VDD
Remark
-: Leave open
User's Manual U15195EJ3V0UD
589
CHAPTER 15 FLASH MEMORY (PD70F3114)
15.3 Programming Environment
The following shows the environment required for writing programs to the flash memory of the V850E/IA2.
VPP1 VDD FA-TVC RS-232-C
XXXX YYYY
VPP VDD REGIN VSS3 VSS RESET UART0 CSI0 V850E/IA2
Bxxxxx Cxxxxxx
XXXXXX
Axxxx
XXX YYY
PG-FP4 (Flash Pro4)
Dedicated flash programmer Host machine
A host machine is required for controlling the dedicated flash programmer. UART0 or CSI0 is used for the interface between the dedicated flash programmer and the V850E/IA2 to perform writing, erasing, etc. A dedicated program adapter (FA series) and dual-power-supply adapter (FA-TVC) are required for off-board writing.
15.4 Communication Mode
(1) UART0 Transfer rate: 4,800 bps to 76,800 bps (LSB first)
VPP1 VDD
XXXX YYYY
XXXXX
STATVE
GND
XXXX
VPP VDD FA-TVC REGIN VSS3 VSS RESET RXD0 TXD0 V850E/IA2
Bxxxxx Cxxxxxx
XXX YYY
PG-FP4 (Flash Pro4)
XXXXX
STATVE
XXXX
XXXXXX
Axxxx
GND Dedicated flash programmer RESET SO SI
Caution
The operating clock amplitude of the V850E/IA2 is 3.3 V.
590
User's Manual U15195EJ3V0UD
CHAPTER 15 FLASH MEMORY (PD70F3114)
(2) CSI0 Transfer rate: up to 2 MHz (MSB first)
VPP1 VDD FA-TVC
XXXX YYYY
VPP VDD REGIN VSS3 VSS RESET SI0 SO0 SCK0 V850E/IA2
Bxxxxx Cxxxxxx
XXXXXX
Axxxx
XXX YYY
PG-FP4 (Flash Pro4)
XXXXX
STATVE
GND RESET SO SI SCK
Dedicated flash programmer
Caution
The operating clock amplitude of the V850E/IA2 is 3.3 V.
The dedicated flash programmer outputs transfer clocks and the V850E/IA2 operates as a slave. (3) Handshake-supported CSI communication Transfer rate: up to 2 MHz (MSB first)
XXXX
VPP1 VDD FA-TVC
XXXX YYYY
VPP VDD REGIN VSS3 VSS RESET SI0 SO0 SCK0 PDH0
Bxxxxx Cxxxxxx
XXXXXX
Axxxx
XXX YYY
PG-FP4 (Flash Pro4)
XXXXX
STATVE
GND RESET
XXXX
Dedicated flash programmer
V850E/IA2
SO SI SCK HS
Caution
The operating clock amplitude of the V850E/IA2 is 3.3 V.
User's Manual U15195EJ3V0UD
591
CHAPTER 15 FLASH MEMORY (PD70F3114)
15.5 Pin Connection
When performing on-board writing, install a connector on the target system to connect to the dedicated flash programmer. Also, install a function on-board to switch from the normal operation mode (single-chip mode or ROMless mode) to the flash memory programming mode. In the flash memory programming mode, all the pins not used for flash memory programming become the same status as they were immediately after reset in single-chip mode. impedance status. 15.5.1 MODE1/VPP pin In the normal operation mode, 0 V is input to the MODE1/VPP pin. In the flash memory programming mode, 7.8 V writing voltage is supplied to the MODE1/VPP pin. MODE1/VPP pin. The following shows an example of the connection of the Therefore, all the ports become output highimpedance status, so that pin connection is required when the external device does not acknowledge the output high-
V850E/IA2 Dedicated flash programmer connection pin MODE1/VPP
Pull-down resistor (RVPP = 5 to 50 k)
15.5.2 Serial interface pin The following shows the pins used by each serial interface. Table 15-3. Pins Used by Each Serial Interface
Serial Interface CSI0 CSI0 + HS UART0 Pins Used SO0, SI0, SCK0 SO0, SI0, SCK0, PDH0 TXD0, RXD0
When connecting a dedicated flash programmer to a serial interface pin that is connected to other devices onboard, care should be taken to avoid the conflict of signals and the malfunction of other devices, etc. (1) Conflict of signals When connecting a dedicated flash programmer (output) to a serial interface pin (input) which is connected to another device (output), a conflict of signals occurs. To avoid the conflict of signals, isolate the connection to the other device or set the other device to the output high-impedance status.
592
User's Manual U15195EJ3V0UD
CHAPTER 15 FLASH MEMORY (PD70F3114)
V850E/IA2 Conflict of signals Input pin Other device Output pin Dedicated flash programmer connection pin
In the flash memory programming mode, the signal that the dedicated flash programmer sends out conflicts with signals the other device outputs. Therefore, isolate the signals on the other device side.
(2) Malfunction of the other device When connecting a dedicated flash programmer (output or input) to a serial interface pin (input or output) connected to another device (input), the signal output to the other device may cause the device to malfunction. To avoid this, isolate the connection to the other device or make the setting so that the input signal to the other device is ignored.
V850E/IA2 Dedicated flash programmer connection pin Output pin Other device Input pin
In the flash memory programming mode, if the signal the V850E/IA2 outputs affects the other device, isolate the signal on the other device side.
V850E/IA2 Dedicated flash programmer connection pin Input pin Other device Input pin
In the flash memory programming mode, if the signal the dedicated flash programmer outputs affects the other device, isolate the signal on the other device side.
User's Manual U15195EJ3V0UD
593
CHAPTER 15 FLASH MEMORY (PD70F3114)
15.5.3 RESET pin When connecting the reset signals of the dedicated flash programmer to the RESET pin, which is connected, to the reset signal generator on-board, a conflict of signals occurs. To avoid the conflict of signals, isolate the connection to the reset signal generator. When the reset signal is input from the user system in flash memory programming mode, the programming operation will not be performed correctly. Therefore, do not input signals other than the reset signals from the dedicated flash programmer.
V850E/IA2 Conflict of signals RESET Reset signal generator Output pin Dedicated flash programmer connection pin
In the flash memory programming mode, the signal the reset signal generator outputs conflicts with the signal the dedicated flash programmer outputs. Therefore, isolate the signals on the reset signal generator side.
15.5.4 NMI pin Do not change the input signal to the NMI pin in flash memory programming mode. If it is changed in flash memory programming mode, programming may not be performed correctly. 15.5.5 MODE0, MODE1 pins To shift to the flash memory programming mode, set MODE0 to high level, apply the writing voltage (7.8 V) to the MODE1/VPP pin, and release reset. 15.5.6 Port pins When the flash memory programming mode is set, all the port pins except the pins which communicate with the dedicated flash programmer become output high-impedance status. Nothing need be done to these port pins. If problems such as disabling output high-impedance status should occur to the external devices connected to the ports, connect them to VDD or VSS via resistors. 15.5.7 Other signal pins Connect X1 and X2 to the same status as in the normal operation mode. The amplitude is 3.3 V. 15.5.8 Power supply Supply the power supply (VDD, VSS, VSS3, AVDD0, AVDD1, AVSS0, AVSS1, CVSS, RVDD) the same as in normal operation mode. Supply 3.3 V to the REGIN pin from the dual-power-supply adapter (FA-TVC).
594
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
16.1 Normal Operation Mode
Absolute Maximum Ratings (TA = 25C)
Parameter Power supply voltage Symbol REGIN VDD RVDD CVSS AVDD AVSS Input voltage VI1 VI2 Clock input voltage Analog input voltage VK VIAN REGIN pin VDD pin RVDD pin CVSS pin AVDD0, AVDD1 pins AVSS0, AVSS1 pins Other than X1 and VPP pins VPP pin (PD70F3114 only) X1 pin ANI00 to ANI05 pins, ANI10 to ANI17 pins AVDD > VDD VDD AVDD
Note 2
Conditions
Ratings -0.5 to +4.6 -0.5 to +7.0 -0.5 to +7.0 -0.5 to +0.5 -0.5 to VDD + 0.5 -0.5 to +0.5 -0.5 to VDD + 0.5 -0.5 to +8.5 -0.5 to REGIN + 1.0 -0.5 to VDD + 0.5
Note 1 Note 1 Note 1
Unit V V V V V V V V V V V mA mA
Note 1
-0.5 to AVDD + 0.5Note 1 20 4.0
Output current, low
IOL
Per pin for the TO000 to TO005 and TO010 to TO015 pins Per pin other than for the TO000 to TO005 and TO010 to TO015 pins Total for all pins
180 -4.0 -100 -40 to + 85 -65 to + 150
mA mA mA C C
Output current, high
IOH
Per pin Total for all pins
Operating ambient temperature Storage temperature
TA Tstg
User's Manual U15195EJ3V0UD
595
CHAPTER 16 ELECTRICAL SPECIFICATIONS
Notes 1. Be sure not to exceed the absolute maximum ratings (MAX. value) of each power supply voltage. 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 (2 ms when the power supply voltage is stepped down via a regulator) after VDD has reached the lower-limit value (4.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 (4.5 V) of the operating voltage range of VDD (see b in the figure below).
VDD
4.5 V 0V a b
VPP 4.5 V 0V
Cautions 1. Do not directly connect output (or I/O) pins of IC products to each other, or to VDD, VCC, and GND. Open drain pins or open collector pins, however, can be directly connected to each other. Direct connection of the output pins between an IC product and an external circuit is possible, if the output pins can be set to the high-impedance state and the output timing of the external circuit is designed to avoid output conflict. 2. 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. The ratings and conditions shown below for DC characteristics and AC characteristics are within the range for normal operation and quality assurance. Capacitance (TA = 25C, REGIN = VDD = RVDD = VSS3 = VSS = CVSS = 0 V)
Parameter Input capacitance I/O capacitance Output capacitance CI CIO CO Symbol Conditions fC = 1 MHz Unmeasured pins returned to 0 V. MIN. TYP. MAX. 15 15 15 Unit pF pF pF
Operating Conditions
Operation Mode Internal System Clock Frequency (fXX) Operating Ambient Temperature (TA) -40 to +85C -40 to +85C Power Supply Voltage REGIN 3.3 V 0.3 V 3.3 V 0.3 V VDD = RVDD 5.0 V 0.5 V 5.0 V 0.5 V
Direct mode PLL mode
4 to 25 MHz 4 to 40 MHz
Caution When interfacing to the external devices using the CLKOUT signal, make the internal system clock frequency (fXX) 32 MHz or lower.
596
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
Clock Oscillator Characteristics (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V) (a) Ceramic resonator or crystal resonator connection
X1
X2 Rd C1 C2
Parameter Oscillation frequency
Symbol fX
Conditions
MIN. 4
TYP.
MAX. 6.4
Unit MHz
Remarks 1. 2. 3.
Connect the oscillator as close to the X1 and X2 pins as possible. Do not wire any other signal lines in the area indicated by the broken lines. For the resonator selection and oscillator constant, customers are required to either evaluate the oscillation themselves or apply to the resonator manufacturer for evaluation.
(b) External clock input
X1
X2 Open
High-speed CMOS inverter External clock
Cautions 1. Connect the high-speed CMOS inverter as close to the X1 pin as possible. 2. Thoroughly evaluate the matching between the V850E/IA2 and the high-speed CMOS inverter. 3. When an internal regulator is used, the external clock must not be used. This is because a malfunction may occur if the 3.3 V system voltage supplied by the internal regulator and the voltage of the external clock differ in potential. When using an external clock, do not use the internal regulator and externally supply the REGIN pin with a 3.3 V system voltage of the same potential as the external clock.
User's Manual U15195EJ3V0UD
597
CHAPTER 16 ELECTRICAL SPECIFICATIONS
Recommended Oscillator Constant (a) Ceramic resonator (i)
Type
Murata Manufacturing Co., Ltd. (TA = -40 to +85C)
Product Name Oscillation Frequency fX (MHz) Recommended Circuit Constant Recommended Voltage Range MIN. (V) 3.0 3.0 MAX. (V) 3.6 3.6
C1 (pF) On-chip On-chip
C2 (pF) On-chip On-chip 0 0
Rd ()
Surface mount
CSTCR4M00G55-R0 CSTCR6M00G55-R0
4.0 6.0
Caution This oscillator constant is a reference value based on evaluation under a specific environment by the resonator manufacturer. If optimization of oscillator characteristics is necessary in the actual application, apply to the resonator manufacturer for evaluation on the implementation circuit. The oscillation voltage and oscillation frequency indicate only oscillator characteristics. Use the V850E/IA2 so that the internal operating conditions are within the specifications of the DC and AC characteristics.
598
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
DC Characteristics (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V)
Parameter Input voltage, high Symbol VIH1 VIH2 VIH3 Conditions Pins for bus control Port pins
Note 2 Note 1
MIN. 2.2 0.7 VDD 0.8 VDD
TYP.
MAX. VDD VDD VDD
Unit V V V
Port pins other than Notes 1, 2, RESET pin X1 pin Pins for bus control Port pins
Note 2 Note 1
VIH4 Input voltage, low VIL1 VIL2 VIL3 VIL4 Output voltage, high Output voltage, low VOH VOL1
0.8 REGIN 0 0 0 -0.5 VDD - 1.0 IOL = 15 mA IOL = 2.5 mA
REGIN + 0.3 0.8 0.3 VDD 0.2 VDD 0.15 REGIN
V V V V V V
Port pins other than Notes 1, 2, RESET pin X1 pin IOH = -2.5 mA PWM output
Note 3
2.0 0.4 0.4 10 -10 10
V V V
VOL2 Input leakage current, high Input leakage current, low Output leakage current, high Output leakage current, low Analog pin input leakage current Power supply currentNote 4 During normal operation In HALT mode In IDLE mode In STOP mode ILIH ILIL ILOH
Pins other than Note 3 VI = VDD VI = 0 V VO = VDD
IOL = 2.5 mA
A A A A A
mA mA mA mA mA mA mA
ILOL ILIAN IDD1
VO = 0 V ANI00 to ANI05, ANI10 to ANI17 pins REGIN Note 5, PD703114 Note 5, PD70F3114 VDD + RVDD Note 6 Note 5 Note 6
-10 10 1.8 fXX + 15 3.0 fXX + 30 2.0 fXX + 15 3.2 fXX + 30 30 45
IDD2
REGIN VDD + RVDD
0.8 fXX + 10 1.2 fXX + 15 15 8 30 15 1.0 300 600 60
IDD3
REGIN VDD + RVDD Note 6
0.5 25 25 30
IDD4
REGIN
PD703114 PD70F3114
A A A
VDD + RVDD
Note 6
Notes 1. AD0/PDL0 to AD15/PDL15, A16/PDH0 to A21/PDH5, LWR/PCT0, UWR/PCT1, RD/PCT4, ASTB/PCT6, WAIT/PCM0, CLKOUT/PCM1 2. P31/TXD0, P33/TXD1, P41/SO0 3. TO000 to TO005, TO010 to TO015 4. Value in the PLL mode 5. Determine the value by calculating fXX from the operating conditions. 6. The current of the TO000 to TO005 and TO010 to TO015 pins is not included. Remark fXX: Internal system clock frequency
User's Manual U15195EJ3V0UD
599
CHAPTER 16 ELECTRICAL SPECIFICATIONS
Data Retention Characteristics (TA = -40 to +85C)
Parameter Data retention voltage Symbol VDDDR HVDDDR Data retention current IDDDR Conditions STOP mode, REGIN = VDDDR STOP mode, VDD = RVDD = HVDDDR REGIN = VDDDR MIN. 1.5 3.6 25 25 30 200 200 0 0 Note 2 Note 2 0.8 HVDDDR 0 HVDDDR 0.2 HVDDDR TYP. MAX. 3.6 5.5 300 600 60 Unit V V
PD703114 PD70F3114
A A A s s
ms ns V V
HIDDDR Power supply voltage rise time Power supply voltage fall time Power supply voltage retention time (from STOP mode setting) STOP release signal input time Data retention input voltage, high Data retention input voltage, low tRVD tFVD tHVD tDREL VIHDR VILDR
VDD = RVDD = HVDDDR, Note 1
Notes 1. The current of the TO000 to TO005 and TO010 to TO015 pins is not included. 2. P00/NMI, P01/ESO0/INTP0, P02/ESO1/INTP1, P03/ADTRG0/INTP2, P04/ADTRG1/INTP3, P05/INTP4/TO3OFF, P10/TIUD10/TO10, P11/TCUD10/INTP100, P12/TCLR10/INTP101, P20/TI2/INTP20, P21/TO21/INTP21 to P24/TO24/INTP24, P25/TCLR2/INTP25, P26/TI3/TCLR3/INTP30, P27/TO3/INTP31, P30/RXD0, P32/RXD1/SI1, P34/ASCK1/SCK1, P40/SI0, P42/SCK0, MODE0, MODE1, CKSEL, RESET Remark The TYP. value is a reference value for when TA = 25C.
STOP mode setting
REGIN, VDD, RVDD tFVD tHVD
VDDDR, HVDDDR tRVD tDREL
RESET (input)
V IHDR
STOP mode release interrupt (NMI, etc.) (Released by falling edge)
V IHDR
STOP mode release interrupt (NMI, etc.) (Released by rising edge) V ILDR
600
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
AC Characteristics (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF) AC test input test points (a) Other than (b) and (c) below
VDD
0.8 VDD Test points 0.2 VDD
0.8 VDD 0.2 VDD
0V
(b) AD0/PDL0 to AD15/PDL15, A16/PDH0 to A21/PDH5, LWR/PCT0, UWR/PCT1, RD/PCT4, ASTB/PCT6, WAIT/PCM0, CLKOUT/PCM1
VDD
2.2 V Test points 0.8 V
2.2 V 0.8 V
0V
(c) X1
REGIN
0.8 REGIN Test points 0.15 REGIN
0.8 REGIN 0.15 REGIN
0V
AC test output test points
VDD
0.8 VDD Test points 0.2 VDD
0.8 VDD 0.2 VDD
0V
User's Manual U15195EJ3V0UD
601
CHAPTER 16 ELECTRICAL SPECIFICATIONS
Load condition
DUT (Device under test) CL = 50 pF
Caution
In cases where the load capacitance is greater than 50 pF due to the circuit configuration, insert a buffer or other element to reduce the device's load capacitance to 50 pF or lower.
602
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(1) Clock timing (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter X1 input cycle Symbol tCYX <1> Conditions Direct mode PLL mode X1 input high-level width tWXH <2> Direct mode PLL mode X1 input low-level width tWXL <3> Direct mode PLL mode X1 input rise time tXR <4> Direct mode PLL mode X1 input fall time tXF <5> Direct mode PLL mode CPU operation frequency fXX - CLKOUT signal used CLKOUT output cycle tCYK <6> CLKOUT signal used CLKOUT high-level width CLKOUT low-level width CLKOUT rise time CLKOUT fall time Delay time from X1 to CLKOUT tWKH tWKL tKR tKF tDXK <7> <8> <9> <10> <11> Direct mode
Note Note
MIN. 20 156 6 50 6 50
MAX. 125 250
Unit ns ns ns ns ns ns
4 10 4 10 4 4 25 31.25 0.5 T - 9 0.5 T - 11 11 9 40 40 32 250 250
ns ns ns ns MHz MHz ns ns ns ns ns ns ns
Note
When interfacing to the external devices using the CLKOUT signal, make the internal system clock frequency (fXX) 32 MHz or lower.
Remark T = tCYK
<1> <2> <4> X1 (PLL mode) <1> <3> <5> <5> <3>
<2> <4> X1 (Direct mode)
<11>
<11>
CLKOUT (output) <9> <10> <7> <6>
User's Manual U15195EJ3V0UD
<8>
603
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(2) Output waveform (except for CLKOUT) (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter Output rise time Output fall time tOR tOF Symbol <12> <13> Conditions MIN. MAX. 15 15 Unit ns ns
<12>
<13>
Signals other than CLKOUT
(3) Regulator output stabilization time (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V)
Parameter Regulator output stabilization time tRG Symbol <14> Conditions External NPN transistor: 2SD1950 (VL compliant product) or 2SD1581 Stabilization capacitance: C = 22 pF (electrolytic capacitor) Bias resistance between B and E: R = 110 k MIN. 2 MAX. Unit ms
Caution The regulator output stabilization time (tRG) varies depending on the external transistor, stabilization capacitance, and bias resistance between B and E.
RVDD RVDD
4.5 V <14>
0V
REGIN REGIN
3.3 V
0V
604
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(4) Reset timing (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter RESET pin high-level width RESET pin low-level width Symbol tWRSH tWRSL <15> <16> At power-on At STOP mode release
Note
Conditions
MIN. 500 500 + TOS + tRG 500 + TOS 500
MAX.
Unit ns ns ns ns
Other than at power-on and at STOP mode release
Note
Release the STOP mode in the range of REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V.
Caution Thoroughly evaluate the oscillation stabilization time. Remark TOS: Oscillation stabilization time tRG: Regulator output stabilization time
<15>
<16>
RESET (input)
User's Manual U15195EJ3V0UD
605
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(5) Multiplex bus timing (a) CLKOUT asynchronous (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter Address setup time (to ASTB) Address hold time (from ASTB) Address float delay time from RD Data input setup time from address Data input setup time from RD Delay time from ASTB to RD, LWR, UWR Data input hold time (from RD) Address output time from RD Delay time from RD, LWR, UWR to ASTB Delay time from RD to ASTB RD, LWR, UWR low-level width ASTB high-level width Data output time from LWR, UWR Data output setup time (to LWR, UWR) Data output hold time (from LWR, UWR ) WAIT data output hold time (to address) Symbol tSAST tHSTA tFRDA tSAID tSRDID tDSTRDWR tHRDID tDRDA tDRDWRST tDRDST tWRDWRL tWSTH tDWROD tSODWR tHWROD tSAWT1 tSAWT2 WAIT hold time (from address) tHAWT1 tHAWT2 WAIT setup time (to ASTB) tSSTWT1 tSSTWT2 WAIT hold time (from ASTB) tHSTWT1 tHSTWT2 <17> <18> <19> <20> <21> <22> <23> <24> <25> <26> <27> <28> <29> <30> <31> <32> <33> <34> <35> <36> <37> <38> <39> w1 (w + wAS)T (1 + w + wAH)T w1 w1 (0.5 + w + wAS + wAH)T (1.5 + w + wAS + wAH)T (1 + wAH)T - 32 (1 + w + wAH)T - 32 w1 (1 + w)T - 25 T - 20 (1.5 + wAS + wAH)T- 40 (1.5 + w + wAS + wAH)T - 40 (0.5 + wAH)T - 15 0 (1 + i)T - 15 0.5T - 15 (1.5 + i + wAS)T - 15 (1 + w)T - 22 (1 + wAS)T - 15 10 Conditions MIN. (0.5 + wAS)T - 16 (0.5 + wAH)T - 15 11 (2 + w + wAS + wAH)T - 40 (1 + w)T - 40 MAX. Unit ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns
Remarks 1. T = tCYK 2. wAS: Number of address setup wait states (0 or 1) 3. wAH: Number of address hold wait states (0 or 1) 4. w: 5. i: Number of wait clocks inserted in the bus cycle Number of idle states inserted after the read cycle (0 or 1) The sampling timing changes when a programmable wait is inserted. 6. Observe at least one of the data input hold times tHKID or tHRDID.
606
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(b) CLKOUT synchronous (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter Delay time from CLKOUT to address Delay time from CLKOUT to address float Delay time from CLKOUT to ASTB tDKA tFKA tDKST Symbol <40> <41> <42> <43> <44> <45> <46> <47> <48> 21 5 Conditions MIN. -7 -12 -3 + wAHT -5 21 5 19 MAX. 19 15 19 + wAHT 19 Unit ns ns ns ns ns ns ns ns ns
Delay time from CLKOUT to RD, LWR, UWR tDKRDWR Data input setup time (to CLKOUT) Data input hold time (from CLKOUT) Delay time from CLKOUT to data output WAIT setup time (to CLKOUT) WAIT hold time (from CLKOUT) tSIDK tHKID tDKOD tSWTK tHKWT
Remarks 1. 2. 3.
T = tCYK wAH: Number of address hold wait states (0 or 1) Observe at least one of the data input hold times tHKID or tHRDID.
User's Manual U15195EJ3V0UD
607
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(c) Read cycle (CLKOUT synchronous/asynchronous, 1 wait)
T1
T2
TW
T3
CLKOUT (output)
<40>
A16 to A21 (output)
<20> <44> <41>
AD0 to AD15 (I/O) Address Hi-Z Data
<45>
<42> <17> <18>
<42> <23>
ASTB (output)
<28> <43> <22> <19> <21> <25> <43> <24> <26>
RD (output)
<36> <47> <38> <37> <39>
WAIT (input)
<48>
<27> <47>
<48>
<32> <34> <33> <35>
Remark LWR and UWR are high level.
608
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(d) Write cycle (CLKOUT synchronous/asynchronous, 1 wait)
T1
T2
TW
T3
CLKOUT (output)
<40>
A16 to A21 (output)
<46>
AD0 to AD15 (I/O) Address Data
<42> <18> <17>
<42>
ASTB (output)
<28>
<43> <22> <29> <30>
<25> <43> <31>
LWR (output) UWR (output)
<36> <47> <38> <37> <39>
WAIT (input)
<48>
<27> <47>
<48>
<32> <34> <33> <35>
Remark RD is high level.
User's Manual U15195EJ3V0UD
609
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(6) Interrupt timing (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter NMI high-level width NMI low-level width INTPn high-level width Symbol tWNIH tWNIL tWITH <49> <50> <51> n = 0 to 4 n = 100, 101, 30, 31 n = 20 to 25 (when analog filter specified) n = 20 to 25 (when digital filter specified) INTPn low-level width tWITL <52> n = 0 to 4 n = 100, 101, 30, 31 n = 20 to 25 (when analog filter specified) n = 20 to 25 (when digital filter specified) Conditions MIN. 500 500 500 5T + 10 250 5T + 10 500 5T + 10 250 5T + 10 MAX. Unit ns ns ns ns ns ns ns ns ns ns
Remark T: Digital filter sampling clock T can be selected by setting the following registers. * INTP100, INTP101: Can be selected from fXX/2, fXX/4, fXX/8, and fXX/16 by setting the NRC101 and NRC100 bits of the timer 10 noise elimination time select register (NRC10) (fXX: Internal system clock). * INTP30: Can be selected from fXXTM3/2, fXXTM3/4, fXXTM3/8, and fXXTM3/16 by setting the NRC31 and NRC30 bits of the timer 3 noise elimination time select register (NRC3) (fXXTM3: Clock selected with the timer 3 clock select register (PRM03)). * INTP31: Can be selected from fXXTM3/32, fXXTM3/64, fXXTM3/128, and fXXTM3/256 by setting the NRC33 and NRC32 bits of the NRC3 register (fXXTM3: Clock selected with the PRM03 register).
<49>
NMI (input)
<50>
<51>
INTPnv (input)
<52>
Remark n = 0 to 4, 100, 101, 20 to 25, 30, 31
610
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(7) Timer input timing (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter TIUD10, TCUD10 high-/low level width TIUD10, TCUD10 input time difference TCLRn high-/low-level width Symbol tWUDH, tWUDL tPHUD tWTCH, tWTCL tWTIH, tWTIL <53> Conditions MIN. 5T + 10 MAX. Unit ns
<54> <55> n = 10, 2 (other than for through input), 3 n = 2 (for through input <56>
Note
5T + 10 5T + 10 2T + 10 5T + 10 2T + 10
ns ns ns ns ns
)
TIm high-/low-level width
m = 2 (other than for through input), 3 m = 2 (for through input
Note
)
Note
When setting the CESE1 and CESE0 bits of timer 2 count clock/control edge select register 0 (CSE0) to 1 and 0, respectively.
Remarks 1. T: Digital filter sampling clock T can be selected by setting the following registers. * TIUD10, TCUD10, TCLR10: Can be selected from fXX/2, fXX/4, fXX/8, and fXX/16 by setting the NRC101 and NRC100 bits of the timer 10 noise elimination time select register (NRC10). * TCLR2, TI2: Fixed to fXX/2. * TCLR3, TI3: Can be selected from fXXTM3/2, fXXTM3/4, fXXTM3/8, and fXXTM3/16 by setting the NRC31 and NRC30 bits of the timer 3 noise elimination time select register (NRC3) (fXXTM3: Clock selected with the timer 3 clock select register (PRM03)). 2. fX: Internal system clock frequency
<53> TIUD10 (input) <54> <53> TCUD10 (input) <54>
<53>
<54> <53>
<54>
<55> TCLRn (input)
<55>
<56> TIm (input)
<56>
Remark n = 10, 2, 3 m = 2, 3
User's Manual U15195EJ3V0UD
611
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(8) Timer operating frequency (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter Timer 00, timer 01 operating frequency T0 Timer 10 operating frequency T1 Symbol Conditions MIN. MAX. 40 20 20 32 Unit MHz MHz MHz MHz
Timer 20, timer 21 operating frequency T2 Timer 3 operating frequency T3
(9) CSI timing (1/2) (a) Master mode (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter SCKn cycle SCKn high-level width SCKn low-level width SIn setup time (to SCKn) SIn hold time (from SCKn) SOn output delay time (from SCKn) SOn output hold time (from SCKn) Symbol tCYSK1 tWSK1H tWSK1L tSSISK tHSKSI tDSKSO tHSKSO <57> <58> <59> <60> <61> <62> <63> 0.5 tCYSK1 - 20 Output Output Output Conditions MIN. 200 0.5 tCYSK1 - 25 0.5 tCYSK1 - 25 35 30 30 MAX. Unit ns ns ns ns ns ns ns
Remark n = 0, 1 (b) Slave mode (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter SCKn cycle SCKn high-level width SCKn low-level width SIn setup time (to SCKn) SIn hold time (from SCKn) SOn output delay time (from SCKn) SOn output hold time (from SCKn) Symbol tCYSK1 tWSK1H tWSK1L tSSISK tHSKSI tDSKSO tHSKSO <57> <58> <59> <60> <61> <62> <63> tWSK1H Input Input Input Conditions MIN. 200 90 90 50 50 50 MAX. Unit ns ns ns ns ns ns ns
Remark n = 0, 1
612
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(9) CSI timing (2/2)
<57> <59> <58>
SCKn (I/O)
<60>
<61>
SIn (input)
Input data
<62>
<63>
SOn (output)
Output data
Remarks 1. The broken lines indicate high impedance. 2. n = 0, 1
(10) UART0 timing (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter UART0 baud rate generator input frequency Symbol fBRG Conditions MIN. MAX. 20 Unit MHz
Remarks 1.
UART0 baud rate generator input frequency (fBRG): Can be selected from fXX, fXX/2, fXX/4, fXX/8, fXX/16, fXX/32, fXX/64, fXX/128, fXX/256, fXX/512, fXX/1024, and fXX/2048 by setting the TPS3 to TPS0 bits of clock select register 0 (CKSR0).
2.
fXX: Internal system clock frequency
User's Manual U15195EJ3V0UD
613
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(11) UART1 timing (1/2) (a) Clocked master mode (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter ASCK1 cycle ASCK1 high-level width ASCK1 low-level width RXD1 setup time (to ASCK1) RXD1 hold time (from ASCK1) TXD1 output delay time (from ASCK1) TXD1 output hold time (from ASCK1) Symbol tCYSK0 tWSK0H tWSK0L tSRXSK tHSKRX tDSKTX tHSKTX <64> <65> <66> <67> <68> <69> <70> (k + 1)T - 20 Output Output Output Conditions MIN. 1000 k T - 20 k T - 20 1.5 T + 35 0 MAX. Unit ns ns ns ns ns ns ns
Remarks 1. T = 2tCYK 2. k: Setting value of prescaler compare register 1 (PRSCM1) of UART1 (b) Clocked slave mode (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter ASCK1 cycle ASCK1 high-level width ASCK1 low-level width RXD1 setup time (to ASCK1) RXD1 hold time (from ASCK1) TXD1 output delay time (from ASCK1) TXD1 output hold time (from ASCK1) Symbol tCYSK0 tWSK0H tWSK0L tSRXSK tHSKRX tDSKTX tHSKTX <64> <65> <66> <67> <68> <69> <70> (k + 1.5)T Input Input Input Conditions MIN. 1000 4 T + 80 4 T + 80 T + 10 T + 10 2.5 T + 45 MAX. Unit ns ns ns ns ns ns ns
Remarks 1. T = 2tCYK 2. k: Setting value of prescaler compare register 1 (PRSCM1) of UART1
614
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
(11) UART1 timing (2/2)
<64> <66> <65>
ASCK1 (I/O)
<67>
<68>
RXD1 (input)
Input data
<69>
<70>
TXD1 (output)
Output data
User's Manual U15195EJ3V0UD
615
CHAPTER 16 ELECTRICAL SPECIFICATIONS
A/D Converter Characteristics (TA = -40 to +85C, REGIN = 3.0 to 3.6 V, AVDD = VDD = RVDD = 5 .0 V 0.5 V, VSS = VSS3 = VSS = CVSS = 0 V, output pin load capacitance: CL = 50 pF)
Parameter Resolution Overall error
Note 1
Symbol - - - tCONV tSAMP
Conditions
MIN. 10
TYP.
MAX.
Unit bit
4 1/2 5 833 4 4 4 4 -0.3 4.5 4 AVDD + 0.3 5.5 8 10
LSB LSB
Quantization error Conversion time Sampling time Zero-scale error Full-scale error
Note 1
s
ns LSB LSB LSB LSB V V mA
- -
Note 1
Note 1
Differential linearity error Integral linearity error Analog input voltage
- - VIAN AVDD AIDD
Note 1
Analog reference voltage AVDD power supply currentNote 2
Notes 1. Quantization error (0.5 LSB) is not included. 2. The V850E/IA2 incorporates two A/D converters. This is the rated value for one converter. Remark LSB: Least Significant Bit
616
User's Manual U15195EJ3V0UD
CHAPTER 16 ELECTRICAL SPECIFICATIONS
16.2 Flash Memory Programming Mode
Basic Characteristics (TA =10 to 40C (during rewrite), TA = -40 to +85C (except during rewrite), REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V)
Parameter Operating frequency VPP supply voltage Symbol fX VPP1 VPPL VPPM VPPH VDD3 supply current VPP supply current Step erase time Overall erase time IDD1 IPP tER tERA During flash memory programming VPP low-level detection VPP, REGIN level detection VPP high-voltage level detection VPP = VPP1 VPP = 7.8 V Note 1 When the step erase time = 0.4 s, Note 2 Note 3 When the write-back time = 1 ms, Note 4 0.99 1 0.398 0.4 Conditions MIN. 4 7.5 0.8 REGIN 0.65 REGIN 7.5 7.8 7.8 REGIN TYP. MAX. 40 8.1 1.2 REGIN REGIN + 0.3 8.1 3.2 fXX + 30 100 0.402 40 Unit MHz V V V V mA mA s s
Write-back time Number of write-backs per write-back command Number of erase/write-backs Step writing time Overall writing time per word Number of rewrites
tWB CWB
1.01 300
ms Count/ write-back command Count
CERWB tWT tWTW CERWR Note 5 When the step writing time = 20 s (1 word = 4 bytes), Note 6 1 erase + 1 write after erase = 1 rewrite, Note 7 18 20 100 20
16 22 200
s s/word
Count
Notes 1. The recommended setting value of the step erase time is 0.4 s. 2. The prewrite time prior to erasure and the erase verify time (write-back time) are not included. 3. The recommended setting value of the write-back time is 1 ms. 4. Write-back is executed once by the issuance of the write-back command. Therefore, the retry count must be the maximum value minus the number of commands issued. 5. The recommended setting value of the step writing time is 20 s. 6. 20 s is added to the actual writing time per word. The internal verify time during and after the writing is not included. 7. When writing initially to shipped products, it is counted as one rewrite for both "erase to write" and "write only". 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 When the PG-FP3 or PG-FP4 is used, a time parameter required for writing/erasing by downloading parameter files is automatically set. Do not change the settings unless otherwise specified.
User's Manual U15195EJ3V0UD
617
CHAPTER 16 ELECTRICAL SPECIFICATIONS
Serial Write Operation Characteristics (TA = 10 to +40C, REGIN = 3.0 to 3.6 V, VDD = RVDD = 5.0 V 0.5 V, VSS3 = VSS = CVSS = 0 V)
Parameter VDD to VPP set time VPP to RESET set time RESET to VPP count start time Count execution time VPP counter high-level width VPP counter low-level width VPP counter rise time VPP counter fall time VPP to REGIN reset time Symbol <71> <72> <73> <74> <75> <76> <77> <78> <79> tDRPSR tPSRRF tRFOF tCOUNT tCH tCL tR tF tPFDR 10 1 1 1 1 VPP = 7.8 V Conditions MIN. tRG + 0.01 1 10T + 1500 15 TYP. MAX. Unit ms
s
ns ms
s s s s s
Remarks 1. tRG: Regulator output stabilization time 2. T = tCYK
4.5 V VDD 0V <71> 3.0 V REGIN 0V <74> <73> VPP VDD REGIN <78> 0V <72> <76> <75> <77> <79>
VPP
RESET (input)
VDD 0V
618
User's Manual U15195EJ3V0UD
CHAPTER 17 PACKAGE DRAWINGS
100-PIN PLASTIC LQFP (FINE PITCH) (14x14)
A B
75 76
51 50
detail of lead end S CD Q R
100 1
26 25
F G P H I
M
J K S
N
S L M
NOTE Each lead centerline is located within 0.08 mm of its true position (T.P.) at maximum material condition.
ITEM A B C D F G H I J K L M N P Q R S
MILLIMETERS 16.000.20 14.000.20 14.000.20 16.000.20 1.00 1.00 0.22 +0.05 -0.04 0.08 0.50 (T.P.) 1.000.20 0.500.20 0.17 +0.03 -0.07 0.08 1.400.05 0.100.05 3 +7 -3 1.60 MAX.
S100GC-50-8EU, 8EA-2
User's Manual U15195EJ3V0UD
619
CHAPTER 17 PACKAGE DRAWINGS
100-PIN PLASTIC QFP (14x20)
A B
80 81
51 50
detail of lead end S CD Q R
100 1
31 30
F G H I
M
J
P
K S N S L M
NOTE Each lead centerline is located within 0.15 mm of its true position (T.P.) at maximum material condition.
ITEM A B C D F G H I J K L M N P Q R S
MILLIMETERS 23.60.4 20.00.2 14.00.2 17.60.4 0.8 0.6 0.300.10 0.15 0.65 (T.P.) 1.80.2 0.80.2 0.15+0.10 -0.05 0.10 2.70.1 0.10.1 55 3.0 MAX.
P100GF-65-3BA1-4
620
User's Manual U15195EJ3V0UD
CHAPTER 18 RECOMMENDED SOLDERING CONDITIONS
The PD703114 and 70F3114 should be soldered and mounted under the following recommended conditions. For details of the recommended soldering conditions, refer to the document Semiconductor Device Mounting Technology Manual (C10535E). For soldering methods and conditions other than those recommended below, contact an NEC Electronics sales representative.
User's Manual U15195EJ3V0UD
621
CHAPTER 18 RECOMMENDED SOLDERING CONDITIONS
Table 18-1. Surface Mounting Type Soldering Conditions xxx-8EU: 100-pin plastic LQFP (fine pitch) (14 x 14) (1) PD703114GC-xxx xxx
PD70F3114GC-8EU:
Soldering Method
100-pin plastic LQFP (fine pitch) (14 x 14)
Soldering Conditions Recommended Condition Symbol IR35-107-2
Infrared reflow
Package peak temperature: 235C, Time: 30 seconds max. (at 210C or higher), Count: Two times or less Exposure limit: 7 daysNote (after that, prebake at 125C for 10 to 72 hours) Package peak temperature: 215C, Time: 25 to 40 seconds (at 200C or higher), Count: Two times or less Exposure limit: 7 daysNote (after that, prebake at 125C for 10 to 72 hours) Pin temperature: 350C max., Time: 3 seconds max. (per pin row)
VPS
VP15-107-2
Partial heating
-
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).
xxx-3BA: 100-pin plastic QFP (14 x 20) (2) PD703114GF-xxx xxx
PD70F3114GF-3BA:
Soldering Method
100-pin plastic QFP (14 x 20)
Soldering Conditions Recommended Condition Symbol IR35-207-2
Infrared reflow
Package peak temperature: 235C, Time: 30 seconds max. (at 210C or higher), Count: Two times or less Exposure limit: 7 daysNote (after that, prebake at 125C for 20 to 72 hours) Package peak temperature: 215C, Time: 25 to 40 seconds (at 200C or higher), Count: Two times or less Exposure limit: 7 daysNote (after that, prebake at 125C for 20 to 72 hours) Solder bath temperature: 260C max., Time: 10 seconds max., Count: Once Preheating temperature: 120C max. (package surface temperature) Exposure limit: 7 daysNote (after that, prebake at 125C for 20 to 72 hours) Pin temperature: 350C max., Time: 3 seconds max. (per pin row)
VPS
VP15-207-2
Wave soldering
WS60-207-1
Partial heating
-
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).
622
User's Manual U15195EJ3V0UD
APPENDIX A NOTES ON TARGET SYSTEM DESIGN
The following shows a diagram of the connection conditions between the in-circuit emulator option board and conversion connector. Design your system making allowances for conditions such as the form of parts mounted on the target system as shown below. Figure A-1. 100-Pin Plastic LQFP (Fine Pitch) (14 x 14) Side view
In-circuit emulator IE-V850E-MC In-circuit emulator option board IE-703114-MC-EM1
231.26 mm
Note
Target system
Conversion connector YQGUIDE YQPACK100SD NQPACK100SD
Note YQSOCKET100SDN (sold separately) can be inserted here to adjust the height (height: 3.2 mm). Top view
IE-V850E-MC Target system
IE-703114-MC-EM1 YQPACK100SD, NQPACK100SD, YQGUIDE
Connection condition diagram
IE-703114-MC-EM1 Connect to IE-V850E-MC.
75 mm
YQGUIDE YQPACK100SD NQPACK100SD
13.3 mm 31.84 mm 17.9955 mm 21.58 mm 28.7445 mm
Target system
User's Manual U15195EJ3V0UD
623
APPENDIX A NOTES ON TARGET SYSTEM DESIGN
Figure A-2. 100-Pin Plastic QFP (14 x 20) Side view
In-circuit emulator IE-V850E-MC
In-circuit emulator option board IE-703114-MC-EM1
231.26 mm
Note
Conversion connector NEXB-2R100SD/RB YQGUIDE YQPACK100RB NQPACK100RB
Target system
Note YQSOCKET100SDN (sold separately) can be inserted here to adjust the height (height: 3.2 mm). Top view
IE-V850E-MC
NEXB-2R100SD/RB
Target system
Pin 1 position
IE-703114-MC-EM1
8 mm
20.7 mm
YQPACK100RB, NQPACK100RB, YQGUIDE
Connection condition diagram
IE-703114-MC-EM1 Connect to IE-V850E-MC. Pin 1 position
75 mm
NEXB-2R100SD/RB
YQPACK100RB NQPACK100RB
33.2 mm
38 mm 20 mm 28.7 mm 18.5 mm
Target system
624
User's Manual U15195EJ3V0UD
APPENDIX B REGISTER INDEX
(1/9)
Symbol ADCR00 ADCR01 ADCR02 ADCR03 ADCR04 ADCR05 ADCR10 ADCR11 ADCR12 ADCR13 ADCR14 ADCR15 ADCR16 ADCR17 ADETM0 ADETM0H ADETM0L ADETM1 ADETM1H ADETM1L ADIC0 ADIC1 ADSCM00 ADSCM00H ADSCM00L ADSCM01 ADSCM01H ADSCM01L ADSCM10 ADSCM10H ADSCM10L ADSCM11 ADSCM11H ADSCM11L ASIF0 ASIM0 ASIM10 ASIM11 Register Name A/D conversion result register 00 A/D conversion result register 01 A/D conversion result register 02 A/D conversion result register 03 A/D conversion result register 04 A/D conversion result register 05 A/D conversion result register 10 A/D conversion result register 11 A/D conversion result register 12 A/D conversion result register 13 A/D conversion result register 14 A/D conversion result register 15 A/D conversion result register 16 A/D conversion result register 17 A/D voltage detection mode register 0 A/D voltage detection mode register 0H A/D voltage detection mode register 0L A/D voltage detection mode register 1 A/D voltage detection mode register 1H A/D voltage detection mode register 1L Interrupt control register Interrupt control register A/D scan mode register 00 A/D scan mode register 00H A/D scan mode register 00L A/D scan mode register 01 A/D scan mode register 01H A/D scan mode register 01L A/D scan mode register 10 A/D scan mode register 10H A/D scan mode register 10L A/D scan mode register 11 A/D scan mode register 11H A/D scan mode register 11L Asynchronous serial interface mode transmission status register 0 Asynchronous serial interface mode register 0 Asynchronous serial interface mode register 10 Asynchronous serial interface mode register 11 Unit ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC INTC INTC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC ADC UART0 UART0 UART1 UART1 Page 508 508 508 508 508 508 508 508 508 508 508 508 508 508 507 507 507 507 507 507 146 146 504 504 504 506 506 506 504 504 504 506 506 506 402 398 429 431
User's Manual U15195EJ3V0UD
625
APPENDIX B REGISTER INDEX
(2/9)
Symbol ASIS0 ASIS1 AWC BCC BCT0 BCT1 BFCM00 BFCM01 BFCM02 BFCM03 BFCM04 BFCM05 BFCM10 BFCM11 BFCM12 BFCM13 BFCM14 BFCM15 BRGC0 BSC CC100 CC101 CC10IC0 CC10IC1 CC2IC0 CC2IC1 CC2IC2 CC2IC3 CC2IC4 CC2IC5 CC30 CC31 CC3IC0 CC3IC1 CCR0 CCSTATE0 CCSTATE0H CCSTATE0L CKC CKSR0 CM000 Register Name Asynchronous serial interface status register 0 Asynchronous serial interface status register 1 Address wait control register Bus cycle control register Bus cycle type configuration register 0 Bus cycle type configuration register 1 Buffer register CM00 Buffer register CM01 Buffer register CM02 Buffer register CM03 Buffer register CM04 Buffer register CM05 Buffer register CM10 Buffer register CM11 Buffer register CM12 Buffer register CM13 Buffer register CM14 Buffer register CM15 Baud rate generator control register 0 Bus size configuration register Capture/compare register 100 Capture/compare register 101 Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Capture/compare register 30 Capture/compare register 31 Interrupt control register Interrupt control register Capture/compare control register 0 Timer 2 capture/compare 1 to 4 status register 0 Timer 2 capture/compare 1 to 4 status register 0H Timer 2 capture/compare 1 to 4 status register 0L Clock control register Clock selection register 0 Compare register 000 Unit UART0 UART1 BCU BCU BCU BCU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU UART0 BCU RPU RPU INTC INTC INTC INTC INTC INTC INTC INTC RPU RPU INTC INTC RPU RPU RPU RPU CG UART0 RPU Page 401 432 97 99 87 87 198 198 198 200 198 198 198 198 198 200 198 198 420 89 290 291 146 146 146 146 146 146 146 146 358 358 146 146 295 334 334 334 173 419 197
626
User's Manual U15195EJ3V0UD
APPENDIX B REGISTER INDEX
(3/9)
Symbol CM001 CM002 CM003 CM004 CM005 CM00IC1 CM010 CM011 CM012 CM013 CM014 CM015 CM01IC1 CM02IC1 CM03IC0 CM03IC1 CM04IC0 CM04IC1 CM05IC0 CM05IC1 CM100 CM101 CM10IC0 CM10IC1 CM4 CM4IC0 CMSE050 CMSE120 CMSE340 CSC0 CSC1 CSCE0 CSE0 CSE0H CSE0L CSIC0 CSIC1 CSIIC0 CSIIC1 CSIM0 CSIM1 Compare register 001 Compare register 002 Compare register 003 Compare register 004 Compare register 005 Interrupt control register Compare register 010 Compare register 011 Compare register 012 Compare register 013 Compare register 014 Compare register 015 Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Compare register 100 Compare register 101 Interrupt control register Interrupt control register Compare register 4 Interrupt control register Timer 2 sub-channel 0, 5 capture/compare control register Timer 2 sub-channel 1, 2 capture/compare control register Timer 2 sub-channel 3, 4 capture/compare control register Chip area selection control register Chip area selection control register Timer 2 software event capture register Timer 2 count clock/control edge selection register 0 Timer 2 count clock/control edge selection register 0H Timer 2 count clock/control edge selection register 0L Clocked serial interface clock selection register 0 Clocked serial interface clock selection register 1 Interrupt control register Interrupt control register Clocked serial interface mode register 0 Clocked serial interface mode register 1 Register Name Unit RPU RPU RPU RPU RPU INTC RPU RPU RPU RPU RPU RPU INTC INTC INTC INTC INTC INTC INTC INTC RPU RPU INTC INTC RPU INTC RPU RPU RPU BCU BCU RPU RPU RPU RPU CSI0 CSI1 INTC INTC CSI0 CSI1 Page 197 197 198 198 198 146 197 197 197 198 198 198 146 146 146 146 146 146 146 146 289 289 146 146 385 146 328 329 331 84 84 336 322 322 322 467 467 146 146 465 465
User's Manual U15195EJ3V0UD
627
APPENDIX B REGISTER INDEX
(4/9)
Symbol CSL10 CVPE10 CVPE20 CVPE30 CVPE40 CVSE00 CVSE10 CVSE20 CVSE30 CVSE40 CVSE50 DADC0 DADC1 DADC2 DADC3 DBC0 DBC1 DBC2 DBC3 DCHC0 DCHC1 DCHC2 DCHC3 DDA0H DDA0L DDA1H DDA1L DDA2H DDA2L DDA3H DDA3L DDIS DETIC0 DETIC1 DMAIC0 DMAIC1 DMAIC2 DMAIC3 DRST DSA0H DSA0L Register Name CC101 capture input selection register Timer 2 sub-channel 1 main capture/compare register Timer 2 sub-channel 2 main capture/compare register Timer 2 sub-channel 3 main capture/compare register Timer 2 sub-channel 4 main capture/compare register Timer 2 sub-channel 0 capture/compare register Timer 2 sub-channel 1 sub capture/compare register Timer 2 sub-channel 2 sub capture/compare register Timer 2 sub-channel 3 sub capture/compare register Timer 2 sub-channel 4 sub capture/compare register Timer 2 sub-channel 5 capture/compare register DMA addressing control register 0 DMA addressing control register 1 DMA addressing control register 2 DMA addressing control register 3 DMA transfer count register 0 DMA transfer count register 1 DMA transfer count register 2 DMA transfer count register 3 DMA channel control register 0 DMA channel control register 1 DMA channel control register 2 DMA channel control register 3 DMA destination address register 0H DMA destination address register 0L DMA destination address register 1H DMA destination address register 1L DMA destination address register 2H DMA destination address register 2L DMA destination address register 3H DMA destination address register 3L DMA disable status register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register DMA restart register DMA source address register 0H DMA source address register 0L Unit RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC INTC INTC INTC INTC INTC INTC DMAC DMAC DMAC Page 299 319 319 319 319 319 320 320 320 320 320 114 114 114 114 113 113 113 113 116 116 116 116 111 112 111 112 111 112 111 112 117 146 146 146 146 146 146 117 109 110
628
User's Manual U15195EJ3V0UD
APPENDIX B REGISTER INDEX
(5/9)
Symbol DSA1H DSA1L DSA2H DSA2L DSA3H DSA3L DTFR0 DTFR1 DTFR2 DTFR3 DTM00 DTM01 DTM02 DTM10 DTM11 DTM12 DTRR0 DTRR1 DWC0 DWC1 FEM0 FEM1 FEM2 FEM3 FEM4 FEM5 IMR0 IMR0H IMR0L IMR1 IMR1H IMR1L IMR2 IMR2H IMR2L IMR3 IMR3H IMR3L INTM0 INTM1 INTM2 Register Name DMA source address register 1H DMA source address register 1L DMA source address register 2H DMA source address register 2L DMA source address register 3H DMA source address register 3L DMA trigger factor register 0 DMA trigger factor register 1 DMA trigger factor register 2 DMA trigger factor register 3 Dead time timer 00 Dead time timer 01 Dead time timer 02 Dead time timer 10 Dead time timer 11 Dead time timer 12 Dead time timer reload register 0 Dead time timer reload register 1 Data wait control register 0 Data wait control register 1 Timer 2 input filter mode register 0 Timer 2 input filter mode register 1 Timer 2 input filter mode register 2 Timer 2 input filter mode register 3 Timer 2 input filter mode register 4 Timer 2 input filter mode register 5 Interrupt mask register 0 Interrupt mask register 0H Interrupt mask register 0L Interrupt mask register 1 Interrupt mask register 1H Interrupt mask register 1L Interrupt mask register 2 Interrupt mask register 2H Interrupt mask register 2L Interrupt mask register 3 Interrupt mask register 3H Interrupt mask register 3L External interrupt mode register 0 External interrupt mode register 1 External interrupt mode register 2 Unit DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC DMAC RPU RPU RPU RPU RPU RPU RPU RPU BCU BCU RPU RPU RPU RPU RPU RPU INTC INTC INTC INTC INTC INTC INTC INTC INTC INTC INTC INTC INTC INTC INTC Page 109 110 109 110 109 110 118 118 118 118 197 197 197 197 197 197 197 197 96 96 156, 571 156, 571 156, 571 156, 571 156, 571 156, 571 149 149 149 149 149 149 149 149 149 149 149 149 138 152 152
User's Manual U15195EJ3V0UD
629
APPENDIX B REGISTER INDEX
(6/9)
Symbol ISPR ITRG0 ITRG1 LOCKR NRC10 NRC3 OCTLE0 OCTLE0H OCTLE0L ODELE0 ODELE0H ODELE0L P0 P0IC0 P0IC1 P0IC2 P0IC3 P0IC4 P1 P2 P3 P4 PCM PCT PDH PDL PDLH PDLL PFC1 PFC2 PFC3 PHCMD PHS PM1 PM2 PM3 PM4 PMC1 PMC2 PMC3 PMC4 In-service priority register A/D internal trigger selection register 0 A/D internal trigger selection register 1 Lock register Timer 10 noise elimination time selection register Timer 3 noise elimination time selection register Timer 2 output control register Timer 2 output control register 0H Timer 2 output control register 0L Timer 2 output delay register Timer 2 output delay register 0H Timer 2 output delay register 0L Port 0 Interrupt control register Interrupt control register Interrupt control register Interrupt control register Interrupt control register Port 1 Port 2 Port 3 Port 4 Port CM Port CT Port DH Port DL Port DLH Port DLL Port 1 function control register Port 2 function control register Port 3 function control register Peripheral command register Peripheral status register Port 1 mode register Port 2 mode register Port 3 mode register Port 4 mode register Port 1 mode control register Port 2 mode control register Port 3 mode control register Port 4 mode control register Register Name Unit INTC ADC ADC CPU RPU RPU RPU RPU RPU RPU RPU RPU Port INTC INTC INTC INTC INTC Port Port Port Port Port Port Port Port Port Port Port Port Port CPU CPU Port Port Port Port Port Port Port Port Page 150 509 509 176 568 569 327 327 327 335 335 335 549 146 146 146 146 146 550 552 554 556 564 562 558 560 560 560 551 553 555 172 175 550 552 554 557 551 553 555 557
630
User's Manual U15195EJ3V0UD
APPENDIX B REGISTER INDEX
(7/9)
Symbol PMCCM PMCCT PMCDH PMCDL PMCDLH PMCDLL PMCM PMCT PMDH PMDL PMDLH PMDLL POER0 POER1 PRCMD PRM01 PRM02 PRM03 PRM10 PRSCM1 PRSCM3 PRSM1 PRSM3 PSC PSMR PSTO0 PSTO1 REGC RXB0 RXB1 RXBL1 SEIC0 SESA10 SESC SESE0 SESE0H SESE0L SIO0 SIO1 SIOL0 SIOL1 Port CM mode control register Port CT mode control register Port DH mode control register Port DL mode control register Port DL mode control register H Port DL mode control register L Port CM mode register Port CT mode register Port DH mode register Port DL mode register Port DL mode register H Port DL mode register L PWM output enable register 0 PWM output enable register 1 Command register Timer 0 clock selection register Timer 1/ Timer 2 clock selection register Timer 3 clock selection register Prescaler mode register 10 Prescaler compare register 1 Prescaler compare register 3 Prescaler mode register 1 Prescaler mode register 3 Power save control register Power save mode register PWM software timing output register 0 PWM software timing output register 1 Regulator control register Reception buffer register 2-frame continuous reception buffer registers 1 Reception buffer register L1 Interrupt control register Signal edge selection register 10 Valid edge selection register Timer 2 sub-channel input event edge selection register Timer 2 sub-channel input event edge selection register 0H Timer 2 sub-channel input event edge selection register 0L Serial I/O shift register 0 Serial I/O shift register 1 Serial I/O shift register L0 Serial I/O shift register L1 Register Name Unit Port Port Port Port Port Port Port Port Port Port Port Port RPU RPU CPU RPU RPU RPU RPU UART1 CSI0, CSI1 UART1 CSI0, CSI1 CPU CPU RPU RPU Regulator UART0 UART1 UART1 INTC INTC, RPU INTC, RPU RPU RPU RPU CSI0 CSI1 CSI0 CSI1 Page 565 563 559 561 561 561 565 563 559 561 561 561 214 214 180 201 292, 321 360 298 456 497 455 496 181 180 215 215 586 403 434 434 146 153, 296 155, 365 323 323 323 477 477 478 478
User's Manual U15195EJ3V0UD
631
APPENDIX B REGISTER INDEX
(8/9)
Symbol SIRB0 SIRB1 SIRBE0 SIRBE1 SIRBEL0 SIRBEL1 SIRBL0 SIRBL1 SOTB0 SOTB1 SOTBF0 SOTBF1 SOTBFL0 SOTBFL1 SOTBL0 SOTBL1 SPEC0 SPEC1 SRIC0 SRIC1 STATUS0 STIC0 STIC1 STOPTE0 STOPTE0H STOPTE0L TBSTATE0 TBSTATE0H TBSTATE0L TCRE0 TCRE0H TCRE0L TM00 TM01 TM0IC0 TM0IC1 TM10 TM20 TM21 TM2IC0 TM2IC1 Register Name Clocked serial interface reception buffer register 0 Clocked serial interface reception buffer register 1 Clocked serial interface read-only reception buffer register 0 Clocked serial interface read-only reception buffer register 1 Clocked serial interface read-only reception buffer register L0 Clocked serial interface read-only reception buffer register L1 Clocked serial interface reception buffer register L0 Clocked serial interface reception buffer register L1 Clocked serial interface transmission buffer register 0 Clocked serial interface transmission buffer register 1 Clocked serial interface initial transmission buffer register 0 Clocked serial interface initial transmission buffer register 1 Clocked serial interface initial transmission buffer register L0 Clocked serial interface initial transmission buffer register L1 Clocked serial interface initial transmission buffer register L0 Clocked serial interface initial transmission buffer register L1 TOMR write enable register 0 TOMR write enable register 1 Interrupt control register Interrupt control register Status register 0 Interrupt control register Interrupt control register Timer 2 clock stop register 0 Timer 2 clock stop register 0H Timer 2 clock stop register 0L Timer 2 timer base status register 0 Timer 2 timer base status register 0H Timer 2 timer base status register 0L Timer 2 time base control register 0 Timer 2 time base control register 0H Timer 2 time base control register 0L Timer 00 Timer 01 Interrupt control register Interrupt control register Timer 10 Timer 20 Timer 21 Interrupt control register Interrupt control register Unit CSI0 CSI1 CSI0 CSI1 CSI0 CSI1 CSI1 CSI0 CSI1 CSI0 CSI1 CSI0 CSI1 CSI0 CSI1 CSI0 CSI1 CSI0 CSI1 RPU RPU INTC INTC RPU INTC INTC RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU INTC INTC RPU RPU Page 469 469 471 471 472 472 470 470 473 473 475 475 476 476 474 474 224 224 146 146 299 146 146 321 321 321 333 333 333 324 324 324 196 196 146 146 287 319 319 146 146
632
User's Manual U15195EJ3V0UD
APPENDIX B REGISTER INDEX
(9/9)
Symbol TM3 TM3IC0 TM4 TMC00 TMC00H TMC00L TMC01 TMC01H TMC01L TMC10 TMC30 TMC31 TMC4 TMIC0 TO3C TOMR0 TOMR1 TUC00 TUC01 TUM0 TXB0 TXS1 TXSL1 VSWC Timer 3 Interrupt control register Timer 4 Timer control register 00 Timer control register 00H Timer control register 00L Timer control register 01 Timer control register 01H Timer control register 01L Timer control register 10 Timer control register 30 Timer control register 31 Timer control register 4 Timer connection selection register 0 Timer 3 output control register Timer output mode register 0 Timer output mode register 1 Timer unit control register 00 Timer unit control register 01 Timer unit mode register 0 Transmission buffer register 00 2-frame continuous transmission shift register 1 Transmission shift register L1 System wait control register Register Name Unit RPU INTC RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU RPU UART0 UART1 UART1 BCU Page 357 146 384 202 202 202 202 202 202 294 361 363 387 392 366 209 209 208 208 293 404 437 437 81
User's Manual U15195EJ3V0UD
633
APPENDIX C INSTRUCTION SET LIST
C.1 Conventions
(1) Symbols used in operand descriptions
Symbol reg1 reg2 Explanation General-purpose register (Used as source register) General-purpose register (Usually used as destination register. Used as source register in some instructions.) General-purpose register (Usually stores remainder of division result or higher 32 bits of multiplication result.) 3-bit data for bit number specification X-bit immediate data X-bit displacement data System register number 5-bit data that specifies a trap vector (00H to 1FH) 4-bit data that shows a condition code Stack pointer (r3) Element pointer (r30) X-item register list
reg3
bit#3 immX dispX regID vector cccc sp ep listx
(2) Symbols used in operands
Symbol R r w d I i cccc CCCC bbb L S Explanation 1 bit of data of code that specifies reg1 or regID 1 bit of data of code that specifies reg2 1 bit of data of code that specifies reg3 1 bit of data of a displacement 1 bit of immediate data (Shows higher bit of immediate data) 1 bit of immediate data 4-bit data that shows a condition code 4-bit data that shows condition code of Bcond instruction 3-bit data for bit number specification 1 bit of data that specifies a program register in a register list 1 bit of data that specifies a system register in a register list
634
User's Manual U15195EJ3V0UD
APPENDIX C INSTRUCTION SET LIST
(3) Symbols used in operations
Symbol GR [ ] SR [ ] zero-extend (n) sign-extend (n) load-memory (a, b) store-memory (a, b, c) load-memory-bit (a, b) store-memory-bit (a, b, c) saturated (n) Assignment General-purpose register System register Zero-extend n to word length. Sign-extend n to word length. Read data of size "b" from address "a". Write data "b" of size "c" to address "a". Read bit "b" of address "a". Write "c" in bit "b" of address "a". Perform saturation processing of n (n is 2's complement). If n is a computation result and n > 7FFFFFFFH, make n = 7FFFFFFFH. If n is a computation result and n < 80000000H, make n = 80000000H. Reflect result in flag. Byte (8 bits) Halfword (16 bits) Word (32 bits) Addition Subtraction Bit concatenation Multiplication Division Remainder of division result Logical product Logical sum Exclusive logical sum Logical negation Logical shift left Logical shift right Arithmetic shift right Explanation
result Byte Half-word Word + - || x / % AND OR XOR NOT logically shift left by logically shift right by arithmetically shift right by
(4) Symbols used in execution clock
Symbol i r | Explanation When executing another instruction immediately after instruction execution (issue). When repeating same instruction immediately after instruction execution (repeat) When using instruction execution result in instruction immediately after instruction execution (latency)
User's Manual U15195EJ3V0UD
635
APPENDIX C INSTRUCTION SET LIST
(5) Symbols used in flag operations
Symbol (Blank) 0 x R No change Clear to 0. Set or cleared according to result. Previously saved value is restored. Explanation
(6) Condition codes
Condition Name (cond) V NV C/L 0000 1000 0001 Condition Code (CCCC) Condition Expression Explanation
OV = 1 OV = 0 CY = 1
Overflow No overflow Carry Lower (Less than) No carry No lower (Greater than or equal) Zero Equal Not zero Not equal Not higher (Less than equal) Higher (Greater than) Negative Positive - Always (Unconditional) Saturated Less then signed Greater than or equal signed Less than or equal signed Greater than signed
NC/NL
1001
CY = 0
Z/E
0010
Z=1
NZ/NE
1010
Z=0
NH H N P T SA LT GE LE GT
0011 1011 0100 1100 0101 1101 0110 1110 0111 1111
(CY or Z) = 1 (CY or Z) = 0 S=1 S=0
SAT = 1 (S xor OV) = 1 (S xor OV) = 0 ((S xor OV) or Z) = 1 ((S xor OV) or Z) = 0
636
User's Manual U15195EJ3V0UD
APPENDIX C INSTRUCTION SET LIST
C.2 Instruction Set (Alphabetical Order)
(1/5)
Mnemonic Operands Opcode Operation Execution Clock i ADD reg1, reg2 imm5, reg2 ADDI imm16, reg1, reg2 AND ANDI reg1, reg2 imm16, reg1, reg2 disp9 r r r r r 0 0 1 1 1 0 R R R R R GR[reg2] GR[reg2] + GR[reg1] r r r r r 0 1 0 0 1 0 i i i i i GR[reg2] GR[reg2] + sign-extend (imm5) r r r r r 1 1 0 0 0 0 R R R R R GR[reg2] GR[reg1] + sign-extend (imm16) iiiiiiiiiiiiiii i r r r r r 0 0 1 0 1 0 R R R R R GR[reg2] GR[reg2] AND GR[reg1] r r r r r 1 1 0 1 1 0 R R R R R GR[reg2] GR[reg1] AND zero-extend (imm 16) iiiiiiiiiiiiiii i d d d d d 1 0 1 1 d d d c c c c if conditions are satisfied Note 1 then PC PC + sign extend (disp9) Conditions satisfied Conditions not satisfied 3 1 3 1 3 1 1 1 1 1 1 1 0 0 1 1 1 r 1 1 1 I 1 1 1 CY OV Flags S Z SAT
x x x
x x x
x x x
x x x
x
0
x x
Bcond
Note 2 Note 2 Note 2
BSH
reg2, reg3
r r r r r 1 1 1 1 1 1 0 0 0 0 0 GR[reg3] GR[reg2] (23:16) || GR[reg2] (31:24)||GR w w w w w 0 1 1 0 1 0 0 0 0 1 0 [reg2] (7:0)||GR[reg2] (15:8) r r r r r 1 1 1 1 1 1 0 0 0 0 0 GR[reg3] GR[reg2] (7:0) || GR[reg2] (15:8)||GR w w w w w 0 1 1 0 1 0 0 0 0 0 0 [reg2] (23:16)||GR[reg2] (31:24) 0 0 0 0 0 0 1 0 0 0 i i i i i i CTPC PC + 2 (return PC) CTPSW PSW adr CTBP + zero-extend (imm6 logically shift left by 1) PC CTBP + zero-extend (Load-memory (adr, Halfword) 1 0 b b b 1 1 1 1 1 0 R R R R R adr GR[reg1] + sign-extend (disp 16) d d d d d d d d d d d d d d d d Z flag Not (Load-memory-bit (adr, bit#3)) Store-memory-bit (adr, bit#3, 0) 1 0 b b b 1 1 1 1 1 0 R R R R R adr GR[reg1] d d d d d d d d d d d d d d d d Z flag Not (Load-memory-bit (adr, reg2)) Store-memory-bit (adr, reg2, 0) r r r r r 1 1 1 1 1 1 i i i i i if conditions are satisfied w w w w w 0 1 1 0 0 0 c c c c 0 then GR[reg3] sign-extend (imm5) else GR[reg3] GR[reg2] r r r r r 1 1 1 1 1 1 R R R R R if conditions are satisfied w w w w w 0 1 1 0 0 1 c c c c 0 then GR[reg3] GR[reg1] else GR[reg3] GR[reg2] r r r r r 0 0 1 1 1 1 R R R R R result GR[reg2] - GR[reg1] r r r r r 0 1 0 0 1 1 i i i i i result GR[reg2] - sign-extend (imm5) 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 PC CTPC 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 PSW CTPSW 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 PC DBPC 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 0 PSW DBPSW 1 1 1 1 1 0 0 0 0 1 0 0 0 0 0 0 DBPC PC + 2 (return PC) DBPSW PSW PSW.NP 1 PSW.EP 1 PSW.ID 1 PC 00000060H 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 PSW.ID 1 000000010110000 0
1
1
1
x x
0
x x
x x
BSW
reg2, reg3
1
1
1
0
CALLT
imm6
5
5
5
CLR1
bit#3, disp16[reg1]
3
3
3
x
Note 3 Note 3 Note 3
reg2, [reg1]
3
3
3
x
Note 3 Note 3 Note 3
CMOV
cccc, imm5, reg2, reg3
1
1
1
cccc, reg1, reg2, reg3
1
1
1
CMP
reg1, reg2 imm5, reg2
1 1 4
1 1 4
1 1 4
x x
R
x x
R
x x
R
x x
R R
CTRET
DBRET
4
4
4
R
R
R
R
R
DBTRAP
4
4
4
DI
1
1
1
User's Manual U15195EJ3V0UD
637
APPENDIX C INSTRUCTION SET LIST
(2/5)
Mnemonic Operands Opcode Operation Execution Clock i DISPOSE imm5, list12 0 0 0 0 0 1 1 0 0 1 i i i i i L sp sp + zero-extend (imm5 logically shift left by 2) L L L L L L L L L L L 0 0 0 0 0 GR[reg in list12] Load-memory (sp, Word) sp sp + 4 repeat 2 steps above until regs in list 12 is loaded 0 0 0 0 0 1 1 0 0 1 i i i i i L sp sp + zero-extend (imm5 logically shift left by 2) L L L L L L L L L L L R R R R R GR[reg in list12] Load-memory (sp, Word) Note 5 sp sp + 4 repeat 2 steps above until regs in list12 is loaded PC GR[reg1] r r r r r 1 1 1 1 1 1 R R R R R GR[reg2] GR[reg2] / GR[reg1] w w w w w 0 1 0 1 1 0 0 0 0 0 0 GR[reg3] GR[reg2]%GR[reg1] r r r r r 0 0 0 0 1 0 R R R R R GR[reg2] GR[reg2] / GR[reg1]Note 6 r r r r r 1 1 1 1 1 1 R R R R R GR[reg2] GR[reg2] / GR[reg1]Note 6 w w w w w 0 1 0 1 0 0 0 0 0 0 0 GR[reg3] GR[reg2]%GR[reg1] r r r r r 1 1 1 1 1 1 R R R R R GR[reg2] GR[reg2] / GR[reg1]Note 6 w w w w w 0 1 0 1 0 0 0 0 0 1 0 GR[reg3] GR[reg2]%GR[reg1] r r r r r 1 1 1 1 1 1 R R R R R GR[reg2] GR[reg2] / GR[reg1] w w w w w 0 1 0 1 0 0 0 0 0 1 0 GR[reg3] GR[reg2]%GR[reg1] 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 PSW.ID 0 000000010110000 0 HALT 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 Stop 000000010010000 0 HSW reg2, reg3 r r r r r 1 1 1 1 1 1 0 0 0 0 0 GR[reg3] GR[reg2] (15:0)||GR[reg2] (31:16) wwwww0110100010 0 JARL disp22, reg2 r r r r r 1 1 1 1 0 d d d d d d GR[reg2] PC + 4 d d d d d d d d d d d d d d d 0 PC PC + sign-extend (disp22) 0 0 0 0 0 0 0 0 0 1 1 R R R R R PC GR[reg1] 0 0 0 0 0 1 1 1 1 0 d d d d d d PC PC + sign-extend (disp22) ddddddddddddddd 0 Note 7 LD.B disp16[reg1], reg2 disp16[reg1], reg2 r r r r r 1 1 1 0 0 0 R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d d GR[reg2] sign-extend (Load-memory (adr, Byte)) r r r r r 1 1 1 1 0 b R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d 1 GR[reg2] zero (Load-memory (adr, Byte)) Notes 8, 10 LD.H disp16[reg1], reg2 r r r r r 1 1 1 0 0 1 R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d 0 GR[reg2] sign-extend (Load-memory (adr, Note 8 Halfword)) r r r r r 1 1 1 1 1 1 R R R R R SR[regID] GR[reg2] 00 00 0 00 0 00 1 00 0 00 Note 12 LD.HU disp16[reg1], reg2 Other than regID = PSW regID = PSW 1 1
Note 11
Flags CY OV S Z SAT
r n+1
I n+1
n+1
Note 4 Note 4 Note 4
imm5, list12[reg1]
n+3
n+3
n+3
Note 4 Note 4 Note 4
DIV
reg1, reg2, reg3 reg1, reg2 reg1, reg2, reg3
35
35
35
x x x x x
x x x x x
x x x x x
DIVH
35 35
35 35
35 35
DIVHU
reg1, reg2, reg3 reg1, reg2, reg3
34
34
34
DIVU
34
34
34
EI
1
1
1
1
1
1
1
1
1
x
0
x
x
3
3
3
JMP JR
[reg1] disp22
4 3
4 3
4 3
1
1
Note 11
LD.BU
1
1
Note 11
LDSR
reg2, regID
1 1 1
1 1 1
1 1
Note 11
x
x
x
x
x
r r r r r 1 1 1 0 0 1 R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d 1 GR[reg2] zero-extend (Load-memory (adr, Note 8 Halfword))
638
User's Manual U15195EJ3V0UD
APPENDIX C INSTRUCTION SET LIST
(3/5)
Mnemonic Operands Opcode Operation Execution Clock i LD.W disp16[reg1], reg2 r r r r r 1 1 1 0 0 1 R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d 1 GR[reg2] Load-memory (adr, Word) Note 8 r r r r r 0 0 0 0 0 0 R R R R R GR[reg2] GR[reg1] r r r r r 0 1 0 0 0 0 i i i i i GR[reg2] sign-extend (imm5) 0 0 0 0 0 1 1 0 0 0 1 R R R R R GR[reg1] imm32 iiiiiiiiiiiiiii i iiiiiiiiiiiiiii i MOVEA imm16, reg1, reg2 imm16, reg1, reg2 reg1, reg2, reg3 imm9, reg2, reg3 r r r r r 1 1 0 0 0 1 R R R R R GR[reg2] GR[reg1] + sign-extend (imm16) iiiiiiiiiiiiiii i
16 r r r r r 1 1 0 0 1 0 R R R R R GR[reg2] GR[reg1] + (imm16 || 0 )
Flags CY OV S Z SAT
r 1
I
Note 11
1
MOV
reg1, reg2 imm5, reg2 imm32, reg1
1 1 2
1 1 2
1 1 2
1
1
1
MOVHI
1
1
1
iiiiiiiiiiiiiii i r r r r r 1 1 1 1 1 1 R R R R R GR[reg3] || GR[reg2] GR[reg2] x GR[reg1] w w w w w 0 1 0 0 0 1 0 0 0 0 0 reg1 reg2 reg3, reg3 r0 r r r r r 1 1 1 1 1 1 i i i i i GR[reg3] || GR[reg2] GR[reg2] x sign-extend w w w w w 0 1 0 0 1 I I I I 0 0 (imm9) Note 13 r r r r r 0 0 0 1 1 1 R R R R R GR[reg2] GR[reg2] Note 6 x GR[reg1] Note 6 r r r r r 0 1 0 1 1 1 i i i i i GR[reg2] GR[reg2] Note 6 x sign-extend (imm5) r r r r r 1 1 0 1 1 1 R R R R R GR[reg2] GR[reg1] Note 6 x imm16 iiiiiiiiiiiiiii i r r r r r 1 1 1 1 1 1 R R R R R GR[reg3] || GR[reg2] GR[reg2] x GR [reg1] w w w w w 0 1 0 0 0 1 0 0 0 1 0 reg1 reg2 reg3, reg3 r0 r r r r r 1 1 1 1 1 1 i i i i i GR[reg3]||GR[reg2] GR[reg2] x zero-extend w w w w w 0 1 0 0 1 I I I I 1 0 (imm9) Note 13 1 2
Note 14
MUL
1
2
Note 14
2
1
2
Note 14
2
MULH
reg1, reg2 imm5, reg2
1 1 1
1 1 1
2 2 2
MULHI
imm16, reg1, reg2 reg1, reg2, reg3 imm9, reg2, reg3
MULU
2
1
2
Note 14
2
NOP NOT NOT1 reg1, reg2 bit#3, disp16[reg1]
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Passes at least 1 cycle doing nothing. r r r r r 0 0 0 0 0 1 R R R R R GR[reg2] NOT (GR[reg1]) 0 1 b b b 1 1 1 1 1 0 R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d d Z flag Not (Load-memory-bit (adr, bit#3)) Store-memory-bit (adr, bit#3, Z flag) r r r r r 1 1 1 1 1 1 R R R R R adr GR[reg1] 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 Z flag Not (Load-memory-bit (adr, reg2)) Store-memory-bit (adr, reg2, Z flag) r r r r r 0 0 1 0 0 0 R R R R R GR[reg2] GR[reg2] OR GR[reg1] r r r r r 1 1 0 1 0 0 R R R R R GR[reg2] GR[reg1] OR zero-extend (imm16) iiiiiiiiiiiiiii i 0 0 0 0 0 1 1 1 1 0 i i i i i L Store-memory (sp-4, GR[reg in list12], Word) L L L L L L L L L L L 0 0 0 0 1 sp sp-4 repeat 1 steps above until regs in list12 is stored sp sp-zero-extend (imm5) 0 0 0 0 0 1 1 1 1 0 i i i i i L Store-memory (sp-4, GR[reg in list12], Word) L L L L L L L L L L L f f 0 1 1 GR[reg in list12] Load-memory (sp, Word) sp sp + 4 imm16/imm32 Note 16 repeat 2 steps above until regs in list12 is loaded PC GR[reg1]
1 1 3
1 1 3
1 1 3 0
x
x x
Note 3 Note 3 Note 3
reg2, [reg1]
3
3
3
x
Note 3 Note 3 Note 3
OR ORI
reg1, reg2 imm16, reg1, reg2 list12, imm5
1 1
1 1
1 1
0 0
x x
x x
PREPARE
n+1
n+1
n+1
Note 4 Note 4 Note 4
list12, imm5, sp/immNote15
n+2
n+2
n+2
Note 4 Note 4 Note 4 Note 17 Note 17 Note 17
User's Manual U15195EJ3V0UD
639
APPENDIX C INSTRUCTION SET LIST
(4/5)
Mnemonic Operands Opcode Operation Execution Clock i RETI 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 if PSW.EP = 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 then PC EIPC PSW EIPSW else if PSW.NP = 1 then PC FEPC PSW FEPSW else PC EIPC PSW EIPSW reg1, reg2 r r r r r 1 1 1 1 1 1 R R R R R GR[reg2] GR[reg2] arithmetically shift right by 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 GR[reg1] r r r r r 0 1 0 1 0 1 i i i i i GR[reg2] GR[reg2] arithmetically shift right by zeroextend (imm5) r r r r r 1 1 1 1 1 1 0 c c c c if conditions are satisfied 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 then GR[reg2] (GR[reg2] Logically shift left by 1) OR 00000001H else GR[reg2] (GR[reg2] Logically shift left by 1) OR 00000000H r r r r r 0 0 0 1 1 0 R R R R R GR[reg2] saturated (GR[reg2] + GR[reg1]) r r r r r 0 1 0 0 0 1 i i i i i GR[reg2] saturated (GR[reg2] sign-extend (imm5)) r r r r r 0 0 0 1 0 1 R R R R R GR[reg2] saturated (GR[reg2] - GR[reg1]) r r r r r 1 1 0 0 1 1 R R R R R GR[reg2] saturated (GR[reg1] - sign-extend i i i i i i i i i i i i i i i i (imm16) r r r r r 0 0 0 1 0 0 R R R R R GR[reg2] saturated (GR[reg1] - GR[reg2]) r r r r r 1 1 1 1 1 1 0 c c c c if conditions are satisfied 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 then GR[reg2] 00000001H else GR[reg2] 00000000H 0 0 b b b 1 1 1 1 1 0 R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d d Z flag Not (Load-memory-bit (adr, bit#3)) Store-memory-bit (adr, bit#3, 1) r r r r r 1 1 1 1 1 1 R R R R R adr GR[reg1] 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 Z flag Not (Load-memory-bit (adr, reg2)) Store-memory-bit (adr, reg2, 1) r r r r r 1 1 1 1 1 1 R R R R R GR[reg2] GR[reg2] logically shift left by GR[reg1] 000000001100000 0 imm5, reg2 r r r r r 0 1 0 1 1 0 i i i i i GR[reg2] GR[reg2] logically shift left by zero-extend (imm5) r r r r r 1 1 1 1 1 1 R R R R R GR[reg2] GR[reg2] logically shift right by GR[reg1] 000000001000000 0 imm5, reg2 r r r r r 0 1 0 1 0 0 i i i i i GR[reg2] GR[reg2] logically shift right by zero-extend (imm5) r r r r r 0 1 1 0 d d d d d d d adr ep + zero-extend (disp7) GR[reg2] sign-extend (Load-memory (adr, Byte)) r r r r r 0 0 0 0 1 1 0 d d d d adr ep + zero-extend (disp4) Note 18 GR[reg2] zero-extend (Load-memory (adr, Byte)) r r r r r 1 0 0 0 d d d d d d d adr ep + zero-extend (disp8) Note 19 GR[reg2] sign-extend (Load-memory (adr, Halfword)) 1 1 1 1 1 1 4 r 4 I 4 CY R OV R Flags S R Z R SAT R
SAR
1
1
1
x x
0
x x
x x
imm5, reg2
1
1
1
0
SASF
cccc, reg2
1
1
1
SATADD
reg1, reg2 imm5, reg2
1 1 1 1
1 1 1 1
1 1 1 1
x x x x x
x x x x x
x x x x x
x x x x x
x x x x x
SATSUB SATSUBI
reg1, reg2 imm16, reg1, reg2 reg1, reg2 cccc, reg2
SATSUBR SETF
1 1
1 1
1 1
SET1
bit#3, disp16 [reg1]
3
3
3
x
Note 3 Note 3 Note 3
reg2, [reg1]
3
3
3
x
Note 3 Note 3 Note 3
SHL
reg1, reg2
1
1
1
x x x x
0
x x x x
x x x x
0
SHR
reg1, reg2
1
1
1
0
0
SLD.B
disp7[ep], reg2 disp4[ep], reg2 disp8[ep], reg2
1
1
Note 9
SLD.BU
1
1
Note 9
SLD.H
1
1
Note 9
640
User's Manual U15195EJ3V0UD
APPENDIX C INSTRUCTION SET LIST
(5/5)
Mnemonic Operands Opcode Operation Execution Clock i SLD.HU disp5[ep], reg2 r r r r r 0 0 0 0 1 1 1 d d d d adr ep + zero-extend (disp5) Notes 18, 20 GR[reg2] zero-extend (Load-memory (adr, Halfword) r r r r r 1 0 1 0 d d d d d d 0 adr ep + zero-extend (disp8) Note 21 GR[reg2] Load-memory (adr, Word) r r r r r 0 1 1 1 d d d d d d d adr ep + zero-extend (disp7) Store-memory (adr, GR[reg2], Byte) r r r r r 1 0 0 1 d d d d d d d adr ep + zero-extend (disp8) Note 19 Store-memory (adr, GR[reg2], Halfword) r r r r r 1 0 1 0 d d d d d d 1 adr ep + zero-extend (disp8) Note 21 Store-memory (adr, GR[reg2], Word) r r r r r 1 1 1 0 1 0 R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d d Store-memory (adr, GR[reg2], Byte) r r r r r 1 1 1 0 1 1 R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d 0 Store-memory (adr, GR[reg2], Halfword) Note 8 ST.W reg2, disp16 [reg1] r r r r r 1 1 1 0 1 1 R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d 1 Store-memory (adr, GR[reg2], Word) Note 8 STSR regID, reg2 r r r r r 1 1 1 1 1 1 R R R R R GR[reg2] SR[regID] 000000000100000 0 SUB SUBR SWITCH reg1, reg2 reg1, reg2 reg1 r r r r r 0 0 1 1 0 1 R R R R R GR[reg2] GR[reg2] - GR[reg1] r r r r r 0 0 1 1 0 0 R R R R R GR[reg2] GR[reg1] - GR[reg2] 0 0 0 0 0 0 0 0 0 1 0 R R R R R adr (PC + 2) + GR[reg1] logically shift left by 1) PC (PC + 2) + (sign-extend (Load-memory (adr, Halfword)) logically shift left by 1 0 0 0 0 0 0 0 0 1 0 1 R R R R R GR[reg1] sign-extend (GR[reg1] (7:0)) 0 0 0 0 0 0 0 0 1 1 1 R R R R R GR[reg1] sign-extend (GR[reg1] (15:0)) PC + 4 (return PC) 0 0 0 0 0 1 1 1 1 1 1 i i i i i EIPC PSW 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 EIPSW ECR.EICC interrupt code PSW.EP 1 PSW.ID 1 PC 00000040H (when vector is 00H to 0FH) 00000050H (when vector is 10H to 1FH) TST TST1 reg1, reg2 bit#3, disp16 [reg1] reg2, [reg1] r r r r r 0 0 1 0 1 1 R R R R R result GR[reg2] AND GR[reg1] 1 1 b b b 1 1 1 1 1 0 R R R R R adr GR[reg1] + sign-extend (disp16) d d d d d d d d d d d d d d d d Z flag Not(Load-memory-bit(adr,bit#3)) r r r r r 1 1 1 1 1 1 R R R R R adr GR[reg1] 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 0 Z flag Not(Load-memory-bit(adr,reg2)) r r r r r 0 0 1 0 0 1 R R R R R GR[reg2] GR[reg2] XOR GR[reg1] r r r r r 1 1 0 1 0 1 R R R R R GR[reg2] GR[reg1] XOR zero-extend (imm16) iiiiiiiiiiiiiii i 0 0 0 0 0 0 0 0 1 0 0 R R R R R GR[reg1] zero-extend (GR[reg1] (7:0)) 0 0 0 0 0 0 0 0 1 1 0 R R R R R GR[reg1] zero-extend (GR[reg1] (15:0)) 1 1 1 1 1 1 1 3 1 3 1 3 0 1 1 5 1 1 5 1 1 5 1 1 1 1 1 1 1 r 1 I
Note 9
Flags CY OV S Z SAT
SLD.W
disp8[ep], reg2 reg2, disp7[ep] reg2, disp8[ep] reg2, disp8[ep] reg2, disp16 [reg1] reg2, disp16 [reg1]
1
1
Note 9
SST.B
1
1
1
SST.H
1
1
1
SST.W
1
1
1
ST.B
1
1
1
ST.H
1
1
1
x x
x x
x x
x x
SXB SXH TRAP
reg1 reg1 vector
1 1 4
1 1 4
1 1 4
x
x x x
Note 3 Note 3 Note 3
3
3
3
Note 3 Note 3 Note 3
XOR XORI
reg1, reg2 imm16, reg1, reg2 reg1 reg1
1 1
1 1
1 1
0 0
x x
x x
ZXB ZXH
User's Manual U15195EJ3V0UD
641
APPENDIX C INSTRUCTION SET LIST
Notes 1. 2. 3. 4. 5. 6. 7. 8. 9.
dddddddd is the higher 8 bits of disp9. 4 if there is an instruction to overwrite the contents of the PSW immediately before. If there is no wait state (3 + number of read access wait states) n is the total number of load registers in list12 (According to the number of wait states. If there are no wait states, n is the number of registers in list12. When n = 0, the operation is the same as n = 1.) RRRRR: Other than 00000 Only the lower halfword of data is valid. ddddddddddddddddddddd is the higher 21 bits of disp22. ddddddddddddddd is the higher 15 bits of disp16. According to the number of wait states (1 if there are no wait states)
10. b: Bit 0 of disp16 11. According to the number of wait states (2 if there are no wait states) 12. In this instruction, although the source register is regarded as reg2 for convenience of the mnemonic description, the reg1 field is used in the opcode. Therefore, the meanings of register specifications assigned in the mnemonic description and in the opcode differ from those in other instructions. rrrrr = regID specification RRRRR = reg2 specification 13. iiiii: Lower 5 bits of imm9 IIII: Higher 4 bits of imm9 14. Shortened by 1 clock if reg2 = reg3 (lower 32 bits of result are not written to register) or reg3 = r0 (higher 32 bits of result are not written to register). 15. sp/imm: Specify in bits 19 and 20 of sub-opcode. 16. ff = 00: Load sp in ep. 01: Load sign-extended 16-bit immediate data (bits 47 to 32) in ep. 10: Load 16-bit immediate data (bits 47 to 32) logically shifted 16 bits to the right in ep. 11: Load 32-bit immediate data (bits 63 to 32) in ep. 17. n + 3 clocks when imm = imm32 18. rrrrr: Other then 00000 19. ddddddd is the higher 7 bits of disp8. 20. dddd is the higher 4 bits of disp5. 21. dddddd is the higher 6 bits of disp8.
642
User's Manual U15195EJ3V0UD
APPENDIX D INDEX
2-frame continuous reception buffer register 1 ...... 434 2-frame continuous transmission shift register 1 ... 437
asynchronous serial interface mode register 0...... 398 asynchronous serial interface mode register 10.... 429 asynchronous serial interface mode register 11.... 431 asynchronous serial interface status register 0 ..... 401 asynchronous serial interface status register 1 ..... 432 asynchronous serial interface transmission status register 0 ............................................................... 402 AVDD0, AVDD1 .......................................................... 49 AVSS0, AVSS1 ........................................................... 49 AWC........................................................................ 97
[A]
A/D conversion result registers 00 to 05 and 10 to 17 ................................................................. 508 A/D converter operation......................................... 528 A/D converter .................................................. 34, 499 A/D internal trigger selection registers 0, 1............ 509 A/D scan mode registers 00, 00H, 00L, 10, 10H, 10L ................................... 504 A/D scan mode registers 01, 01H, 01L, 11, 11H, 11L ................................... 506 A/D voltage detection mode registers 0, 0H, 0L, 1, 1H, 1L ............................................... 507 A16 to A21............................................................... 47 AD0 to AD15 ........................................................... 47 ADC......................................................................... 34 ADCR00 to ADCR05, ADCR10 to ADCR17 .......... 508 address space ......................................................... 60 address wait control register.................................... 97 ADETM0, ADETM0H, ADETM0L, ADETM1, ADETM1H, ADETM1L........................................... 507 ADIC0, ADIC1 ....................................................... 146 ADSCM00, ADSCM00H, ADSCM00L, ADSCM10, ADSCM10H, ADSCM10L ................... 504 ADSCM01, ADSCM01H, ADSCM01L, ADSCM11, ADSCM11H, ADSCM11L ................... 506 ADTRG0, ADTRG1 ................................................. 41 ANI00 to ANI05, ANI10 to ANI17............................. 47 application example (timer 4) ................................ 390 application examples (timer 3)............................... 375 applications ............................................................. 28 area ......................................................................... 64 ASCK1..................................................................... 44 ASIF0 .................................................................... 402 ASIM0.................................................................... 398 ASIM10.................................................................. 429 ASIM11.................................................................. 431 ASIS0 .................................................................... 401 ASIS1 .................................................................... 432 assembler-reserved register.................................... 55 ASTB ....................................................................... 46 asynchronous serial interface 0 ............................. 395 asynchronous serial interface 1 ............................. 426
[B]
basic configuration (timer 0) .................................. 194 basic configuration (timer 1) .................................. 286 basic configuration (timer 2) .................................. 315 basic configuration (timer 3) .................................. 356 basic configuration (timer 4) .................................. 383 basic configuration of ports ................................... 533 baud rate generator control register 0 ................... 420 BCC......................................................................... 99 BCT0, BCT1............................................................ 87 BCU......................................................................... 33 BFCM00 to BFCM02 ............................................. 198 BFCM03, BFCM13 ................................................ 200 BFCM04, BFCM05 ................................................ 198 BFCM10 to BFCM12 ............................................. 198 BFCM14, BFCM15 ................................................ 198 block transfer mode............................................... 125 boundary operation conditions .............................. 101 BRG0 .................................................................... 418 BRG1 .................................................................... 454 BRG3 .................................................................... 495 BRGC0.................................................................. 420 BSC......................................................................... 89 buffer registers CM00 to CM02 ............................. 198 buffer registers CM03, CM13 ................................ 200 buffer registers CM04, CM05 ................................ 198 buffer registers CM10 to CM12 ............................. 198 buffer registers CM14, CM15 ................................ 198 bus access .............................................................. 88 bus control function ................................................. 82 bus control pins ....................................................... 82 bus control unit........................................................ 33 bus cycle control register......................................... 99 bus cycle type configuration registers 0, 1 .............. 87
User's Manual U15195EJ3V0UD
643
APPENDIX D INDEX
bus cycle type control function.................................87 bus priority order....................................................100 bus size configuration register .................................89 bus sizing function ...................................................89 bus width..................................................................90
clocked serial interface transmission buffer registers 0, 1 ........................................................................ 473 clocked serial interface transmission buffer registers L0, L1 .................................................................... 474 clocked serial interfaces 0, 1 ................................. 461 CM000 to CM002 .................................................. 197 CM003, CM013 ..................................................... 198 CM004, CM005 ..................................................... 198 CM00IC1, CM01IC1, CM02IC1 ............................. 146 CM010 to CM012 .................................................. 197 CM014, CM015 ..................................................... 198 CM03IC0, CM03IC1 .............................................. 146 CM04IC0, CM05IC0, CM04IC1, CM05IC1 ............ 146 CM100................................................................... 289 CM101................................................................... 289 CM10IC0, CM10IC1 .............................................. 146 CM4....................................................................... 385 CM4IC0 ................................................................. 146 CMSE050 .............................................................. 328 CMSE120 .............................................................. 329 CMSE340 .............................................................. 331 command register.................................................. 180 communication mode ............................................ 590 compare register 100............................................. 289 compare register 101............................................. 289 compare register 4................................................. 385 compare registers 000 to 002................................ 197 compare registers 003, 013................................... 198 compare registers 004, 005................................... 198 compare registers 010 to 012................................ 197 compare registers 014, 015................................... 198 continuous transmission operation (UART0) ......... 409 continuous transmission operation (UART1) ......... 443 conversion time ..................................................... 532 CPU address space................................................. 60 CPU register set ...................................................... 54 CPU......................................................................... 33 CSC0, CSC1 ........................................................... 84 CSCE0 .................................................................. 336 CSE0, CSE0H, CSE0L.......................................... 322 CSI0, CSI1 ............................................................ 461 CSIC0, CSIC1 ....................................................... 467 CSIIC0, CSIIC1 ..................................................... 146 CSIM0, CSIM1....................................................... 465 CSL10 ................................................................... 299 CVPEn0 (n = 1 to 4) .............................................. 319 CVSE00................................................................. 319 CVSE50................................................................. 320
[C]
capture/compare control register 0 ........................295 capture/compare register 100 ................................290 capture/compare register 101 ................................291 capture/compare registers 30 and 31 ....................358 cautions (CPU) ........................................................81 CC100....................................................................290 CC101 capture input selection register..................299 CC101....................................................................291 CC10IC0, CC10IC1 ...............................................146 CC2IC0 to CC2IC5 ................................................146 CC30 and CC31 ....................................................358 CC3IC0, CC3IC1 ...................................................146 CCR0 .....................................................................295 CCSTATE0, CCSTATE0H, CCSTATE0L ..............334 CG ...........................................................................33 chip area selection control registers 0, 1 .................84 chip select control function.......................................84 CKC .......................................................................173 CKSEL .....................................................................47 CKSR0...................................................................419 CLKOUT ..................................................................45 clock control register..............................................173 clock generation function .......................................170 clock generator ........................................................33 clock selection register 0........................................419 clocked serial interface clock selection registers 0, 1.........................................................................467 clocked serial interface initial transmission buffer registers 0, 1 ..........................................................475 clocked serial interface initial transmission buffer registers L0, L1 ......................................................476 clocked serial interface mode registers 0, 1...........465 clocked serial interface read-only reception buffer registers 0, 1 ..........................................................471 clocked serial interface read-only reception buffer registers L0, L1 ......................................................472 clocked serial interface reception buffer registers 0, 1.........................................................................469 clocked serial interface reception buffer registers L0, L1.....................................................................470
644
User's Manual U15195EJ3V0UD
APPENDIX D INDEX
CVSEn0 (n = 1 to 4) .............................................. 319 CVSS ........................................................................ 48
DWC0, DWC1 ......................................................... 96
[E] [D]
DADC0 to DADC3 ................................................. 114 data space................................................. 62, 69, 101 data wait control registers 0, 1................................. 96 DBC0 to DBC3 ...................................................... 113 DCHC0 to DCHC3................................................. 116 DDA0H to DDA3H ................................................. 111 DDA0L to DDA3L .................................................. 112 DDIS...................................................................... 117 dead-time timer reload registers 0, 1 ..................... 197 dead-time timers 00 to 02, 10 to 12 ....................... 197 debug trap ............................................................. 164 dedicated baud rate generator 0............................ 418 dedicated baud rate generator 1............................ 454 dedicated baud rate generator 3............................ 495 description of pin functions ...................................... 41 DETIC0, DETIC1 ................................................... 146 differential linearity error ........................................ 531 direct mode.................................................... 171, 177 DMA addressing control registers 0 to 3................ 114 DMA bus states ..................................................... 121 DMA channel control registers 0 to 3..................... 116 DMA channel priorities .......................................... 128 DMA controller................................................. 33, 107 DMA destination address registers 0H to 3H......... 111 DMA destination address registers 0L to 3L.......... 112 DMA disable status register................................... 117 DMA functions ....................................................... 107 DMA restart register .............................................. 117 DMA source address registers 0H to 3H ............... 109 DMA source address registers 0L to 3L ................ 110 DMA transfer count registers 0 to 3 ....................... 113 DMA transfer end .................................................. 130 DMA transfer start factors...................................... 129 DMA trigger factor registers 0 to 3......................... 118 DMAC bus cycle state transition............................ 122 DMAC ...................................................................... 33 DMAIC0 to DMAIC3 .............................................. 146 DRST..................................................................... 117 DSA0H to DSA3H.................................................. 109 DSA0L to DSA3L................................................... 110 DTFR0 to DTFR3 .................................................. 118 DTM00 to DTM02 .................................................. 197 DTM10 to DTM12 .................................................. 197 DTRR0, DTRR1..................................................... 197 ECR......................................................................... 56 edge detection function ......................................... 138 element pointer ....................................................... 55 EP ......................................................................... 161 ESO0, ESO1 ........................................................... 41 exception status flag.............................................. 161 exception trap........................................................ 162 external bus cycles during DMA transfer............... 127 external interrupt mode register 0 ......................... 138 external interrupt mode registers 1, 2.................... 152 external memory area ............................................. 67 external memory expansion .................................... 68 external wait function............................................... 98
[F]
FEM0 to FEM5 .............................................. 156, 571 flash memory......................................................... 587 forcible interruption................................................ 129 forcible termination ................................................ 130 full-scale error ....................................................... 531 function overview (timer 0) .................................... 191 function overview (timer 1) .................................... 284 function overview (timer 2) .................................... 313 function overview (timer 3) .................................... 355 function overview (timer 4) .................................... 382
[G]
general-purpose registers ....................................... 55 general-purpose timer mode ................................. 287 global pointer........................................................... 55
[H]
HALT mode ................................................... 177, 183 how to read A/D converter characteristics table .... 529
[I]
ID........................................................................... 151 IDLE mode .................................................... 177, 185 idle state insertion function...................................... 99 illegal opcode definition ......................................... 162 image ...................................................................... 61 IMR0 to IMR3 ........................................................ 143 initialization............................................................ 578 input clock selection .............................................. 171 in-service priority register ...................................... 150
User's Manual U15195EJ3V0UD
645
APPENDIX D INDEX
INTC ........................................................................33 integral linearity error .............................................532 internal block diagram..............................................32 internal flash memory area ......................................64 internal RAM area....................................................66 internal ROM area ...................................................64 internal units ............................................................33 interrupt control register .........................................146 interrupt controller....................................................33 interrupt mask registers 0 to 3 ...............................149 interrupt response time ..........................................168 interrupt source register ...........................................56 interrupt trigger mode selection .............................151 interrupt/exception processing function .................131 interrupt/exception source list ................................132 interrupt/exception table...........................................65 INTM0 ....................................................................138 INTM1, INTM2 .......................................................152 INTP0 to INTP4 .......................................................41 INTP100, INTP101 ..................................................42 INTP20 to INTP25 ...................................................43 INTP30, INTP31 ......................................................43 introduction ..............................................................25 ISPR ......................................................................150 ITRG0, ITRG1........................................................509
non-maskable interrupt status flag......................... 138 non-maskable interrupt.......................................... 134 NP ......................................................................... 138 NRC10................................................................... 568 NRC3..................................................................... 569 number of access clocks ......................................... 88
[O]
OCTLE0, OCTLE0H, OCTLE0L ............................ 327 ODELE0, ODELE0H, ODELE0L............................ 335 on-chip peripheral I/O area...................................... 67 on-chip peripheral I/O register ................................. 71 operation in A/D trigger mode................................ 519 operation in A/D trigger polling mode .................... 521 operation in external trigger mode ......................... 525 operation in timer trigger mode.............................. 523 operation mode specification................................... 59 operation modes and trigger modes ...................... 516 operation modes...................................................... 58 ordering information................................................. 28 overall error ........................................................... 529
[P]
P0 .......................................................................... 549 P00 to P05............................................................... 41 P0IC0 to P0IC4...................................................... 146 P1 .......................................................................... 550 P10 to P12............................................................... 42 P2 .......................................................................... 552 P20 to P27............................................................... 43 P3 .......................................................................... 554 P30 to P34............................................................... 44 P4 .......................................................................... 556 P40 to P42............................................................... 45 PC ........................................................................... 55 PCM ...................................................................... 564 PCM0, PCM1........................................................... 45 PCT ....................................................................... 562 PCT0, PCT1, PCT4, PCT6...................................... 46 PDH....................................................................... 558 PDH0 to PDH5 ........................................................ 47 PDL ....................................................................... 560 PDL0 to PDL15........................................................ 47 periods in which interrupts are not acknowledged . 169 peripheral command register ................................. 172 peripheral status register ....................................... 175 PFC1 ..................................................................... 551 PFC2 ..................................................................... 553
[L]
link pointer ...............................................................55 list of pin functions ...................................................35 lock register ...........................................................176 LOCKR ..................................................................176 LWR.........................................................................46
[M]
maskable interrupt status flag ................................151 maskable interrupts ...............................................139 MEMC......................................................................33 memory access control function ............................102 memory block function .............................................83 memory controller ....................................................33 memory map............................................................63 MODE0, MODE1 .....................................................48 multiple interrupt servicing control .........................166
[N]
next address setting function .................................128 NMI ..........................................................................41 noise eliminator......................................................566
646
User's Manual U15195EJ3V0UD
APPENDIX D INDEX
PFC3 ..................................................................... 555 PHCMD ................................................................. 172 PHS ....................................................................... 175 pin configuration ...................................................... 29 pin I/O circuits.......................................................... 52 pin status ................................................................. 40 PLL lockup............................................................. 176 PLL mode ...................................................... 171, 177 PM1 ....................................................................... 550 PM2 ....................................................................... 552 PM3 ....................................................................... 554 PM4 ....................................................................... 557 PMC1 .................................................................... 551 PMC2 .................................................................... 553 PMC3 .................................................................... 555 PMC4 .................................................................... 557 PMCCM ................................................................. 565 PMCCT.................................................................. 563 PMCDH ................................................................. 559 PMCDL .................................................................. 561 PMCM.................................................................... 565 PMCT .................................................................... 563 PMDH .................................................................... 559 PMDL .................................................................... 561 POER0, POER1 .................................................... 214 port 0 ..................................................................... 549 port 1 function control register ............................... 551 port 1 mode control register................................... 551 port 1 mode register .............................................. 550 port 1 ..................................................................... 550 port 2 function control register ............................... 553 port 2 mode control register................................... 553 port 2 mode register .............................................. 552 port 2 ..................................................................... 552 port 3 function control register ............................... 555 port 3 mode control register................................... 555 port 3 mode register .............................................. 554 port 3 ..................................................................... 554 port 4 mode control register................................... 557 port 4 mode register .............................................. 557 port 4 ..................................................................... 556 port CM mode control register ............................... 565 port CM mode register........................................... 565 port CM.................................................................. 564 port CT mode control register ................................ 563 port CT mode register............................................ 563 port CT .................................................................. 562 port DH mode control register ............................... 558
port DH mode register ........................................... 558 port DH.................................................................. 558 port DL mode control register................................ 561 port DL mode register............................................ 561 port DL .................................................................. 560 port functions......................................................... 549 ports ........................................................................ 34 power save control register ................................... 181 power save control ................................................ 177 power save mode register ..................................... 180 PRCMD ................................................................. 180 precautions (DMA) ................................................ 130 precautions (timer 3) ............................................. 381 precautions (timer 4) ............................................. 390 precautions (UART0)............................................. 425 precautions on operation (A/D converter).............. 527 prescaler compare register 1................................. 456 prescaler compare register 3................................. 497 prescaler mode register 1...................................... 455 prescaler mode register 10.................................... 298 prescaler mode register 3...................................... 496 priorities of maskable interrupts ............................ 142 PRM01 .................................................................. 201 PRM02 .......................................................... 292, 301 PRM03 .................................................................. 360 PRM10 .................................................................. 298 program counter ...................................................... 55 program register set .......................................... 55, 56 program registers .................................................... 55 program space .......................................... 62, 69, 101 program status word................................................ 57 programmable wait function .................................... 96 programming environment .................................... 590 PRSCM1 ............................................................... 456 PRSCM3 ............................................................... 497 PRSM1.................................................................. 455 PRSM3.................................................................. 496 PSC....................................................................... 181 PSMR.................................................................... 180 PSTO0, PSTO1..................................................... 215 PSW ........................................................................ 57 PWM mode 0 ........................................................ 227 PWM mode 1 ........................................................ 239 PWM mode 2 ........................................................ 261 PWM output enable registers 0, 1 ......................... 214 PWM software timing output registers 0, 1............ 215
[Q] 647
User's Manual U15195EJ3V0UD
APPENDIX D INDEX
quantization error...................................................530
SI1 ........................................................................... 44 signal edge selection register 10 ................... 153, 296 single transfer mode ...................................... 123, 479 single-chip mode ..................................................... 58 single-step transfer mode ...................................... 125 SIO .......................................................................... 34 SIO0, SIO1 ............................................................ 477 SIOL0, SIOL1 ........................................................ 478 SIRB0, SIRB1........................................................ 469 SIRBE0, SIRBE1 ................................................... 471 SIRBEL0, SIRBEL1 ............................................... 472 SIRBL0, SIRBL1.................................................... 470 SO0 ......................................................................... 45 SO1 ......................................................................... 44 software exception................................................. 159 software STOP mode .................................... 177, 187 SOTB0, SOTB1 ..................................................... 473 SOTBF0, SOTBF1................................................. 475 SOTBFL0, SOTBFL1............................................. 476 SOTBL0, SOTBL1 ................................................. 474 SPEC0, SPEC1 ..................................................... 224 specific registers...................................................... 81 SRAM, external ROM, external I/O access ........... 103 SRAM, external ROM, external I/O interface......... 102 SRIC0, SRIC1 ....................................................... 146 stack pointer ............................................................ 55 status register 0 ..................................................... 299 STATUS0 .............................................................. 299 STIC0, STIC1 ........................................................ 146 STOPTE0, STOPTE0H, STOPTE0L ..................... 321 supplementary description of internal operation (timer 1) ................................................................. 310 synchronous mode ................................................ 449 system register set ............................................ 56, 58 system wait control register ..................................... 81
[R]
r0 to r31 ...................................................................55 RAM.........................................................................33 RD............................................................................46 real-time pulse unit .......................................... 34, 191 reception buffer register 0 ......................................396 reception buffer register L1 ....................................434 reception error (UART0) ........................................414 reception error (UART1) ........................................447 reception operation (UART0) .................................413 reception operation (UART1) .................................444 recommended use of address space.......................69 REGC ....................................................................586 REGIN .....................................................................49 REGOUT .................................................................49 regulator.................................................................583 regulator control register ........................................586 repeat transfer mode .............................................486 reset function .........................................................573 RESET.....................................................................48 resolution ...............................................................529 right-left asymmetric waveform control ..................239 right-left symmetric waveform control ....................227 ROM ........................................................................33 ROMless mode ........................................................58 RPU .........................................................................34 RVDD .......................................................................49 RXB0 .....................................................................403 RXB1 .....................................................................434 RXBL1 ...................................................................434 RXD0, RXD1............................................................44
[S]
sampling time.........................................................532 sawtooth wave modulation.....................................261 SCK0 .......................................................................45 SCK1 .......................................................................44 securing oscillation stabilization time .....................189 SEIC0 ....................................................................146 serial I/O shift registers 0, 1 ...................................477 serial I/O shift registers L0, L1 ...............................478 serial interface ................................................. 34, 393 SESA10 ......................................................... 153, 296 SESC ............................................................. 155, 365 SESE0, SESE0H, SESE0L....................................323 SI0 ...........................................................................45
[T]
TBC ....................................................................... 190 TBSTATE0, TBSTATE0H, TBSTATE0L................ 333 TCLR10 ................................................................... 42 TCLR2, TCLR3........................................................ 43 TCRE0, TCRE0H, TCRE0L .................................. 324 TCUD10 .................................................................. 42 text pointer............................................................... 55 TI2, TI3 .................................................................... 43 time base counter .................................................. 190 timer 0 clock selection register .............................. 201 timer 0 ................................................................... 191
648
User's Manual U15195EJ3V0UD
APPENDIX D INDEX
timer 1 ................................................................... 284 timer 1/timer 2 clock selection register .......... 292, 321 timer 10 noise elimination time selection register .. 568 timer 10 ................................................................. 287 timer 2 capture/compare 1 to 4 status registers 0, 0H, 0L ................................................. 334 timer 2 clock stop registers 0, 0H, 0L .................... 321 timer 2 count clock/control edge selection registers 0, 0H, 0L ................................................. 322 timer 2 input filter mode registers 0 to 5 ........ 156, 157 timer 2 output control registers 0, 0H, 0L............... 327 timer 2 output delay registers 0, 0H, 0L................. 335 timer 2 software event capture register ................. 336 timer 2 sub-channel 0 capture/compare register ... 319 timer 2 sub-channel 0, 5 capture/compare control register .................................................................. 328 timer 2 sub-channel 1, 2 capture/compare control register .................................................................. 329 timer 2 sub-channel 3, 4 capture/compare control register .................................................................. 331 timer 2 sub-channel 5 capture/compare register ... 320 timer 2 sub-channel input event edge selection registers 0, 0H, 0L ................................................. 323 timer 2 sub-channel n main capture/compare register (n = 1 to 4) ................................................ 319 timer 2 sub-channel n sub capture/compare register (n = 1 to 4) ................................................ 320 timer 2 time base control registers 0, 0H, 0L ......... 324 timer 2 time base status registers 0, 0H, 0L .......... 333 timer 2 ................................................................... 313 timer 3 clock selection register .............................. 360 timer 3 noise elimination time selection register .... 569 timer 3 output control register ................................ 366 timer 3 ........................................................... 355, 357 timer 4 ........................................................... 382, 384 timer connection function....................................... 391 timer connection selection register 0 ..................... 392 timer control register 10......................................... 294 timer control register 30......................................... 361 timer control register 31......................................... 363 timer control register 4........................................... 387 timer control registers 00, 01 ................................. 202 timer output mode registers 0, 1 ............................ 209 timer unit control registers 00, 01 .......................... 208 timer unit mode register 0...................................... 293 timer/counter function ............................................ 191 timers 00, 01.......................................................... 196 timers 20, 21.......................................................... 319
TIUD10.................................................................... 42 TM00, TM01.......................................................... 196 TM0IC0, TM0IC1................................................... 146 TM10 ..................................................................... 287 TM20, TM21.......................................................... 319 TM2IC0, TM2IC1................................................... 146 TM3 ....................................................................... 357 TM3IC0 ................................................................. 146 TM4 ....................................................................... 384 TMC00, TMC01..................................................... 202 TMC10 .................................................................. 294 TMC30 .................................................................. 361 TMC31 .................................................................. 363 TMC4 .................................................................... 387 TMIC0 ................................................................... 392 TO000 to TO005 ..................................................... 47 TO010 to TO015 ..................................................... 47 TO10 ....................................................................... 42 TO21 to TO24 ......................................................... 43 TO3 ......................................................................... 43 TO3OFF .................................................................. 41 TO3C..................................................................... 366 TOMR write enable registers 0, 1.......................... 224 TOMR0, TOMR1 ................................................... 209 transfer mode ........................................................ 123 transfer object ....................................................... 127 transfer type and transfer object............................ 127 transfer types ........................................................ 126 transmission buffer register 0 ................................ 397 transmission operation (UART0) ........................... 407 transmission operation (UART1) ........................... 441 transmission shift register L1................................. 437 triangular wave modulation ........................... 239, 227 TUC00, TUC01 ..................................................... 208 TUM0 .................................................................... 293 two-cycle transfer .................................................. 126 TXB0 ..................................................................... 404 TXD0, TXD1............................................................ 44 TXS1 ..................................................................... 437 TXSL1 ................................................................... 437 types of pin I/O circuit and connection of unused pins.......................................................................... 50
[U]
UART0 .................................................................. 395 UART1 .................................................................. 426 UDC mode A ......................................................... 300 UDC mode B ......................................................... 300
User's Manual U15195EJ3V0UD
649
APPENDIX D INDEX
UDC mode .............................................................287 up/down counter mode ..........................................287 UWR ........................................................................46
[V]
valid edge selection register .......................... 155, 365 VDD...........................................................................48 VSS ...........................................................................48 VSS3..........................................................................49 VSWC ......................................................................81
[W]
wait function.............................................................96 WAIT........................................................................45 wrap-around of CPU address space........................62 writing by flash programmer...................................587
[X]
X1, X2 ......................................................................48
[Z]
zero register.............................................................55 zero-scale error......................................................530
650
User's Manual U15195EJ3V0UD
APPENDIX E REVISION HISTORY
The following table shows the revision history up to this edition. The "Applied to:" column indicates the chapters of each edition in which the revision was applied. (1/5)
Edition 2nd Major Revision from Previous Edition Change of description on memory space in 1.2 Features Change of description on regulator in 1.2 Features Deletion of Note in 1.4 Ordering Information Change of ASTB (PCT6) pin status in 2.2 Pin Status Change of I/O circuit type from 5-K to 5-AC in 2.4 Types of Pin I/O Circuits and Connection of Unused Pins Change of I/O circuit type from 5-K to 5-AC in 2.5 Pin I/O Circuits Modification of Figure 3-3 Memory Map Addition and deletion of description in 3.4.5 (2) Internal RAM area Modification of description in 3.4.5 (4) External memory area Deletion of description in 3.4.7 (1) Program space Deletion of part of description in example of wrap-around application in 3.4.7 (2) Data space Modification of Figure 3-5 Recommended Memory Map Addition and modification of description in 3.4.8 Peripheral I/O registers Addition and modification of description in 3.4.10 System wait control register (VSWC) Addition and modification of description in 4.2.1 Pin status during internal ROM, internal RAM, and peripheral I/O access Addition and modification of description in 4.3 Memory Block Function Addition of 4.3.1 Chip select control function Addition of description in 4.4.1 (1) Bus cycle type configuration registers 0, 1 (BCT0, BCT1) Addition of indication of Note in 4.5.1 Number of access clocks Addition of 4.5.2 Bus sizing function Addition of description in 4.6.1 (1) Data wait control registers 0, 1 (DWC0, DWC1) Addition of description in 4.6.1 (2) Address wait control register (AWC) Change of timing in Figure 4-2 Example of Wait Insertion Addition of description in 4.7 (1) Bus cycle control register (BCC) Addition of description in 6.3.3 DMA byte count registers 0 to 3 (DBC0 to DBC3) Change of description when DS1, DS0 bits = 1, 0 in 6.3.4 DMA addressing control registers 0 to 3 (DADC0 to DADC3) Addition of Cautions in 6.3.5 DMA channel control registers 0 to 3 (DCHC0 to DCHC3) Change of description on bit that can be manipulated in 6.3.6 DMA disable status register (DDIS) Change of description on bit that can be manipulated in 6.3.7 DMA restart register (DRST) Addition of description in 6.5.1 Single transfer mode Addition of description in 6.5.2 Single-step transfer mode Change of transfer status when transfer object is in internal RAM in Table 6-1 Relationship Between Transfer Type and Transfer Object Addition of Caution in 6.8 DMA Channel Priorities Addition of 6.14 (5) DMA start factors CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER) CHAPTER 4 BUS CONTROL FUNCTION CHAPTER 3 CPU FUNCTION CHAPTER 2 PIN FUNCTIONS Applied to: CHAPTER 1 INTRODUCTION
User's Manual U15195EJ3V0UD
651
APPENDIX E REVISION HISTORY
(2/5)
Edition 2nd Major Revision from Previous Edition Addition of generating source of CC10IC1 register in Table 7-1 Interrupt/Exception Source List Change of description in Figure 7-2 Acknowledging Non-Maskable Interrupt Request Addition of Caution and change of description in 7.3.8 (2) Signal edge selection register 10 (SESA10) Addition of Caution in 7.3.8 (3) Valid edge selection register (SESC) Addition and change of description in 7.3.8 (4) Timer 2 input filter mode registers 0 to 5 (FEM0 to FEM5) Modification of description in 7.8 Periods in Which Interrupts Are Not Acknowledged Change of description on bits that can be manipulated and data setting sequences to CKC in 8.3.4 Clock control register (CKC) Modification of Note in Figure 8-1 Power Save Mode State Transition Diagram Modification of operation status of ASTB in Table 8-4 Operation Status in IDLE Mode Addition and modification of description in 8.5.4 (2) Release of IDLE mode Change of operation status of ASTB in Table 8-6 Operation Status in Software STOP Mode Addition and modification of description in 8.5.5 (2) Release of software STOP mode Addition and modification of description and change of timing chart in 8.6.1 (1) Securing the time using an on-chip time base counter Modification of timing chart in 8.6.1 (2) Securing the time according to the signal level width (RESET pin input) Addition of a table in 9.1.2 Function overview (timer 0) Addition of Caution in Table 9-2 Operation Modes of Timer 0 Addition and modification of description in 9.1.5 (3) Timer unit control registers 00, 01 (TUC00, TUC01) Modification of description in 9.1.5 (4) Timer output mode registers 0, 1 (TOMR0, TOMR1) Addition and modification of description in 9.1.5 (6) PWM software timing output registers 0, 1 (PSTO0, PSTO1) and addition of Figures 9-9 to 9-14 Addition of Remark in 9.1.6 Operation Addition of Remark in 9.1.6 (2) PWM mode 0: Triangular wave modulation (right-left symmetric waveform control) [Output waveform width in respect to set value] Addition of Remark in 9.1.6 (3) PWM mode 1: Triangular wave modulation (right-left asymmetric waveform control) [Output waveform width in respect to set value] Addition of Remark in 9.1.6 (4) PWM mode 2: Sawtooth wave modulation [Output waveform width in respect to set value] Addition of Remark in Figure 9-30 TM0CEn Bit Write and TM0n Timer Operation Timing Change of description in 9.2.2 Function overview (timer 1) Change of description in Table 9-5 Timer 1 Configuration List Modification of Figure 9-45 Block Diagram of Timer 1 Modification of description in 9.2.4 (1) Timer 1/timer 2 clock selection register (PRM02) Addition of description in 9.2.4 (3) Timer control register 10 (TMC10) Modification of description in 9.2.4 (5) Signal edge selection register 10 (SESA10) Change of description in Figure 9-46 TM10 Block Diagram (During PWM Output Operation) Change of description in 9.3.2 Function overview (timer 2) Change of description in Table 9-9 Timer 2 Configuration List Addition of Table 9-10 Capture/Compare Operation Sources Addition of Table 9-11 Output Level Sources During Timer Output Change of description in Figure 9-62 Block Diagram of Timer 2 CHAPTER 9 TIMER/COUNTER FUNCTION (REALTIME PULSE UNIT) CHAPTER 8 CLOCK GENERATION FUNCTION Applied to: CHAPTER 7 INTERRUPT/EXCEP TION PROCESSING FUNCTION
652
User's Manual U15195EJ3V0UD
APPENDIX E REVISION HISTORY
(3/5)
Edition 2nd Major Revision from Previous Edition Modification of description in 9.3.4 (1) Timer 1/timer 2 clock selection register (PRM02) Modification of description in 9.3.4 (2) Timer 2 clock stop register 0 (STOPTE0) Addition of Caution and modification in 9.3.4 (5) Timer 2 time base control register 0 (TCRE0) Addition of Note and deletion of Caution in Figure 9-95 Cycle Measurement Operation Timing Example Modification of description in Figure 9-97 Example of Timing During TM4 Operation Modification of Caution in 10.2.3 (1) Asynchronous serial interface mode register 0 (ASIM0) CHAPTER 10 SERIAL Change of description on bits that can be manipulated in 10.2.3 (2) Asynchronous serial INTERFACE interface status register 0 (ASIS0) FUNCTION Addition of Caution and modification of description in 10.2.3 (3) Asynchronous serial interface transmission status register 0 (ASIF0) Change of description on bits that can be manipulated in 10.2.3 (4) Reception buffer register (RXB0) Change of description on bits that can be manipulated in 10.2.3 (5) Transmission buffer register 0 (TXB0) Addition and modification of description in 10.2.5 (3) Continuous transmission operation Addition of Figure 10-5 Continuous Transmission Processing Flow Addition of Note and change of description in table in Figure 10-6 Continuous Transmission Starting Procedure Change of description of table in Figure 10-7 Continuous Transmission End Procedure Addition of Cautions in Figure 10-8 Asynchronous Serial Interface Reception Completion Interrupt Timing Change of description on bits that can be manipulated and addition of Caution in 10.2.6 (2) (a) Clock select register 0 (CKSR0) Change of description on bits that can be manipulated in 10.2.6 (2) (b) Baud rate generator control register 0 (BRGC0) Addition of (2) in 10.2.7 Cautions Change of description on bits that can be manipulated in 10.3.3 (4) 2-frame continuous reception buffer register 1 (RXB1)/reception buffer register L1 (RXBL1) Addition of Caution in 10.3.4 (1) Reception completion interrupt (INTSR1) Addition of 10.3.5 (3) Continuous transmission of 3 or more frames Change of description on bits that can be manipulated in 10.3.7 (2) (c) Prescaler compare register 1 (PRSCM1) Addition of 10.3.7 (3) Allowable baud rate range during reception Addition of 10.3.7 (4) Transfer rate in 2-frame continuous reception Change of description on bits that can be manipulated in 10.4.3 (4) Clocked serial interface reception buffer registers L0, L1 (SIRBL0, SIRBL1) Change of description on bits that can be manipulated in 10.4.3 (6) Clocked serial interface read-only reception buffer registers L0, L1 (SIRBEL0, SIRBEL1) Change of description on bits that can be manipulated in 10.4.3 (8) Clocked serial interface transmission buffer registers L0, L1 (SOTBL0, SOTBL1) Change of description on bits that can be manipulated in 10.4.3 (10) Clocked serial interface initial transmission buffer registers L0, L1 (SOTBFL0, SOTBFL1) Change of description on bits that can be manipulated in 10.4.3 (12) Serial I/O shift registers L0, L1 (SIOL0, SIOL1) Modification of caution description in 10.4.6 (2) (b) Prescaler mode register 3 (PRSM3) Change of description on bits that can be manipulated and Caution in 10.4.6 (2) (c) Prescaler compare register 3 (PRSCM3) Applied to: CHAPTER 9 TIMER/COUNTER FUNCTION (REALTIME PULSE UNIT)
User's Manual U15195EJ3V0UD
653
APPENDIX E REVISION HISTORY
(4/5)
Edition 2nd Major Revision from Previous Edition Addition of Caution in 11.4 (1) A/D scan mode registers 00 and 10 (ADSCM00, ASDSCM10) Change of description on bits that can be manipulated and change of explanation of FR2 to FR0 bits in 11.4 (2) A/D scan mode registers 01 and 11 (ADSCM01, ADSCM11) Addition of 11.11.6 Timing that makes the A/D conversion result undefined Addition of 11.12 How to Read A/D Converter Characteristics Table Modification of description in 12.2 (1) Functions of each port Modification of Figure 12-4 Type D Block Diagram Modification of Figure 12-7 Type G Block Diagram Modification of Figure 12-8 Type H Block Diagram Modification of Figure 12-13 Type M Block Diagram Addition of Figure 12-14 Type N Block Diagram Change of description in 12.3.6 (1) Operation in control mode Modification of Figure 12-15 Example of Noise Elimination Timing Addition of Caution and change of description in 12.4.3 (1) Timer 2 input filter mode registers 0 to 5 (FEM0 to FEM5) Addition of 13.2 (2) <1> Reset circuit and <2> Reset timing Addition of item and change of description in Table 13-2 Initial Values of CPU, Internal RAM, and On-Chip Peripheral I/O After Reset Modification of description in 14.1 Features Addition and modification of description in 14.2 Functional Outline Modification of Figure 14-1 Example of Connection When Using N-ch Transistor Addition of Figure 14-2 Mount Pad Dimensions When Mounted on 2SD1950 (VL Standard Product) (Glass Epoxy Board) (Unit: mm) Addition of Figure 14-3 Connection When Using External Regulator Addition and modification of description in Caution in 14.4 (1) Regulator control register (REGC) Addition of Caution in 15.2 Writing Using Flash Programmer Addition of description in 15.2 (2) Off-board programming Modification of description in 15.3 Programming Environment Change of description in 15.4 (1) UART0 Change of description in 15.4 (2) CSI0 Change of description in 15.4 (3) Handshake-supported CSI communication Modification of description in 15.5.8 Power supply Change of description in B.2 Instruction Set (Alphabetical Order) APPENDIX B INSTRUCTION SET LIST Throughout CHAPTER 1 INTRODUCTION CHAPTER 4 BUS CONTROL FUNCTION CHAPTER 15 FLASH MEMORY (PD70F3114) CHAPTER 13 RESET FUNCTION CHAPTER 12 PORT FUNCTIONS Applied to: CHAPTER 11 A/D CONVERTER
CHAPTER 14 REGULATOR
3rd
Addition of 100-pin plastic QFP (14 x 20) package Addition of Table 1-2 Differences Between V850E/IA1 and V850E/IA2 Register Setting Values Modification of description in 4.2.1 Pin status during internal ROM, internal RAM, and onchip peripheral I/O access Addition of Caution to 4.3.1 (1) Chip area select control registers 0, 1 (CSC0, CSC1) Modification and deletion of description in 4.9.1 Program space Addition of description to 6.3.1 (1) DMA source address registers 0H to 3H (DSA0H to DSA3H) Addition of description to 6.3.2 (1) DMA destination address registers 0H to 3H (DDA0H to DDA3H)
CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
654
User's Manual U15195EJ3V0UD
APPENDIX E REVISION HISTORY
(5/5)
Edition 3rd Major Revision from Previous Edition Addition of description and Caution to 6.3.4 DMA addressing control registers 0 to 3 (DADC0 to DADC3) Addition of description and Caution to and modification of bit description in 6.3.5 DMA channel control registers 0 to 3 (DCHC0 to DCHC3) Addition of description to 6.3.6 DMA disable status register (DDIS) Addition of description to 6.3.7 DMA restart register (DRST) Addition of Caution to 6.6.1 Two-cycle transfer Addition of description to Remark in 6.13 Forcible Termination Modification of description in 6.14 (3) Times related to DMA transfer Addition of Caution to 7.3.4 Interrupt control register (xxICn) Addition of Caution to 7.3.6 In-service priority register (ISPR) Modification of description in Figure 7-14 Pipeline Operation at Interrupt Request Acknowledgement (Outline) Modification of description in Table 9-2 Operation Modes of Timer 0 Modification of description in Table 9-4 Operation Modes of Timer 0 (TM0n) Modification of description in Remark in 9.1.6 (2) PWM mode 0: Triangular wave modulation (right-left symmetric waveform control) Modification of Figures 9-15, 9-17 to 9-20, 9-22 to 9-30, and 9-32 to 9-35 Modification of maximum transfer rate in 10.2.1 Features Addition of description to Table 10-3 Baud Rate Generator Setting Data Addition of Caution to 12.2 (1) Functions of each port Addition of description to 15.2 (2) Off-board programming CHAPTER 10 SERIAL INTERFACE FUNCTION CHAPTER 12 PORT FUNCTIONS CHAPTER 15 FLASH MEMORY (PD70F3114) CHAPTER 16 ELECTRICAL SPECIFICATIONS CHAPTER 17 PACKAGE DRAWINGS CHAPTER 18 RECOMMENDED SOLDERING CONDITIONS APPENDIX A NOTES ON TARGET SYSTEM DESIGN APPENDIX C INSTRUCTION SET LIST APPENDIX D INDEX APPENDIX E REVISION HISTORY CHAPTER 7 INTERRUPT/EXCEP TION PROCESSING FUNCTION CHAPTER 9 TIMER/COUNTER FUNCTION (REALTIME PULSE UNIT) Applied to: CHAPTER 6 DMA FUNCTIONS (DMA CONTROLLER)
Addition of CHAPTER 16 ELECTRICAL SPECIFICATIONS
Addition of CHAPTER 17 PACKAGE DRAWINGS
Addition of CHAPTER 18 RECOMMENDED SOLDERING CONDITIONS
Addition of APPENDIX A NOTES ON TARGET SYSTEM DESIGN
Modification of description in C.2 Instruction Set (Alphabetical Order)
Addition of APPENDIX D INDEX Addition of APPENDIX E REVISION HISTORY
User's Manual U15195EJ3V0UD
655


▲Up To Search▲   

 
Price & Availability of UPD70F3114

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X