RNCCS11640 1
RNCCS11640 1
On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology
Corporation, and Renesas Electronics Corporation took over all the business of both
companies. Therefore, although the old company name remains in this document, it is a valid
Renesas Electronics document. We appreciate your understanding.
(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its majority-
owned subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
User’s Manual
16 M16C/29 Group
Hardware Manual
RENESAS MCU
M16C FAMILY / M16C/Tiny SERIES
All information contained in these materials, including products and product specifications,
represents information on the product at the time of publication and is subject to change by
Renesas Electronics Corp. without notice. Please review the latest information published by
Renesas Electronics Corp. through various means, including the Renesas Electronics Corp.
website (http://www.renesas.com).
Rev.1.12 2007.03
Notes regarding these materials
1. This document is provided for reference purposes only so that Renesas customers may select the appropriate
Renesas products for their use. Renesas neither makes warranties or representations with respect to the
accuracy or completeness of the information contained in this document nor grants any license to any
intellectual property rights or any other rights of Renesas or any third party with respect to the information in
this document.
2. Renesas shall have no liability for damages or infringement of any intellectual property or other rights arising
out of the use of any information in this document, including, but not limited to, product data, diagrams, charts,
programs, algorithms, and application circuit examples.
3. You should not use the products or the technology described in this document for the purpose of military
applications such as the development of weapons of mass destruction or for the purpose of any other military
use. When exporting the products or technology described herein, you should follow the applicable export
control laws and regulations, and procedures required by such laws and regulations.
4. All information included in this document such as product data, diagrams, charts, programs, algorithms, and
application circuit examples, is current as of the date this document is issued. Such information, however, is
subject to change without any prior notice. Before purchasing or using any Renesas products listed in this
document, please confirm the latest product information with a Renesas sales office. Also, please pay regular
and careful attention to additional and different information to be disclosed by Renesas such as that disclosed
through our website. (http://www.renesas.com )
5. Renesas has used reasonable care in compiling the information included in this document, but Renesas
assumes no liability whatsoever for any damages incurred as a result of errors or omissions in the information
included in this document.
6. When using or otherwise relying on the information in this document, you should evaluate the information in
light of the total system before deciding about the applicability of such information to the intended application.
Renesas makes no representations, warranties or guaranties regarding the suitability of its products for any
particular application and specifically disclaims any liability arising out of the application and use of the
information in this document or Renesas products.
7. With the exception of products specified by Renesas as suitable for automobile applications, Renesas
products are not designed, manufactured or tested for applications or otherwise in systems the failure or
malfunction of which may cause a direct threat to human life or create a risk of human injury or which require
especially high quality and reliability such as safety systems, or equipment or systems for transportation and
traffic, healthcare, combustion control, aerospace and aeronautics, nuclear power, or undersea communication
transmission. If you are considering the use of our products for such purposes, please contact a Renesas
sales office beforehand. Renesas shall have no liability for damages arising out of the uses set forth above.
8. Notwithstanding the preceding paragraph, you should not use Renesas products for the purposes listed below:
(1) artificial life support devices or systems
(2) surgical implantations
(3) healthcare intervention (e.g., excision, administration of medication, etc.)
(4) any other purposes that pose a direct threat to human life
Renesas shall have no liability for damages arising out of the uses set forth in the above and purchasers who
elect to use Renesas products in any of the foregoing applications shall indemnify and hold harmless Renesas
Technology Corp., its affiliated companies and their officers, directors, and employees against any and all
damages arising out of such applications.
9. You should use the products described herein within the range specified by Renesas, especially with respect
to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation
characteristics, installation and other product characteristics. Renesas shall have no liability for malfunctions or
damages arising out of the use of Renesas products beyond such specified ranges.
10. Although Renesas endeavors to improve the quality and reliability of its products, IC products have specific
characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use
conditions. Please be sure to implement safety measures to guard against the possibility of physical injury, and
injury or damage caused by fire in the event of the failure of a Renesas product, such as safety design for
hardware and software including but not limited to redundancy, fire control and malfunction prevention,
appropriate treatment for aging degradation or any other applicable measures. Among others, since the
evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or
system manufactured by you.
11. In case Renesas products listed in this document are detached from the products to which the Renesas
products are attached or affixed, the risk of accident such as swallowing by infants and small children is very
high. You should implement safety measures so that Renesas products may not be easily detached from your
products. Renesas shall have no liability for damages arising out of such detachment.
12. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written
approval from Renesas.
13. Please contact a Renesas sales office if you have any questions regarding the information contained in this
document, Renesas semiconductor products, or if you have any other inquiries.
General Precautions in the Handling of MPU/MCU Products
The following usage notes are applicable to all MPU/MCU products from Renesas. For detailed usage notes
on the products covered by this manual, refer to the relevant sections of the manual. If the descriptions under
General Precautions in the Handling of MPU/MCU Products and in the body of the manual differ from each
other, the description in the body of the manual takes precedence.
Particular attention should be paid to the precautionary notes when using the manual. These notes occur
within the body of the text, at the end of each section, and in the Usage Notes section.
The revision history summarizes the locations of revisions and additions. It does not list all revisions. Refer
to the text of the manual for details.
The following documents apply to the M16C/29 Group. Make sure to refer to the latest versions of these documents.
The newest versions of the documents listed may be obtained from the Renesas Technology Web site.
XXX Register *1
b7 b6 b5 b4 b3 b2 b1 b0
XXX5 WO
XXX6 RW
*1
Blank: Set to 0 or 1 according to the application.
0: Set to 0.
1: Set to 1.
X: Nothing is assigned.
*2
RW: Read and write.
RO: Read only.
WO: Write only.
−: Nothing is assigned.
*3
• Reserved bit
Reserved bit. Set to specified value.
*4
• Nothing is assigned
Nothing is assigned to the bit. As the bit may be used for future functions, if necessary, set to 0.
• Do not set to a value
Operation is not guaranteed when a value is set.
• Function varies according to the operating mode.
The function of the bit varies with the peripheral function mode. Refer to the register diagram for information
on the individual modes.
4. List of Abbreviations and Acronyms
All trademarks and registered trademarks are the property of their respective owners.
IEBus is a registered trademark of NEC Electronics Corporation.
Table of Contents
1. Overview ____________________________________________________ 1
1.1 Features ........................................................................................................................... 1
1.1.1 Applications ................................................................................................................ 1
1.1.2 Specifications ............................................................................................................. 2
1.2 Block Diagram .................................................................................................................. 4
1.3 Product List ....................................................................................................................... 6
1.4 Pin Assignments ............................................................................................................. 12
1.5 Pin Description ............................................................................................................... 18
3. Memory ____________________________________________________ 23
A-1
5. Resets _____________________________________________________ 35
5.1 Hardware Reset .............................................................................................................. 35
5.1.1 Hardware Reset 1 .................................................................................................... 35
5.1.2 Brown-Out Detection Reset (Hardware Reset 2) ..................................................... 35
5.2 Software Reset ............................................................................................................... 36
5.3 Watchdog Timer Reset ................................................................................................... 36
5.4 Oscillation Stop Detection Reset .................................................................................... 36
5.5 Voltage Detection Circuit ................................................................................................ 38
5.5.1 Low Voltage Detection Interrupt ............................................................................... 41
5.5.2. Limitations on Stop Mode ........................................................................................ 43
5.5.3. Limitations on WAIT Instruction ............................................................................... 43
8. Protection __________________________________________________ 69
A-2
9. Interrupts ___________________________________________________ 70
9.1 Type of Interrupts ............................................................................................................ 70
9.1.1 Software Interrupts ................................................................................................... 71
9.1.2 Hardware Interrupts ................................................................................................. 72
9.2 Interrupts and Interrupt Vector ........................................................................................ 73
9.2.1 Fixed Vector Tables .................................................................................................. 73
9.2.2 Relocatable Vector Tables ........................................................................................ 74
9.3 Interrupt Control .............................................................................................................. 75
9.3.1 I Flag ........................................................................................................................ 78
9.3.2 IR Bit ........................................................................................................................ 78
9.3.3 ILVL2 to ILVL0 Bits and IPL...................................................................................... 78
9.4 Interrupt Sequence ......................................................................................................... 79
9.4.1 Interrupt Response Time .......................................................................................... 80
9.4.2 Variation of IPL when Interrupt Request is Accepted ............................................... 80
9.4.3 Saving Registers ...................................................................................................... 81
9.4.4 Returning from an Interrupt Routine ......................................................................... 83
9.5 Interrupt Priority .............................................................................................................. 83
9.5.1 Interrupt Priority Resolution Circuit .......................................................................... 83
______
9.6 INT Interrupt ................................................................................................................... 85
______
9.7 NMI Interrupt ................................................................................................................... 86
9.8 Key Input Interrupt .......................................................................................................... 86
9.9 CAN0 Wake-up Interrupt ................................................................................................ 87
9.10 Address Match Interrupt ............................................................................................... 87
A-3
12. Timers ___________________________________________________ 101
12.1 Timer A ...................................................................................................................... 103
12.1.1 Timer Mode .......................................................................................................... 106
12.1.2 Event Counter Mode ............................................................................................ 107
12.1.3 One-shot Timer Mode .......................................................................................... 112
12.1.4 Pulse Width Modulation (PWM) Mode ................................................................. 114
12.2 Timer B ...................................................................................................................... 117
12.2.1 Timer Mode ......................................................................................................... 119
12.2.2 Event Counter Mode ............................................................................................ 120
12.2.3 Pulse Period and Pulse Width Measurement Mode ............................................ 121
12.2.4 A/D Trigger Mode ................................................................................................ 123
12.3 Three-phase Motor Control Timer Function ................................................................ 125
12.3.1 Position-Data-Retain Function ............................................................................. 136
12.3.2 Three-phase/Port Output Switch Function ........................................................... 138
A-4
14.2 SI/O3 and SI/O4 ........................................................................................................ 217
14.2.2 CLK Polarity Selection ........................................................................................ 220
14.2.1 SI/Oi Operation Timing ........................................................................................ 220
14.2.3 Functions for Setting an SOUTi Initial Value ....................................................... 221
A-5
16.5.3 Bit 2: Slave Address Comparison Flag (AAS) ..................................................... 269
16.5.4 Bit 3: Arbitration Lost Detection Flag (AL) ........................................................... 269
16.5.5 Bit 4: I2C bus Interface Interrupt Request Bit (PIN) ............................................. 270
16.5.6 Bit 5: Bus Busy Flag (BB) .................................................................................... 270
16.5.7 Bit 6: Communication Mode Select Bit (Transfer Direction Select Bit: TRX) ....... 271
16.5.8 Bit 7: Communication mode select bit (master/slave select bit: MST) ................ 271
16.6 I2C0 Control Register 1 (S3D0 register) .................................................................... 272
16.6.1 Bit 0 : Interrupt Enable Bit by STOP Condition (SIM ) ......................................... 272
16.6.2 Bit 1: Interrupt Enable Bit at the Completion of Data Receive (WIT) .................. 272
16.6.3 Bits 2,3 : Port Function Select Bits PED, PEC .................................................... 273
16.6.4 Bits 4,5 : SDA/SCL Logic Output Value Monitor Bits SDAM/SCLM .................... 274
16.6.5 Bits 6,7 : I2C System Clock Select Bits ICK0, ICK1 ............................................ 274
16.6.6 Address Receive in STOP/WAIT Mode ............................................................... 274
16.7 I2C0 Control Register 2 (S4D0 Register) ................................................................... 275
16.7.1 Bit0: Time-Out Detection Function Enable Bit (TOE) .......................................... 276
16.7.2 Bit1: Time-Out Detection Flag (TOF ).................................................................. 276
16.7.3 Bit2: Time-Out Detection Period Select Bit (TOSEL) .......................................... 276
16.7.4 Bits 3,4,5: I2C System Clock Select Bits (ICK2-4) ............................................... 276
16.7.5 Bit7: STOP Condition Detection Interrupt Request Bit (SCPIN).......................... 276
16.8 I2C0 START/STOP Condition Control Register (S2D0 Register) ............................... 277
16.8.1 Bit0-Bit4: START/STOP Condition Setting Bits (SSC0-SSC4) ............................ 277
16.8.2 Bit5: SCL/SDA Interrupt Pin Polarity Select Bit (SIP) .......................................... 277
16.8.3 Bit6 : SCL/SDA Interrupt Pin Select Bit (SIS) ...................................................... 277
16.8.4 Bit7: START/STOP Condition Generation Select Bit (STSPSEL) ....................... 277
16.9 START Condition Generation Method ....................................................................... 278
16.10 START Condition Duplicate Protect Function ........................................................... 279
16.11 STOP Condition Generation Method ........................................................................ 279
16.12 START/STOP Condition Detect Operation ............................................................... 281
16.13 Address Data Communication ................................................................................. 282
16.13.1 Example of Master Transmit ............................................................................. 282
16.13.2 Example of Slave Receive ................................................................................ 283
16.14 Precautions ............................................................................................................... 284
A-6
17.2 Operating Modes ........................................................................................................ 300
17.2.1 CAN Reset/Initialization Mode ............................................................................. 300
17.2.2 CAN Operating Mode ........................................................................................... 301
17.2.3 CAN Sleep Mode ................................................................................................. 301
17.2.4 CAN Interface Sleep Mode .................................................................................. 302
17.2.5 Bus Off State ........................................................................................................ 302
17.3 Configuration of the CAN Module System Clock ........................................................ 303
17.3.1 Bit Timing Configuration ....................................................................................... 303
17.3.2 Bit-rate .................................................................................................................. 304
17.4 Acceptance Filtering Function and Masking Function ................................................ 305
17.5 Acceptance Filter Support Unit (ASU) ........................................................................ 306
17.6 BasicCAN Mode ......................................................................................................... 307
17.7 Return from Bus off Function ...................................................................................... 308
17.8 Time Stamp Counter and Time Stamp Function ......................................................... 308
17.9 Listen-Only Mode ....................................................................................................... 308
17.10 Reception and Transmission .................................................................................... 309
17.10.1 Reception ........................................................................................................... 310
17.10.2 Transmission ...................................................................................................... 311
17.11 CAN Interrupts .......................................................................................................... 312
A-7
20.4 CPU Rewrite Mode ..................................................................................................... 337
20.4.1 EW Mode 0 .......................................................................................................... 338
20.4.2 EW Mode 1 .......................................................................................................... 338
20.5 Register Description ................................................................................................... 339
20.5.1 Flash Memory Control Register 0 (FMR0) ........................................................... 339
20.5.2 Flash Memory Control Register 1 (FMR1) ........................................................... 340
20.5.3 Flash Memory Control Register 4 (FMR4) ........................................................... 340
20.6 Precautions in CPU Rewrite Mode ............................................................................. 345
20.6.1 Operation Speed .................................................................................................. 345
20.6.2 Prohibited Instructions .......................................................................................... 345
20.6.3 Interrupts .............................................................................................................. 345
20.6.4 How to Access ...................................................................................................... 345
20.6.5 Writing in the User ROM Area .............................................................................. 345
20.6.6 DMA Transfer ....................................................................................................... 346
20.6.7 Writing Command and Data ................................................................................. 346
20.6.8 Wait Mode ............................................................................................................ 346
20.6.9 Stop Mode ............................................................................................................ 346
20.6.10 Low Power Consumption Mode and On-Chip Oscillator-Low Power Consumption Mode ... 346
20.7 Software Commands .................................................................................................. 347
20.7.1 Read Array Command (FF16)............................................................................... 347
20.7.2 Read Status Register Command (7016) ............................................................... 347
20.7.3 Clear Status Register Command (5016) ............................................................... 347
20.7.4 Program Command (4016) ................................................................................... 348
20.7.5 Block Erase .......................................................................................................... 349
20.8 Status Register ........................................................................................................... 351
20.8.1 Sequence Status (SR7 and FMR00 Bits ) ............................................................ 351
20.8.2 Erase Status (SR5 and FMR07 Bits) ................................................................... 351
20.8.3 Program Status (SR4 and FMR06 Bits) ............................................................... 351
20.8.4 Full Status Check ................................................................................................. 352
20.9 Standard Serial I/O Mode ........................................................................................... 354
20.9.1 ID Code Check Function ...................................................................................... 354
20.9.2 Example of Circuit Application in Standard Serial I/O Mode ................................ 358
20.10 Parallel I/O Mode ...................................................................................................... 360
20.10.1 ROM Code Protect Function .............................................................................. 360
20.11 CAN I/O Mode .......................................................................................................... 361
20.11.1 ID code check function ....................................................................................... 361
20.11.2 Example of Circuit Application in CAN I/O Mode ................................................ 365
A-8
21. Electrical Characteristics _____________________________________ 366
21.1 Normal version ........................................................................................................... 366
21.2 T version ..................................................................................................................... 387
21.3 V Version .................................................................................................................... 408
A-9
22.9 A/D Converter ............................................................................................................. 439
22.10 Multi-Master I2C bus Interface ................................................................................. 441
22.10.1 Writing to the S00 Register ................................................................................ 441
22.10.2 AL Flag ............................................................................................................... 441
22.11 CAN Module ............................................................................................................. 442
22.11.1 Reading C0STR Register ................................................................................... 442
22.11.2 CAN Transceiver in Boot Mode .......................................................................... 444
22.12 Programmable I/O Ports ........................................................................................... 445
22.13 Electric Characteristic Differences Between Mask ROM .......................................... 446
22.14 Mask ROM Version ................................................................................................... 447
22.14.1 Internal ROM Area ............................................................................................. 447
22.14.2 Reserved Bit ....................................................................................................... 447
22.15 Flash Memory Version .............................................................................................. 448
22.15.1 Functions to Inhibit Rewriting Flash Memory Rewrite ........................................ 448
22.15.2 Stop Mode .......................................................................................................... 448
22.15.3 Wait Mode .......................................................................................................... 448
22.15.4 Low PowerDissipation Mode, On-Chip Oscillator Low Power Dissipation Mode .. 448
22.15.5 Writing Command and Data ............................................................................... 448
22.15.6 Program Command ............................................................................................ 448
22.15.7 Operation Speed ................................................................................................ 448
22.15.8 Instructions Inhibited Against Use ...................................................................... 448
22.15.9 Interrupts ............................................................................................................ 449
22.15.10 How to Access .................................................................................................. 449
22.15.11 Writing in the User ROM Area .......................................................................... 449
22.15.12 DMA Transfer ................................................................................................... 449
22.15.13 Regarding Programming/Erasure Times and Execution Time ......................... 449
22.15.14 Definition of Programming/Erasure Times ....................................................... 450
22.15.15 Flash Memory Version Electrical Characteristics 10,000 E/W cycle products
( Normal: U7, U9; T-ver./V-ver.: U7) ............................................. 450
22.15.16 Boot Mode ........................................................................................................ 450
22.16 Noise ........................................................................................................................ 451
22.17 Instruction for a Device Use ..................................................................................... 452
A-10
Appendix 1. Package Dimensions ________________________________ 453
A-11
Quick Reference to Pages Classified by Address
000016 004016
000116 004116 CAN0 wakeup interrupt control register C01WKIC 76
000216 004216 CAN0 successful reception interrupt control register C0RECIC 76
000316 004316 CAN0 successful transmission interrupt control regiser C0TRMIC 76
000416 Processor mode register 0 PM0 44 004416 INT3 interrupt control register INT3IC 76
000516 Processor mode register 1 PM1 44 004516 IC/OC 0 interrupt control register ICOC0IC 76
000616 System clock control register 0 CM0 49 004616 IC/OC 1 interrupt control register, ICOC1IC 76
000716 System clock control register 1 CM1 50 I2C bus interface interrupt control register IICIC 76
000816 004716 IC/OC base timer interrupt control register, BTIC 76
000916 Address match interrupt enable register AIER 88 SCLSDA interrupt control register SCLDAIC 76
000A16 Protect register PRCR 69 004816 SI/O4 interrupt control register, S4IC 76
000B16 INT5 interrupt control register INT5IC 76
000C16 Oscillation stop detection register CM2 51 004916 SI/O3 interrupt control register, S3IC 76
000D16 INT4 interrupt control register INT4IC 76
000E16 Watchdog timer start register WDTS 90 004A16 UART2 Bus collision detection interrupt control register BCNIC 76
000F16 Watchdog timer control register WDC 90 004B16 DMA0 interrupt control register DM0IC 76
001016 004C16 DMA1 interrupt control register DM1IC 76
001116 Address match interrupt register 0 RMAD0 88 004D16 CAN0 error interrupt control register C01ERRIC 76
001216 004E16 A/D conversion interrupt control register ADIC 76
001316 Key input interrupt control register KUPIC 76
001416 004F16 UART2 transmit interrupt control register S2TIC 76
001516 Address match interrupt register 1 RMAD1 88 005016 UART2 receive interrupt control register S2RIC 76
001616 005116 UART0 transmit interrupt control register S0TIC 76
001716 005216 UART0 receive interrupt control register S0RIC 76
001816 005316 UART1 transmit interrupt control register S1TIC 76
001916 Voltage detection register 1 VCR1 41 005416 UART1 receive interrupt control register S1RIC 76
001A16 Voltage detection register 2 VCR2 41 005516 Timer A0 interrupt control register TA0IC 76
001B16 005616 Timer A1 interrupt control register TA1IC 76
001C16 PLL control register 0 PLC0 53 005716 Timer A2 interrupt control register TA2IC 76
001D16 005816 Timer A3 interrupt control register TA3IC 76
001E16 Processor mode register 2 PM2 52 005916 Timer A4 interrupt control register TA4IC 76
001F16 Low voltage detection interrupt register D4INT 42 005A16 Timer B0 interrupt control register TB0IC 76
002016 005B16 Timer B1 interrupt control register TB1IC 76
002116 DMA0 source pointer SAR0 95 005C16 Timer B2 interrupt control register TB2IC 76
002216 005D16 INT0 interrupt control register INT0IC 76
002316 005E16 INT1 interrupt control register INT1IC 76
002416 005F16 INT2 interrupt control register INT2IC 76
002516 DMA0 destination pointer DAR0 95 006016
002616 006116
002716 006216
CAN0 message box 0: Identifier/DLC 289
002816 006316
DMA0 transfer counter TCR0 95
002916 006416
002A16 006516
002B16 006616
002C16 DMA0 control register DM0CON 94 006716
002D16 006816
002E16 006916
CAN 0 message box 0: Data field 289
002F16 006A16
003016 006B16
003116 DMA1 source pointer SAR1 95 006C16
003216 006D16
003316 006E16
CAN0 message box 0: Time stamp 289
003416 006F16
003516 DMA1 destination pointer DAR1 95 007016
003616 007116
003716 007216
CAN0 message box 1: Identifier/DLC 289
003816 007316
DMA1 transfer counter TCR1 95
003916 007416
003A16 007516
003B16 007616
003C16 DMA1 control register DM1CON 94 007716
003D16 007816
003E16 007916
CAN 0 message box 1: Data field 289
003F16 007A16
007B16
Note: The blank areas are reserved and cannot be accessed by users.
007C16
007D16
007E16
CAN0 message box 1: Time stamp 289
007F16
B-1
Quick Reference to Pages Classified by Address
008016 00C016
008116 00C116
008216 00C216
CAN0 message box 2: Identifier/DLC 289 CAN0 message box 6: Identifier/DLC 289
008316 00C316
008416 00C416
008516 00C516
008616 00C616
008716 00C716
008816 00C816
008916 00C916
CAN0 message box 2: Data field 289 CAN0 message box 6: Data field 289
008A16 00CA16
008B16 00CB16
008C16 00CC16
008D16 00CD16
008E16 00CE16
CAN0 message box 2: time stamp 289 CAN0 message box 6: time stamp 289
008F16 00CF16
009016 00D016
009116 00D116
009216 00D216
CAN0 message box 3: Identifier/DLC 289 CAN0 message box 7: Identifier/DLC 289
009316 00D316
009416 00D416
009516 00D516
009616 00D616
009716 00D716
009816 00D816
009916 00D916
CAN0 message box 3: Data field 289 CAN0 message box 7: Data field 289
009A16 00DA16
009B16 00DB16
009C16 00DC16
009D16 00DD16
009E16 00DE16
CAN0 message box 3: time stamp 289 CAN0 message box 7: time stamp 289
009F16 00DF16
00A016 00E016
00A116 00E116
00A216 00E216
CAN0 message box 4: Identifier/DLC 289 CAN0 message box 8: Identifier/DLC 289
00A316 00E316
00A416 00E416
00A516 00E516
00A616 00E616
00A716 00E716
00A816 00E816
00A916 00E916
CAN0 message box 4: Data field 289 CAN0 message box 8: Data field 289
00AA16 00EA16
00AB16 00EB16
00AC16 00EC16
00AD16 00ED16
00AE16 00EE16
CAN0 message box 4: time stamp 289 CAN0 message box 8: time stamp 289
00AF16 00EF16
00B016 00F016
00B116 00F116
00B216 00F216
CAN0 message box 5: Identifier/DLC 289 CAN0 message box 9: Identifier/DLC 289
00B316 00F316
00B416 00F416
00B516 00F516
00B616 00F616
00B716 00F716
00B816 00F816
00B916 00F916
CAN0 message box 5: Data field 289 CAN0 message box 9: Data field 289
00BA16 00FA16
00BB16 00FB16
00BC16 00FC16
00BD16 00FD16
00BE16 00FE16
CAN0 message box 5: time stamp 289 CAN0 message box 9: time stamp 289
00BF16 00FF16
Note: The blank areas are reserved and cannot be accessed by users.
B-2
Quick Reference to Pages Classified by Address
010016 014016
010116 014116
010216 014216
CAN0 message box 10: Identifer/DLC 289 CAN0 message box 14: Identifier/DLC 289
010316 014316
010416 014416
010516 014516
010616 014616
010716 014716
010816 014816
010916 014916
CAN0 message box 10: Data field 289 CAN0 message box 14: Data field 289
010A16 014A16
010B16 014B16
010C16 014C16
010D16 014D16
010E16 014E16
CAN0 message box 10: time stamp 289 CAN0 message box 14: time stamp 289
010F16 014F16
011016 015016
011116 015116
011216 015216
CAN0 message box 11: Identifier/DLC 289 CAN0 message box 15: Identifier/DLC 289
011316 015316
011416 015416
011516 015516
011616 015616
011716 015716
011816 015816
011916 015916
CAN0 message box 11: Data field 289 CAN0 message box 15: Data field 289
011A16 015A16
011B16 015B16
011C16 015C16
011D16 015D16
011E16 015E16
CAN0 message box 11: time stamp 289 CAN0 message box 15: time stamp 289
011F16 015F16
012016 016016
012116 016116
012216 016216
CAN0 message box 12: Identifier/DLC 289 CAN0 global mask register C0GMR 291
012316 016316
012416 016416
012516 016516
012616 016616
012716 016716
012816 016816
012916 016916
CAN0 local mask A register C0LMAR 291
CAN0 message box 12: Data field 289
012A16 016A16
012B16 016B16
012C16 016C16
012D16 016D16
012E16 016E16
CAN0 message box 12: time stamp 289 CAN0 local mask B register C0LMBR 291
012F16 016F16
013016 017016
013116 017116
013216 017216
CAN0 message box 13: Identifier/DLC 289
013316 017316
013416 017416
013516 017516
013616 017616
013716 017716
013816 017816
013916 017916
CAN0 message box 13: Data field 289
013A16 017A16
013B16 017B16
013C16 017C16
013D16 017D16
013E16 017E16
CAN0 message box 13: time stamp 289
013F16 017F16
Note: The blank areas are reserved and cannot be accessed by users.
B-3
Quick Reference to Pages Classified by Address
02FE16 02FE16
02FF16 02FF16
Note 1: The blank areas are reserved and cannot be accessed by users.
Note 2: This register is included in the flash memory version.
B-4
Quick Reference to Pages Classified by Address
030016 034016
TM, WG register 0 G1TM0, G1PO0 146,147
030116 034116
030216 034216
TM, WG register 1 G1TM1, G1PO1 146,147 Timer A1-1 register TA11 130
030316 034316
030416 034416
TM, WG register 2 G1TM2, G1PO2 146,147 Timer A2-1 register TA21 130
030516 034516
030616 034616
TM, WG register 3 G1TM3, G1PO3 146,147 Timer A4-1 register TA41 130
030716 034716
030816 034816 Three-phase PWM control register 0 INVC0 127
TM, WG register 4 G1TM4, G1PO4 146,147
030916 034916 Three-phase PWM control register 1 INVC1 128
030A16 034A16 Three-phase output buffer register 0 IDB0 129
TM, WG register 5 G1TM5, G1PO5 146,147
030B16 034B16 Three-phase output buffer register 1 IDB1 129
030C16 034C16 Dead time timer DTT 129
TM, WG register 6 G1TM6, G1PO6 146,147
030D16 034D16 Timer B2 interrupt occurrence frequency set counter ICTB2 129
030E16 034E16 Position-data-retain function contol register PDRF 137
TM, WG register 7 G1TM7, G1PO7 146,147
030F16 034F16
031016 WG control register 0 G1POCR0 146 035016
031116 WG control register 1 G1POCR1 146 035116
031216 WG control register 2 G1POCR2 146 035216
031316 WG control register 3 G1POCR3 146 035316
031416 WG control register 4 G1POCR4 146 035416
031516 WG control register 5 G1POCR5 146 035516
031616 WG control register 6 G1POCR6 146 035616
031716 WG control register 7 G1POCR7 146 035716
031816 TM control register 0 G1TMCR0 145 035816 Port function control register PFCR 139
031916 TM control register 1 G1TMCR1 145 035916
031A16 TM control register 2 G1TMCR2 145 035A16
031B16 TM control register 3 G1TMCR3 145 035B16
031C16 TM control register 4 G1TMCR4 145 035C16
031D16 TM control register 5 G1TMCR5 145 035D16
031E16 TM control register 6 G1TMCR6 145 035E16 Interrupt request cause select register 2 IFSR2A 77
031F16 TM control register 7 G1TMCR7 145 035F16 Interrupt request cause select register IFSR 77, 85
032016 036016 SI/O3 transmit/receive register S3TRR 218
Base timer register G1BT 142
032116 036116
032216 Base timer control register 0 G1BCR0 142 036216 SI/O3 control register S3C 218
032316 Base timer control register 1 G1BCR1 143 036316 SI/O3 bit rate generator S3BRG 218
032416 TM prescale register 6 G1TPR6 145 036416 SI/O4 transmit/receive register S4TRR 218
032516 TM prescale register 7 G1TPR7 145 036516
032616 Function enable register G1FE 148 036616 SI/O4 control register S4C 218
032716 Function select register G1FS 148 036716 SI/O4 bit rate generator S4BRG 218
032816 036816
Base timer reset register G1BTRR 144
032916 036916
032A16 Divider register G1DV 143 036A16
032B16 036B16
032C16 036C16
032D16 036D16
032E16 036E16
032F16 036F16
033016 Interrupt request register G1IR 149 037016
033116 Interrupt enable register 0 G1IE0 150 037116
033216 Interrupt enable register 1 G1IE1 150 037216
033316 037316
033416 037416 UART2 special mode register 4 U2SMR4 179
033516 037516 UART2 special mode register 3 U2SMR3 179
033616 037616 UART2 special mode register 2 U2SMR2 178
033716 037716 UART2 special mode register U2SMR 178
033816 037816 UART2 transmit/receive mode register U2MR 175
033916 037916 UART2 bit rate generator U2BRG 174
033A16 037A16
UART2 transmit buffer register U2TB 174
033B16 037B16
033C16 037C16 UART2 transmit/receive control register 0 U2C0 176
033D16 037D16 UART2 transmit/receive control register 1 U2C1 177
033E16 NMI digital debounce register NDDR 327 037E16
UART2 receive buffer register U2RB 174
033F16 P17 digital debounce register P17DDR 327 037F16
Note : The blank areas are reserved and cannot be accessed by users.
B-5
Quick Reference to Pages Classified by Address
B-6
M16C/29 Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
1. Overview
1.1 Features
The M16C/29 Group of single-chip control MCU incorporates the M16C/60 series CPU core, employing the
high-performance silicon gate CMOS technology and sophisticated instructions for a high level of effi-
ciency. The M16C/29 Group is housed in 64-pin and 80-pin plastic molded LQFP packages. These single-
chip MCUs operate using sophisticated instructions featuring a high level of instruction efficiency. This
MCU is capable of executing instructions at high speed and it has one CAN module, makes it suitable for
control of cars and LAN system of FA. In addition, the CPU core boasts a multiplier and DMAC for high-
speed processing to make adequate for office automation, communication devices, and other high-speed
processing applications.
1.1.1 Applications
Automotive body, car audio, LAN system of FA, etc.
1.1.2 Specifications
Table 1.1 lists performance overview of M16C/29 Group 80-pin package.
Table 1.2 lists performance overview of M16C/29 Group 64-pin package.
Table 1.1 Performance Overview of M16C/29 Group (T-ver./V-ver.) (80-Pin Package)
Item Performance
CPU Number of basic instructions 91 instructions
Shortest instruction 50 ns (f(BCLK) = 20MHZ, VCC = 3.0 to 5.5 V) (Normal-ver./T-ver.)
excution time 100 ns(f(BCLK) = 10MHZ, VCC = 2.7 to 5.5 V) (Normal-ver.)
50 ns (f(BCLK) = 20MHZ, VCC = 4.2 to 5.5 V, -40 to 105°C) (V-ver.)
62.5 ns (f(BCLK) = 16MHZ, VCC = 4.2 to 5.5 V, -40 to 125°C) (V-ver.)
Operation mode Single chip mode
Address space 1 Mbyte
Memory capacity ROM/RAM: See Tables 1.3 to 1.5
Peripheral Port Input/Output: 71 lines
Function Multifunction timer TimerA:16 bits x 5 channels, TimerB:16 bits x 3 channels
Three-phase Motor Control Timer
TimerS (Input Capture/Output Compare):
16 bit base timer x 1 channel (Input/Output x 8 channels)
Serial I/O 2 channels (UART, clock synchronous serial I/O)
1 channel (UART, clock synchronous serial I/O, I2C bus, or IEbus(1))
2 channels (Clock synchronous serial I/O)
1 channel (Multi- master I2C bus)
A/D converter 10 bits x 27 channels
DMAC 2 channels
CRC calculation circuit 2 polynomial (CRC-CCITT and CRC-16) with MSB/LSB selectable
CAN module 1 channel, supporting CAN 2.0B specification
Watchdog timer 15 bits x 1 channel (with prescaler)
Interrupt 29 internal and 8 external sources, 4 software sources,
interrupt priority level: 7
Clock generation circuit 4 circuits
• Main clock (These circuits contain a built-in feedback
• Sub-clock resistor)
• On-chip oscillator(main-clock oscillation stop detect function)
• PLL frequency synthesizer
Oscillation stop detect Function Main clock oscillation stop, re-oscillation detect function
Voltage detection circuit Available (Normal-ver.) / Not available (T-ver., V-ver.)
Electrical Power supply voltage VCC = 3.0 to 5.5 V (f(BCLK) = 20 MHz) (Normal-ver.)
Charact- VCC = 2.7 to 5.5 V (f(BCLK) = 10 MHz)
eristics VCC = 3.0 to 5.5 V (T-ver.)
VCC = 4.2 to 5.5 V (V-ver.)
Power consumption 18 mA (VCC = 5 V, f(BCLK) = 20 MHz)
25 µA (f(XCIN) = 32 kHz on RAM)
3 µA (VCC = 5 V, f(XCIN) = 32 kHz, in wait mode)
0.8 µA (VCC = 5 V, in stop mode)
Flash Program/erase supply voltage 2.7 to 5.5 V (Normal-ver.), 3.0 to 5.5V (T-ver.), 4.2 to 5.5 V (V-ver.)
memory Program and erase endurance 100 times (all space) or 1,000 times (blocks 0 to 5)/
10,000 times (blocks A and B(2))
Operating ambient temperature -20 to 85°C/-40 to 85°C(2) (Normal-ver.)
-40 to 85°C (T-ver.), -40 to 125°C (V-ver.)
Package 80-pin plastic mold LQFP
NOTES:
1. IEBus is a trademark of NEC Electronics Corporation.
2. Refer to Table 1.6 to Table 1.8 Product code.
8 8 8 8
Port P6
Internal Peripheral Functions
8
Timer (16 bits) UART/clock synchronous SI/O System clock generator
(8 bits x 3 channels)
Output (Timer A) : 5 XIN-XOUT
Port P7
Input (Timer B) : 3 Clock synchronous SI/O XCIN-XCOUT
(8 bits x 2 channels) On-chip oscillator
8
3-phase PWM PLL frequency synthesizer
Multi-master I2C bus
Timer S
(
Port P8
Input capture/
Output compare ) CAN module
(1 channel)
CRC calculation circuit
(CCITT, CRC-16)
Time measurement : 8 channels
8
Waveform generating : 8 channels M16C/60 Series CPU Core Memory
Port P9
A/D converter
(1 0 b its x 2 7 c h a n n e ls ) R1H R1L USP
R2
ISP
7
R3
INTB
RAM(2)
Watchdog timer A0
PC
(15 bits) A1
Port P10
FB FLG
DMAC Multiplier
8
(2 channels)
NOTES:
1. The ROM capacity varies depending on each product.
2. The RAM capacity varies depending on each product.
4 3 8 4
Port P6
Internal Peripheral Functions
8
Timer (16 bits) UART/Clock synchronous SI/O System clock generator
(8 bits x 3 channels) XIN-XOUT
Output (Timer A) : 5 Clock synchronous SI/O XCIN-XCOUT
Port P7
Input (Timer B) : 3 (8 bits x 1 channel) On-chip oscillator
Multi-master I2C bus PLL frequency synthesizer
8
3-phase PWM
CAN module CRC calculation circuit
Timer S (1 channel) (CRC-CCITT, CRC16)
Port P8
(Input capture/
Output compare )
M16C/60 Series CPU Core Memory
Time measurement : 8 channels
8
Waveform generating : 8 channels
ROM(1)
R0H R0L SB
A/D converter
Port P9
R1H R1L USP
(10 bits x 16 channels) R2
R3
ISP RAM(2)
4
INTB
Watchdog timer A0
PC
(15 bits) A1
Port P10
FB FLG
Multiplier
DMAC
8
(2 channels)
NOTES:
1. The ROM capacity varies depending on each product.
2. The RAM capacity varies depending on each product.
Type No. M 3 0 2 9 0 F A T H P - U3
Product Code
See Tables 1.6 and 1.9 for Normal-ver., Tables 1.7
and 1.10 for T-ver., and Tables 1.8 and 1.11 for V-ver..
Package type:
HP = Package PLQP0080KB-A (80P6Q-A)
Package PLQP0064KB-A (64P6Q-A)
Version
Blank: Normal-version
T: T-version
V: V-version
ROM capacity /RAM capacity:
8: (64 K) bytes/4 K bytes
A: (96 K+4 K) bytes(1)/8 K bytes
C: (128 K+4 K) bytes(1)/12 K bytes
NOTE:
1. "+4 K bytes" is needed only in flash memory version.
Memory type:
M: Mask ROM version
F: Flash memory version
Pin count
0: 80-pin package
1: 64-pin package
M16C/29 Group
M16C Family
Table 1.6 Product Codes of Flash Memory Version -M16C/29 Group, Normal-ver.
Internal ROM Internal ROM
(User Program Space: Blocks 0 to 5) (Data Space: Blocks A and B)
Product Operating Ambient
Package Program Program
Code Temperature Temperature
and Erase Temperature Range and Erase
Range
Endurance Endurance
U3 -40 to 85ºC
100 100 0 to 60ºC
U5 -20 to 85ºC
Lead-free 0 to 60ºC
U7 -40 to 85ºC -40 to 85ºC
1,000 10,000
U9 -20 to 85ºC -20 to 85ºC
Table 1.7 Product Codes of Flash Memory Version -M16C/29 Group, T-ver.
Internal ROM Internal ROM
(User Program Space: Blocks 0 to 5) (Data Space: Blocks A and B)
Product Operating Ambient
Package Program Program
Code Temperature Temperature
and Erase Temperature Range and Erase
Range
Endurance Endurance
U3 100 100
Lead-free 0 to 60ºC -40 to 85ºC -40 to 85ºC
U7 1,000 10,000
Table 1.8 Product Codes of Flash Memory Version -M16C/29 Group, V-ver.
Internal ROM Internal ROM
(User Program Space: Blocks 0 to 5) (Data Space: Blocks A and B) Operating
Product
Package Program Program Ambient
Code Temperature
and Erase Temperature Range and Erase Temperature
Range
Endurance Endurance
U3 100 100
Lead-free 0 to 60ºC -40 to 125ºC -40 to 125ºC
U7 1,000 10,000
Table 1.9 Product Codes of Mask ROM Version -M16C/29 Group, Normal-ver.
U3 -40 to 85ºC
Lead-free
U5 -20 to 85ºC
Table 1.10 Product Code of Mask ROM Version -M16C/29 Group, T-ver.
Table 1.11 Product Code of Mask ROM Version -M16C/29 Group, V-ver.
M16C
M30290FAHP Product Name: indicates M30290FAHP
A U3 Chip Version and Product Code:
A: indicates chip version
XXXXXXX
The first edition is shown to be blank and continues with A and B.
U3: indicates product code (see Table 1.6)
Date Code (7 digits): indicates manufacturing management code
Figure 1.4 Marking Diagrams of Flash Memory Version - M16C/29 Group Normal-ver. (Top View)
M16C
M30290FATHP Product Name : indicates M30290FATHP
A U3 Chip Version and Product Code:
A : indicates chip version
XXXXXXX
The first edition is shown to be blank and continues with A and B.
U3 : indicates product code (see Table 1.7)
Date Code (7 digits) : indicates manufacturing management code
Figure 1.5 Marking Diagrams of Flash Memory Version - M16C/29 Group T-ver. (Top View)
M16C
M30290FAVHP Product Name: indicates M30290FAVHP
A U3 Chip Version and Product Code:
A: indicates chip version
XXXXXXX
The first edition is shown to be blank and continues with A and B.
U3: indicates product code (see Table 1.8)
Date Code (7 digits): indicates manufacturing management code
Figure 1.6 Marking Diagrams of Flash Memory Version - M16C/29 Group V-ver. (Top View)
Figure 1.7 Marking Diagrams of Mask ROM Version - M16C/29 Group Normal-ver. (Top View)
P20/OUTC10/INPC10/SDAMM
P21/OUTC11/INPC11/SCLMM
P17/INT5/INPC17/IDU
P22/OUTC12/INPC12
P23/OUTC13/INPC13
P24/OUTC14/INPC14
P25/OUTC15/INPC15
P26/OUTC16/INPC16
P27/OUTC17/INPC17
P15/INT3/ADTRG/IDV
P60/CTS0/RTS0
P16/INT4/IDW
P07/AN07
P12/AN22
P10/AN20
P11/AN21
P61/CLK0
P13/AN23
P62/RxD0
P14
60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41
P06/AN06 61 40 P63/TXD0
P05/AN05 62 39 P30/CLK3
P04/AN04 63 38 P31/SIN3
P03/AN03 64 37 P32/SOUT3
P02/AN02 65 36 P33
P01/AN01
P00/AN00
66
67
M16C/29 Group (M16C/29) 35
34
P34
P35
P107/AN7/KI3 68 33 P36
P106/AN6/KI2 69 32 P37
PLQP0080KB-A
P105/AN5/KI1 70 31 P64/CTS1/RTS1/CTS0/CLKS1
P104/AN4/KI0 71 30 P65/CLK1
P103/AN3
(80P6Q-A)
72 29 P66/RxD1
P102/AN2 73 28 P67/TXD1
P101/AN1 74 27 P70/TXD2/SDA2/TA0OUT/CTS1/RTS1/CTS0/CLKS1
AVSS 75 (top view) 26 P71/RXD2/SCL2/TA0IN/CLK1
P100/AN0 76 25 P72/CLK2/TA1OUT/V/RxD1
VREF 77 24 P73/CTS2/RTS2/TA1IN/V/TxD1
AVcc 78 23 P74/TA2OUT/W
P97/AN27/SIN4 79 22 P75/TA2IN/W
P96/AN26/SOUT4 80 21 P76/TA3OUT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
P85/NMI/SD
P92/AN32/TB2IN/CRX
XOUT
VCC
VSS
P84/INT2/ZP
P83/INT1
XIN
P86/XCOUT
P77/TA3IN
RESET
P91/AN31/TB1IN
P90/AN30/TB0IN/CLKOUT
P82/INT0
P95/AN25/CLK4
P81/TA4IN/U
CNVss
P93/AN24/CTX
P80/TA4OUT/U
P87/XCIN
NOTE:
1.Set bits PACR2 to PACR0 in the PACR register to "0112" before
signals are input or output to individual pins after reset. When the
PACR register is not set, signals are not input or output for some
P20/OUTC10/INPC10/SDAMM
P21/OUTC11/INPC11/SCLMM
P17/INT5/INPC17/IDU
P24/OUTC14/INPC14
P25/OUTC15/INPC15
P22/OUTC12/INPC12
P23/OUTC13/INPC13
P26/OUTC16/INPC16
P27/OUTC17/INPC17
P15/INT3/ADTRG/IDV
P60/CTS0/RTS0
P16/INT4/IDW
P03/AN03
P61/CLK0
P62/RxD0
P63/TxD0
44
42
33
36
34
48
47
46
45
41
40
39
35
43
38
37
P02/AN02 49 32 P30/CLK3
P01/AN01 50 31 P31/SIN3
P00/AN00 51 30 P32/SOUT3
P107/AN7/KI3 52 29 P33
P106/AN6/KI2 53 M16C/29 Group (M16C/29) 28 P64/CTS1/RTS1/CTS0/CLKS1
P105/AN5/KI1 54 27 P65/CLK1
P104/AN4/KI0 55 26 P66/RxD1
P103/AN3
P102/AN2
56
57
PLQP0064KB-A 25
24
P67/TxD1
P70/TxD2/SDA2/TA0OUT/RTS1/CTS1/CTS0/CLKS1
P101/AN1 58 (64P6Q-A) 23 P71/RxD2/SCL2/TA0IN/CLK1
AVSS 59 22
P100/AN0 60 (top view) 21
P72/CLK2/TA1OUT/V/RxD1
P73/CTS2/RTS2/TA1IN/V/TxD1
VREF 61 20 P74/TA2OUT/W
AVCC 62 19 P75/TA2IN/W
P93/AN24/CTX 63 18 P76/TA3OUT
P92/AN32/TB2IN/CRX 64 17 P77/TA3IN
12
16
11
13
14
15
10
2
4
1
6
7
3
8
9
P85/NMI/SD
P84/INT2/ZP
P82/INT0
P90/AN30/TB0IN/CLKOUT
RESET
XOUT
VSS
VCC
P81/TA4IN/U
P87/XCIN
XIN
CNVSS
P80/TA4OUT/U
P83/INT1
P91/AN31/TB1IN
P86/XCOUT
NOTES:
1.Set bits PACR2 to PACR0 in the PACR register to "0102" before
signals are input or output to individual pins after reset. When the
PACR register is not set, signals are not input or output for some
b31 b15 b8 b7 b0
R2 R0H(R0's high bits) R0L(R0's low bits)
R3 R1H(R1's high bits)R1L(R1's low bits)
Data registers (Note)
R2
R3
A0
A1 Address registers (Note)
FB Frame base registers (Note)
b19 b15 b0
PC Program counter
b15 b0
b15 b0
FLG Flag register
b15 b8 b7
b b0
Carry flag
Debug flag
Zero flag
Sign flag
Register bank select flag
Overflow flag
Interrupt enable flag
Stack pointer select flag
Reserved area
Processor interrupt priority level
Reserved area
Note: These registers comprise a register bank. There are two register banks.
3. Memory
Figure 3.1 is a memory map of the M16C/29 Group. M16C/29 Group provides 1-Mbyte address space from
addresses 0000016 to FFFFF16. The internal ROM is allocated lower addresses beginning with address
FFFFF16. For example, 64-Kbytes internal ROM is allocated addresses F000016 to FFFFF16.
Two 2-Kbyte internal ROM areas, block A and block B, are available in the flash memory version. The
blocks are allocated addresses F00016 to FFFF16.
The fixed interrupt vector tables are allocated addresses FFFDC16 to FFFFF16. It stores the starting ad-
dress of each interrupt routine. See the section on interrupts for details.
The internal RAM is allocated higher addresses beginning with address 0040016. For example, 4-Kbytes
internal RAM is allocated addresses 0040016 to 013FF16. Besides sotring data, it becomes stacks when the
subroutines is called or an interrupt is acknowledged.
SFR, consisting of control registers for peripheral functions such as I/O port, A/D converter, serial I/O,
timers is allocated addresses 0000016 to 003FF16. All blank spaces within SFR are reserved and cannot be
accessed by users.
The special page vector table is allocated to the addresses FFE0016 to FFFDB16. This vector is used by the
JMPS or JSRS instruction. For details, refer to the M16C/60 and M16C/20 Series Software Manual.
0040016
Internal RAM
FFE0016
XXXXX16
Reserved Space
Special Page
0F00016
Internal ROM Vector Table
(data space)(1)
0FFFF16
NOTES:
1. The block A (2K bytes) and block B (2K bytes) are shown (only flash memory).
2. Do not write to the internal ROM area in Mask ROM ver..
Note 1: The blank areas are reserved and cannot be used by users.
Note 2: Bits CM20, CM21, and CM27 do not change at oscillation stop detection reset.
Note 3: This register does not change at software reset, watchdog timer reset and oscillation stop detection reset.
Note 4: This registe can not use for T-ver. and V-ver.
X : Undefined
Note 1: The blank areas are reserved and cannot be used by users.
Note 2: A/D conversion interrupt control register is effective when the bit1(Interrupt source select register ( address 35Eh IFSR2A)
is set to "0". Key input interrupt control register is effective when the bit1 is set to "1".
X : Undefined
Note 1: The blank areas are reserved and cannot be used by users.
X : Undefined
Note 1: The blank areas are reserved and cannot be used by users.
X : Undefined
Note 1: The blank areas are reserved and cannot be used by users.
X : Undefined
~ ~
01B316 Flash memory control register 4 (Note 2) FMR4 0100000X2
01B416
01B516 Flash memory control register 1 (Note 2) FMR1 000XXX0X2
01B616
01B716 Flash memory control register 0 (Note 2) FMR0 0116
~
~ ~
~
01FD16
01FE16
01FF16
Note 1: The blank areas are reserved and cannot be used by users.
Note 2: This register is included in the flash memory version.
X : Undefined
~ ~
024216 CAN0 acceptance filter support register C0AFS XX16
024316 XX16
~
~ ~
~
025A16 Three-phase protect control register TPRC 0016
025B16
025C16 On-chip oscillator control register ROCR 000001012
025D16 Pin assignment control register PACR 0016
025E16 Peripheral clock select register PCLKR 000000112
025F16 CAN0 clock select register CCLKR 0016
~
~ ~
~
02E016 I2C0 data-shift register S00 XX16
02E116
02E216 I2C0 address register S0D0 0016
02E316 I2C0 control register 0 S1D0 0016
02E416 I2C0 clock control register S20 0016
02E516 I2C0 start/stop condition control register S2D0 000110102
02E616 I2C0 control register 1 S3D0 001100002
02E716 I2C0 control register 2 S4D0 0016
02E816 I2C0 status register S10 0001000X2
~ ~
02FD16
02FE16
02FF16
Note 1: The blank areas are reserved and cannot be used by users.
X : Undefined
Note 1: The blank areas are reserved and cannot be used by users.
X : Undefined
Note 1: The blank areas are reserved and cannot be used by users.
Note 2: Write 0 to the bit 0 after reset.
X : Undefined
Note 1: The blank areas are reserved and cannot be used by users.
X : Undefined
Note 1: The blank areas are reserved and cannot be used by users.
X : Undefined
5. Resets
Hardware reset 1, brown-out detection reset (hardware reset 2), software reset, watchdog timer reset, and
oscillation stop detection reset are implemented to reset the MCU.
5.1 Hardware Reset
Hardware reset 1 and brown-out detection reset are available as the hardware reset.
5.1.1 Hardware Reset 1
____________
Pins, CPU, and SFRs are reset by using the RESET pin. When a low-level (“L”) signal is applied to the
____________
RESET pin while the supply voltage meets the recommended operating condition, pins, CPU, and SFRs
____________
are reset (see Table 5.1 Pin Status When RESET Pin Level is “L”). The oscillation circuit is also reset and
the on-chip oscillator starts oscillating as the CPU clock. CPU and SFRs re reset when the signal applied
____________
to the RESET pin changes from “L” to high (“H”). The MCU executes a program beginning with the
address indicated by the reset vector. The internal RAM is not reset. When an “L” signal is applied to the
____________
RESET pin while writing data to the internal RAM, the content of internal RAM is undefined.
Figure 5.1 shows an example of the reset circuit. Figure 5.2 shows a reset sequence. Table 5.1 shows
____________
status of the other pins while the RESET pin is held “L”. Figure 5.3 shows CPU register states after reset.
Refer to 4. Special Function Register (SFR) about SFR states after reset.
2. Power-on reset
____________
(1) Apply an “L” signal to the RESET pin
(2) Increase the supply voltage until it meets the the recommended performance condition
(3) Wait for td(P-R) or more to allow the internal power supply to stabilize
(4) Wait td(ROC) or more
____________
(5) Apply an “H” signal to the RESET pin
Pins, CPU, and SFR are reset by using the on-chip voltage detection circuit, which monitors the voltage
applied to VCC pin.
When the VC26 bit in the VCR2 register is set to 1 (reset level detection circuit enabled), pins, CPU, and
SFR are reset as soon as the voltage applied to the VCC pin drops to Vdet3 or below.
Then, pins, CPU, and SFR are reset as soon as the voltage applied to the VCC pin reaches Vdet3r or
above. The MCU executes the program in an address determined by the reset vector.
The MCU executes the program after detecting Vdet3r and waiting td(S-R) ms. The same pins and
registers are reset by the hardware reset 1 and brown-out detection reset, and are also placed in the
same reset state.
The MCU cannot exit stop mode by brown-out detection reset.
Recommended
operating
VCC voltage
0V
RESET VCC
RESET
Equal to or less Equal to or less
than 0.2VCC than 0.2VCC
0V
More than td(ROC) + td(P-R)
VCC
ROC
RESET
Max. 2 ms
CPU clock
Address FFFFE16
____________
Table 5.1 Pin Status When RESET Pin Level is “L”
P0 to P3,
Input port (high impedance)
P6 to P10
b15 b0
b19 b0
0000016 Interrupt table register(INTB)
Content of addresses FFFFE16 to FFFFC16 Program counter(PC)
b15 b0
b15 b0
AA
AAAAAA
b15
AA AA
AAAAAAAA
AA AA
A AAAAA
AA
AAAAAAAAAAA
IPL
A
b8 b7
U I O B S Z D C
b0
The voltage detection circuit has the reset level detection circuit and the low voltage detection circuit. The
reset level detection circuit monitors the voltage applied to the VCC pin. The MCU is reset if the reset level
detection circuit detects VCC is Vdet3 or below. Use bits VC27 and VC26 in the VCR2 register to determine
whether the individual circuit is enabled.
Use the reset level detection circuit for brown-out detection reset.
The low voltage detection circuit also monitors the voltage applied to the VCC pin. The low voltage detec-
tion circuit use the VC13 bit in the VCR1 register to detect VCC is above or below Vdet4. The low voltage
detection interrupt can be used in the voltage detection circuit.
VCR2 Register
RESET
b7 b6
Brown-out Detect Reset
(Hardware Reset 2
1 shot Release Wait Time)
Reset level td(S-R)
detection circuit >T
+ Q
>Vdet3
E
CM10 Bit=1
(Stop Mode) Internal Reset Signal
(“L” active)
VCC +
>Vdet4 Low Voltage
Noise Rejection
E Detect Signal
VCR1 Register
Low voltage b3
detection circuit
VC13 Bit
NOTES:
1. The VC13 bit is useful when the VC27 bit of VCR2 register is set to 1 (low voltage detection circuit enable).
The VC13 bit is always 1 (VCC≥ Vdet4) when the VC27 bit in the VCR2 register is set to 0 (low voltage
detection circuit disable).
2. This register does not change at software reset, watchdog timer reset and oscillation stop detection reset.
NOTES:
1. Write to this register after setting the PRC3 bit in the PRCR register to 1 (write enable).
2. Set the VC26 bit to 1 to use brown-out reset.
3. VC26 bit is disabled in stop mode. (The MCU is not reset even if the voltage input to Vcc pin becomes
lower than Vdet3.)
4. When the VC13 bit in the VCR1 register and D42 bit in the D4INT register are used or the D40 bit is set
to 1 (low voltage detection interrupt enable), set the VC27 bit to 1.
5. This register does not change at software reset, watchdog timer reset and oscillation stop detection
reset.
6. The detection circuit does not start operation until td(E-A) elapses after the VC26 bit or VC27 bit is set
to 1.
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
D4INT 001F16 0016
D41 STOP mode deactivation 0: Disable (do not use the low
control bit (4) voltage detection interrupt to exit
stop mode)
1: Enable (use the low voltage RW
detection interrupt to exit stop
mode)
b5b4
DF0 Sampling clock select bit RW
00 : CPU clock divided by 8
01 : CPU clock divided by 16
10 : CPU clock divided by 32
DF1 RW
11 : CPU clock divided by 64
5.0V 5.0V
Vdet4
Vdet3r
VCC Vdet3
Vdet3s
VSS
RESET
VC13 bit in
Undefined
VCR1 register
Set to 1 by program (reset level detect circuit enable)
VC26 bit in Undefined
VCR2 register (1) Set to 1 by program
(low voltage detection circuit enable)
VC27 bit in Undefined
VCR2 register
NOTES :
1. VC26 bit is invalid in stop mode. (the MCU is not reset even if input voltage of VCC pin
becomes lower than Vdet3).
DF1, DF0
002
012 D42 bit is set to 0 (not detected) by
writing a 0 in a program. VC27 bit is
Low voltage detection circuit 102
set to 0 (low voltage detection circuit
D4INT clock(the 112 disabled), the D42 bit is set to 0.
1/8 1/2 1/2 1/2
VC27 clock with which it
operates also in
wait mode)
VC13 Watchdog
D42 timer interrupt
VCC + Noise signal
Noise rejection Digital
Vref rejection Low voltage detection circuit filter
-
signal
(Rejection wide:200 ns)
D40
Watchdog timer
underflow signal This bit is set to 0 (not detected) by writing a 0 by program.
VCC
VC13 bit
D42 bit
Set to 0 by Set to 0 by a
program (not program (not
detected) detected)
NOTES:
1. D40 bit in the D4INT register is set to 1 (low voltage detection interrupt enabled).
2. Output of the digital filter shown in Figure 5.8.
Figure 5.9 Low voltage Detection Interrupt Generation Circuit Operation Example
Set the CM10 bit to 1 when the VC13 bit is set to set to 0 (VCC < Vdet4), if the MCU is configured to enter
stop mode when voltage applied to the VCC pin drops Vdet4 or below and to exit stop mode when the
voltage applied rises to Vdet4 or above.
Execute the WAIT instruction when the VC13 bit is set to set to 0 (VCC < Vdet4), if the MCU is configured
to enter wait mode when voltage applied to the VCC pin drops Vdet4 or below and to exit wait mode when
the voltage applied rises to Vdet4 or above.
6. Processor Mode
The MCU supports single-chip mode only. Figures 6.1 and 6.2 show the associated registers.
NOTES:
1. Set the PM0 register after the PRC1 bit in the PRCR register is set to 1 (write enable).
NOTES:
1. Rewrite the PM1 register after the PRC1 bit in the PRCR register is set to 1 (write enable).
2. To access the two 2K-byte data spaces in data block A and data block B, set the PM10 bit to 1. The PM10
bit is not available in mask version.
3. When the FMR01 bit in the FMR0 register is set to 1 (enables CPU rewrite mode), the PM10 bit is
automatically set to 1.
4. Set the PM12 bit to 1 by program. (Writing 0 by program has no effect)
5. When the PM17 bit is set to 1 (wait state), one wait is inserted when accessing the internal RAM or the
internal ROM.
NOTES:
1. Write to this register after setting the PRC1 bit in the PRCR register to 1 (write enable).
2. The PM20 bit becomes effective when PLC07 bit in the PLC0 register is set to 1 (PLL on). Change the PM20
bit when the PLC07 bit is set to 0 (PLL off). Set the PM20 bit to 0 (2 waits) when PLL clock > 16MHz.
3. Once this bit is set to 1, it cannot be cleared to 0 by program.
4. Writting to the following bits has no effect when the PM21 bit is set to 1:
CM02 bit in the CM0 register
CM05 bit in the CM0 register (main clock is not halted)
CM07 bit in the CM0 register (CPU clock source does not change)
CM10 bit in the CM1 register (stop mode is not entered)
CM11 bit in the CM1 register (CPU clock source does not change)
CM20 bit in the CM2 register (oscillation stop, re-oscillation detection function settings do not change)
All bits in the PLC0 register (PLL frequency synthesizer setting do not change)
Do not execute WAIT instruction when the PM21 bit is set to 1.
5. Setting the PM22 bit to 1 results in the following conditions:
• The on-chip oscillator continues oscillating even if the CM21 bit in the CM2 register is set to "0" (main clock or
PLL clock) (system clock of count source selected by the CM21 bit is valid)
• The on-chip oscillator starts oscillating, and the on-chip oscillator clock becomes the watchdog timer
count source.
• The CM10 bit in the CM1 register cannnot be written. (Writing 1 has no effect, stop mode is not entered.)
• The watchdog timer does not stop in wait mode.
6. For NMI function, the PM24 bit must be set to 1(NMI function). Once this bit is set to 1, it cannot be set to 0 by
program.
7. SD input is valid regardless of the PM24 setting.
The internal bus consists of CPU bus, memory bus, and peripheral bus. Bus Interface Unit (BIU) is used to
interfere with CPU, ROM/RAM, and perpheral functions by controling CPU bus, memory bus, and periph-
eral bus. Figure 6.3 shows the block diagram of the internal bus.
ROM RAM
CPU BIU
Memory address bus
DMAC
Timer
WDT
CPU clock
Peripheral address bus
Serial I/O
Peripheral function
Periphral data bus
Clock ADC
SFR
I/O
The number of bus cycle varies by the internal bus. Table 6.1 lists the accessible area and bus cycle.
Table 7.1 lists the specifications of the clock generation circuit. Figure 7.1 shows the clock generation
circuit. Figures 7.2 to 7.7 show clock-associated registers.
CCLK2-CCLK0=0002
CCLK2-CCLK0=0012
CCLK2-CCLK0=0102 fCAN
CCLK2-CCLK0=0112
CCLK2-CCLK0=1002
CAN module
system clock
divider
Oscillation f1SIO
stop, re- PCLK1=1
oscillation
detection f2SIO
PCLK1=0
circuit
f8SIO
CM10=1(stop mode) S Q PLL
XIN XOUT frequency f32SIO
R
synthesizer e b c
a d CM07=0 D4INT clock
PLL CM21=1
clock
e
Main 1 CPU clock
clock
Main clock 0 CM21=0 fC
generating circuit CM11
CM05 CM07=1
BCLK
CM02
S Q
WAIT instruction R
e b c
a 1/2 1/2 1/2 1/2 1/2
1/32
RESET 1/2 1/4 1/8 1/16
Software reset CM06=0
CM17, CM16=112
NMI CM06=1
CM06=0
Interrupt request level judgment output CM17, CM16=102
d
CM06=0
CM00, CM01, CM02, CM04, CM05, CM06, CM07: Bits in the CM0 register CM17, CM16=012
CM10, CM11, CM16, CM17: Bits in the CM1 register
PCLK0, PCLK1, PCLK5: Bits in the PCLKR register CM06=0
CM21, CM27: Bits in the CM2 register CM17, CM16=002 Details of divider
ROCR1, ROCR0=002
f1(ROC)
Reset
Pulse generation CM27=0 generating Oscillation stop
circuit for clock Charge, circuit detection reset
Main discharge f2(ROC) 1/2 1/2 1/2
edge detection ROCR1,ROCR0=012
clock and charge, circuit
Oscillation stop, Oscillation stop, 1/2 1/4 1/8
discharge control re-oscillation re-oscillation
CM27=1 ROCR3, ROCR2=112
detection interrupt detection signal f3(ROC)
ROCR1, ROCR0=112
generating circuit ROCR3, ROCR2=102
On-chip
ROCR3, ROCR2=012 oscillator
CM21 switch signal clock
Programmable
Voltage 1/2 PLL clock
counter
Phase Charge control
comparator pump oscillator
(VCO)
Main clock
Internal low-
pass filter
CM02 Wait Mode peripheral function 0: Do not stop peripheral function clock in wait mode
clock stop bit (10) 1: Stop peripheral function clock in wait mode (8) RW
XCIN-XCOUT drive capacity 0: LOW
CM03 RW
select bit (2) 1: HIGH
Port XC select bit (2) 0: I/O port P8 6, P87
CM04
1: XCIN-XCOUT generation function(9)
RW
Main clock stop bit 0: On (4)
CM05 (3, 10, 12, 13) (5) RW
1: Off
CM07 System clock select bit 0: Main clock, PLL clock, or on-chip oscillator clock
(6, 10, 11, 12) 1: Sub-clock
RW
NOTES:
1. Write to this register after setting the PRC0 bit in the PRCR register to 1 (write enable).
2. The CM03 bit is set to 1 (high) when the CM04 bit is set to 0 (I/O port) or the MCU goes to a stop mode.
3. This bit is provided to stop the main clock when the low power dissipation mode or on-chip oscillator low power dissipation mode
is selected. This bit cannot be used for detection as to whether the main clock stopped or not. To stop the main clock, the
following setting is required:
(1) Set the CM07 bit to 1 (Sub-clock select) or the CM21 bit in the CM2 register to 1 (on-chip oscillator select) with the sub-
clock stably oscillating.
(2) Set the CM20 bit in the CM2 register to 0 (Oscillation stop, re-oscillation detection function disabled).
(3) Set the CM05 bit to 1 (Stop).
4. During external clock input, set the CM05 bit to 0 (On).
5. When CM05 bit is set to 1, the XOUT pin goes "H". Futhermore, because the internal feedback resistor remains connectes,
the XIN pin is pulled "H" to the same level as XOUT via the feedback resistor.
6. After setting the CM04 bit to 1 (XCIN-XCOUT oscillator function), wait until the sub-clock oscillates stably before switching
the CM07 bit from 0 to 1 (sub-clock).
7. When entering stop mode from high or middle speed mode, on-chip oscillator mode or on-chip oscillator low power mode, the
CM06 bit is set to 1 (divided-by-8 mode).
8. The fC32 clock does not stop. During low speed or low power dissipation mode, do not set this bit to 1(peripheral clock turned
off in wait mode).
9. To use a sub-clock, set this bit to 1. Also, make sure ports P86 and P87 are directed for input, with no pull-ups.
10. When the PM21 bit in the PM2 register is set to 1 (clock modification disable), writing to bits CM02, CM05, and CM07 has
no effect.
11. If the PM21 bit needs to be set to 1, set the CM07 bit to 0 (main clock) before setting it.
12. To use the main clock a the clock source for the CPU clock, follow the procedure below.
(1) Set the CM05 bit to 0 (oscillate).
(2) Wait the main clock oscillation stabilized.
(3) Set all bits CM11, CM21, and CM07 to 0.
13. When the CM21 bit is set to 0 (on-chip oscillaor turned off) and the CM05 bit is set to 1 (main clock turned off), the CM06 bit
is fixed to 1 (divide-by-8 mode) and the CM15 bit is fixed to 1 (drive capability High).
14. To return from on-chip oscillator mode to high-speed or middle-speed mode set both bits CM06 and CM15 to 1.
0 0 0
Symbol Address After Reset
CM1 0007 16 00100000 2
NOTES:
1. Write to this register after setting the PRC0 bit in the PRCR register to 1 (write enable).
2. When entering stop mode from high or middle speed mode, or when the CM05 bit is set to 1 (main clock
turned off) in low speed mode, the CM15 bit is set to 1 (drive capability high).
3. Effective when the CM06 bit is 0 (bits CM16 and CM17 enable).
4. If the CM10 bit is 1 (stop mode), XOUT goes “H” and the internal feedback resistor is disconnected. The XCIN
and XCOUT pins are placed in the high-impedance state. When the CM11 bit is set to 1 (PLL clock), or the
CM20 bit in the CM2 register is set to 1 (oscillation stop, re-oscillation detection function enabled), do not set
the CM10 bit to 1.
5. After setting the PLC07 bit in the PLC0 register to 1 (PLL operation), wait until tsu (PLL) elapses before setting
the CM11 bit to 1 (PLL clock).
6. When the PM21 bit in the PM2 register is set to 1 (clock modification disable), writing to bits CM10, CM11 has
no effect. When the PM22 bit in the PM2 register is set to 1 (watchdog timer count source is on-chip oscillator
clock), writing to the CM10 bit has no effect.
7. Effective when CM07 bit is 0 and CM21 bit is 0 .
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
0 0 0 ROCR 025C 16 X0000101 2
NOTE:
1. Write to this register after setting the PRC0 bit in the PRCR register to 1 (write enable).
NOTES:
1. Write to this register after setting the PRC0 bit in the PRCR register to 1 (write enable).
2. When the CM20 bit is 1 (oscillation stop, re-oscillation detection function enabled), the CM27 bit is set to 1
(oscillation stop, re-oscillation detection interrupt), and the CPU clock source is the main clock, the CM21 bit is
automatically set to 1 (on-chip oscillator clock) if the main clock stop is detected.
3. If the CM20 bit is set to 1 and the CM23 bit is set to 1 (main clock not oscillating), do not set the CM21 bit to 0.
4. This flag is set to 1 when the main clock is detected to have stopped or when the main clock is detected
to have restarted oscillating. When this flag changes state from 0 to 1, an oscillation stop, reoscillation restart
detection interrupt is generated. Use this flag in an interrupt routine to discriminate the causes of interrupts
between the oscillation stop, reoscillation detection interrupts and the watchdog timer interrupt. The flag is
cleared to 0 by writing 0 by program. (Writing 1 has no effect. Nor is it cleared to 0 by an oscillation stop or an
oscillation restart detection interrupt request acknowledged.) If when the CM22 bit is set to 1 an oscillation
stoppage or an oscillation restart is detected, no oscillation stop, reoscillation restart detection interrupts are
generated.
5. Read the CM23 bit in an oscillation stop, re-oscillation detection interrupt handling routine to determine the
main clock status.
6. Effective when the CM07 bit in the CM0 register is set to 0.
7. When the PM21 bit in the PM2 register is 1 (clock modification disabled), writing to the CM20 bit has no effect.
8. When the CM20 bit is set to 1 (oscillation stop, re-oscillation detection function enabled), the CM27 bit is set 1
(oscillation stop, re-oscillation detection interrupt), and the CM11 bit is 1 (the CPU clock source is PLL clock),
the CM21 bit remains unchanged even when main clock stop is detected. If the CM22 bit is set to 0 under
these conditions, oscillation stop, re-oscillation detection interrupt occur at main clock stop detection; it is,
therefore, necessary to set the CM21 bit to 1 (on-chip oscillator clock) inside the interrupt routine.
9. Set the CM20 bit to 0 (disable) before entering stop mode. After exiting stop mode, set the CM20 bit back to 1
(enable).
10. Set the CM20 bit to 0 (disable) before setting the CM05 bit in the CM0 register.
11. Bits CM20, CM21 and CM27 do not change at oscillation stop detection reset.
12. When the CM21 bit is set to 0 (on-chip oscillator turned off) and the CM05 bit is set to 1 (main clock turned
off), the CM06 bit is fixed to 1 (divide-by-8 mode) and the CM15 bit is fixed to 1 (drive capability High).
NOTE:
1. Write to this register after setting the PRC0 bit in PRCR register to 1 (write enable).
NOTES:
1. Write to this register after setting the PRC1 bit in the PRCR register to 1 (write enable).
2. The PM20 bit becomes effective when PLC07 bit in the PLC0 register is set to 1 (PLL on). Change the PM20
bit when the PLC07 bit is set to 0 (PLL off). Set the PM20 bit to 0 (2 waits) when PLL clock > 16MHz.
3. Once this bit is set to 1, it cannot be cleared to 0 by program.
4. Writting to the following bits has no effect when the PM21 bit is set to 1:
CM02 bit in the CM0 register
CM05 bit in the CM0 register (main clock is not halted)
CM07 bit in the CM0 register (CPU clock source does not change)
CM10 bit in the CM1 register (stop mode is not entered)
CM11 bit in the CM1 register (CPU clock source does not change)
CM20 bit in the CM2 register (oscillation stop, re-oscillation detection function settings do not change)
All bits in the PLC0 register (PLL frequency synthesizer setting do not change)
Do not execute WAIT instruction when the PM21 bit is set to 1.
5. Setting the PM22 bit to 1 results in the following conditions:
• The on-chip oscillator continues oscillating even if the CM21 bit in the CM2 register is set to "0" (main clock or
PLL clock) (system clock of count source selected by the CM21 bit is valid)
• The on-chip oscillator starts oscillating, and the on-chip oscillator clock becomes the watchdog timer
count source.
• The CM10 bit in the CM1 register cannnot be written. (Writing 1 has no effect, stop mode is not entered.)
• The watchdog timer does not stop in wait mode.
6. For NMI function, the PM24 bit must be set to 1(NMI function). Once this bit is set to 1, it cannot be set to 0 by
program.
7. SD input is valid regardless of the PM24 setting.
Bit
Symbol Bit Name Function RW
0: PLL Off
PLC07 Operation enable bit (4) RW
1: PLL On
NOTES:
1. Write to this register after setting the PRC0 bit in the PRCR register to 1 (write enable).
2. When the PM21 bit in the PM2 register is 1 (clock modification disable), writing to this register has no effect.
3. These three bits can only be modified when the PLC07 bit is set to 0 (PLL turned off). The value once written to
this bit cannot be modified.
4. Before setting this bit to 1 , set the CM07 bit to 0 (main clock), set bits CM17 to CM16 bits to 002 (main
clock undivided mode), and set the CM06 bit to 0 (CM16 and CM17 bits enable).
CCLK0 0 0 0 No division RW
0 0 1: Divide-by-2
0 1 0: Divide-by-4
CCLK1 CAN0 clock select bits(2) 0 1 1: Divide-by-8 RW
1 0 0: Divide-by-16
1 0 1:
CCLK2 1 1 0: Inhibited
RW
1 1 1:
CAN0 CPU interface 0: CAN0 CPU interface operating
CCLK3 sleep bit(3) RW
1: CAN0 CPU interface in sleep
NOTES:
1. Write to this register after setting the PRC0 bit in the PRCR register to 1 (write enable).
2. Configuration of bits CCLK2 to CCLK0 can be done only when the Reset bit in the C0CTLR register is set to 1
(Reset/Initialization mode).
3. Before setting this bit to 1(CAN0 CPU interface in sleep), set the Sleep bit in C0CTLR register to 1 (Sleep
mode).
The following describes the clocks generated by the clock generation circuit.
MCU MCU
(Built-in Feedback Resistor) (Built-in Feedback Resistor)
CIN
XIN XIN External Clock
Oscillator VCC
VSS
XOUT
Rd(1) COUT
NOTE:
1. Insert a damping resistor if required. Resistance value varies depending on the oscillator setting.
Use resistance value recommended by the oscillator manufacturer. If the oscillator manufacturer
recommends that a feedback resistor be added to the chip externally, insert a feedback resistor
between XIN and XOUT.
2. The external clock should not be stopped when it is connected to the XIN pin and the main clock is
selected as the CPU clock.
MCU MCU
(Built-in Feedback Resistor) (Built-in Feedback Resistor)
CCIN
XCIN XCIN External Clock
Oscillator VCC
VSS
XCOUT
RCd(1) CCOUT
NOTE:
1. Place a damping resistor if required. Resistance values vary depending on the oscillator setting.
Use values recommended by each oscillator manufacturer.
Place a feedback resistor between XCIN and XCOUT if the oscillator manufacturer recommends
placing the resistor externally.
NOTE:
1. 10MHz ≤ PLL clock frequency ≤ 20MHz.
START
Set the CM07 bit to 0 (main clock), bits CM17 and CM16 to
002(main clock undivided), and the CM06 bit to 0
(bits CM17 and CM16 enabled). (1)
Set the CM11 bit to 1 (PLL clock for the CPU clock source).
END
NOTE:
1. PLL operation mode can be entered from high speed mode.
7.5.2 Peripheral Function Clock(f1, f2, f8, f32, f1SIO, f2SIO, f8SIO, f32SIO, fAD, fC32, fCAN0)
These are operating clocks for the peripheral functions.
Of these, fi (i = 1, 2, 8, 32) and fiSIO are derived from the main clock, PLL clock, or on-chip oscillator clock
divided by i. The clock fi is used for Timer A, Timer B, SI/O3 and SI/O4 while fiSIO is used for UART0 to
UART2. Additionally, the f1 and f2 clocks are also used for dead time timer, Timer S, multi-master I2C bus.
The fAD clock is produced from the main clock, PLL clock or on-chip oscillator clock, and is used for the A/
D converter.
The fCAN0 clock is derived from the main clock, PLL clock or on-chip oscillator clock devided by 1 (undi-
vided), 2, 4, 8, or 16, and is used for the CAN module.
When the WAIT instruction is executed after setting the CM02 bit in the CM0 register to 1 (peripheral
function clock turned off during wait mode), or when the MCU is in low power dissipation mode, the fi, fiSIO,
fAD, and fCAN0 clocks are turned off. (Note 1)
The fC32 clock is produced from the sub clock, and is used for timers A and B. This clock can only be used
when the sub clock is on.
Note 1: fCAN0 clock stops at "H" in CAN0 sleep mode.
To use peripheral function interrupts to exit wait mode, set the followings before executing the WAIT
instruction.
1. Set the interrupt priority level to the bits ILVL2 to ILVL0 in the interrupt control register of the periph-
eral function interrupts that are used to exit wait mode. Also, set bits ILVL2 to ILVL0 of all peripheral
function interrupts that are not used to exit wait mode to 0002 (interrupt disabled).
2. Set the I flag to 1.
3. Operate the peripheral functions that are used to exit wait mode.
When the peripheral function interrupts are used to exit wait mode, an interrupt routine is executed
after an interrupt request is generated and the CPU is clocked.
The CPU clock used when exiting wait mode by a peripheral function interrupt is the same CPU clock
that is used when executing the WAIT instruction.
______
Which CPU clock will be used after exiting stop mode by a peripheral function or NMI interrupt is deter-
mined by the CPU clock that was on when the MCU was placed into stop mode as follows:
If the CPU clock before entering stop mode was derived from the sub clock: sub clock
If the CPU clock before entering stop mode was derived from the main clock: main clock divide-by-8
If the CPU clock before entering stop mode was derived from the on-chip oscillator clock: on-chip oscil-
lator clock divide-by-8
Figure 7.11 shows the state transition from normal operation mode to stop mode and wait mode. Figure
7.12 shows the state transition in normal operation mode.
Table 7.7 shows a state transition matrix describing allowed transition and setting. The vertical line
shows current state and horizontal line shows state after transition.
PLL operation
mode
WAIT
CM10=1 (6) instruction
Stop mode Low-speed mode Wait mode
Interrupt Interrupt
(7)
WAIT
CM10=1 (6) instruction
Stop mode Low power dissipation mode Wait mode
Interrupt Interrupt
CM21=0 CM21=1
WAIT
CM10=1 (6) instruction
Stop mode On-chip oscillator low power
Wait mode
dissipation mode
Interrupt (4) Interrupt
On-chip oscillator
mode (f 2(ROC)/16)
: Arrow shows mode can be changed. Do not change mode to another mode when no arrow is shown.
NOTES:
1. Do not go directly from PLL operation mode to wait or stop mode.
2. PLL operation mode can be entered from high speed mode. Similarly, PLL operation mode can be changed back to high speed mode.
3. When the PM21 bit is set to 0 (system clock protective function unused).
4. The on-chip oscillator clock divided by 8 provides the CPU clock.
5. Write to the CM0 register and CM1 register simultaneously by accessing in word units while CM21 bit is set to 0 (on-chip oscillator
turned off). When the clock generated externally is input to the XCIN pin, transit to stop mode with this process.
6. Before entering stop mode, be sure to clear the CM20 bit in the CM2 register to 0 (oscillation stop and oscillation restart detection
function disabled).
7. The CM06 bit is set to 1 (divide-by-8).
On-chip oscillator
PLL operation On-chip oscillator low power
Middle-speed mode Middle-speed mode Middle-speed mode Middle-speed mode
mode mode dissipation mode
PLC07=1 High-speed mode (divide by 2) (divide by 4) (divide by 8) (divide by 16)
CPU clock: f(PLL) CM11=1 CM21=0 CPU clock CPU clock
(5) CPU clock: f(XIN) CPU clock: f(XIN)/2 CPU clock: f(XIN)/4 CPU clock: f(XIN)/8 CPU clock: f(XIN)/16 (2, 6) CM05=0
M
M0
CM07=0 f(ROC) f(ROC)
CM07=0 CM07=0 CM07=0 CM07=0 f(ROC)/2 f(ROC)/2
CM06=0 CM07=0
CM06=0 CM06=0 CM06=0 CM06=0 f(ROC)/4 f(ROC)/4
CM17=0 PLC07=0 f(ROC)/8 f(ROC)/8
CM17=0 CM17=0 CM17=1 CM17=1
CM16=0 CM11=0 CM06=1 CM21=1 f(ROC)/16 f(ROC)/16
(5) CM16=0 CM16=1 CM16=0 CM16=1
CM05=1
(1)
Low-speed
Low-speed mode CM21=0 mode
CM05=1 CM05=0
(1, 7)
: Arrow shows mode can be changed. Do not change mode to another mode when no arrow is shown.
NOTES:
1. Avoid making a transition when the CM20 bit is set to 1 (oscillation stop, re-oscillation detection function enabled).
Set the CM20 bit to 0 (oscillation stop, re-oscillation detection function disabled) before transiting.
2. Wait for the main clock oscillation stabilization time before switching over. Set the CM15 bit in the CM1 register to 1 (drive capacity High) until main clock oscillation is stabilized.
3. Switch clock after oscillation of sub-clock is sufficiently stable.
4. Change bits CM17 and CM16 before changing the CM06 bit.
5. The PM20 bit in the PM2 register becomes effective when the PLC07 bit in the PLC0 register is set to 1 (PLL on). Change the PM20 bit when the PLC07 bit is set to 0 (PLL off).
Set the PM20 bit to 0 (2 waits) when PLL clock > 16MHz.
6. Set the CM06 bit to 1 (division by 8 mode) before changing back the operation mode from on-chip oscillator mode to high- or middle-speed mode.
7. When the CM21 bit is set to 0 (on-chip oscillator turned off) and the CM05 bit is set to 1 (main clock turned off), the CM06 bit is fixed to 1 (divide-by-8 mode) and the
CM15 bit is fixed to 1 (drive capability High).
Setting Operation
CM04, CM05, CM06, CM07 : Bits in the CM0 register
(1) CM04 = 0 Sub clock turned off CM10, CM11, CM16, CM17 : Bits in the CM1 register
CM20, CM21 : Bits in the CM2 register
(2) CM04 = 1 Sub clock oscillating PLC07 : Bit in the PLC0 register
(3) CM06 = 0,
CM17 = 0 , CM16 = 0 CPU clock no division mode
CM06 = 0,
(4) CM17 = 0 , CM16 = 1
CPU clock division by 2 mode
CM06 = 0,
(5) CM17 = 1 , CM16 = 0
CPU clock division by 4 mode
CM06 = 0,
(6) CM17 = 1 , CM16 = 1
CPU clock division by 16 mode
Before the system clock protective function can be used, the following register settings must be made while
the CM05 bit in the CM0 register is 0 (main clock oscillating) and CM07 bit is 0 (main clock selected for the
CPU clock source):
(1) Set the PRC1 bit in the PRCR register to 1 (enable writes to PM2 register).
(2) Set the PM21 bit in the PM2 register to 1 (disable clock modification).
(3) Set the PRC1 bit in the PRCR register to 0 (disable writes to PM2 register).
Do not execute the WAIT instruction when the PM21 bit is 1.
Table 7.8 Specification Overview of Oscillation Stop and Re-oscillation Detect Function
Item Specification
Oscillation stop detectable clock and f(XIN) ≥ 2 MHz
frequency bandwidth
Enabling condition for oscillation stop, Set CM20 bit to 1(enable)
re-oscillation detection function
Operation at oscillation stop, •Reset occurs (when CM27 bit =0)
re-oscillation detection •Oscillation stop, re-oscillation detection interrupt occurs(when CM27 bit =1)
When the PLL clock corresponds to the CPU clock source and the CM20 bit is 1, the system is placed in
the following state if the main clock comes to a halt: Since the CM21 bit remains unchanged, set it to 1
(on-chip oscillator clock) inside the interrupt routine.
• Oscillation stop and re-oscillation detect interrupt request occurs.
• CM22 bit = 1 (main clock stop detected)
• CM23 bit = 1 (main clock stopped)
• CM21 bit remains unchanged
When the CM20 bit is 1, the system is placed in the following state if the main clock re-oscillates from the
stop condition:
• Oscillation stop and re-oscillation detect interrupt request occurs.
• CM22 bit = 1 (main clock re-oscillation detected)
• CM23 bit = 0 (main clock oscillation)
• CM21 bit remains unchanged
Yes
NOTE:
1. If the clock source for CPU clock is to be changed to PLL clock, set to PLL operation
mode after set to high-speed mode.
Figure 7.13 Procedure to Switch Clock Source From On-chip Oscillator to Main Clock
8. Protection
In the event that a program runs out of control, this function protects the important registers so that they will
not be rewritten easily. Figure 8.1 shows the PRCR register. The following lists the registers protected by
the PRCR register.
• Registers protected by the PRC0 bit: CM0, CM1, CM2, PLC0, ROCR, PCLKR, and CCLKR
• Registers protected by the PRC1 bit: PM0, PM1, PM2, TB2SC, INVC0, and INVC1
• Registers protected by the PRC2 bit: PD9 , PACR, S4C, and NDDR
• Registers protected by the PRC3 bit: VCR2 and D4INT
The PRC2 bit is set to 0 (write enabled) when data is written to the SFR area after setting the PRC2 bit to 1
(write enable). Set registers PD9, PACR, S4C and NDDR immediately after setting the PRC2 bit in the
PRCR register to 1 (write enable). Do not generate an interrupt or a DMA transfer between the instruction
to set the PRC2 bit to 1 and the following instruction. Bits PRC3, PRC1, and PRC0 are not set to 0 even if
data is written to the SFR area. Set bits PRC3, PRC1, and PRC0 to 0 by program.
Protect Register
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
0 0 PRCR 000A16 XX0000002
NOTE:
1. The PRC2 bit is set to 0 when writing into the SFR area after the PRC2 bit is set to 1. Bits
PRC0, PRC1, and PRC3 are not automatically set to 0. Set them to 0 by program.
9. Interrupts
Note
The SI/O4 interrupt of peripheral function interrupts is not available in the 64-pin package.
The low voltage detection function is not available in M16C/29 T-ver. and V-ver..
Undefined instruction (UND instruction)
Software Overflow (INTO instruction)
(Non-maskable interrupt)
BRK instruction
INT instruction
_______
NMI
Interrupt
________
DBC (2)
Watchdog timer
Special Oscillation stop and re-oscillation
(Non-maskable interrupt) detection
Hardware
Low voltage detection
Single step (2)
Address match
Peripheral function (1)
(Maskable interrupt)
NOTES:
1. Peripheral function interrupts are generated by the MCU's internal functions.
2. Do not normally use this interrupt because it is provided exclusively for use by development
tools.
Figure 9.1 Interrupts
• Maskable Interrupt: An interrupt which can be enabled (disabled) by the interrupt enable flag (I flag) or
whose interrupt priority can be changed by priority level.
• Non-maskable Interrupt: An interrupt which cannot be enabled (disabled) by the interrupt enable flag
(I flag) or whose interrupt priority cannot be changed by priority level.
_______
9.1.2.1.1 NMI Interrupt
_______ _______
An NMI interrupt is generated when input on the NMI pin changes state from high to low. For details
_______
about the NMI interrupt, refer to the section "NMI interrupt".
________
9.1.2.1.2 DBC Interrupt
This interrupt is exclusively for debugger, do not use in any other circumstances.
MSB LSB
Vector address (L) Low address
Mid address
NOTES:
1. Address relative to address in INTB.
2. These interrupts cannot be disabled using the I flag.
3. Set the IFSR22 bit in the IFSR register to 0.
4. Use bits IFSR26 and IFSR27 in the IFSR2A register to select.
5. Use bits IFSR6 and IFSR7 in the IFSR register to select.
6. Bus collision detection: In IEBus mode, this bus collision detection constitutes the cause of an interrupt. In I2C bus
mode, however, a start condition or a stop condition detection constitutes the cause of an interrupt.
7. Use the IFSR21 bit in the IFSR2A register to select.
8. During I2C bus mode, NACK and ACK interrupts comprise the interrupt source.
Also, the following interrupts share a vector and an interrupt control register.
________
•INT4 and SIO3
________
•INT5 and SIO4
•A/D converter and key input interrupt
•IC/OC base timer and SCL/SDA
•IC/OC interrupt 1 and I2C bus interface
An interrupt request is set by bits IFSR6 and IFSR7 in the IFSR register and bits IFSR27, IFSR26, and
IFSR21 in the IFSR2A register. Figure 9.4 shows registers IFSR register and IFSR2A.
NOTES:
1. This bit can only be reset by writing 0 (Do not write 1).
2. To rewrite the interrupt control registers, do so at a point that does not generate the interrupt request for that register.
For details, refer to 22. 4 Interrupts.
3. Use the IFSR2A register to select.
Symbol Address After reset
INT3IC 004416 XX00X0002
b b4 b3 b2 b1 b0 S4IC, INT5IC 004816 XX00X0002
0 S3IC, INT4IC 004916 XX00X0002
INT0IC to INT2IC 005D16 to 005F16 XX00X0002
NOTES:
1. This bit can only be reset by writing 0 (Do not write 1).
2. To rewrite the interrupt control register, do so at a point that does not generate the interrupt request for that
register. For details, refer to 22.4 Interrupts.
3. If the IFSRi bit in the IFSR register (i = 0 to 5) is 1 (both edges), set the POL bit in the INTiIC register to 0
(falling edge).
4. Set the POL bit in register S3IC or S4IC to 0 (falling edge) when the IFSR6 bit in the IFSR register is set to 0
(SI/O3 selected) or IFSR7 bit in the IFSR register to 0 (SI/O4 selected), respectively.
NOTES:
1. When setting this bit to 1 (both edges), make sure the POL bit in registers INT0IC to INT5IC is set to
0 (falling edge).
2. When setting this bit to 0 (SI/O3, SI/O4), make sure the POL bit in registers S3IC and S4IC is set to
0 (falling edge).
9.3.1 I Flag
The I flag enables or disables the maskable interrupt. Setting the I flag to 1 (= enabled) enables the
maskable interrupt. Setting the I flag to 0 (= disabled) disables all maskable interrupts.
9.3.2 IR Bit
The IR bit is set to 1 (= interrupt requested) when an interrupt request is generated. Then, when the
interrupt request is accepted and the CPU branches to the corresponding interrupt vector, the IR bit is
cleared to 0 (= interrupt not requested).
The IR bit can be cleared to 0 in a program. Note that do not write 1 to this bit.
The I flag, IR bit, bits ILVL2 to ILVL0, and IPL are independent of each other. In no case do they affect
one another.
Table 9.3 Settings of Interrupt Priority Table 9.4 Interrupt Priority Levels
Levels Enabled by IPL
0002 Level 0 (interrupt disabled) 0002 Interrupt levels 1 and above are enabled
0012 Level 1 Low 0012 Interrupt levels 2 and above are enabled
(1) The CPU gets interrupt information (interrupt number and interrupt request priority level) by reading
the address 0000016. Then it clears the IR bit for the corresponding interrupt to 0 (interrupt not
requested).
(2) The FLG register immediately before entering the interrupt sequence is saved to the CPU’s internal
temporary register(Note).
(3) The I, D and U flags in the FLG register become as follows:
The I flag is cleared to 0 (interrupts disabled).
The D flag is cleared to 0 (single-step interrupt disabled).
The U flag is cleared to 0 (ISP selected).
However, the U flag does not change state if an INT instruction for software interrupt Nos. 32 to 63 is
executed.
(4) The CPU’s internal temporary register(1) is saved to the stack.
(5) The PC is saved to the stack.
(6) The interrupt priority level of the accepted interrupt is set in the IPL.
(7) The start address of the relevant interrupt routine set in the interrupt vector is stored in the PC.
After the interrupt sequence is completed, the processor resumes executing instructions from the start
address of the interrupt routine.
NOTE:
1. This register cannot be used by user.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
CPU clock
RD Undefined(1)
WR(2)
NOTES:
1. The undefined state depends on the instruction queue buffer. A read cycle occurs when the instruction queue
buffer is ready to accept instructions.
2. When the stack is in the internal RAM, the WR signal indicates the write timing by changing high-level to low-level.
Time
(a) The time from when an interrupt request is generated till when the instruction then
executing is completed. The length of this time varies with the instruction being
executed. The DIVX instruction requires the longest time, which is equal to 30 cycles
(without wait state, the divisor being a register).
(b) The time during which the interrupt sequence is executed. For details, see the table
below. Note, however, that the values in this table must be increased 2 cycles for the
DBC interrupt and 1 cycle for the address match and single-step interrupts.
Table 9.5 IPL Level That is Set to IPL When A Software or Special Interrupt Is Accepted
Interrupt sources IPL setting
_______
Watchdog timer, NMI, Oscillation stop and re-oscillation detection, Low volage detection 7
_________
Software, address match, DBC, single-step No change
[SP]
m–4 m–4 PCL New SP value
Stack status before interrupt request Stack status after interrupt request
is acknowledged is acknowledged
Figure 9.7 Stack Status Before and After Acceptance of Interrupt Request
The operation of saving registers carried out in the interrupt sequence is dependent on whether the SP(1),
at the time of acceptance of an interrupt request, is even or odd. If the stack pointer (1) is even, the FLG
register and the PC are saved, 16 bits at a time. If odd, they are saved in two steps, 8 bits at a time.
Figure 9.8 shows the operation of the saving registers.
NOTE:
1. When any INT instruction in software numbers 32 to 63 has been executed, this is the SP indicated
by the U flag. Otherwise, it is the ISP.
[SP] – 5 (Odd)
[SP] (Even)
Finished saving registers
in two operations.
[SP] – 5 (Even)
[SP] (Odd)
Finished saving registers
in four operations.
NOTE:
1. [SP] denotes the initial value of the SP when interrupt request is acknowledged.
After registers are saved, the SP content is [SP] minus 4.
Reset High
NMI
DBC
Single step
Low
Address match
Timer B2
Timer B0
Timer A3
Timer A1
INT3
INT2
INT0
Timer B1
Timer A4
Timer A2
ICOC interrupt 0
UART1 reception
UART0 reception
DMA1
Priority of peripheral function interrupts
(if priority levels are same)
UART 2 bus collision
SI/O4, INT5
Timer A0
UART1 transmission
UART0 transmission
CAN 0 error
DMA0
SI/O3, INT4
CAN 0 transmission
CAN 0 reception
Lowest
CAN 0 wakeup
I flag Interrupt
request
Address match accepted
Watchdog timer
DBC
NMI
______
9.6 INT Interrupt
_______
INTi interrupt (i=0 to 5) is triggered by the edges of external inputs. The edge polarity is selected using the
IFSRi bit in the IFSR register.
________
The INT5 input has an effective digital debounce function for a noise rejection. Refer to "19.6 Digital
________
Debounce function" for this detail. When using INT5 interrupt to exit stop mode, set the P17DDR register
to FF16 before entering stop mode.
________ ________ ________
To use the INT4 interrupt, set the IFSR6 bit in the IFSR register to 1 (INT4). To use the INT5 interrupt, set
________
the IFSR7 bit in the IFSR register to 1 (INT5).
After modifiying bit IFSR6 or IFSR7, clear the corresponding IR bit to 0 (interrupt not requested) before
enabling the interrupt.
Figure 9.11 shows the IFSR registers.
NOTES:
1. When setting this bit to 1 (both edges), make sure the POL bit in registers INT0IC to INT5IC is set to
0 (falling edge).
2. When setting this bit to 0 (SI/O3, SI/O4), make sure the POL bit in registers S3IC and S4IC is set to
0 (falling edge).
______
9.7 NMI Interrupt
_______ _______
An NMI interrupt request is generated when input on the NMI pin changes state from high to low, after the
_______ ______
NMI interrupt was enabled by writing a 1 to bit 4 in the register PM2. The NMI interrupt is a non-maskable
interrupt, once it is enabled.
_______
The input level of this NMI interrupt input pin can be read by accessing the P8_5 bit in the P8 register.
_______
NMI is disabled by default after reset (the pin is a GPIO pin, P85) and can be enabled using bit 4 in the PM2
register. Once enabled, it can only be disabled by a reset signal.
_______
The NMI input has a digital debounce function for noise rejection. Refer to "19.6 Digital Debounce func-
_______
tion" for details. When using NMI interrupt to exit stop mode, set the NDDR register to FF16 before entering
stop mode.
9.8 Key Input Interrupt
A key input interrupt is generated when input on any of the P104 to P107 pins which has had bits PD10_7 to
PD10_4 in the PD10 register set to 0 (= input) goes low. Key input interrupts can be used for a key-on
wakeup function to get the MCU to exit stop or wait modes. However, if you intend to use the key input
interrupt, do not use P104 to P107 as analog input ports. Figure 9.12 shows the block diagram of the key
input interrupt. Note, however, that while input on any pin which has had bits PD10_7 to PD10_4 set to 0 (=
input mode) is pulled low, inputs on all other pins of the port are not detected as interrupts.
KI3
KI1
C01WKIC register
Table 9.6 PC Value Saved in Stack Area When Address Match Interrupt Request Is Acknowledged
Value of the PC that is
Instruction at the address indicated by the RMADi register saved to the stack area
The address
Instructions other than the above indicated by the
RMADi register +1
Value of the PC that is saved to the stack area : Refer to “Saving Registers”.
Op-code is an abbreviation of Operation Code. It is a portion of instruction code.
Refer to Chapter 4 Instruction Code/Number of Cycles in M16C/60, M16C/20 Series Software Manual. Op-code is shown
as a bold-framed figure directly below the Syntax.
Table 9.7 Relationship Between Address Match Interrupt Sources and Associated Registers
Address match interrupt sources Address match interrupt enable bit Address match interrupt register
Address match interrupt 0 AIER0 RMAD0
Address match interrupt 1 AIER1 RMAD1
With main clock source chosen for CPU clock, on-chip oscillator clock, PLL clock
Prescaler dividing (16 or 128) X Watchdog timer count (32768)
Watchdog timer period =
CPU clock
With sub-clock chosen for CPU clock
Prescaler dividing (2) X Watchdog timer count (32768)
Watchdog timer period =
CPU clock
For example, when CPU clock is set to 16 MHz and the divide-by-N value for the prescale ris set to 16, the
watchdog timer period is approx. 32.8 ms.
The watchdog timer is initialized by writing to the WDTS register. The prescaler is initialized after reset. Note that
the watchdog timer and the prescaler both are inactive after reset, so that the watchdog timer is activated to start
counting by writing to the WDTS register.
Write the WDTS register with shorter cycle than the watchdog timer cycle. Set the WDTS register also in the
beginning of the watchdog timer interrupt routine.
In stop mode and wait mode, the watchdog timer and prescaler are stopped. Counting is resumed from the held
value when the modes or state are released.
Figure 10.1 shows the block diagram of the watchdog timer. Figure 10.2 shows the watchdog timer-related
registers.
Prescaler
CM07 = 0
WDC7 = 0
1/16
PM12 = 0
CM07 = 0
WDC7 = 1 PM22 = 0 Watchdog timer
CPU clock 1/128 interrupt request
Watchdog timer
CM07 = 1 PM22 = 1
1/2
PM12 = 1
Reset
b7 b0
Symbol Address After Reset
WDTS 000E16 Undefined
Function RW
The watchdog timer is initialized and starts counting after a write instruction
to this register. The watchdog timer value is always initialized to 7FFF16 WO
regardless of whatever value is written.
11. DMAC
Note
Do not use SI/O4 interrupt request as a DMA request in the 64-pin package.
The DMAC (Direct Memory Access Controller) allows data to be transferred without the CPU intervention.
Two DMAC channels are included. Each time a DMA request occurs, the DMAC transfers one (8 or 16-bit)
data from the source address to the destination address. The DMAC uses the same data bus as used by
the CPU. Because the DMAC has higher priority of bus control than the CPU and because it makes use of
a cycle steal method, it can transfer one word (16 bits) or one byte (8 bits) of data within a very short time
after a DMA request is generated. Figure 11.1 shows the block diagram of the DMAC. Table 11.1 shows
the DMAC specifications. Figures 11.2 to 11.4 show the DMAC-related registers.
Address bus
DMA0 transfer counter reload register TCR0 (16) DMA1 source pointer SAR1 (20)
(addresses 0029 16, 0028 16) (addresses 0032 16 to 0030 16)
DMA0 transfer counter TCR0 (16) DMA1 destination pointer DAR1 (20)
(addresses 0036 16 to 0034 16)
DMA1 transfer counter reload register TCR1 (16) DMA1 forward address pointer (20) (1)
NOTE:
1. Pointer is incremented by a DMA request.
A DMA request is generated by a write to the DSR bit in the DMiSL register (i = 0,1), as well as by an
interrupt request which is generated by any function specified by the DMS and bits DSEL3 to DSEL0 in the
DMiSL register. However, unlike in the case of interrupt requests, DMA requests are not affected by the I
flag and the interrupt control register, so that even when interrupt requests are disabled and no interrupt
request can be accepted, DMA requests are always accepted. Furthermore, because the DMAC does not
affect interrupts, the IR bit in the interrupt control register does not change state due to a DMA transfer.
A data transfer is initiated each time a DMA request is generated when the DMAE bit in the DMiCON
register is set to 1 (DMA enabled). However, if the cycle in which a DMA request is generated is faster than
the DMA transfer cycle, the number of transfer requests generated and the number of times data is trans-
ferred may not match. For details, refer to “DMA Requests”.
DSEL3 RW
Nothing is assigned. When write, set to 0.
(b5-b4) When read, their content are 0
DMA request cause 0: Basic cause of request
DMS RW
expansion select bit 1: Extended cause of request
NOTE:
1. The causes of DMA0 requests can be selected by a combination of DMS bit and bits DSEL3 to DSEL0 in the
manner described below.
NOTES:
1. The causes of DMA1 requests can be selected by a combination of DMS bit and bits DSEL3 to DSEL0 in the
manner described below.
NOTE:
1. If the DSD bit in the DMiCON register is 0 (fixed), this register can only be written to when the DMAE bit in the
DMiCON register is set to 0 (DMA disabled).
If the DSD bit is set to 1 (forward direction), this register can be written to at any time.
If the DSD bit is set to 1 and the DMAE bit is set to 1 (DMA enabled), the DMAi forward address pointer can be
read from this register. Otherwise, the value written to it can be read.
Figure 11.4 SAR0, SAR1, DAR0, DAR1, TCR0, and TCR1 Registers
Figure 11.5 shows the example of the cycles for a source read. For convenience, the destination write
cycle is shown as one cycle and the source read cycles for the different conditions are shown. In reality, the
destination write cycle is subject to the same conditions as the source read cycle, with the transfer cycle
changing accordingly. When calculating transfer cycles, take into consideration each condition for the
source read and the destination write cycle, respectively. For example, when data is transferred in 16 bit
units and when both the source address and destination address are an odd address ((2) in Figure 11.5),
two source read bus cycles and two destination write bus cycles are required.
(1) When the transfer unit is 8 or 16 bits and the source of transfer is an even address
CPU clock
Address Dummy
CPU use Source Destination CPU use
bus cycle
RD signal
WR signal
Data Dummy
CPU use Source Destination CPU use
bus cycle
(2) When the transfer unit is 16 bits and the source address of transfer is an odd address.
CPU clock
Address Dummy
CPU use Source Source + 1 Destination CPU use
bus cycle
RD signal
WR signal
(3) When the source read cycle under condition (1) has one wait state inserted
CPU clock
Address Destination
Dummy
CPU use Source cycle CPU use
bus
RD signal
WR signal
Data Destination
Dummy
CPU use Source CPU use
bus cycle
(4) When the source read cycle under condition (2) has one wait state inserted
CPU clock
Address Dummy
CPU use Source Source + 1 Destination CPU use
bus cycle
RD signal
WR signal
Data Dummy
CPU use Source Source + 1 Destination CPU use
bus cycle
NOTE:
1. The same timing changes occur with the respective conditions at the destination as at the source.
No. of transfer cycles per transfer unit = No. of read cycles x j + No. of write cycles x k
j 1 2 2 3
k 1 2 2 3
NOTE:
1. Depends on the set value of PM20 bit in PM2 register
If the DMAE bit is set to 1 again while it remains set, the DMAC performs the above operation. However,
if a DMA request may occur simultaneously when the DMAE bit is being written, follow the steps below.
(1) Write 1 to bits DMAE and DMAS in DMiCON register simultaneously.
(2) Make sure that the DMAi is in an initial state as described above (a) and (b) by program.
If the DMAi is not in an initial state, the above steps should be repeated.
An example where DMA requests for external causes are detected active at the same
CPU clock
DMA0
DMA1 Obtainment
of the bus
CPU right
INT0
DMA0
request bit
INT1
DMA1
request bit
12. Timers
Eight 16-bit timers, each capable of operating independently of the others, can be classified by function as
either timer A (five) and timer B (three). The count source for each timer acts as a clock, to control such
timer operations as counting, reloading, etc. Figures 12.1 and 12.2 show block diagrams of timer A and
timer B configuration, respectively.
f2 PCLK0 bit = 0
1/2 Clock prescaler
• Main clock f1 f1 or f2
• PLL clock XCIN 1/32 fC32
• On-chip oscillator PCLK0 bit = 1
1/8 f8 Reset
clock Set the CPSR bit in the
1/4 f32 CPSRF register to 1
(prescaler reset)
f1 or f2 f8 f32 fC32
• Timer mode
• One-shot timer mode
• Pulse Width Measuring (PWM) mode
Timer A0 interrupt
Timer A0
TA0IN Noise
filter • Event counter mode
• Timer mode
• One-shot timer mode
• PWM mode
Timer A1 interrupt
Noise
Timer A1
TA1IN filter
• Event counter mode
• Timer mode
• One-shot timer mode
• PWM mode
Timer A2 interrupt
Noise Timer A2
TA2IN filter • Event counter mode
• Timer mode
• One-shot timer mode
• PWM mode
Timer A3 interrupt
Noise
Timer A3
TA3IN filter • Event counter mode
• Timer mode
• One-shot timer mode
• PWM mode
Timer A4 interrupt
Noise
Timer A4
TA4IN filter
• Event counter mode
f2 PCLK0 bit = 0
1/2 Clock prescaler
• Main clock f1 f1 or f2
• PLL clock XCIN 1/32 fC32
PCLK0 bit = 1
• On-chip oscillator Reset
1/8 f8
clock Set the CPSR bit in the
1/4 f32 CPSRF register to 1
(prescaler reset)
f1 or f2 f8 f32 fC32
Timer B2 overflow or underflow ( to Timer A count source)
• Timer mode
• Pulse width measuring mode,
pulse period measuring mode
Timer B0 interrupt
Noise
TB0IN filter Timer B0
• Event counter mode
• Timer mode
• Pulse width measuring mode,
pulse period measuring mode
Timer B1 interrupt
TB1IN Noise
filter
Timer B1
• Event counter mode
• Timer mode
• Pulse width measuring mode,
pulse period measuring mode Timer B2 interrupt
Noise
TB2IN filter Timer B2
• Event counter mode
12.1 Timer A
Figure 12.3 shows a block diagram of the timer A. Figures 12.4 to 12.6 show registers related to the timer A.
The timer A supports the following four modes. Except in event counter mode, timers A0 to A4 all have the
same function. Use bits TMOD1 to TMOD0 in the TAiMR register (i = 0 to 4) to select the desired mode.
• Timer mode: The timer counts an internal count source.
• Event counter mode: The timer counts pulses from an external device or overflows and underflows of
other timers.
• One-shot timer mode: The timer outputs a pulse only once before it reaches the minimum count 000016.
• Pulse width modulation (PWM) mode: The timer outputs pulses in a given width successively.
Clock selection
• Event counter
Polarity Counter
selection Increment/decrement
TAiIN
(i = 0 to 4) Always counts down except
Clock selection
TABSR register in event counter mode
NOTE:
1. Overflow or underflow
NOTES:
1. The register must be accessed in 16 bit units.
2. If the TAi register is set to 000016, the counter does not work and timer Ai interrupt requests are not
generated either. Furthermore, if “pulse output” is selected, no pulses are output from the TAiOUT pin.
3. If the TAi register is set to 000016, the pulse width modulator does not work, the output level on the
TAiOUT pin remains low, and timer Ai interrupt requests are not generated either. The same applies
when the 8 high-order bits of the timer TAi register are set to 000016 while operating as an 8-bit pulse
width modulator.
4. Use the MOV instruction to write to the TAi register.
5. The timer counts pulses from an external device or overflows or underflows in other timers.
NOTES:
1. Use MOV instruction to write to this register.
2. Make sure the port direction bits for the TA2IN to TA4IN and TA2OUT to TA4OUT pins are set to 0
input mode.
3. When the two-phase pulse signal processing function is not used, set the corresponding bit to 0.
Figure 12.5 TA0 to TA4 Registers, TABSR Register, and UDF Register
CPSR Clock prescaler reset flag Setting this bit to 1 initializes the
prescaler for the timekeeping clock. RW
(When read, its content is 0)
Table 12.2 Specifications in Event Counter Mode (when not processing two-phase pulse signal)
Item Specification
Count source • External signals input to TAiIN pin (i=0 to 4) (effective edge can be selected
in program)
• Timer B2 overflows or underflows,
timer Aj (j=i-1, except j=4 if i=0) overflows or underflows,
timer Ak (k=i+1, except k=0 if i=4) overflows or underflows
Count operation • Increment or decrement can be selected by external signal or program
• When the timer overflows or underflows, it reloads the reload register con-
tents and continues counting. When operating in free-running mode, the
timer continues counting without reloading.
Divided ratio 1/ (FFFF16 - n + 1) for increment
1/ (n + 1) for down-count n : set value of TAi register 000016 to FFFF16
Count start condition Set TAiS bit in the TABSR register to 1 (start counting)
Count stop condition Set TAiS bit to 0 (stop counting)
Interrupt request generation timing Timer overflow or underflow
TAiIN pin function I/O port or count source input
TAiOUT pin function I/O port, pulse output, or up/down-count select input
Read from timer Count value can be read by reading TAi register
Write to timer • When not counting and until the 1st count source is input after counting start
Value written to TAi register is written to both reload register and counter
• When counting (after 1st count source input)
Value written to TAi register is written to only reload register
(Transferred to counter when reloaded next)
Select function • Free-run count function
Even when the timer overflows or underflows, the reload register content is
not reloaded to it
• Pulse output function
Whenever the timer underflows or underflows, the output polarity of TAiOUT
pin is inverted . When not counting, the pin outputs a low.
NOTES:
1. During event counter mode, the count source can be selected using registers ONSF and TRGSR.
2. Effective when bits TAiTGH and TAiTGL in the ONSF or TRGSR register are 002 (TAiIN pin input).
3. Decrement when input on TAiOUT pin is low or increment when input on that pin is high. The port
direction bit for TAiOUT pin must be set to 0 (input mode).
Figure 12.8 TAiMR Register in Event Counter Mode (when not using two-phase pulse signal
processing)
TAjOUT
TAjIN
(j=2,3) Increment Increment Increment Decrement Decrement Decrement
TAkOUT
TAkIN
(k=3,4)
NOTES:
1. The TCK1 bit is valid for timer A3 mode register. No matter how this bit is set, timers A2 and A4 always operate
in normal processing mode and x4 processing mode, respectively.
2. If two-phase pulse signal processing is desired, following register settings are required:
• Set the TAiP bit in the UDF register to 1 (two-phase pulse signal processing function enabled).
• Set bits TAiTGH and TAiTGL in the TRGSR register to 002 (TAiIN pin input).
• Set the port direction bits for TAiIN and TAiOUT to 0 (input mode).
Figure 12.9 TA2MR to TA4MR Registers in Event Counter Mode (when using two-phase pulse
signal processing with timer A2, A3 or A4)
This function can only be used in timer A3 event counter mode during two-phase pulse signal process-
_______
ing, free-running type, x4 processing, with Z-phase entered from the INT2 pin.
Counter initialization by Z-phase input is enabled by writing 000016 to the TA3 register and setting the
TAZIE bit in ONSF register to 1 (Z-phase input enabled).
Counter initialization is accomplished by detecting Z-phase input edge. The active edge can be cho-
sen to be the rising or falling edge by using the POL bit in the INT2IC register. The Z-phase pulse
_______
width applied to the INT2 pin must be equal to or greater than one clock cycle of the timer A3 count
source.
The counter is initialized at the next count timing after recognizing Z-phase input. Figure 12.10 shows
the relationship between the two-phase pulse (A phase and B phase) and the Z phase.
If timer A3 overflow or underflow coincides with the counter initialization by Z-phase input, a timer A3
interrupt request is generated twice in succession. Do not use the timer A3 interrupt when using this
function.
TA3 OUT
(A phase)
TA3 IN
(B phase)
Count source
INT2 (1)
(Z phase)
Input equal to or greater than one clock cycle
of count source
Timer A3 m m+1 1 2 3 4 5
NOTE:
1. This timing diagram is for the case where the POL bit in the INT2IC register is set to 1 (rising edge).
Figure 12.10 Two-phase Pulse (A phase and B phase) and the Z Phase
NOTES:
1. Effective when bits TAiTGH and TAiTGL in the ONSF or TRGSR register are 002 (TAiIN pin input).
2. The port direction bit for the TAiIN pin must be set to 0 (input mode).
MR2 Trigger select bit 0: Write 1 to TAiS bit in the TASF register RW
1: Selected by bits TAiTGH to TAiTGL
TCK0 0 0: f1 or f2 RW
0 1: f8
Count source select bit 1 0: f32
TCK1 1 1: fC32 RW
NOTES:
1. Effective when bits TAiTGH and TAiTGL in the ONSF or TRGSR register are 002 (TAiIN pin input).
2. The port direction bit for the TAiIN pin must be set to 0 ( input mode).
1 / f i X (2 16 – 1)
Count source
1 / fj X n
PWM pulse output “H”
from TA iOUT pin “L”
IR bit in the 1
TAiIC register 0
NOTES:
1. n = 0000 16 to FFFE 16.
2. This timing diagram is for the case where the TAi register is 0003 16, bits TAiTGH and TAiTGL in the ONSF or
TRGSR register is set to 00 2 (TAiIN pin input), the MR1 bit in the TAiMR register is set to 1 (rising edge), and
the MR2 bit in the TAiMR register is set to 1 (trigger selected by TAiTGH and TAiTGL bits).
8
1 / fj X (m + 1) X (2 – 1)
1 / f j X (m + 1)
Underflow signal of “H”
8-bit prescaler (2) “L”
1 / f j X (m + 1) X n
1
IR bit in the
TAiIC register 0
NOTES:
1. The 8-bit prescaler counts the count source.
2. The 8-bit pulse width modulator counts the 8-bit prescaler's underflow signal.
3. m = 0016 to FF16; n = 0016 to FE16.
4. This timing diagram is for the case where the TAi register is 020216, bits TAiTGH and TAiTGL in the ONSF or
TRGSR register is set to 002 (TAiIN pin input), the MR1 bit in the TAiMR register is set to 0 (falling edge), and the
MR2 bit in the TAiMR register is set to 1 (trigger selected by bits TAiTGH and TAiTGL).
12.2 Timer B
Figure 12.15 shows a block diagram of the timer B. Figures 12.16 and 12.17 show registers related to the
timer B.
Timer B supports the following four modes. Use bits TMOD1 and TMOD0 in the TBiMR register (i = 0 to 2)
to select the desired mode.
• Timer mode: The timer counts the internal count source.
• Event counter mode: The timer counts the external pulses or overflows and underflows of other timers.
• Pulse period/pulse width measurement mode: The timer measures the pulse period or pulse width of
external signal.
• A/D trigger mode: The timer starts counting by one trigger until the count value becomes 000016.
This mode is used together with simultaneous sample sweep mode or delayed trigger mode 0 of A/D
converter to start A/D conversion.
NOTE:
1. Overflow or underflow.
AA
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
0 0 TB0MR to TB2MR 039B16 to 039D16 00XX00002
A
b4 b3 b2 b1
0 1
b0
Symbol
TB0MR to TB2MR
Bit Symbol
Address
039B16 to 039D16
Bit Name
After Reset
00XX00002
Function RW
TMOD0 Operation mode select bit b1 b0 RW
0 1: Event counter mode RW
TMOD1
b3 b2
MR0 Count polarity select
0 0: Counts external signal's
bit (1) RW
falling edges
0 1: Counts external signal's rising
edges
1 0: Counts external signal's
MR1 falling and rising edges RW
1 1: Do not set
TB0MR register
RW
Set to 0 in timer mode
MR2 TB1MR, TB2MR registers
Nothing is assigned. If necessary, set to 0. When read, the
content is undefined
MR3 When write in event counter mode, set to 0. When read in event
counter mode, its content is undefined RO
NOTES:
1. Effective when the TCK1 bit is set to 0 (input from TBiIN pin). If the TCK1 bit is set to 1 (TBj overflow or
underflow), these bits can be set to 0 or 1.
2. The port direction bit for the TBiIN pin must be set to 0 (= input mode).
Table 12.8 Specifications in Pulse Period and Pulse Width Measurement Mode
Item Specification
Count source f1, f2, f8, f32, fC32
Count operation • Increment
• Counter value is transferred to reload register at an effective edge of mea-
surement pulse. The counter value is set to 000016 to continue counting.
Count start condition Set TBiS (i=0 to 2) bit (3) to 1 (start counting)
Count stop condition Set TBiS bit to 0 (stop counting)
Interrupt request generation timing • When an effective edge of measurement pulse is input (1)
• Timer overflow. When an overflow occurs, MR3 bit in the TBiMR register is set to
1 (overflowed) simultaneously. MR3 bit is cleared to 0 (no overflow) by writing
to TBiMR register at the next count timing or later after MR3 bit was set to 1. At
this time, make sure TBiS bit is set to 1 (start counting).
TBiIN pin function Measurement pulse input
Read from timer Contents of the reload register (measurement result) can be read by reading TBi register (2)
Write to timer Value written to TBi register is written to neither reload register nor counter
NOTES:
1. Interrupt request is not generated when the first effective edge is input after the timer started counting.
2. Value read from TBi register is undefined until the second valid edge is input after the timer starts counting.
3. Bits TB0S to TB2S are assigned to the bit 5 to bit 7 in the TABSR register .
NOTE:
1.This flag is undefined after reset. When the TBiS bit is set to 1 (start counting), the MR3 bit is cleared to 0 (no overflow) by
writing to the TBiMR register at the next count timing or later after the MR3 bit was set to 1 (overflowed). The MR3 bit cannot be
set to 1 by program. Bits TB0S to TB2S are assigned to the bit 5 to bit 7 in the TABSR register.
Figure 12.20 TBiMR Register in Pulse Period and Pulse Width Measurement Mode
Count source
“H”
Measurement pulse
“L”
Transfer Transfer
(undefined value) (measured value)
1
TBiS bit
0
TBiIC register's 1
IR bit 0
i = 0 to 2
NOTES:
1. Counter is initialized at completion of measurement.
2. Timer has overflowed.
3. This timing diagram is for the case where bits MR1 and MR0 in the TBiMR register are 002 (measure the
interval from falling edge to falling edge of the measurement pulse).
Count source
“H”
Measurement pulse
“L”
Transfer Transfer Transfer Transfer
(undefined (measured value) (measured (measured value)
value) value)
Reload register counter
transfer timing
(1) (1) (1) (1) (1)
Timing at which counter
reaches 000016
TBiS bit 1
0
1
TBiIC register's
IR bit 0
AA
A
Timer Bi Mode Register (i= 0 to 1)
AA
A
b7 b6 b5 b4 b3 b2 b1 b0 Symbol Address After Reset
0 0 TB0MR to TB1MR 039B16 to 039C16 00XX00002
NOTE:
1. When this bit is used in delayed trigger mode 0, set the same count source to the timer B0 and timer B1.
(6)
TB2SEL Trigger select bit 0: TB2 interrupt
RW
1: Underflow of TB2 interrupt
generation frequency setting counter [ICTB2]
NOTES:
1. Write to this register after setting the PRC1 bit in the PRCR register to 1 (write enabled).
2. If the INV11 bit is 0 (three-phase mode 0) or the INV06 bit is 1 (triangular wave modulation mode), set this bit to 0 (timer
B2 underflow).
3. When setting the IVPCR1 bit to 1 (three-phase output forcible cutoff by SD pin input enabled), Set the PD85 bit to 0 (= input
mode).
4. Related pins are U(P80), U(P81), V(P72), V(P73), W(P74), W(P75). When a high-level ("H") signal is applied to the SD pin
and set the IVPCR1 bit to 0 after forcible cutoff, pins U, U, V, V, W, and W are exit from the high-impedance state. If a low-
level (“L”) signal is applied to the SD pin, three-phase motor control timer output will be disabled (INV03=0). At this time,
when the IVPCR1 bit is 0, pins U, U, V, V, W, and W become programmable I/O ports. When the IVPCR1 bit is set to 1,
pins U, U, V, V, W, and W are placed in a high-impedance state regardless of which function of those pins is used.
5. When this bit is used in delayed trigger mode 0, set bits TB0EN and TB1EN to 1 (A/D trigger mode).
6. When setting the TB2SEL bit to 1 (underflow of TB2 interrupt generation frequency setting counter[ICTB2]), set the INV02
bit to 1 (three-phase motor control timer function).
REJ09B0101-0112
Q D IDW
INV01 Interrupt occurrence set circuit b0 T
PD7_2
Trigger Reverse
D Q control V
Trigger Dead time timer
T
INV06 n = 1 to 255
V phase output signal
TA1 register Reload TA11 register PD7_3
V phase output V phase output
Trigger control circuit Reverse
Timer A1 counter signal V
D Q control
(One-shot timer mode)
T PD7_4
INV11
NOTE:
1. If the INV06 bit is set to 0 (triangular wave modulation mode), a transfer trigger is generated at only the first occurrence of a timer B2 underflow after writing to the IDB0 and IDB1 registers.
12. Timer (Three-phase Motor Control Timer Function)
M16C/29 Group 12. Timer (Three-phase Motor Control Timer Function)
NOTES:
1. Write to this register after setting the PRC1 bit in the PRCR register to 1 (write enable). Note also that bits INV00 to INV02,
bits INV04 and INV06 can only be rewritten when timers A1, A2, A4 and B2 are idle.
2. If this bit needs to be set to 1, set any value in the ICTB2 register before writing to it.
3. Effective when the INV11 bit in the INV1 register is 1 (three-phase mode 1). If INV11 is set to 0 (three-phase mode 0), the
ICTB2 counter is incremented by 1 each time the timer B2 underflows, regardless of whether the INV00 and INV01 bits are
set. When setting the INV01 bit to 1, the first interrupt is generated when the timer B2 underflows n-1 times, if n is the value
set in the ICTB2 counter. Subsequent interrupts are generated every n times the timer B2 underflow.
4. Setting the INV02 bit to 1 activates the dead time timer, U/V/W-phase output control circuits and ICTB2 counter.
5. When the INV02 bit is set to 1 and the INV03 bit is set to 0, U, U, V, V, W, W pins, including pins shared with other output
functions, enter a high-impedance state. When INV03 is set to 1, U/V/W corresponding pins generate the three-phase PWM
output.
6. The INV03 bit is set to 0 in the following cases:
• When reset
• When positive and negative go active (INV05 = 1) simultaneously while INV04 bit is 1
• When set to 0 by program
• When input on the SD pin changes state from “H” to “L” regardless of the value of the INVCR1 bit. (The INV03 bit cannot be
set to 1 when SD input is “L”.) INV03 is set to 0 when both bits INV05 and INV04 are set to 1.
Transfer trigger: Timer B2 underflow, write to the INV07 bit or write to the TB2 register when the INV10 bit is set to 1.
9: If the INV06 bit is set to 1, set the INV11 bit to 0 (three-phase mode 0) and set the PWCON bit to 0 (timer B2 reloaded by a
timer B2 underflow)
10. When the PFCi (i = 0 to 5) bit in the PFCR register is set to 1 (three-phase PWM output), individual pins are enabled to output.
INV13 Carrier wave detect flag (5) 0: Timer Reload control signal is set to 0 RO
1: Timer Reload control signal is set to 1
NOTES:
1. Write to this register after setting the PRC1 bit in the PRCR register to 1 (write enable). Note also that this register
can only be rewritten when timers A1, A2, A4 and B2 are idle.
2. A start trigger is generated by writing to the TB2 register only while timer B2 stops.
3. The effects of the INV11 bit are described in the table below.
Item INV11=0 INV11=1
Mode Three-phase mode 0 Three-phase mode 1
TA11, TA21, TA41 registers Not Used Used
INV00 bit, INV01 bit Has no effect. ICTB2 counted every time Effect
timer B2 underflows regardless of
whether bits INV00 and INV01 are set
INV13 bit Has no effect Effective when INV11 bit is 1 and
INV06 bit is 0
4. If the INV06 bit is 1 (sawtooth wave modulation mode), set this bit to 0 (three-phase mode 0). Also, if the INV11 bit is
0, set the PWCON bit to 0 (timer B2 reloaded by a timer B2 underflow).
5. The INV13 bit is effective only when the INV06 bit is set to 0 (triangular wave modulation mode) and the INV11 bit is
set to 1 (three-phase mode 1).
6. If all of the following conditions hold true, set the INV16 bit to 1 (dead time timer triggered by the rising edge of three-
phase output shift register output)
• The INV15 bit is 0 (dead time timer enabled)
• When the INV03 bit is set to 1 (three-phase motor control timer output enabled), the Dij bit and DiBj bit (i:U, V, or
W, j: 0 to 1) have always different values (the positive-phase and negative-phase always output different levels
during the period other than dead time).
Conversely, if either one of the above conditions holds false, set the INV16 bit to 0 (dead time timer triggered by the
falling edge of one-shot pulse).
NOTE:
1. Registers IDB0 and IDB1 values are transferred to the three-phase shift register by a transfer trigger. The value
written to the IDB0 register aftera transfer trigger represents the output signal of each phase, and the next value
written to the IDB1 register at the falling edge of the timer A1, A2, or A4 one-shot pulse represents the output signal
of each phase.
Assuming the set value = n, upon a start trigger the timer starts 1 to 255
counting the count souce selected by the INV12 bit and stops
after counting it n times. The positive or negative phase
whichever is going from an inactive to an active level changes WO
at the same time the dead time timer stops.
NOTES:
1. Use MOV instruction to write to this register.
2. Effective when the INV15 bit is set to 0 (dead time timer enable). If the INV15 bit is set to 1, the dead time timer is
disabled and has no effect.
Nothing is assigned. When write, set to "0". When read, the content is
undefined.
NOTE:
1. Use MOV instruction to write to this register.
If the INV01 bit is set to 1, make sure the TB2S bit also is set to 0 (timer B2 count stopped) when writing to
this register. If the INV01 bit is set to 0, although this register can be written even when the TB2S bit is set to
1 (timer B2 count start), do not write synchronously with a timer B2 underflow.
Figure 12.28 IDB0 Register, IDB1Register, DTT Register, and ICTB2 Register
NOTES:
1. The register must be accessed in 16 bit units.
2. When the timer Ai register is set to 000016, the counter does not operate and a timer Ai interrupt does not occur.
3. Use MOV instruction to write to these registers.
4. If the INV15 bit is 0 (dead time timer enable), the positive or negative phase whichever is going from an inactive
to an active level changes at the same time the dead time timer stops.
5. If the INV11 bit is 0 (three-phase mode 0), the TAi register value is transferred to the reload register by
a timer Ai (i = 1, 2 or 4) start trigger.
If the INV11 bit is 1 (three-phase mode 1), the TAi1 register value is transferred to the reload register by a timer Ai
start trigger first and then the TAi register value is transferred to the reload register by the next timer Ai start trigger.
Thereafter, the TAi1 register and TAi register values are transferred to the reload register alternately.
6. Do not write to TAi1 registers synchronously with a timer B2 underflow In three-phase mode 1.
7. Write to the TAi1 register as follows:
(1) Write a value to the TAi1 register
(2) Wait for one cycle of timer Ai count source.
(3) Write the same value to the TAi1 register again.
Figure 12.29 TA1, TA2, TA4, TA11, TA21, and TA41 Registers
IVPCR1 Three-phase output port 0: Three-phase output forcible cutoff by SD pin input
SD control bit 1 (high impedance) disabled
(3, 4, 7) 1: Three-phase output forcible cutoff by SD pin input RW
(high impedance) enabled
NOTES:
1. Write to this register after setting the PRC1 bit in the PRCR register to 1 (write enabled).
2. If the INV11 bit is 0 (three-phase mode 0) or the INV06 bit is 1 (triangular wave modulation mode), set this bit to 0 (timer
B2 underflow).
3. When setting the IVPCR1 bit to 1 (three-phase output forcible cutoff by SD pin input enabled), Set the PD85 bit to 0 (= input
mode).
4. Related pins are U(P80), U(P81), V(P72), V(P73), W(P74), W(P75). When a high-level ("H") signal is applied to the SD pin
and set the IVPCR1 bit to 0 after forcible cutoff, pins U, U, V, V, W, and W are exit from the high-impedance state. If a low-
level (“L”) signal is applied to the SD pin, three-phase motor control timer output will be disabled (INV03=0). At this time,
when the IVPCR1 bit is 0, pins U, U, V, V, W, and W become programmable I/O ports. When the IVPCR1 bit is set to 1,
pins U, U, V, V, W, and W are placed in a high-impedance state regardless of which function of those pins is used.
5. When this bit is used in delayed trigger mode 0, set bits TB0EN and TB1EN to 1 (A/D trigger mode).
6. When setting the TB2SEL bit to 1 (underflow of TB2 interrupt generation frequency setting counter[ICTB2]), set the INV02
bit to 1 (three-phase motor control timer function).
7. Refer to "19.6 Digital Debounce Function" for the SD input.
The effect of SD pin input is below.
1.Case of INV03 = 1(Three-phase motor control timer output enabled)
IVPCR1 bit SD pin inputs(3) Status of U/V/W pins Remarks
1 Peripheral input/output
H or input/output port
(Three-phase output
forcrible cutoff enable) L High impedance Three-phase output
forcrible cutoff(1)
0 H Peripheral input/output
or input/output port
(Three-phase output
forcrible cutoff disable) L Peripheral input/output
or input/output port
NOTE:
1. The three-phase output forcrible cutoff function becomes effective if the INPCR1 bit is set to 1 (three-phase output
forcrible cutoff function enable) even when the INV03 bit is 0 (three-phase motor control timer output disalbe)
b5 b4
TA3TGL Timer A3 event/trigger
0 0 : Input on TA3 IN is selected (1) RW
select bit
0 1 : TB2 is selected (2)
TA3TGH 1 0 : TA2 is selected (2) RW
1 1 : TA4 is selected (2)
NOTES:
1. Set the corresponding port direction bit to 0 (input mode).
2. Overflow or underflow.
b7 b6
TCK0 0 0: f1 or f2 RW
Count source select bit 0 1: f8
TCK1 1 0: f32 RW
1 1: fC32
The three-phase motor control timer function is enabled by setting the INV02 bit in the INVC0 register to 1.
When this function is on, timer B2 is used to control the carrier wave, and timers A4, A1 and A2 are used to
__ ___ ___
control three-phase PWM outputs (U, U, V, V, W and W). The dead time is controlled by a dedicated dead-
time timer. Figure 12.33 shows the example of triangular modulation waveform, and Figure 12.34 shows
the example of sawtooth modulation waveform.
Signal wave
Timer B2
Timer A4 m m n n p p
one-shot pulse(1)
U phase
output signal (1) Transfer the values
to the three-phase
U phase output shift register
output signal (1)
U phase
INV14 = 0
(“L” active)
U phase
Dead time
U phase
INV14 = 1
(“H” active)
Dead time
U phase
INV13
(INV11=1(three-phase
mode 1))
NOTE:
1. Internal signals. See Figure 12.25.
Signal wave
Timer B2
Timer A4
one-shot pulse(1)
Rewrite registers
IDB0 and IDB1 Transfer the values to the three-
phase output shift register
U phase
output signal (1)
U phase
output signal (1)
U phase
INV14 = 0
(“L” active) Dead time
U phase
U phase
INV14 = 1
(“H” active) Dead time
U phase
NOTE:
1. Internal signals. See Figure 12.25.
The above applies under the following conditions:
INVC0 = 01XX110X2 (X varies depending on each system) and INVC1 = 010XXX002.
Examples of PWM output change are:
• Default value of registers IDB0 and IDB1: DU0=0, DUB0=1, DU1=1, DUB1=1.
They are changed to DU0=1, DUB0=0, DU1=1, DUB1=1 when the timer B2 interrupt is generated.
1 2
Carrier wave
Pin IDU
Transferred Transferred
Transferred Transferred
PDRU bit
Note: The retain trigger is the falling edge of the positive signal.
NOTE:
1.This register is valid only in the three-phase mode.
Timer B2
U phase
NOTE:
1. This register is valid only when the INVC03 bit in the INVC0 register is 1 (Three-phase motor control
timer.
13. Timer S
The Timer S (Input Capture/Output Compare : here after, Timer S is referred to as "IC/OC".) is a high-
performance I/O port for time measurement and waveform generation.
The IC/OC has one 16-bit base timer for free-running operation and eight 16-bit registers for time measure-
ment and waveform generation.
Table 13.1 lists functions and channels of the IC/OC.
NOTE:
1. The time measurement function and the waveform generating function share a pin.
The time measurement function or waveform generating function can be selected for each channel.
1/2 PCLK0=0
Main clock,
PLL clock,
On-chip f1 or f2
PCLK0=1
oscillator clock
BCK1 to BCK0
11
f1 or f2 (n+1) fBT1
Divider register Base timer Base timer over flow request
Two-phase 10
pulse input (G1DV)
00
10:fBT1
Digital 11: f1 or f2 Edge G1TM0, G1PO0
INPC10 OUTC10
filter select register (Note 1)
DF1 to DF0
00 CTS1 to CTS0 PWM
10:fBT1 output
INPC11 Digital 11: f1 or f2 Edge G1TM1, G1PO1
OUTC11
filter select register
DF1 to DF0
00 CTS1 to CTS0
10:fBT1
Digital 11: f1 or f2 Edge G1TM2, G1PO2
INPC12 OUTC12
filter select register
DF1 to DF0 PWM
00 CTS1 to CTS0
10:fBT1 output
Digital 11: f1 or f2 Edge G1TM3, G1PO3
INPC13 OUTC13
filter select register
DF1 to DF0
00 CTS1 to CTS0
10:fBT1
Digital 11: f1 or f2 Edge G1TM4, G1PO4
INPC14 OUTC14
filter select register
DF1 to DF0
CTS1 to CTS0 PWM
00 output
10:fBT1
Digital 11: f1 or f2 Edge G1TM5, G1PO5
INPC15 OUTC15
filter select register
DF1 to DF0
CTS1 to CTS0
00 0 0
10:fBT1
Digital 11: f1 or f2 Edge Gate 1 Prescaler 1 G1TM6, G1PO6 OUTC16
INPC16 filter
DF1 to DF0 select function function register
GT PR PWM
CTS1 to CTS0
10:fBT1
00 0 0 output
Digital Digital 11: f1 or f2 Edge Gate 1 Prescaler 1 G1TM7, G1PO7 OUTC17
INPC17
debounce filter
DF1 to DF0
select function function register
GT PR
CTS1 to CTS0
Ch0 to ch7
interrupt request signal
Figures 13.2 to 13.10 show registers associated with the IC/OC base timer, the time measurement func-
tion, and the waveform generating function.
(1)
Base Timer Register
b15 b8
(b7) (b0) b7 b0 Symbol Address After Reset
G1BT 032116 - 032016 Undefined
Divider Register
b7 b6 b5 b4 b3 b2 b1 b0 Symbol Address After Reset
G1DV 032A16 0016
Bit
Symbol Bit Name Function RW
NOTS:
1. The base timer is reset two fBT1 clock cycles after the base timer matches the value set in the
G1PO0 register. (See Figure 13.7 for details on the G1PO0 register) When the RST1 bit is set to 1,
the value of the G1POj register (j=1 to 7) for the waveform generating function must be set to a
value smaller than that of the G1PO0 register.
When the RST1 bit is set to 1, set the RST4 bit in the G1BCR0 register to 0.
NOTE:
1. The G1BTRR register reflects the value of the base timer, synchronizing with the count source fBT1 cycles.
Bit
Symbol Bit Name Function RW
b1 b0
CTS0 0 0 : No time measurement RW
Time measurement
0 1 : Rising edge
trigger select bit
1 0 : Falling edge
CTS1 RW
1 1 : Both edges
b3 b2
DF0 0 0 : No digital filter RW
Digital filter function
0 1 : Do not set to this value
select bit
1 0 : fBT1
DF1 RW
1 1 : f1 or f2 (1)
(1)
Time Measurement Prescale Register j (j=6,7)
b7 b0 Symbol Address After Reset
G1TPR6 to G1TPR7 032416, 032516 0016
NOTES:
1. The G1TPR6 to G1TPR7 registers reflect the base timer value, synchronizing with the count source
fBT1 cycles.
2. The first prescaler, after the PR bit in the G1TMCRj register is changed from 0 (not used) to 1
(used), may be divided by n, rather than n+1. The subsequent prescaler is divided by n+1.
Bit
Symbol Bit Name Function RW
b1b0
MOD0 0 0 : Single waveform output mode RW
Operating mode 0 1 : SR waveform output mode (1)
select bit 1 0 : Phase-delayed waveform
output mode
MOD1 1 1 : Do not set to this value RW
NOTES :
1. This setting is enabled only for even channels. In SR waveform output mode, values written to the
corresponding odd channel (next channel after an even channel) are ignored. Even channels
provide waveform output. Odd channels provide no waveform output.
2. The inverse output function is the final step in waveform generating process. When the INV bit is set
to 1, and "H" signal is provided a default output by setting the IVL bit to 0, and an "L" signal is
provided by setting it to 1.
3. In the SR waveform output mode, set not only the even channel but also the correspoinding even
channel (next channel after the even channel).
4. To provide either "H" or "L" signal output set in the IVL bit, set the FSCj bit in the G1FS register to 0
(select waveform generating function) and IFEj bit in the G1FE register to 1 (functions for channel j
enabled). Then set the IVL bit to 0 or 1.
Bit
Symbol Bit Name Function RW
Channel 0 time measure-
FSC0 ment/waveform generating 0: Select the waveform generating RW
function select bit function
Channel 1 Time Measure- 1: Select the time measurement
FSC1 ment/Waveform Generating
function RW
Function Select Bit
Channel 2 time measure-
FSC2 ment/waveform generating RW
function select bit
Channel 3 time measure-
FSC3 ment/waveform generating RW
function select bit
Channel 4 time measure-
FSC4 ment/waveform generating RW
function select bit
Channel 5 time measure-
FSC5 ment/waveform generating RW
function select bit
Channel 6 time measure-
FSC6 ment/waveform generating RW
function select bit
Channel 7 time measure-
FSC7 ment/waveform generating RW
function select bit
Bit
Symbol Bit Name Function RW
NOTES:
1. The G1FE register reflects the base timer value, synchronizing with the count source fBT1 cycles.
2. When functions for the channel j are disabled, each pin functions as an I/O port.
Bit
Symbol Bit Name Function RW
0 : No interrupt request
G1IR0 Interrupt request, Ch0 RW
1 : Interrupt requested
NOTE:
1. When writing 0 to each bit in the G1IR register, use the following instruction:
AND, BCLR
Bit
Symbol Bit Name Function RW
0 : IC/OC interrupt 0 request disable
G1IE00 Interrupt enable 0, CH0 RW
1 : IC/OC interrupt 0 request enable
Bit
Symbol Bit Name Function RW
0 : IC/OC interrupt 1 request disable
G1IE10 Interrupt enable 1, CH0 RW
1 : IC/OC interrupt 1 request enable
G1IE11 Interrupt enable 1, CH1 RW
Count start condition The BTS bit in the G1BCR1 register is set to 1 (base timer starts counting)
Count stop condition The BTS bit in the G1BCR1 register is set to 0 (base timer reset)
Base timer reset condition (1) The value of the base timer matches the value of the G1BTRR register
(2) The value of the base timer matches the value of G1PO0 register.
________
(3) Apply a low-level signal ("L") to external interrupt pin,INT1 pin
P80
P81
fBT1
BCK1 to BCK0
11
f1 or f2
(n+1) divider Base timer b14 b15
10
Two-phase pulse input (Note 1)
Overflow signal
0 Base timer
BTS bit in G1BCR1 register
overflow request
1
RST4 IT
Matched with G1BTRR
RST1
Base timer reset
Matched with G1PO0 register
RST2
NOTE:
Input "L" to INT1 pin
1. Divider is reset when the BTS bit is set to 0.
IT, RST4, BCK1 to BCK0: Bits in the G1BCR0 register
RST2 to RST1: Bits in the G1BCR1 register
Table 13.3 Base Timer Associated Register Settings (Time Measurement Function, Waveform
Generation Function, Communication Function)
Register Bit Function
G1BCR0 BCK1 to BCK0 Select a count source
RST4 Select base timer reset timing
IT Select the base timer overflow
G1BCR1 RST2 to RST1 Select base timer reset timing
BTS Used to start the base timer
UD1 to UD0 Select how to count
G1BT - Read or write base timer value
G1DV - Divide ratio of a count source
Set the following registers to set the RST1 bit to 1 (base timer reset by matching the base timer with the G1PO0 register)
G1POCR0 MOD1 to MOD0 Set to 002 (single-phase waveform output mode)
G1PO0 - Set reset cycle
G1FS FSC0 Set to 0 (waveform generating function)
G1FE IFE0 Set to 1 (channel operation start)
FFFF16
C00016
State of a counter
800016
400016
000016
FFFF16
C00016
State of a counter
800016
400016
000016
(1) When the base timer is reset while the base timer increments the counter
P80 (A-phase)
Input waveform
min 1 µs
fBT1
( When selects no
division with the divider by (n+1) )
(Note 1)
INT1 (Z-phase)
(2) When the base timer is reset while the base timer decrements the counter
P80 (A-phase)
fBT1
( When selects no
division with the divider by (n+1) )
(1)
INT1 (Z-phase)
NOTE:
1. 1.5 fBT1 clock cycle or more are required.
Figure 13.14 Base Timer Operation in Two-phase Pulse Signal Processing Mode
RST4
G1BTRR register m
(Base timer reset register)
NOTE:
1. Following conditions are required to generate a base timer overflow request by resetting the base timer.
If the IT bit is set to 0: 07FFF16 ≤ m ≤ 0FFFE16
If the IT bit is set to 1: 07FFF16 ≤ m ≤ 0FFFE16 or 0BFFF16 ≤ m ≤ 0FFFE16
Figure 13.15 Base Timer Reset operation by Base Timer Reset Register
RST1
G1PO0 m
G1IR0
RST2
P83/INT1
NOTE:
________ ________
1. INT1 Base Timer reset does not generate a Base Timer interrupt. INT1 may generate an interrupt if enabled.
_______
Figure 13.17 Base Timer Reset operation by INT1
Selecting trigger input polarity Rising edge, falling edge, both edges of the INPC1j pin (1)
Measurement start condition The IFEj bit in the G1FE register should be set to 1 (channels j function
enabled) when the FSCj bit (j=0 to 7) in the G1FS register is set to 1 (time
measurement function selected).
Measurement stop condition The IFEj bit should be set to 0 (channel j function disabled)
Time measurement timing •No prescaler : every time a trigger signal is applied
Interrupt request generation timing The G1IRi bit (i=0 to 7) in the interrupt request register (See Figure 13.9) is
set to 1 at time measurement timing
INPC1j pin function (1) Trigger input pin
The digital filter samples a trigger input signal level every f1, f2 or fBT1
cycles and passes pulse signal matching trigger input signal level three
times
Table 13.6 Register Settings Associated with the Time Measurement Function
Register Bit Function
j = 0 to 7 k = 6, 7
Bit configurations and function varys with channels used.
Registers associated with the time measurement function must be set after setting registers associated with the base timer.
FFFF16
n
Base timer p
m
000016
G1TMj register m n p
j = 0 to 7
G1IRj bit: Bits in the G1IR register
The above applies to the following condition.
Bits CTS1 to CTS0 in the G1TMCRj registers are set to 012 (rising edge). The PR bit is
set to 0 (no prescaler used) and the GT bit is set to 0 (no gate function used).
Bits RTS4, RTS2, and RTS1 in registers G1BCR0 and G1BCR1 are set to 0 (no base
timer reset). Bits UD1 to UD0 bits are set to 002 (counter increment mode).
Set the base timer to 000016 (setting the RST1 bit to 1, and bits RST4 and RST2 to 0),
when the base timer value matches the G1PO0 register setting. The base timer is set to 000016
after it reaches the G1PO0 register value + 2.
fBT1
Base timer n-2 n-1 n n+1 n+2 n+3 n+4 n+5 n+6 n+7 n+8 n+9 n+10 n+11 n+12 n+13 n+14
(2)
INPC1j pin input or
trigger signal after
passing the digital
filter
NOTES :
1. Bits in the G1IR register.
2. Input pulse applied to the INPC1j pin requires 1.5 fBT1 clock cycles. or more.
Base timer n-2 n-1 n n+1 n+2 n+3 n+4 n+5 n+6 n+7 n+8 n+9 n+10 n+11 n+12 n+13 n+14
NOTES :
1. Bits in the G1IR register.
2. No interrupt is generated if the MCU receives a trigger signal when. the G1IRj bit is set to 1.
However, the value of the G1TMj register is updated.
INPC1j pin
Maximum 3.5 f1 or f2 or fBT1
(1)
Signals, which do not match 3 clock cycles
Trigger signal after
passing the digital times, are stripped off
filter The trigger signal is delayed
by the digital filter
NOTE:
1. fBT1 when bits DF1 to DF0 are set to 102, and f1 or f2 when set to 112.
fBT1
Base timer n-2 n-1 n n+1 n+2 n+3 n+4 n+5 n+6 n+7 n+8 n+9 n+10 n+11 +12 n+13 n+14
Internal time
measurement trigger
Prescaler (1) 2 1 0 2
NOTES:
1. This applies to 2nd or later prescaler cycle after the PR bit in the G1TMCRj register is set to 1 (prescaler used).
2. Bits in the G1IR register.
fBT1
FFFF16
Value of the G1POk register
Base timer
000016
G1POk register
match signal
G1TMj register
NOTE:
1. Bits in the G1IR register.
(bits RST1, RST2, and RST4 of registers G1BCR1 and G1BCR0 are set to 0
(no reset))
65536
Cycle :
fBT1
m
Default output level width :
fBT1
65536-m
Inverse level width :
fBT1
• The base timer is cleared to 000016 by matching the base timer with either
following register
(a) G1PO0 register (enabled by setting RST1 bit to 1, and RST4 and RST2 bits to 0), or
(b) G1BTRR register (enabled by setting RST4 bit to 1, and RST2 and RST1 bits to 0)
Cycle : n+2
fBT1
Default output level width : m
fBT1
Inverse level width n+2-m
:
fBT1
m : setting value of the G1POj register (j=0 to 7), 000116 to FFFD16
n : setting value of the G1PO0 register or the G1BTRR register, 000116 to FFFD16
Waveform output start condition The IFEj bit in the G1FE register is set to 1 (channel j function enabled)
Waveform output stop condition The IFEj bit is set to 0 (channel j function disabled)
Interrupt request The G1IRj bit in the G1IR register is set to 1 when the base timer value
matches the G1POj register value (See Figure 13.22)
OUTC1j pin (1) Pulse signal output pin
Selectable function • Default value set function: Set starting waveform output level
FFFF16
Base timer
000016
m 65536-m
fBT1 fBT1
j=0 to 7
m : Setting value of the G1POj register
G1IRj bit : Bits in the G1IR register
(2) The base timer is reset when the base timer matches either following register
(a) G1PO0 (enabled by setting bit RST1 to 1, and bits RST4 and RST2 to 0), or
(b) G1BTRR (enabled by setting bit RST4 to 1, and bits RST2 and RST1 to 0)
FFFF16
n+2
Base timer
m
000016
m n+2-m
fBT1 fBT1
j=1 to 7
m : Setting value of the G1POj register
n: Setting value of either G1PO0 register or G1BTRR register
G1IRj bit : Bits in the G1IR register
The above applies under the following conditions.
-The IVL bit in the G1POCRj register is set to 0 ("L" output as a default value) and the INV
bit is set to 0 (not inversed).
-Bits UD1 to UD0 are set to 002 (counter increment mode).
(bits RST1, RST2, and RST4 in registers G1BCR1 and G1BCR0 are set to 0
(no reset))
65536 x 2
Cycle :
fBT1
65536
"H" and "L" width :
fBT1
• The base timer is cleared to 000016 by matching the base timer with either
following register
(a) G1PO0 register (enabled by setting RST1 bit to 1, and bits RST4 and RST2 to 0), or
(b) G1BTRR register (enabled by setting RST4 bit to 1, and bits RST2 and RST1 to 0)
2(n+2)
Cycle :
fBT1
n+2
"H" and "L" width :
fBT1
n : setting value of either G1PO0 register or G1BTRR register
Waveform output start condition The IFEj bit in the G1FE register is set to 1 (channel j function enabled)
Waveform output stop condition The IFEj bit is set to 0 (channel j function disabled)
Interrupt request The G1IRj bit in the interrupt request register is set to 1 when the base timer
value matches the G1POj register value. (See Figure 13.23)
OUTC1j pin (1) Pulse signal output pin
Selectable function • Default value set function: Set starting waveform output level
FFFF16
Base timer
000016
65536 65536
fBT1 fBT1
Inverse
OUTC1j pin Inverse
65536X2
Write 0 by program fBT1
if setting to 0
G1IRj bit
j=0 to 7
m : Setting value of the G1POj register
G1IRj bit : Bits in the G1IR register
The above applies under the following conditions.
The IVL bit in the G1POCRj register is set to 0 (L output as a default value). The INV bit
is set to 0 (not inversed).
Bits UD1 to UD0 are set to 002 (counter increment mode).
(2) Base timer is reset when the base timer matches either following register
(a) G1PO0 (enabled by setting bit RST1 to 1, and bits RST4 and RST2 to 0), or
(b) G1BTRR (enabled by setting bit RST4 to 1, and bits RST2 and RST1 to 0)
FFFF16
n+2
Base timer
m
000016
m n+2 n+2
fBT1 fBT1 fBT1
j=1 to 7
m : Setting value of the G1POj register n: Setting value of either register G1PO0 or G1BTRR
G1IRj bit : Bits in the G1IR register
The above applies under the following conditions.
The IVL bit in the G1POCRj register is set to 0 (L output as a default value).
The INV bit is set to 0 (not inversed).
Bits UD1 to UD0 are set to 002 (counter increment mode).
(the RST1, RTS2, and RST4 bits of the G1BCR1 and G1BCR0 registers are set
to 0 (no reset))
Cycle :65536
fBT1
Inverse level width(1) : n-m
fBT1
• The base timer is cleared to 000016 by matching the base timer with either
following register
(a) G1PO0 register (enabled by setting RST1 bit to 1, and bits RST4 and RST2 to 0)(2), or
(b) G1BTRR register (enabled by setting RST4 bit to 1, and bits RST2 and RST1 to 0)
p+2
Cycle :
fBT1
n-m
Inverse level width(1) :
fBT1
m : setting value of the G1POj register (j=0, 2, 4, 6 )
Waveform output start condition Bits IFEj and IFEk in the G1FE register is set to 1 (channel j function enabled)
Waveform output stop condition Bits IFEj and IFEk are set to 0 (channel j function disabled)
Interrupt request The G1IRj bit in the G1IR register is set to 1 when the base timer value
matches the G1POj register value.
The G1IRk bit in the interrupt request register is set to 1 when the base timer
value matches the G1POk register value (See Figure 13.24)
OUTC1j pin (3) Pulse signal output pin
Selectable function • Default value set function : Set starting waveform output level
000016
n-m 65536-n+m
fBT1 fBT1
Return to default
output level
OUTC1j pin Inverse Inverse
65536
fBT1
Write 0 by program
G1IRj bit if setting to 0
inverse
G1IRk bit
j=0, 2, 4, 6 k=j+1
m : Setting value of the G1POj register n: Setting value of the G1POk register
G1IRj, G1IRk bits: Bits in the G1IR register
The above applies under the following conditions.
The IVL bit in the G1POCRj register is set to 0 (L output as a default value). The INV bit is set to 0
(not inversed).
Bits UD1 and UD0 are set to 002 (counter increment mode).
(2) Base timer is reset when the base timer matches either following register
(a) G1PO0 (enabled by setting bit RST1 to 1, and bits RST4 and RST2 to 0), or
(b) G1BTRR (enabled by setting bit RST4 to 1, and bits RST2 and RST1 to 0)
FFFF16
p+2
n
Base timer m
000016
n-m p+2-n+m
fBT1 fBT1
Return to default output level
OUTC1j pin
p+2
fBT1
Write 0 by program
if setting to 0
G1IRj bit
When setting to 0,
write 0 by program
G1IRk bit
j=2, 4, 6 k=j+1
m : Setting value of the G1POj register n: Setting value of the G1POk register
p: Setting value of either register G1PO0 or G1BTRR
G1IRj, G1IRk bits: Bits in the G1IR register
The above applies under the following conditions.
The IVL bit in the G1POCRj register is set to 0 (L output as a default value). The INV bit is set to 0 (not
inversed).
Bits UD1 and UD0 are set to 002 (counter increment mode).
Table 13.11 Pin setting for Time Measurement and Waveform Generating Functions
Pin IFE FSC MOD1 MOD0 Port Direction Port Data
P27/INPC17/ 0 X X X Determined by PD27 P27
OUTC17 1 1 X X Determined by PD27, Input to INPC17 is always active P27 or INPC17
1 0 0 0 Single-phase Waveform Output OUTC17
1 0 0 1 Determined by PD27, SR waveform output mode P27
1 0 1 0 Phase-delayed Waveform Output OUTC17
P26/INPC16/ 0 X X X Determined by PD26 P26
OUTC16 1 1 X X Determined by PD26, Input to INPC16 is always active P26 or INPC16
1 0 0 0 Single-phase Waveform Output OUTC16
1 0 0 1 SR Waveform Output OUTC16
1 0 1 0 Phase-delayed Waveform Output OUTC16
P25/INPC15/ 0 X X X Determined by PD25 P25
OUTC15 1 1 X X Determined by PD25, Input to INPC15 is always active P25 or INPC15
1 0 0 0 Single-phase Waveform Output OUTC15
1 0 0 1 Determined by PD25, SR Waveform Output mode P25
1 0 1 0 Phase-delayed Waveform Output OUTC15
P24/INPC14/ 0 X X X Determined by PD24 P24
OUTC14 1 1 X X Determined by PD24, Input to INPC14 is always active P24 or INPC14
1 0 0 0 Single-phase Waveform Output OUTC14
1 0 0 1 SR Waveform Output OUTC14
1 0 1 0 Phase-delayed Waveform Output OUTC14
P23/INPC13/ 0 X X X Determined by PD23 P23
OUTC13 1 1 X X Determined by PD23, Input to INPC13 is always active P23 or INPC13
1 0 0 0 Single-phase Waveform Output OUTC13
1 0 0 1 Determined by PD23, SR waveform output mode P23
1 0 1 0 Phase-delayed Waveform Output OUTC13
P22/INPC12/ 0 X X X Determined by PD22 P22
OUTC12 1 1 X X Determined by PD22, Input to INPC12 is always active P22 or INPC12
1 0 0 0 Single-phase Waveform Output OUTC12
1 0 0 1 SR Waveform Output OUTC12
1 0 1 0 Phase-delayed Waveform Output OUTC12
P21/INPC11/ 0 X X X Determined by PD21 P21
OUTC11 1 1 X X Determined by PD21, Input to INPC11 is always active P21 or INPC11
1 0 0 0 Single-phase Waveform Output OUTC11
1 0 0 1 Determined by PD21, SR waveform output mode P21
1 0 1 0 Phase-delayed Waveform Output OUTC11
P20/INPC10/ 0 X X X Determined by PD20 P20
OUTC10 1 1 X X Determined by PD20, Input to INPC10 is always active P20 or INPC10
1 0 0 0 Single-phase Waveform Output OUTC10
1 0 0 1 SR Waveform Output OUTC10
1 0 1 0 Phase-delayed Waveform Output OUTC10
IFE: IFEj (j=0 to 7) bits in the G1FE register.
FSC: FSCj (j=0 to 7) bits in the G1FS register.
MOD2 to MOD1: Bits in the G1POCRj (j=0 to 7) register.
________
13.6.2 Digital Debounce Function for Pin P17/INT5/INPC17
________ ________
The INT5/INPC17 input from the P17/INT5/INPC17/IDU pin has an effective digital debounce function
against a noise rejection. Refer to 19.6 Digital Debounce function for this detail.
Serial I/O is configured with five channels: UART0 to UART2, SI/O3 and SI/O4.
PCLK1=0
f2SIO
1/2
f1SIO or f2SIO
f1SIO
Main clock, PLL clock,
or on-chip oscillator clock PCLK1=1
1/8 f8SIO
1/4 f32SIO
(UART0)
RxD0 TxD0
Clock source selection UART reception Receive
1/16
Reception clock
CLK1 to CLK0 Clock synchronous
002 control circuit
f1SIO or f2SIO U0BRG type Transmit/
012 Internal CKDIR=0 register receive
f8SIO unit
102 UART transmission Transmit
f32SIO 1 / (n0+1) 1/16
Transmission control clock
External Clock synchronous circuit
CKDIR=1 type
Clock synchronous type
(when internal clock is selected)
1/2
CKDIR=0
Clock synchronous type
CKPOL (when external clock is selected) CKDIR=1
Clock synchronous type
(when internal clock is selected)
CLK
polarity
CLK0 reversing
circuit
CTS/RTS selected CTS/RTS disabled
CRS=1 RTS0
CTS0 / RTS0
CRS=0 VCC
CTS/RTS disabled
RCSP=0 CRD=1 CTS0
CTS0 from UART1 CRD=0
RCSP=1
(UART1)
RxD1 TxD1
Clock source selection UART reception
1/16 Receive
CLK1 to CLK0 Reception clock
Clock synchronous control circuit
002 Transmit/
f1SIO or f2SIO U1BRG type
receive
012 Internal CKDIR=0 register
f8SIO unit
102 UART transmission Transmit
f32SIO 1 / (n1+1) 1/16 Transmission clock
Clock synchronous control circuit
External CKDIR=1 type
Clock synchronous type
1/2 (when internal clock is selected)
CKDIR=0
Clock synchronous type
CKPOL (when external clock is selected)
CKDIR=1
CLK Clock synchronous type
polarity (when internal clock is selected)
CLK1 reversing
CLKMD0=0
circuit
CLKMD0=1
Clock output
pin select CTS/RTS selected CTS/RTS disabled
CTS1 / RTS1/ CLKMD1=1 CRS=1 RTS1
CTS0/ CLKS1 CLKMD1=0 CRS=0
VCC
CTS/RTS disabled
RCSP=0 CTS1
CRD=1
(UART2) RCSP=1
TxD
RxD polarity polarity
RxD2 reversing circuit reversing TxD2
circuit
Clock source selection UART reception Receive
1/16
CLK1 to CLK0 Reception clock
Clock synchronous control circuit
002 U2BRG type Transmit/
f1SIO or f2SIO receive
012 Internal CKDIR=0 register
f8SIO unit
102 UART transmission Transmit
f32SIO 1 / (n2+1) 1/16
Transmission clock
Clock synchronous control circuit
External CKDIR=1 type
Clock synchronous type
1/2 (when internal clock is selected)
CKDIR=0
Clock synchronous type
(when external clock is selected)
CKPOL CKDIR=1
Clock synchronous type
CLK (when internal clock is selected)
polarity
CLK2 reversing
circuit
CTS/RTS CTS/RTS disabled
selected
CRS=1 RTS2
CTS2 / RTS2 CRS=0
VCC
CTS/RTS disabled
CRD=1 CTS2
CRD=0
i = 0 to 2
ni: Values set to the UiBRG register
SMD2 to SMD0, CKDIR: Bists in the UiMR register
CLK1 to CLK0, CKPOL, CRD, CRS: Bits in the UiC0 register
CLKMD0, CLKMD1, RCSP: Bits in the UCON register
Clock
synchronous type
PAR UART (7 bits)
1SP disabled
Clock UART (8 bits)
synchronous UART (7 bits) UARTi receive register
type
STPS=0 PRYE=0
RxDi SP SP PAR
STPS=1 PAR PRYE=1 UART
2SP enabled UART (9 bits)
Clock
synchronous type
UART (8 bits)
UART (9 bits)
UARTi receive
0 0 0 0 0 0 0 D8 D7 D6 D5 D4 D3 D2 D1 D0 buffer register
Address 03A616
MSB/LSB conversion circuit Address 03A716
Address 03AE16
Address 03AF16
Data bus high-order bits
D8 D7 D6 D5 D4 D3 D2 D1 D0 UARTi transmit
buffer register
Address 03A216
Address 03A316
Address 03AA16
UART (8 bits) Address 03AB16
UART (9 bits)
Clock synchronous
UART (9 bits) type
PAR
2SP STPS=1 enabled PRYE=1 UART
SP SP PAR TxDi
STPS=0 PRYE=0 Clock
synchronous UART (7 bits) UARTi transmit register
type UART (7 bits)
1SP PAR UART (8 bits)
disabled
0 Clock synchronous
SP: Stop bit
type PAR: Parity bit
SMD2 to SMD0, STPS, PRYE, IOPOL, CKDIR : Bits in the UiMR
No reverse
IOPOL=0
RxD data
RxD2 reverse circuit
IOPOL=1
Reverse
Clock
synchronous type
PAR UART
1SP (7 bits)
disabled
Clock UART
UART(7 bits) UARTi receive register
synchronous (8 bits)
STPS=0 PRYE=0 type
SP SP PAR
0 0 0 0 0 0 0 D8 D7 D6 D5 D4 D3 D2 D1 D0 UART2 receive
buffer register
Address 037E16
Address 037F16
Logic reverse circuit + MSB/LSB conversion circuit
D8 D7 D6 D5 D4 D3 D2 D1 D0 UART2 transmit
buffer register
Address 037A16
Address 037B16
UART
(8 bits)
UART
(9 bits)
UART Clock
PAR (9 bits) synchronous type
STPS=1 enabled
2SP PRYE=1 UART
SP SP PAR
STPS=0 PRYE=0 Clock
synchronous
UART UART(7 bits) UARTi transmit register
type (7 bits)
1SP PAR UART
disabled (8 bits)
0
Clock
synchronous type
Error signal output
U2ERE disable IOPOL No reverse
=0 =0
Error signal TxD data TxD2
output circuit reverse circuit
U2ERE IOPOL
Error signal output Reverse
=1 enable
=1
Function RW
Transmit data WO
Bit
Bit Name Function RW
Symbol
NOTES:
1. When the SMD2 to SMD0 bits in the UiMR register are set to 0002 (serial I/O disabled) or the RE bit in the UiC1 register is set to
0 (reception disabled), all bits SUM, PER, FER and OER are set to 0 (no error). The SUM bit is set to 0 (no error) when all of the
PER, FER and OER bits are set to 0 (no error). Also, bits PER and FER are set to 0 by reading the lower byte of the UiRB
register.
2. The ABT bit is set to 0 by setting to 0 by program. (Writing 1 has no effect.) Nothing is assigned at the bit 11 in the U0RB and
U1RB registers. If necessary, set to 0. When read, its content is 0.
NOTES:
1. Write to this register while serial I/O is neither transmitting nor receiving.
2. Use MOV instruction to write to this register.
The transfer clock is shown below when the setting value in the UiBRG register is set as n.
(1) When the CKDIR bit in the UiMR register to 0 (internal clock)
• Clock synchronous serial I/O mode : fj/(2(n+1))
• Clock asynchronous serial I/O (UART) mode : fj/(16(n+1))
(2) When the CKDIR bit in the UiMR register to 1 (external clock)
• Clock synchronous serial I/O mode : f EXT
• Clock asynchronous serial I/O (UART) mode : f EXT/(16(n+1))
fj : f1SIO, f2SIO, f8SIO, f32SIO
fEXT : Input from CLKi pin
3. Set the UiBRG register after setting bits CLK1 and CLK0 in the registers UiC0.
Bit
Bit Name Function RW
Symbol
NOTES:
1. Set the corresponding port direction bit for each CLKi pin to 0 (input mode).
2. To receive data, set the corresponding port direction bit for each RxDi pin to 0.
Bit
Bit Name Function RW
Symbol
Bit
Bit Name Function RW
Symbol
b1 b0
CLK0 BRG count source 0 0 : f1SIO or f2SIO is selected RW
select bit(7) 0 1 : f8SIO is selected
CLK1 1 0 : f32SIO is selected RW
1 1 : Do not set
TXEPT Transmit register empty 0 : Data present in transmit register (during transmission)
flag 1 : No data present in transmit register RO
(transmission completed)
NCH Data output select bit(5) 0 : TxD2/SDA2 and SCLi pins are CMOS output
RW
1 : TxD2/SDA2 and SCLi pins are N-channel open-drain output(4)
CKPOL CLK polarity select bit 0 : Transmit data is output at falling edge of transfer clock
and receive data is input at rising edge RW
1 : Transmit data is output at rising edge of transfer clock
and receive data is input at falling edge
UFORM Transfer format select bit 0 : LSB first RW
(2) 1 : MSB first
NOTES:
1. Set the corresponding port direction bit for each CTSi pin to 0 (input mode).
2. Effective when bits SMD2 to SMD0 in the UMR register to 0012 (clock synchronous serial I/O mode) or 0102 (UART mode transfer
data 8 bits long). Set the UFORM bit to 1 when bits SMD2 to SMD0 are set to 1012 (I2C bus mode) and 0 when they are set to 1002.
3. CTS1/RTS1 can be used when the CLKMD1 bit in the UCON register is set to 0 (only CLK1 output) and the RCSP bit in the UCON
register is set to 0 (CTS0/RTS0 not separated).
4. SDA2 and SCL2 are effective when i = 2.
5. When bits SMD2 to SMD in the UiMR regiser are set to 0002 (serial I/O disable), do not set NCH bit to 1 (TxDi/SDA2 and SCL2 pins
are N-channel open-drain output).
6. When the U1MAP bit in PACR register is 1 (P73 to P70), P70 functions as CTS/RTS pin in UART1.
7. When the CLK1 and CLK0 bit settings are changed, set the UiBRG register.
Bit
Bit Name Function RW
Symbol
NOTES:
1. When using multiple transfer clock output pins, make sure the following conditions are met:set the CKDIR bit in the U1MR
register to 0 (internal clock)
2. When the U1MAP bit in PACR register is set to 1 (P73 to P70), P70 pin functions as CTS0 pin.
Bit Function
Bit Name RW
Symbol
Nothing is assigned.
(b7-b4) If necessary, set to 0. When read, the content is 0
Bit Function
Bit Name RW
Symbol
NOTE:
1. Set the PACR register by the next instruction after setting the PRC2 bit in the PRCR register to 1(write enable).
Bit Function
Bit Name RW
Symbol
NOTES:
1: The BBS bit is set to 0 by writing 0 by program. (Writing 1 has no effect).
2: When a transfer begins, the SSS bit is set to 0 (Not synchronized to RxD2).
Bit
Bit Name Function RW
Symbol
NOTES:
1. Bits DL2 to DL0 are used to generate a delay in SDA output by digital means during I2C bus mode. In other than I2C bus
mode,set these bits to 0002 (no delay).
2. The amount of delay varies with the load on pins SCL2 and SDA2. Also, when using an external clock, the amount of
delay increases by about 100 ns.
Bit
Bit Name Function RW
Symbol
Interrupt request • For transmission, one of the following conditions can be selected
_ The UiIRS bit (3) is set to 0 (transmit buffer empty): when transferring data from the
generation timing
UiTB register to the UARTi transmit register (at start of transmission)
_ The UiIRS bit is set to 1 (transfer completed): when the serial I/O finished sending
Table 14.2 Registers to Be Used and Settings in Clock Synchronous Serial I/O Mode
Register Bit Function
UiTB(3) 0 to 7 Set transmission data
UiRB(3) 0 to 7 Reception data can be read
OER Overrun error flag
UiBRG 0 to 7 Set bit rate
UiMR(3) SMD2 to SMD0 Set to 0012
CKDIR Select the internal clock or external clock
IOPOL(i=2) (4) Set to 0
UiC0 CLK1 to CLK0 Select the count source for the UiBRG register
_______ _______
CRS Select CTS or RTS to use
TXEPT Transmit register empty flag
_______ _______
CRD Enable or disable the CTS or RTS function
NCH Select TxDi pin output mode
CKPOL Select the transfer clock polarity
UFORM Select the LSB first or MSB first
UiC1 TE Set this bit to 1 to enable transmission/reception
TI Transmit buffer empty flag
RE Set this bit to 1 to enable reception
RI Reception complete flag
U2IRS (1) Select the source of UART2 transmit interrupt
U2RRM (1) Set this bit to 1 to use UART2 continuous receive mode
U2LCH (3) Set this bit to 1 to use UART2 inverted data logic
U2ERE (3) Set to 0
U2SMR 0 to 7 Set to 0
U2SMR2 0 to 7 Set to 0
U2SMR3 0 to 2 Set to 0
NODC Select clock output mode
4 to 7 Set to 0
U2SMR4 0 to 7 Set to 0
UCON U0IRS, U1IRS Select the source of UART0/UART1 transmit interrupt
U0RRM, U1RRM Set this bit to 1 to use continuous receive mode
CLKMD0 Select the transfer clock output pin when CLKMD1 is set to 1
CLKMD1 Set this bit to 1 to output UART1 transfer clock from two pins
_________
RCSP Set this bit to 1 to accept as input the UART0 CTS0 signal from the P64 pin
7 Set to 0
NOTES:
1. Set bits 5 and 4 in registers U0C1 and U1C1 to 0. Bits U0IRS, U1IRS, U0RRM, and U1RRM are in the
UCON register.
2. Not all register bits are described above. Set those bits to 0 when writing to the registers in clock
synchronous serial I/O mode.
3. Set bits 7 and 6 in registers U0C1 and U1C1 to 0.
4. Set the bit 7 in registers U0MR and U1MR to 0.
i=0 to 2
Table 14.3 lists pin functions for the case where the multiple transfer clock output pin select function is
deselected. Table 14.4 lists the P64 pin functions during clock synchronous serial I/O mode.
Note that for a period from when the UARTi operation mode is selected to when transfer starts, the TxDi
pin outputs an “H”. (If the N-channel open-drain output is selected, this pin is in a high-impedance state.)
Table 14.3 Pin Functions (When Not Select Multiple Transfer Clock Output Pin Function)(1)
Pin Name Function Method of Selection
TxDi (i = 0 to 2) Serial data output (Outputs dummy data when performing reception only)
(P63, P6 7, P70)
RxDi Serial data input Set the PD6_2 bit and PD6_6 bit in the PD6 register, and PD7_1 bit in the PD7
(P6 2, P6 6, P71) register to 0 (Can be used as an input port when performing transmission only)
CLKi Transfer clock output Set the CKDIR bit in the UiMR register to 0
(P61, P6 5, P72)
Transfer clock input Set the CKDIR bit in the UiMR register to 1
Set the PD6_1 bit and PD6_5 bit in the PD6 register, and the PD7_2 bit in the
PD7 register to 0
CTSi/RTSi CTS input Set the CRD bit in the UiC0 register to 0
(P60, P6 4, P73) Set the CRS bit in the UiC0 register to 0
Set the PD6_0 bit and PD6_4 bit in the PD6 register is set to 0, the PD7_3 bit
in the PD7 register to 0
RTS output Set the CRD bit in the UiC0 register to 0
Set the CRS bit in the UiC0 register to 1
NOTE:
1: When the U1MAP bit in PACR register is 1 (P73 to P70), UART1 pin is assgined to P73 to P70.
Transfer clock
1
UiC1 register
TE bit 0 Write data to the UiTB register
UiC1 register 1
TI bit 0
Transferred from UiTB register to UARTi transmit register
“H”
CTSi TCLK
“L”
Stopped pulsing because CTSi = “H” Stopped pulsing because the TE bit = 0
CLKi
TxDi D0 D1 D2 D3 D4 D5 D6 D7 D0 D 1 D2 D3 D4 D5 D6 D7 D0 D1 D 2 D 3 D4 D5 D6 D7
UiC0 register 1
TXEPT bit 0
SiTIC register 1
IR bit 0
1
UiC1 register
RE bit 0
1
UiC1 register
TE bit 0 Write dummy data to UiTB register
1
UiC1 register
TI bit 0
Transferred from UiTB register to UARTi transmit register
“H”
RTSi Even if the reception is completed, the RTS
“L” does not change. The RTS becomes “L”
1 / fEXT when the RI bit changes to 0 from 1.
CLKi
Receive data is taken in
RxDi D0 D 1 D2 D3 D4 D 5 D6 D7 D0 D1 D2 D3 D 4 D5
Transferred from UARTi receive register Read out from UiRB register
1 to UiRB register
UiC1 register
RI bit 0
SiRIC register 1
IR bit 0
Figure 14.10 Typical transmit/receive timings in clock synchronous serial I/O mode
(1) When the CKPOL bit in the UiC0 register is set to 0 (transmit data output at the falling edge
and the receive data taken in at the rising edge of the transfer clock)
CLKi (2)
TXD i D0 D1 D2 D3 D4 D5 D6 D7
RX Di D0 D1 D2 D3 D4 D5 D6 D7
(2) When the CKPOL bit in the UiC0 register is set to 1 (transmit data output at the rising
edge and the receive data taken in at the falling edge of the transfer clock)
CLKi (3)
TXD i D0 D1 D2 D3 D4 D5 D6 D7
RX Di D0 D1 D2 D3 D4 D5 D6 D7
i = 0 to 2
NOTES:
1. This applies to the case where the UFORM bit in the UiC0 register is set to 0 (LSB first) and the
UiLCH bit in the UiC1 register is set to 0 (no reverse).
2. When not transferring, the CLKi pin outputs a high signal.
(1) When the UFORM bit in the UiC0 register 0 (LSB first)
CLKi
TXDi D0 D1 D2 D3 D4 D5 D6 D7
RXDi D0 D1 D2 D3 D4 D5 D6 D7
(2) When the UFORM bit in the UiC0 register is set to 1 (MSB first)
CLKi
TXDi D7 D6 D5 D4 D3 D2 D1 D0
RXDi D7 D6 D5 D4 D3 D2 D1 D0
i = 0 to 2
NOTE:
1. This applies to the case where the CKPOL bit in the UiC0 register is set to 0 (transmit data output at
the falling edge and the receive data taken in at the rising edge of the transfer clock) and the
UiLCH bit in the UiC1 register 0 (no reverse).
(1) When the U2LCH bit in the U2C1 register is set to 0 (no reverse)
“H”
Transfer clock
“L”
TxD2 “H”
D0 D1 D2 D3 D4 D5 D6 D7
(no reverse) “L”
(2) When the U2LCH bit in the U2C1 register is set to 1 (reverse)
“H”
Transfer clock
“L”
TxD2 “H”
(reverse) D0 D1 D2 D3 D4 D5 D6 D7
“L”
NOTE:
1. This applies to the case where the CKPOL bit in the U2C0 register is set to 0 (transmit data
output at the falling edge and the receive data taken in at the rising edge of the transfer
clock) and the UFORM bit is set to 0 (LSB first).
MCU
TXD1 (P6 7)
CLKS 1 (P6 4)
CLK1 (P6 5) IN IN
CLK CLK
_______ _______
14.1.1.7 CTS/RTS separate function (UART0)
_______ _______ _______ _______
This function separates CTS0/RTS0, outputs RTS0 from the P60 pin, and accepts as input the CTS0
from the P64 pin or P70 pin. To use this function, set the register bits as shown below.
_______ _______
• The CRD bit in the U0C0 register is set to 0 (enables UART0 CTS/RTS)
_______
• The CRS bit in the U0C0 register is set to 1 (outputs UART0 RTS)
_______ _______
• The CRD bit in the U1C0 register is set to 0 (enables UART1 CTS/RTS)
_______
• The CRS bit in the U1C0 register is set to 0 (inputs UART1 CTS)
_______
• The RCSP bit in the UCON register is set to 1 (inputs CTS0 from the P64 pin or P70 pin)
• The CLKMD1 bit in the UCON register is set to 0 (CLKS1 not used)
_______ _______ _______ _______
Note that when using the CTS/RTS separate function, UART1 CTS/RTS separate function cannot be
used.
MCU IC
TXD0 (P6 3) IN
RXD0 (P6 2) OUT
CLK0 (P6 1) CLK
NOTE:
1. This applies to the case where the U1MAP bit in the PACR register is set to 0 (P67 to P64).
Reception start condition • Before reception can start, the following requirements must be met"
_ The RE bit in the UiC1 register is set to 1 (reception enabled)
_ Start bit detection
Table 14.7 lists the functions of the input/output pins in UART mode. Table 14.8 lists the P64 pin func-
tions during UART mode. Note that for a period from when the UARTi operation mode is selected to when
transfer starts, the TxDi pin outputs an “H”. (If the N-channel open-drain output is selected, this pin is in a
high-impedance state.)
NOTE:
1. When the U1MAP bit in PACR register is set to 1 (P73 to P70), UART1 pin is assgined to P73 to P70.
NOTES:
1. When the U1MAP bit in PACR register is 1 (P73 to P70), this table lists the P70 functions.
2. In addition to this, set the CRD bit in the U0C0 register to 0 (CTS0/RTS0 enabled) and the
CRS bit in the U0C0 register to 1 (RTS0 selected).
• Example of transmit timing when transfer data is 8-bit long (parity enabled, one stop bit)
The transfer clock stops momentarily as CTSi is “H” when the stop bit is checked.
The transfer clock starts as the transfer starts immediately CTSi changes to “L”.
Tc
Transfer clock
UiC1 register 1
TE bit
0 Write data to the UiTB register
UiC1 register
TI bit 1
0
Transferred from UiTB register to UARTi transmit register
“H”
CTSi
“L”
Stopped pulsing
Start Parity Stop because the TE bit
bit bit bit = “0”
TxDi ST D0 D1 D2 D3 D4 D5 D6 D7 P SP ST D0 D1 D2 D3 D4 D5 D6 D7 P SP ST D0 D1
UiC0 register 1
TXEPT bit
0
SiTIC register 1
IR bit 0
The above timing diagram applies to the case where the register bits Tc = 16 (n + 1) / fj or 16 (n + 1) / fEXT
are set as follows: fj: frequency of UiBRG count source (f1SIO, f2SIO, f8SIO, f32SIO)
• Set the PRYE bit in the UiMR register to 1 (parity enabled) fEXT: frequency of UiBRG count source (external clock)
• Set the STPS bit in the UiMR register to 0 (1 stop bit) n: value set to UiBRG
• Set the CRD bit in the UiC0 register to 0 (CTS/RTS enabled), i = 0 to 2
the CRS bit to 0 (CTS selected).
• Set the UiIRS bit to 1 (an interrupt request occurs when transmit completed):
U0IRS bit is the UCON register bit 0, U1IRS bit is the UCON
register bit 1, and U2IRS bit is the U2C1 register bit 4
• Example of transmit timing when transfer data is 9-bit long (parity disabled, two stop bits)
Tc
Transfer clock
1
UiC1 register
TE bit 0 Write data to the UiTB register
UiC1 register 1
TI bit
0
Transferred from UiTB register to UARTi
transmit register
Start Stop Stop
bit bit bit
TxDi ST D0 D1 D2 D3 D4 D5 D6 D7 D8 SP SP ST D0 D1 D2 D3 D4 D5 D6 D7 D8 SPSP ST D0 D1
UiC0 register 1
TXEPT bit
0
SiTIC register 1
IR bit
0
The above timing diagram applies to the case where the register bits are Tc = 16 (n + 1) / fj or 16 (n + 1) / fEXT
set as follows: fj: frequency of UiBRG count source (f1SIO, f2SIO, f8SIO, f32SIO)
• Set the PRYE bit in the UiMR register to 0 (parity disabled) fEXT: frequency of UiBRG count source (external clock)
• Set the STPS bit in the UiMR register to 1 (2 stop bits) n: value set to UiBRG
• Set the CRD bit in the UiC0 register to 1 (CTS/RTS disabled)
i = 0 to 2
• Set the UiIRS bit to 0 (an interrupt request occurs when transmit buffer
becomes empty):
U0IRS bit is the UCON register bit 0, U1IRS bit is the UCON
register bit 1, and U2IRS bit is the U2C1 register bit 4
• Example of receive timing when transfer data is 8 bits long (parity disabled, one stop bit)
UiBRG count
source
UiC1 register 1
RE bit 0
Stop bit
RxDi Start D0 D1 D7
bit
Sampled “L”
Receive data taken in
Transfer clock
Reception triggered when transfer clock Transferred from UARTi receive Read out from
UiC1 register 1 is generated by falling edge of start bit register to UiRB register UiRB register
RI bit 0
“H”
RTSi
“L”
SiRIC register 1
IR bit 0
(1) When the UFORM bit in the UiC0 register is set to 0 (LSB first)
CLKi
TXDi ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
RXDi ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
(2) When the UFORM bit in the UiC0 register is set to 1 (MSB first)
CLKi
TXDi ST D7 D6 D5 D4 D3 D2 D1 D0 P SP
RXDi ST D7 D6 D5 D4 D3 D2 D1 D0 P SP
ST : Start bit
P : Parity bit
SP : Stop bit
i = 0 to 2
NOTE:
1. This applies to the case where the CKPOL bit in the UiC0 register is set to 0 (transmit data output at the
falling edge and the receive data taken in at the rising edge of the transfer clock), the UiLCH bit in the UiC1
register is set to 0 (no reverse), the STPS bit in the UiMR register is set to 0 (1 stop bit) and the PRYE bit in
the UiMR register is set to 1 (parity enabled).
(1) When the U2LCH bit in the U2C1 register is set to 0 (no reverse)
“H”
Transfer clock
“L”
TxD2 “H”
ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
(no reverse) “L”
(2) When the U2LCH bit in the U2C1 register is set 1 (reverse)
“H”
Transfer clock
“L”
TxD2 “H”
(reverse)
ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
“L”
(1) When the IOPOL bit in the U2MR register is set to 0 (no reverse)
“H”
Transfer clock
“L”
TxD2 “H”
ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
(no reverse) “L”
RxD2 “H” ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
(no reverse) “L”
(2) When the IOPOL bit in the U2MR register is set to 1 (reverse)
Transfer clock “H”
“L”
TxD2 “H”
(reverse) “L”
ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
“H”
RxD2 “L”
ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
(reverse)
_______ _______
14.1.2.6 CTS/RTS Separate Function (UART0)
_______ _______ _______ _______
This function separates CTS0/RTS0, outputs RTS0 from the P60 pin, and accepts as input the CTS0
from the P64 pin or P70 pin. To use this function, set the register bits as shown below.
_______ _______
• The CRD bit in the U0C0 register is set to 0 (enables UART0 CTS/RTS)
_______
• The CRS bit in the U0C0 register is set to 1 (outputs UART0 RTS)
_______ _______
• The CRD bit in the U1C0 register is set to 0 (enables UART1 CTS/RTS)
_______
• The CRS bit in the U1C0 register is set to 0 (inputs UART1 CTS)
_______
• The RCSP bit in the UCON register is set to 1 (inputs CTS0 from the P64 pin or P70 pin)
• The CLKMD1 bit in the UCON register is set to 0 (CLKS1 not used)
_______ _______ _______ _______
Note that when using the CTS/RTS separate function, UART1 CTS/RTS separate function cannot be
used.
MCU IC
TXD0 (P6 3) IN
RXD0 (P6 2) OUT
NOTE:
1. This applies to the case where the U1MAP bit in the PACR register is set to 0 (P67 to P64).
_______ _______
Figure 14.21 CTS/RTS Separate Function
As shown in Table 14.13, the MCU is placed in I2C bus mode by setting bits SMD2 to SMD0 to 0102 and
the IICM bit to 1. Because SDA2 transmit output has a delay circuit attached, SDA output does not
change state until SCL2 goes low and remains stably low.
Table 14.10 I2C bus mode Specifications
Item Specification
Transfer data format • Transfer data length: 8 bits
Transfer clock • During master
the CKDIR bit in the U2MR register is set to 0 (internal clock) : fj/ (2(n+1))
fj = f1SIO, f2SIO, f8SIO, f32SIO. n: Setting value in the U2BRG register 0016 to FF16
• During slave
CKDIR bit is set to 1 (external clock ) : Input from SCL2 pin
Transmission start condition • Before transmission can start, the following requirements must be met (1)
_ The TE bit in the U2C1 register is set to 1 (transmission enabled)
_ The TI bit in the U2C1 register is set to 0 (data present in U2TB register)
Reception start condition • Before reception can start, the following requirements must be met (1)
_ The RE bit in the U2C1 register is set to 1 (reception enabled)
_ The TE bit in the U2C1 register is set to 1 (transmission enabled)
_ The TI bit in the U2C1 register is set to 0 (data present in the UiTB register)
Interrupt request When start or stop condition is detected, acknowledge undetected, and acknowledge
generation timing detected
Error detection • Overrun error (2)
This error occurs if the serial I/O started receiving the next data before reading the
U2RB register and received the 8th bit in the the next data
Select function • Arbitration lost
Timing at which the ABT bit in the U2RB register is updated can be selected
• SDA digital delay
No digital delay or a delay of 2 to 8 U2BRG count source clock cycles selectable
• Clock phase setting
With or without clock delay selectable
NOTES:
1. When an external clock is selected, the conditions must be met while the external clock is in the high
state.
2. If an overrun error occurs, bits 8 to 0 in the U2RB register are undefined. The IR bit in the S2RIC
register remains unchange.
DMA0
D Q Arbitration
Noise T
Filter
IICM2=1
Reception register UART2 receive,
ACK interrupt request,
UART2
IICM=1 and DMA1 request
IICM2=0
Start condition
detection
S
Q Bus
R busy
Stop condition NACK
detection
D Q
T
Falling edge
detection
SCL2 D Q
T ACK
IICM=0 R Port register
I/O port Q (1) 9th bit
STSPSEL=0 Internal clock
This diagram applies to the case where bits SMD2 to SMD0 in the U2MR register is set to 0102 and the IICM bit in the U2SMR register
is set to 1.
NOTE:
1. If the IICM bit is set to 1, the pin can be read even when the PD7_1 bit is set to 1 (output mode).
Table 14.11 Registers to Be Used and Settings in I2C bus mode (1) (Continued)
Register Bit Function
Master Slave
U2TB 0 to 7 Set transmission data Set transmission data
Table 14.12 Registers to Be Used and Settings in I2C bus Mode (2) (Continued)
Register Bit Function
Master Slave
U2SMR4 STAREQ Set this bit to 1 to generate start Set to 0
condition
RSTAREQ Set this bit to 1 to generate restart Set to 0
condition
STPREQ Set this bit to 1 to generate stop Set to 0
condition
STSPSEL Set this bit to 1 to output each condition Set to 0
ACKD Select ACK or NACK Select ACK or NACK
ACKC Set this bit to 1 to output ACK data Set this bit to 1 to output ACK data
SCLHI Set this bit to 1 to have SCL2 output Set to 0
stopped when stop condition is detected
SWC9 Set to 0 Set this bit to 1 to set the SCL2 to “L”
hold at the falling edge of the 9th bit of
clock
NOTE:
1: Not all bits in the register are described above. Set those bits to 0 when writing to the registers in I2C bus mode.
Factor of interrupt number UART2 transmission No acknowledgment UART2 transmission UART2 transmission
15 (1) (Refer to Fig.14.23) Transmission started or detection (NACK) Rising edge of Falling edge of SCL2
completed (selected by U2IRS) Rising edge of SCL2 9th bit SCL2 9th bit next to the 9th bit
Factor of interrupt number UART2 reception Acknowledgment detection UART2 transmission
16 (1) (Refer to Fig.14.23) When 8th bit received (ACK) Falling edge of SCL2 9th bit
CKPOL = 0 (rising edge) Rising edge of SCL2 9th bit
CKPOL = 1 (falling edge)
Timing for transferring data CKPOL = 0 (rising edge) Rising edge of SCL2 9th bit Falling edge of Falling and rising
from the UART reception CKPOL = 1 (falling edge) SCL2 9th bit edges of SCL2 9th
shift register to the U2RB bit
register
UART2 transmission Not delayed Delayed
output delay
Functions of P70 pin TxD2 output SDA2 input/output
Functions of P72 pin CLK2 input or output selected (Cannot be used in I2C bus mode)
Read received data U2RB register status is read Read U2RB register
directly as is Bit 6 to bit 0 as bit 7
to bit 1, and bit 8 as
bit 0 (4)
NOTES:
1. If the source or cause of any interrupt is changed, the IR bit in the interrupt control register for the changed interrupt
may inadvertently be set to 1 (interrupt requested). (Refer to “Notes on interrupts” in Precautions.)
. change. Therefore,
If one of the bits shown below is changed, the interrupt source, the interrupt timing, etc.
.
always be sure to clear the IR bit to 0 (interrupt not requested) after changing those bits
Bits SMD2 to the SMD0 in the U2MR register, the IICM bit in the U2SMR register,
the IICM2 bit in the U2SMR2 register, the CKPH bit in the U2SMR3 register
2. Set the initial value of SDA2 output while bits SMD2 to SMD0 in the U2MR register is set to 0002 (serial I/O
disabled).
3. Second data transfer to U2RB register (Rising edge of SCL2 9th bit)
4. First data transfer to U2RB register (Falling edge of SCL2 9th bit)
(1) When the IICM2 bit is set to 0 (ACK or NACK interrupt) and the CKPH bit is set to 0 (No clock delay)
1st 2nd 3rd 4th 5th 6th 7th 8th 9th
bit bit bit bit bit bit bit bit bit
SCL2
(2) When the IICM2 bit is set to 0 and the CKPH bit is set to 1 (clock delay)
1st 2nd 3rd 4th 5th 6th 7th 8th 9th
bit bit bit bit bit bit bit bit bit
SCL2
(3) When the IICM2 bit is set to 1 (UART transmit or receive interrupt) and the CKPH bit is set to 0
1st 2nd 3rd 4th 5th 6th 7th 8th 9th
bit bit bit bit bit bit bit bit bit
SCL2
(4) When the IICM2 bit is set to 1 and the CKPH bit is set to 1
1st 2nd 3rd 4th 5th 6th 7th 8th 9th
bit bit bit bit bit bit bit bit bit
SCL2
Data is transferred to the U2RB register Data is transferred to the U2RB register
b15 b9 b8 b7 b0 b15 b9 b8 b7 b0
••• D0 D7 D6 D5 D 4 D3 D2 D1 ••• D8 D7 D6 D5 D4 D 3 D2 D 1 D0
Contents in the U2RB register Contents in the U2RB register
SCL2
SDA2
(Start condition)
SDA2
(Stop condition)
NOTE:
1. When the PCLK1 bit in the PCLKR register is set to 1, the cycles indicates the f1SIO's
generation frequency cycles; when PCLK1 bit is set to 0, the cycles indicated the
f2SIO's generation frequency cycles.
STPSEL bit 0
1st 2nd 3rd 4th 5th 6th 7th 8th 9th bit
SCL2
SDA2
STPSEL bit
SDA2
Set STAREQ
to 1 (start) Set STPREQ
Start condition detection Stop condition detection
to 1 (start) interrupt
interrupt
14.1.3.3 Arbitration
Unmatching of the transmit data and SDA2 pin input data is checked synchronously with the rising
edge of SCL2. Use the ABC bit in the U2SMR register to select the timing at which the ABT bit in the
U2RB register is updated. If the ABC bit is set to 0 (updated bitwise), the ABT bit is set to 1 at the same
time unmatching is detected during check, and is cleared to 0 when not detected. In cases when the
ABC bit is set to 1, if unmatching is detected even once during check, the ABT bit is set to 1
(unmatching detected) at the falling edge of the clock pulse of 9th bit. If the ABT bit needs to be
updated bytewise, clear the ABT bit to 0 (undetected) after detecting acknowledge in the first byte,
before transferring the next byte.
Setting the ALS bit in the U2SMR2 register to 1 (SDA2 output stop enabled) causes arbitration-lost to
occur, in which case the SDA2 pin is placed in the high-impedance state at the same time the ABT bit
is set to 1 (unmatching detected).
ferring data from the U2TB register to the UART2 transmit register (at start of transmission)
_ The U2IRS bit is set to 1 (transfer completed): when the serial I/O finished sending
P13
P12
P93
P72(CLK2) P72(CLK2)
P71(RxD2) P71(RxD2)
P70(TxD2) P70(TxD2)
MCU MCU
(Master) (Slave)
P93
P72(CLK2)
P71(RxD2)
P70(TxD2)
MCU
(Slave)
Figure 14.27 Transmission and Reception Timing in Master Mode (Internal Clock)
"H"
Slave control input
"L"
Figure 14.28 Transmission and Reception Timing (CKPH=0) in Slave Mode (External Clock)
"H"
Slave control input
"L"
Figure 14.29 Transmission and Reception Timing (CKPH=1) in Slave Mode (External Clock)
(1) The ABSCS bit in the U2SMR register (bus collision detect sampling clock select)
If ABSCS=0, bus collision is determined at the rising edge of the transfer clock
Transfer clock
ST D0 D1 D2 D3 D4 D5 D6 D7 D8 SP
TxD2
RxD2
Input to TA0IN
Timer A0
If ABSCS is set to 1, bus collision is determined when timer
A0 (one-shot timer mode) underflows .
(2) The ACSE bit in the U2SMR register (auto clear of transmit enable bit)
Transfer clock
ST D0 D1 D2 D3 D4 D5 D6 D7 D8 SP
TxD2
RxD2
(3) The SSS bit in the U2SMR register (Transmit start condition select)
If SSS bit is set to 0, the serial I/O starts sending data one transfer clock cycle after the transmission enable condition is met.
Transfer clock
ST D0 D1 D2 D3 D4 D5 D6 D7 D8 SP
TxD2
If SSS bit = 1, the serial I/O starts sending data at the rising edge (Note 1) of RxD2
CLK2
ST D0 D1 D2 D3 D4 D5 D6 D7 D8 SP
TxD2 (Note 2)
RxD2
NOTES:
1: The falling edge of RxD2 when the IOPOL is set to 0; the rising edge of RxD2 when the IOPOL is set to 1.
2: The transmit condition must be met before the falling edge (Note 1) of RxD.
.
This diagram applies to the case where the IOPOL is set to 1 (reversed)
Reception start condition • Before reception can start, the following requirements must be met
_ The RE bit in the U2C1 register is set to 1 (reception enabled)
_ Start bit detection
Transfer Clock
1
TE bit in U2C1
register 0
Data is written to
the UART2 register
TI bit in U2C1 1
register
0
IR bit in S2TIC 1
register
0
Transfer Clock
1
RE bit in U2C1
register 0
Start Parity Stop
Transmit Waveform bit bit bit
from the
Transmitting End ST D0 D1 D2 D3 D4 D5 D6 D7 P SP ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
TxD2
TxD2 outputs "L" due
to a parity error
RI bit in U2C1 1
register
0
Read the U2RB register
IR bit in S2RIC 1
register 0
NOTES:
1. Because TxD2 and RxD2 are connected, this is composite waveform consisting of the TxD2 output and the parity error
signal sent back from receiver.
2. Because TxD2 and RxD2 are connected, this is composite waveform consisting of the transmitter's transmit waveform
and the parity error signal received.
Figure 14.32 shows the example of connecting the SIM interface. Connect TXD2 and RXD2 and apply
pull-up.
MCU
SIM card
TxD2
RxD2
Transfer “H”
clock “L”
“H”
RxD 2 ST D0 D1 D2 D3 D4 D5 D6 D7 P SP
“L”
“H”
TxD2 (1)
“L”
U2C1 register 1
RI bit 0
This timing diagram applies to the case where the direct format is implemented. ST: Start bit
P: Even Parity
NOTE: SP: Stop bit
1. The output of MCU is in the high-impedance state (pulled up externally).
14.1.6.2 Format
• Direct Format
Set the PRY bit in the U2MR register to 1, the UFORM bit in U2C0 register to 0 and the U2LCH bit in
U2C1 register to 0.
• Inverse Format
Set the PRY bit to 0, UFORM bit to 1 and U2LCH bit to 1.
Figure 14.34 shows the SIM interface format.
TxD2 “H”
D0 D1 D2 D3 D4 D5 D6 D7 P
“L”
P : Even parity
“H”
TxD2
“L” D7 D6 D5 D4 D3 D2 D1 D0 P
P : Odd parity
SMi2
SMi3
SMi5 LSB MSB
SOUTi
8
Note: i = 3, 4.
n = A value set in the SiBRG register.
Bit
Symbol Bit Name Function RW
NOTES:
1. Set the S4C register by the next instruction after setting the PRC2 bit in the PRCR register to 1 (write enable).
2. Set the SMi3 bit to 1 and the corresponding port direction bit to 0 (input mode).
3. Set the SMi3 bit to 1 (SOUTi output, CLKi function) .
4. When the SMi2 bit is set to 1, the corresponding pin goes to high-impedance regardless of the function in use.
5. When the SMi1 and SMi0 bit settings are changed, set the SiBRG register .
NOTES:
1. Write to this register while serial I/O is neither transmitting or receiving.
2. Use MOV instruction to write to this register.
3. Set the SiBRG register after setting bits SMi1 and SMi0 in the SiC register.
Description RW
Transmission/reception starts by writing transmit data to this register. After RW
transmission/reception completion, reception data can be read by reading this register.
NOTES:
1. Write to this register while serial I/O is neither transmitting or receiving.
2. To receive data, set the corresponding port direction bit for SINi to 0 (input mode).
Figure 14.36 S3C and S4C Registers, S3BRG and S4BRG Registers, and S3TRR and S4TRR Registers
"H"
SI/Oi internal clock "L"
(2)
SOUTi output "H"
"L"
D0 D1 D2 D3 D4 D5 D6 D7
"H"
SINi input
"L"
SiIC register 1
IR bit 0
i= 3, 4
NOTES:
1. This diagram applies to the case where the SiC register bits are set as follows:
SMi2 = 0 (SOUTi output), SMi3 = 1 (SOUTi output, CLKi function), SMi4 = 0 (transmit data output at the falling edge and receive data input at the
rising edge of the transfer clock), SMi5 = 0 (LSB first) and SMi6 = 1 (internal clock)
2. When the SMi6 bit is set to 0 (internal clock), the SOUTi pin is placed in the high-impedance state after the transfer is completed.
3. If the SMi6 bit is set to 0 (internal clock), the serial I/O starts sending or receiving data a maximum of 1.5 transfer clock cycles after writing to
the SiTRR register.
CLKi (2)
SINi D0 D1 D2 D3 D4 D5 D6 D7
SOUTi D0 D1 D2 D3 D4 D5 D6 D7
CLKi (3)
SINi D0 D1 D2 D3 D4 D5 D6 D7
SOUTi D0 D1 D2 D3 D4 D5 D6 D7
i=3 and 4
NOTES:
1. This diagram applies to the case where the SiC register bits are set as follows:
SMi5 = 0 (LSB first) and SMi6 = 1 (internal clock)
2. When the SMi6 bit is set to 1 (internal clock), a high level is output from the CLKi pin if not transferring data.
3 When the SMi6 bit is set to 1 (internal clock), a low level is output from the CLKi pin if not transferring data.
SMi3 bit
Set the SMi7 bit to 1
(SOUT i initial value = “H”)
D0
SOUTi (internal)
Set the SMi3 bit to 1
(SOUTi pin functions as S OUTi output)
Port output D 0
SOUTi pin output
“H” level is output
Initial value = “H” (3)
from the S OUT i pin
(i = 3, 4)
Setting the SOUTi Port selection switching Write to the SiTRR register
initial value to “H” (I/O port SOUTi)
(2)
NOTES:
1. This diagram applies to the case where the bits in the SiC register are set as follows: Serial transmit/reception starts
SMi2 = 0 (SOUTi output), SMi5 = 0 (LSB first) and SMi6 = 0 (external clock)
2. SOUTi can only be initialized when input on the CLKi pin is in the high state if the SMi4bit in the SiC
register is set to 0 (transmit data output at the falling edge of the transfer clock) or in the low state if
the SMi4 bit is set to 1 (transmit data output at the rising edge of the transfer clock).
3. If the SMi6 bit is set to 1 (internal clock) or if the SMi2 bit is set to 1 (SOUTi output disabled), this
output goes to the high-impedance state.
The MCU contains one A/D converter circuit based on 10-bit successive approximation method configured
with a capacitive-coupling amplifier. The analog inputs share the pins with P100 to P107 (AN0 to AN7), P00
to P07 (AN00 to AN07), and P10 to P13, P93, P95 to P97 (AN20 to AN27), and P90 to P92 (AN30 to AN32).
____________
Similarly, ADTRG input shares the pin with P15. Therefore, when using these inputs, make sure the corre-
sponding port direction bits are set to 0 (input mode).
When not using the A/D converter, set the VCUT bit to 0 (Vref unconnected), so that no current will flow
from the Vref pin into the resistor ladder, helping to reduce the power consumption of the chip.
The A/D conversion result is stored in the ADi register bits for ANi, AN0i, AN2i (i = 0 to 7), and AN3i pins (i
= 0 to 2). Table 15.1 shows the A/D converter performance. Figure 15.1 shows the A/D converter block
diagram and Figures 15.2 to 15.4 show the A/D converter associated with registers.
VREF
VCUT=0 Resistor ladder
AVSS
VCUT=1
ADCON0 register
Addresses (address 03D616)
(03C116 to 03C016) A/D register 0(16)
(03C316 to 03C216) A/D register 1(16)
(03C516 to 03C416) A/D register 2(16)
(03C716 to 03C616) A/D register 3(16) Decoder
(03C916 to 03C816) for A/D register
A/D register 4(16)
(03CB16 to 03CA16) A/D register 5(16)
(03CD16 to 03CC16) A/D register 6(16)
(03CF16 to 03CE16) A/D register 7(16)
Comparator 0
Decoder
for channel VIN
selection
ADGSEL1 to ADGSEL0=112
ADGSEL1 to ADGSEL0=012
Note: AN04 to AN07, AN20 to AN23, and AN25 to AN27, is available for only 80-pin package.
CH1 Analog input pin select bit Function varies with each operation mode RW
CH2 RW
b4 b3
0: Software trigger
TRG Trigger select bit RW
1: Hardware trigger
0: A/D conversion disabled
ADST A/D conversion start flag RW
1: A/D conversion started
NOTE:
1. If the ADCON0 register is rewritten during A/D conversion, the conversion result will be undefined.
SCAN0 RW
A/D sweep pin select bit Function varies with each operation mode
SCAN1 RW
NOTES:
1. If the ADCON1 register is rewritten during A/D conversion, the conversion result will be undefined.
2. If the VCUT bit is reset from 0 (VREF unconnected) to 1 (VREF connected), wait for 1 µs or more before starting A/D
conversion.
TRG1 Trigger select bit Function varies with each operation mode RW
NOTS:
1. If the ADCON2 register is rewritten during A/D conversion, the conversion result will be undefined.
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
ADTRGCON 03D216 0016
AN0 Trigger Select Bit Function varies with each operation mode RW
HPTRG0
AN1 Trigger Select Bit Function varies with each operation mode RW
HPTRG1
NOTES:
1. If the ADTRGCON register is rewritten during A/D conversion, the conversion result will be undefined.
2. Set 00 16 in this register in one-shot mode, repeat mode, single sweep mode, repeat sweep mode 0 and repeat
sweep mode 1.
ADERR0 AN1 trigger status flag 0: AN1 trigger did not occur during
AN0 conversion RW
1: AN1 trigger occured during
AN0 conversion
Function RW
When the BITS bit in the ADCON1 When the BITS bit in the ADCON1
register is 1 (10-bit mode) register is 0 (8-bit mode) RW
Eight low-order bits of A/D conversion result
A/D conversion result RO
(6)
TB2SEL Trigger select bit 0: TB2 interrupt
RW
1: Underflow of TB2 interrupt
generation frequency setting counter [ICTB2]
NOTES:
1. Write to this register after setting the PRC1 bit in the PRCR register to 1 (write enabled).
2. If the INV11 bit is 0 (three-phase mode 0) or the INV06 bit is 1 (triangular wave modulation mode), set this bit to 0 (timer
B2 underflow).
3. When setting the IVPCR1 bit to 1 (three-phase output forcible cutoff by SD pin input enabled), Set the PD85 bit to 0 (= input
mode).
4. Related pins are U(P80), U(P81), V(P72), V(P73), W(P74), W(P75). When a high-level ("H") signal is applied to the SD pin
and set the IVPCR1 bit to 0 after forcible cutoff, pins U, U, V, V, W, and W are exit from the high-impedance state. If a low-
level (“L”) signal is applied to the SD pin, three-phase motor control timer output will be disabled (INV03=0). At this time,
when the IVPCR1 bit is 0, pins U, U, V, V, W, and W become programmable I/O ports. When the IVPCR1 bit is set to 1,
pins U, U, V, V, W, and W are placed in a high-impedance state regardless of which function of those pins is used.
5. When this bit is used in delayed trigger mode 0, set bits TB0EN and TB1EN to 1 (A/D trigger mode).
6. When setting the TB2SEL bit to 1 (underflow of TB2 interrupt generation frequency setting counter[ICTB2]), set the INV02
bit to 1 (three-phase motor control timer function).
•Example when selecting AN2 to an analog input pin (Ch2 to CH0 = 0102)
SCAN1 RW
NOTES:
1. If the ADCON1 register is rewritten during A/D conversion, the conversion result will be undefined.
2. If the VCUT bit is reset from 0 (Vref unconnected) to 1 (Vref connected), wait for 1 µs or more before starting
A/D conversion.
NOTE:
1. If the ADCON2 register is rewritten during A/D conversion, the conversion result will be undefined.
•Example when selecting AN2 to an analog input pin (Ch2 to CH0 = 0102)
AN0
AN1
AN2
AN3
AN4
AN5
AN6
AN7
MD0 b4 b3 RW
A/D operation mode
select bit 0 (3) 0 1: Repeat mode
MD1 RW
0: Software trigger
TRG Trigger select bit RW
1: Hardware trigger (ADTRG trigger)
0: A/D conversion disabled
ADST A/D conversion start flag RW
1: A/D conversion started
NOTES:
1. If the ADCON0 register is rewritten during A/D conversion, the conversion result will be undefined.
2. AN00 to AN07, AN20 to AN27, and AN30 to AN32 can be used in the same way as AN0 to AN7. Use bits ADGSEL1
and ADGSEL 0 in the ADCON2 register to select the desired pin.
3. After rewriting bits MD1 and MD0, set bits CH2 to CH0 over again using an another instruction.
SCAN0 RW
A/D sweep pin select bit Invalid in repeat mode
SCAN1 RW
0: 8-bit mode
BITS 8/10-bit mode select bit RW
1: 10-bit mode
NOTES:
1. If the ADCON1 register is rewritten during A/D conversion, the conversion result will be undefined.
2. If the VCUT bit is reset from 0 (Vref unconnected) to 1 (Vref connected), wait for 1 µs or more before starting A/D
conversion.
NOTE:
1. If the ADCON2 register is rewritten during A/D conversion, the conversion result will be undefined.
•Example when selecting AN0 to AN3 to A/D sweep pins (SCAN1 to SCAN0 = 012)
AN0
AN1
AN2
AN3
AN4
AN5 A/D interrupt request generated
AN6
AN7
CH1 Analog input pin select bit Invalid in single sweep mode RW
CH2 RW
MD0 b4 b3
RW
A/D operation mode 1 0: Single sweep mode or Simultaneous
MD1 select bit 0 sample sweep mode
RW
0: Software trigger
TRG Trigger select bit RW
1: Hardware trigger (ADTRG trigger)
0: A/D conversion disabled
ADST A/D conversion start flag RW
1: A/D conversion started
NOTE:
1. If the ADCON0 register is rewritten during A/D conversion, the conversion result will be undefined.
NOTES:
1. If the ADCON1 register is rewritten during A/D conversion, the conversion result will be undefined.
2. AN00 to AN07, AN20 to AN27, and AN30 to AN32 can be used in the same way as AN0 to AN7. Use bits ADGSEL1
and ADGSEL 0 in the ADCON2 register to select the desired pin.
3. If the VCUT bit is reset from 0 (Vref unconnected) to 1 (Vref connected), wait for 1 µs or more before starting A/D
conversion.
NOTE:
1. If the ADCON2 register is rewritten during A/D conversion, the conversion result will be undefined.
•Example when selecting AN0 to AN3 to A/D sweep pins (SCAN1 to SCAN0 = 012)
AN0
AN1
AN2
AN3
AN4
AN5
AN6
AN7
CH1 Analog input pin select bit Invalid in repeat sweep mode 0 RW
CH2 RW
MD0 b4 b3
RW
A/D operation mode 1 1: Repeat sweep mode 0 or
MD1 select bit 0 repeat sweep mode 1
RW
0: Software trigger
TRG Trigger select bit RW
1: Hardware trigger (ADTRG trigger)
0: A/D conversion disabled
ADST A/D conversion start flag RW
1: A/D conversion started
NOTE:
1. If the ADCON0 register is rewritten during A/D conversion, the conversion result will be undefined.
NOTES:
1. If the ADCON1 register is rewritten during A/D conversion, the conversion result will be undefined.
2. AN00 to AN07, AN20 to AN27, and AN30 to AN32 can be used in the same way as AN0 to AN7. Use bits ADGSEL1
and ADGSEL 0 in the ADCON2 register to select the desired pin.
3. If the VCUT bit is reset from 0 (Vref unconnected) to 1 (Vref connected), wait for 1 µs or more before starting A/D
conversion.
NOTE:
1. If the ADCON2 register is rewritten during A/D conversion, the conversion result will be undefined.
•Example when selecting AN0 to A/D sweep pins (SCAN1 to SCAN0 = 002)
AN0
AN1
AN2
AN3
AN4
AN5
AN6
AN7
CH1 Analog input pin select bit Invalid in repeat sweep mode 1 RW
CH2 RW
MD0 b4 b3
RW
A/D operation mode 1 1: Repeat sweep mode 0 or
MD1 select bit 0 repeat sweep mode 1
RW
0: Software trigger
TRG Trigger select bit RW
1: Hardware trigger (ADTRG trigger)
0: A/D conversion disabled
ADST A/D conversion start flag RW
1: A/D conversion started
NOTE:
1. If the ADCON0 register is rewritten during A/D conversion, the conversion result will be undefined.
NOTES:
1. If the ADCON1 register is rewritten during A/D conversion, the conversion result will be undefined.
2. AN00 to AN07, AN20 to AN27, and AN30 to AN32 can be used in the same way as AN0 to AN7. Use bits ADGSEL1
and ADGSEL 0 in the ADCON2 register to select the desired pin.
3. If the VCUT bit is reset from 0 (Vref unconnected) to 1 (Vref connected), wait for 1 µs or more before starting A/D
conversion.
NOTE:
1. If the ADCON2 register is rewritten during A/D conversion, the conversion result will be undefined.
•Example when selecting AN0 to AN3 to A/D pins for sweep (SCAN1 to SCAN0 = 012)
AN0
AN1
AN2
AN3
AN4
AN5
A/D interrupt request generated
AN6
AN7
CH1 Analog input pin select bit Invalid in repeat sweep mode 0 RW
CH2 RW
MD0 b4 b3
RW
A/D operation mode 1 0: Single sweep mode or
MD1 select bit 0 simultaneous sample sweep mode
RW
NOTE:
1. If the ADCON0 register is rewritten during A/D conversion, the conversion result will be undefined.
NOTES:
1. If the ADCON1 register is rewritten during A/D conversion, the conversion result will be undefined.
2. AN00 to AN07, AN20 to AN27, and AN30 to AN32 can be used in the same way as AN0 to AN7. Use bits ADGSEL1
and ADGSEL 0 in the ADCON2 register to select the desired pin.
3. If the VCUT bit is reset from 0 (Vref unconnected) to 1 (Vref connected), wait for 1 µs or more before starting A/D
conversion.
NOTE:
1. If the ADCON2 register is rewritten during A/D conversion, the conversion result will be undefined.
NOTE:
1. If ADTRGCON is rewritten during A/D conversion, the conversion result will be undefined.
Table 15.9 Trigger Select Bit Setting in Simultaneous Sample Sweep Mode
TRG TRG1 HPTRG0 TRIGGER
0 - - Software trigger
1 - 1 Timer B0 underflow (1)
1 0 0 ADTRG
Timer B2 or Timer B2 interrupt generation frequency setting
1 1 0
counter underflow (2)
NOTES:
1. A count can be started for Timer B2, Timer B2 interrupt generation frequency
setting counter underflow or the INT5 pin falling edge as count start
conditions of Timer B0.
2. Select Timer B2 or Timer B2 interrupt generation frequency setting counter
using the TB2SEL bit in the TB2SC register.
•Example when selecting AN0 to AN3 to A/D sweep pins (SCAN1 to SCAN0 = 012)
AN0
AN1
AN2
AN3
Timer B0 underflow
Timer B1 underflow
AN0
AN1
AN2
AN3
•Example 3: When Timer B0 underflow is generated during A/D conversion of any pins except AN0 pin
Timer B0 underflow
Timer B0 underflow
(Abort othrt pins conversion)
Timer B1 underflow Timer B1 under flow
AN0
AN1
AN2
AN3
•Example 4: When Timer B0 underflow is generated again before Timer B1 underflow is generated
after Timer B0 underflow generation
AN0
AN1
AN2
AN3
•Example when selecting AN0 to AN3 to A/D sweep pins (SCAN1 to SCAN0 = 012)
AN0
AN1
AN2
AN3
1
ADST flag
0 Do not set to 1 by program
1
ADERR0 flag
0
ADERR1 flag 1
0
ADTCSF flag 1
0
ADSTT0 flag 1
0
ADSTT1 flag 1
0
ADSTRT0 flag 1
0
Set to 0 by program
ADSTRT1 flag 1
0
Timer B0 underflow
Timer B1 underflow
AN0
AN1
AN2
AN3
ADST flag 1
0
Do not set to 1 by program
ADERR0 flag 1
0
ADERR1 flag 1
0
ADTCSF flag 1
0
ADSTT0 flag 1
0
ADSTT1 flag 1
0
ADSTRT0 flag 1
0 Set to 0 by program
ADSTRT1 flag 1
0
Figure 15.20 Each Flag Operation in ADSTAT0 Register Associated with the Operation
Example in Delayed Trigger Mode 0 (1)
•Example 3: When Timer B0 underflow is generated during A/D pin conversion of any pins except AN0 pin
ADST flag 1
0 Do not set to 1 by program
ADERR0 flag 1
0
ADERR1 flag 1
0
ADTCSF flag 1
0
ADSTT0 flag 1
0
ADSTT1 flag 1
0
ADSTRT0 flag 1
0
Set to 0 by program
ADSTRT1 flag 1
0
•Example 4: After Timer B0 underflow is generated and when Timer B0 underflow is generated again
before Timer B1 underflow is genetaed
AN1
AN2
AN3
1
ADST flag
0
Do not set to 1 by program
1
ADERR0 flag
0
ADERR1 flag 1
0
ADTCSF flag 1
0
ADSTT0 flag 1
0
ADSTT1 flag 1
0
ADSTRT0 flag 1
0
Set to 0 by program
ADSTRT1 flag 1
0
Figure 15.21 Each Flag Operation in ADSTAT0 Register Associated with the Operation
Example in Delayed Trigger Mode 0 (2)
CH1 RW
CH2 RW
NOTES:
1. If the ADCON0 register is rewritten during A/D conversion, the conversion result will be undefined.
2. Do not write 1 in delayed trigger mode 0. When write, set to 0.
NOTES:
1. If the ADCON1 register is rewritten during A/D conversion, the conversion result will be undefined.
2. AN0 0 to AN0 7, AN2 0 to AN2 7, and AN3 0 to AN3 2 can be used in the same way as AN 0 to AN 7. Use bits ADGSEL1 and
ADGSEL0 in the ADCON2 register to select the desired pin.
3. If the VCUT bit is reset from 0 (Vref unconnected) to 1 (Vref connected), wait for 1 µs or more before starting
A/D conversion.
b2 b1
ADGSEL0 A/D input group 0 0: Select port P10 group RW
select bit 0 1: Select port P9 group
1 0: Select port P0 group
ADGSEL1 RW
1 1: Select port P1/P9 group
NOTES:
1. If the ADCON2 register is rewritten during A/D conversion, the conversion result will be undefined.
2. Set to 1 in delayed trigger mode 0.
NOTE:
1. If ADTRGCON is rewritten during A/D conversion, the conversion result will be undefined.
NOTES:
___________
1. Do not generate the next ADTRG pin falling edge after the AN1 pin conversion is started until all selected pins
___________
complete A/D conversion. When an ADTRG pin falling edge is generated again during A/D conversion, its trigger
___________
is ignored. The falling edge of ADTRG pin, which was input after all selected pins complete A/D conversion, is
considered to be the next AN0 pin conversion start condition.
___________ ___________
2. The ADTRG pin falling edge is detected synchronized with the operation clock fAD. Therefore, when the ADTRG pin
___________
falling edge is generated in shorter periods than fAD, the second ADTRG pin falling edge may not be detected. Do
___________
not generate the ADTRG pin falling edge in shorter periods than fAD.
3. Do not write 1 (A/D conversion started) to the ADST bit in delayed trigger mode 1. When write 1,unexpected
interrupts may be generated.
4. AN00 to AN07, AN 20 to AN27, and AN30 to AN32 can be used in the same way as AN0 to AN7. However, all input
pins need to belong to the same group.
•Example when selecting AN0 to AN3 to A/D sweep pins (SCAN1 to SCAN0 = 012)
•Example 1: When ADTRG pin falling edge is generated during AN0 pin conversion A/D pin input
voltage sampling
A/D pin conversion
ADTRG pin input
AN0
AN1
AN2
AN3
•Example 2: When ADTRG pin falling edge is generated again after AN0 pin conversion
AN0
AN1
AN2
AN3
•Example 3: When ADTRG pin falling edge is generated more than two times after AN0 pin conversion
AN0
AN1 (invalid)
AN2
AN3
•Example when selecting AN0 to AN3 to A/D sweep pins (SCAN1 to SCAN0 = 012)
•Example 1: When ADTRG pin falling edge is generated during AN0 pin conversion
AN0
AN1
AN2
AN3
ADST flag 1
0 Do not set to 1 by program
ADERR0 flag 1
0
ADERR1 flag 1
0
ADTCSF flag 1
0
ADSTT0 flag 1
0
ADSTT1 flag 1
0
ADSTRT0 flag 1
0
Set to 0 by program
ADSTRT1 flag 1
0
•Example 2: When ADTRG pin falling edge is generated again after AN0 pin conversion
AN0
AN1
AN2
AN3
ADST flag 1
0
Do not set to 1 by program
ADERR0 flag 1
0
ADERR1 flag 1
0
ADTCSF flag 1
0
ADSTT0 flag 1
0
ADSTT1 flag 1
0
ADSTRT0 flag 1
0
Set to 0 by program
ADSTRT1 flag 1
0
Figure 15.25 Each Flag Operation in ADSTAT0 Register Associated with the Operation Example
in Delayed Trigger Mode 1 (1)
•Example 3: When ADTRG input falling edge is generated more than two times after AN0 pin conversion
A/D pin input
voltage sampling
A/D pin conversion
AN0
AN1 (invalid)
AN2
AN3
ADST flag 1
0
Do not set to 1 by program
ADERR0 flag 1
0
ADERR1 flag 1
0
ADTCSF flag 1
0
ADSTT0 flag 1
0
ADSTT1 flag 1
0
ADSTRT0 flag 1
0
Set to 0 by program
ADSTRT1 flag 1
0
Figure 15.26 Each Flag Operation in ADSTAT0 Register Associated with the Operation Example
in Delayed Trigger Mode 1 (2)
CH1 RW
CH2 RW
NOTES:
1. If the ADCON0 register is rewritten during A/D conversion, the conversion result will be undefined.
2. Do not write 1 in delayed trigger mode 1. If necessary, set to 0.
b2 b1
ADGSEL0 A/D input group 0 0: Select port P10 group RW
select bit 0 1: Select port P9 group
1 0: Select port P0 group
ADGSEL1 RW
1 1: Select port P1/P9 group
NOTES:
1. If the ADCON2 register is rewritten during A/D conversion, the conversion result will be undefined.
2. Set to 1 in delayed trigger mode 1.
NOTE:
1. If ADTRGCON is rewritten during A/D conversion, the conversion result will be undefined.
0 1 0 0 ADTRG
X X
And when t = T, VC=VIN- VIN=VIN(1- )
Y Y
1 T
c(R0+R) X
e =
Y
1 X
- T = ln
C(R0+R) Y
T
Hence, R0 = - -R
C•ln X
Y
Figure 15.29 shows analog input pin and externalsensor equivalent circuit. When the difference be-
tween VIN and VC becomes 0.1 LSB, we find impedance R0 when voltage between pins. VC changes
from 0 to VIN-(0.1/1024) VIN in timer T. (0.1/1024) means that A/D precision drop due to insufficient
capacitor chage is held to 0.1LSB at time of A/D conversion in the 10-bit mode. Actual error however is
the value of absolute precision added to 0.1LSB. When f(XIN) = 10MHz, T=0.3µs in the A/D conversion
mode with sample & hold. Output inpedance R0 for sufficiently charging capacitor C within time T is
determined as follows.
0.3X10-6
R0 = - - 7.8 X 103 ≅ 13.9 X 103
0.1
1.5X10-12•ln
1024
Thus, the allowable output impedance of the sensor circuit capable of thoroughly driving the A/D con-
verter turns out of be approximately 13.9kΩ.
MCU
Sensor equivalent
circuit
(1)
R0 R (7.8kΩ)
VIN (1)
C (1.5pF) Sampling time
VC 3
Sample-and-hold function enabled: φAD
NOTE:
1. Reference value
Figure 15.29 Analog Input Pin and External Sensor Equivalent Circuit
REJ09B0101-0112
S3D0 ICK1 ICK0 SCLM SDAM WIT SIM
Address comparator
STSP
AL
SIS SIP SSC4 SSC3 SSC2 SSC1 SSC0
SEL circuit
S10 I2C0 Status Registers
I2C0 start/stop condition control register
2
I C0 Control Registers 2
BB
S4D0 ICK 4 ICK 3 ICK 2 TOSEL TOF T OE
circuit
2
I C0 Address Register
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
0 S0D0 02E216 00 16
SAD0 RW
SAD1 RW
SAD2 RW
Compare with received
Slave address
SAD3 address data RW
SAD4 RW
SAD5 RW
SAD6 RW
Function RW
NOTE:
1. Write is enabled only when the ES0 bit in the S1D0 register is 1 (I2C bus interface is enabled). Write the transmit data after
the receive data is read because the S00 register is used to store both the transmit and receive data. When the S00 register
is set, bits BC2 to BC0 in the S1D0 register are set to 0002, while bits LRB, AAS, and AL in the S10 register are set to 0
respectively.
CCR1 RW
CCR2 RW
CCR3 RW
CCR4 RW
I 2 C0 Control Register 0
b7 b3 b2 b1 b0
Symbol Address After Reset
S1D0 02E316 00 16
NOTE:
1.In the following status, the bit counter is set to 000 automatically
•Start condition/stop condition are detected
•Immediately after the completion of 1-byte data transmit
•Immediately after the completion of 1-byte data receive
I 2 C0 Status Register
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
S10 02E816 0001000X 2
NOTES:
1. This bit is read only if it is used for the status check.
To write to this bit, refer to 16.9 START Condition Generation Method and 16.11 STOP Condition Generation
Method.
2. Read only. If necessary, set to 0.
3. To write to these bits, refer to 16.9 START Condition Generation Method and 16.11 STOP Condition
Generation Method.
I 2 C0 Control Register 1
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
S3D0 02E616 00110000 2
WIT The interrupt enable bit for 0: Disable the I2C bus interface
data receive completion interrupt of data receive
completion
1: Enable the I2C bus interface
interrupt of data receive RW
completion
b7 b6
ICK0 I2C bus system clock RW
0 0 : VIIC =1/2 fIIC
selection bits, 0 1 : VIIC =1/4fIIC
if bits ICK4 to ICK2 in the 1 0 : VIIC =1/8 fIIC
ICK1 S4D0 register is 000 2 RW
1 1 : Reserved (2)
NOTE:
1. Bits PED and PEC are enabled when the ES0 bit in the S1D0 register is set to 1 (I2C bus interface enabled).
2. When the PCLK0 bit in the PCLKR register is set to 0, fIIC=f2. When the PCLK0 bit in the PCLKR register is set
to 1, fIIC=f1.
I 2 C0 Control Register 2
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
S4D0 02E716 00 16
NOTE:
1. When the PCLK0 bit in the PCLKR register is set to 0, fIIC = f2. When the PCLK0 bit is set to 1, fIIC=f1.
SSC0 RW
SSC1 RW
Setting for detection condition
START/STOP condition
SSC2 of START/STOP condition. RW
setting bits(1)
See Table 16.2
SSC3 RW
SSC4 RW
NOTE:
1. Do not set 000002 or odd values.
Table 16.2 Recommended setting (SSC4-SSC0) start/stop condition at each oscillation frequency
Oscillation I2C bus system I2C bus system SSC4-SSC0(1) SCL release Setup time Hold time
f1 (MHz) clock select clock(MHz) time (cycle) (cycle) (cycle)
10 1 / 2f1 (2) 5 XXX11110 6.2 µs (31) 3.2 µs (16) 3.0 µs (15)
8 1 / 2f1(2) 4 XXX11010 6.75 µs(27) 3.5 µs (14) 3.25 µs(13)
XXX11000 6.25 µs(25) 3.25 µs (13) 3.0 µs (12)
8 1 / 8f1 (2) 1 XXX00100 5.0 µs (5) 3.0 µs (3) 2.0 µs (2)
4 1 / 2f1 (2) 2 XXX01100 6.5 µs (13) 3.5 µs (7) 3.0 µs (6)
XXX01010 5.5 µs (11) 3.0 µs (6) 2.5 µs (5)
2 1 / 2f1 (2) 1 XXX00100 5.0 µs (5) 3.0 µs (3) 2.0 µs (2)
NOTES:
1. Do not set odd values or 000002 to START/STOP condition setting bits (SSC4 to SSC0)
2. When the PCLK0 bit in the PCLKR register is set to 1.
SCL
SDA
tdfil
Internal SCL tdfil: Noise elimination circuit delay time
1 to 2 VIIC cycle
tdsft: Shift clock delay time
Internal SDA
1 VIIC cycle
tdfil tdsft
Shift clock
Store data at the rising edge of shift clock
1 1 1 0 1 17.2 34.5
1 1 1 1 0 16.6 33.3
1 1 1 1 1 16.1 32.3
NOTES:
1. The duty of the SCL clock output is 50 %. The duty becomes 35 to 45 % only when high-speed
clock mode is selected and the CCR value = 5 (400 kHz, at VIIC = 4 MHz). “H” duration of the
clock fluctuates from –4 to +2 I2C system clock cycles in standard clock mode, and fluctuates from
–2 to +2 I2C system clock cycles in high-speed clock mode. In the case of negative fluctuation,
the frequency does not increase because the “L” is extended instead of “H” reduction. These are
the values when the SCL clock synchronization by the synchronous function is not performed.
The CCR value is the decimal notation value of the CCR4 to CCR0 bits.
2. Each value of the SCL frequency exceeds the limit at VIIC = 4 MHz or more. When using these
setting values, use VIIC = 4 MHz or less. Refer to Figure 16.6.
3. The data formula of SCL frequency is described below:
VIIC/(8 x CCR value) Standard clock mode
VIIC/(4 x CCR value) High-speed clock mode (CCR value ≠ 5)
VIIC/(2 x CCR value) High-speed clock mode (CCR value = 5)
Do not set 0 to 2 as the CCR value regardless of the VIIC frequency. Set 100 kHz (max.) in
standard clock mode and 400 kHz (max.) in high-speed clock mode to the SCL frequency by
setting the CCR4 to CCR0 bits.
16.4.5 Bit 7: I2C bus Interface Pin Input Level Select Bit (TISS)
The TISS bit selects the input level of the SCL and SDA pins for the multi-master I2C bus interface.
When the TISS bit is set to 1, the P20 and P21 become the SMBus input level.
IHR bit
Figure 16.10 The timing of reset to the I2C bus interface circuit
NOTE:
1. General call: A master device transmits the general call address 0016 to all slaves. When the
master device transmits the general call, all slave devices receive the controlled data after general
call.
NOTE:
1. Arbitration lost: communication disabled as a master
SC L
PIN flag
I2CIRQ
16.5.7 Bit 6: Communication Mode Select Bit (Transfer Direction Select Bit: TRX)
This TRX bit decides a transfer direction for data communication. When the TRX bit is set to 0, receive
mode is entered and data is received from a transmit device. When the TRX bit is set to 1, transmit mode
is entered, and address data and control data are output to the SDAMM, synchronized with a clock gener-
ated in the SCLMM.
The TRX bit is set to 1 automatically in the following condition:
•In slave mode, when the ALS in the S1D0 register to 0(addressing format), the AAS flag is set to
___
1 (address match) after the address data is received, and the received R/W bit is set to 1
The TRX bit is set to 0 in one of the following conditions:
•When an arbitration lost is detected
•When a STOP condition is detected
•When a START condition is detected
•When a START condition is disabled by the START condition duplicate protect function (1)
•When the MST bit in the S10 register is set to 0(slave mode) and a start condition is detected
•When the MST bit is set to 0 and the ACK non-return is detected
•When the ES0 bit is set to 0(I2C bus interface disabled)
•When the IHR bit in the S1D0 register is set to 1(reset)
16.5.8 Bit 7: Communication mode select bit (master/slave select bit: MST)
The MST bit selects either master mode or slave mode for data communication. When the MST bit is set
to 0, slave mode is entered and the START/STOP condition generated by a master device are received.
The data communication is synchronized with the clock generted by the master. When the MST bit is set
to 1, master mode is entered and the START/STOP condition is generated.
Additionally, clocks required for the data communication are generated on the SCLMM.
The MST bit is set to 0 in one of the following conditions.
•After 1-byte data of a master whose arbtration is lost if arbitration lost is detected
•When a STOP condition is detected
•When a START condition is detected
•When a start condition is disabled by the START condition duplicate protect function (1)
•When the IHR bit in the S1D0 register is set to 1(reset)
•When the ES0 bit is set to 0(I2C bus interface disabled)
NOTE:
1. START condition duplicate protect function:
When the START condition is generated, after confirming that the BB flag in the S1D0 register is
set to 0 (bus free), all the MST, TRX and BB flags are set to 1 at the same time. However, if the
BB flag is set to 1 immediately after the BB flag setting is confirmed because a START condition
is generated by other master device, bits MST and TRX cannot be written. The duplicate protect
function is valid from the rising edge of the BB flag until slave address is received. Refer to 16.9
START Condition Generation Method for details.
16.6.2 Bit 1: Interrupt Enable Bit at the Completion of Data Receive (WIT)
If the WIT bit is set to 1 while the ACK-CLK bit in the S20 register is set to 1 (ACK clock), the I2C bus
interface interrupt request is generated and the PIN bit is set to 1 at the falling edge of the last data bit
clock. Then an "L" signal is applied to the SCLMM and the ACK clock generation is controlled. Table 16.4
and Figure 16.12 show the interrupt generation timing and the procedure of communication restart. After
the communication is restarted, the PIN bit is set to 0 again, synchronized with the falling edge of the ACK
clock, and the I2C bus interface interrupt request is generated.
The internal WAIT flag can be read by reading the WIT bit. The internal WAIT flag is set to 1 after writing
data to the S00 register and it is set to 0 after writing to the S20 register.
Consequently, the I2C bus interface interrupt request generated by the timing 1) or 2) can be determined.
(See Figure 16.12)
When the data is transmitted and the address data is received immediately after the START condition,
the WAIT flag remains 0 regardless of the WIT bit setting, and the I2C bus interface interrupt request is
only generated at the falling edge of the ACK clock. Set the WIT bit to 0 when the ACK-CLK bit in the S20
register is set to 0 (no ACK clock).
ACKBIT bit
PIN flag
ACKBIT bit
PIN flag
NOTE:
1. Do not write to the I2C0 clock control register except the bit ACK-BIT.
Figure 16.12 The timing of the interrupt generation at the completion of the data receive
16.6.4 Bits 4,5 : SDA/SCL Logic Output Value Monitor Bits SDAM/SCLM
Bits SDAM/SCLM can monitor the logic value of the SDA and SCL output signals from the I 2C bus
interface circuit. The SDAM bit monitors the SDA output logic value. The SCLM bit monitors the SCL
output logic value. The SDAM and SCLM bits are read-only. If necessary, set them to 0.
16.6.5 Bits 6,7 : I2C System Clock Select Bits ICK0, ICK1
The ICK1 bit, ICK0 bit, bits ICK4 to ICK2 in the S4D0 register, and the PCLK0 bit in the PCLKR register
can select the system clock (VIIC) of the I2C bus interface circuit.
The I2C bus system clock VIIC can be selected among 1/2 fIIC, 1/2.5 fIIC, 1/3 fIIC, 1/4 fIIC, 1/5 fIIC, 1/6 fIIC
and 1/8 fIIC. fIIC can be selected between f1 and f2 by the PCLK0 bit setting.
BB flag
NOTE:
1. The SCL/SDA interrupt request may be set when changing the SIP, SIS and ES0 bit settings in the
S1D0 register. When using the SCL/SDA interrupt, set the above bits, while the SCL/SDA interrupt
is disabled. Then, enable the SCL/SDA interrupt after setting the SCL/SDA bit in the IR register to 0.
Interrupt disable
No
BB=0?
Yes
S10 = E016 Start condition standby status setting
Interrupt enable
BB flag
Figure 16.15 The duration of the start condition duplicate protect function
S00 register
S00 register
As mentioned above, when bits MST and TRX are set to 1, START condition or STOP condition mode is
entered by writing 1 or 0 to the BB flag in the S10 register and writing 0 to the PIN bit and 4 low-order bits in
the S10 register at the same time. Then SDAMM is left open in the START condition standby mode and
SDAMM is set to low-level ("L") in the STOP condition standby mode. When the S00 register is set, the
START/STOP conditions are generated. In order to set bits MST and TRX to 1 without generating the
START/STOP conditions, write 1 to the 4 low-order bits simultaneously. Table 16.9 lists functions along
with the S10 register settings.
SCL
Setup time Hold time
SDA
BB flag
set time
BB flag
SCL
Setup time Hold time
SDA
BB flag
set time
BB flag
This section describes data transmit control when a master transferes data or a slave receives data in 7-bit
address format. Figure 16.20 (1) shows a master transmit format.
16.14 Precautions
(1) Access to the registers of I2C bus interface circuit
The following is precautions when read or write the control registers of I2C bus interface circuit
•S00 register
Do not rewrite the S00 register during data transfer. If the bits in the S00 register are rewritten, the bit
counter for transfer is reset and data may not be transferred successfully.
•S1D0 register
Bits BC2 o BC0 are set to 0002 when START condition is detected or when 1-byte data transfer is
completed. Do not read or write the S1D0 register at this timing. Otherwise, data may be read or
written unsuccessfully. Figure 16.22 and Figure 16.23 show the bit counter reset timing.
•S20 register
Do not rewrite the S20 register except the ACKBIT bit during transfer. If the bits in the S20 register
except ACKBIT bit are rewritten, the I2C bus clock circuit is reset and data may be transferred incom-
pletely.
•S3D0 register
Rewrite bits ICK4 to ICK0 in the S3D0 register when the ES0 bit in the S1D0 register is set to 0 (I2C bus
interface is disabled). When the WIT bit is read, the internal WAIT flag is read. Therefore, do not use
the bit managing instruction(read-modify-write instruction) to access the S3D0 register.
•S10 register
Do not use the bit managing instruction (read-modify-write instruction) because all bits in the S10
register will be changed, depending on the communication conditions. Do not read/write when te
communication mode select bits, bits MST and TRX, are changing their value. Otherwise, data may be
read or written unsuccessfully. Figure16.21 to Figure 16.23 show the timing when bits MST and TRX
change.
SCL
SDA
BB flag
Figure 16.21 The bit reset timing (The STOP condition detection)
SCL
SDA
BB flag
Figure 16.22 The bit reset timing (The START condition detection)
AAAAA
SCL
PIN bit
AA AAAAA
The bits referring BC0 - BC2
to reset MST(When in arbitration lost)
Bit reset signal
AAA AAAAA
TRX(When in NACK receive in slave
transmit mode)
2VIIC cycle
Bit set signal The bits referring TRX(ALS=0 meanwhile the slave
to set receive R/W bit = 1
1VIIC cycle
SDA
Data Bus
C0LMAR Register
C0MCTLj Register
C0LMBR Register
CTX
Message Box
slots 0 to 15
Protocol
Controller Acceptance Filter
slots 0 to 15 Message ID
16 Bit Timer DLC
Message Data
CRX C0TSR Register Time Stamp
Wake Up
Function
Interrupt
Generation
C0RECR Register Function
CAN0 Successful Reception Int
C0TECR Register C0STR Register C0SSTR Register C0ICR Register
CAN0 Successful Transmission Int
Figures 17.2 and 17.3 show the bit mapping in each slot in byte access and word access. The content of
each slot remains unchanged unless transmission or reception of a new message is performed.
bit 7 bit 0
SID10 SID9 SID8 SID7 SID6
Data Byte 0
Data Byte 1
Data Byte 7
NOTE:
1. When is read, the value is the one written upon the transmission slot configuration.
The value is 0 when read on the reception slot configuration.
EID17 EID16 EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 EID7 EID6
EID5 EID4 EID3 EID2 EID1 EID0 DLC3 DLC 2 DLC1 DLC0
NOTE:
1. When is read, the value is the one written upon the transmission slot configuration.
The value is "0" when read on the reception slot configuration.
Addresses
bit 7 bit 0 CAN0
SID10 SID9 SID8 SID7 SID6 016016
NOTES
1. is undefined.
2. These registers can be written in CAN reset/initialization mode of the CAN module.
Addresses
bit 15 bit 8 bit 7 bit 0 CAN0
SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 SID 2 SID1 SID 0 016016
EID17 EID16 EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 EID7 EID6 016216 C0GMR register
SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 SID 2 SID1 SID 0 016616
EID17 EID16 EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 EID7 EID6 016816 C0LMAR register
SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 SID 2 SID1 SID 0 016C16
EID17 EID16 EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 EID7 EID6 016E16 C0LMBR register
NOTES:
1. As for write, only writing 0 is possible. The value of each bit is written when the CAN module enters the respective state.
2. In Basic CAN mode, the slots 14 and 15 serve as data format identification flag. If the data frame is received, the RemActive
bit is set to 0. If the remote frame is received, the bit is set to 1.
3. One slot cannot be defined as reception slot and transmission slot at the same time.
4. Set these registers only when the CAN module is in CAN operating mode.
NOTES:
1. When the Reset bit is set to 1 (CAN reset/initialization mode), check that the State_Reset bit in the C0STR register is set to 1 (Reset mode).
2. Change this bit only in the CAN reset/initialization mode.
3. When using CAN0 wake-up interrupt, set these bits to 1.
4. When the PortEn bit is set to 1, set the PD9_2 bit in the PD9 register to 0.
(b15) (b8)
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After reset
C0CTLR 021116 XX0X00002
(b15) (b8)
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
C0STR 021316 X00000012
State_ Error passive 0: The CAN module is not in error passive state.
ErrPass state flag 1: The CAN module is in error passive state. RO
State_ Error bus off 0: The CAN module is not in error bus off state.
BusOff state flag RO
1: The CAN module is in error bus off state.
- Nothing is assigned. If necessary, set to 0.
-
(b7) When read, the content is undefined
NOTE:
1. Set the C0ICR register only when the CAN module is in CAN operating mode.
NOTE:
1. Set the C0IDR register only when the CAN module is in CAN operating mode.
.....
1 1 1 0: Divide-by-15 of fCAN
1 1 1 1: Divide-by-16 of fCAN (1)
0: One time sampling
SAM Sampling control bit RW
1: Three times sampling
b7 b6 b5
0 0 0: 1Tq
0 0 1: 2Tq
Propagation time 0 1 0: 2Tq
PTS RW
segment control bits
.....
1 1 0: 7Tq
1 1 1: 8Tq
NOTES:
1. fCAN serves for the CAN clock. The period is decided by configuration of the CCLKi bits (i = 0 to 2) in the CCLKR register.
2. Set the C0CONR register only when the CAN module is in CAN reset / initialization mode.
(b15) (b8)
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
C0CONR 021B16 Undefined
control bits
1 1 0: 7Tq
1 1 1: 8Tq
b5 b4 b3
0 0 0: Do not set
Phase buffer 0 0 1: 2Tq
PBS2 segment 2 0 1 0: 3Tq RW
.....
control bits
1 1 0: 7Tq
1 1 1: 8Tq
b7 b6
Resynchronization 0 0: 1Tq
SJW jump width 0 1: 2Tq RW
control bits 1 0: 3Tq
1 1: 4Tq
NOTE:
1. The value is undefined in bus off state.
NOTE:
1. Use a 16-bit data for reading.
MCU Reset
Reset = 0
CAN reset/initialization CAN operating mode
mode
State_Reset = 1 State_Reset = 0
Reset = 1
when 11 consecutive
Sleep = 0 Sleep = 1 recessive bits are
TEC > 255 detected 128 times
or
RetBusOff = 1
CCLK3 = 1
CAN interface Reset = 1 Bus off state
sleep mode CAN sleep mode
State_BusOff = 1
CCLK3 = 0
Module idle
TrmState = 0
RecState = 0
Start Detect
transmission an SOF
Finish Finish
transmission reception
Divide-by-1 (undivided)
CAN module Divide-by-2 Prescaler
system clock Divide-by-4 fCAN Baud rate
f1 1/2
divider Divide-by-8
prescaler fCANCLK
Value: 1, 2, 4, 8, 16 Divide-by-16 division value
CCLKR register :P+1
CAN module
fCAN: CAN module system clock
P: The value written in the BRP bit of the C0CONR register. P = 0 to 15
fCANCLK: CAN communication clock fCANCLK = fCAN/2(P + 1)
Figure 17.19 Block Diagram of CAN Module System Clock Generation Circuit
Bit time
SS PTS PBS1 PBS2
SJW SJW
Sampling point
The range of each segment: Bit time = 8 to 25Tq Configuration of PBS1 and PBS2: PBS1 ≥ PBS2
SS = 1Tq PBS1 ≥ SJW
PTS = 1Tq to 8Tq PBS2 ≥ 2 when SJW = 1
PBS1 = 2Tq to 8Tq PBS2 ≥ SJW when 2 ≤ SJW ≤ 4
PBS2 = 2Tq to 8Tq
SJW = 1Tq to 4Tq
17.3.2 Bit-rate
Bit-rate depends on f1, the division value of the CAN module system clock, the division value of the baud
rate prescaler, and the number of Tq of one bit.
Table 17.2 shows the examples of bit-rate.
Calculation of Bit-rate
f1
2 ✕ “fCAN division value (Note 1)” ✕ “baud rate prescaler division value (Note 2)” ✕ “number of Tq of one bit”
Slot #0
Slot #1
Slot #2
Slot #3
Slot #4
Slot #5
Slot #6
C0GMR register Slot #7
Slot #8
Slot #9
Slot #10
Slot #11
Slot #12
Slot #13
Acceptance Signal
Figure 17.23 shows the write and read of the C0AFS register in word access.
Address
CAN0
bit 15 bit 8 bit 7 bit 0
When write SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 SID2 SID1 SID 0 24216
3/8 Decoder
17.10.1 Reception
Figure 17.25 shows the behavior of the module when receiving two consecutive CAN messages, that fit
into the slot of the shown C0MCTLj register (j = 0 to 15) and leads to losing/overwriting of the first
message.
CANbus
RecReq bit
C0MCTLj register
InvalData bit (2) (5)
(1)
RecState bit
C0STR register
RecSucc bit
j = 0 to 15
(1) On monitoring a SOF on the CAN bus the RecState bit in the C0STR register becomes 1 (CAN module
is receiver) immediately, given the module has no transmission pending.
(2) After successful reception of the message, the NewData bit in the C0MCTLj register (j = 0 to 15) of the
receiving slot becomes 1 (stored new data in slot). The InvalData bit in the C0MCTLj register
becomes 1 (message is being updated) at the same time and the InvalData bit becomes 0 (message is
valid) again after the complete message was transferred to the slot.
(3) When the interrupt enable bit in the C0ICR register of the receiving slot = 1 (interrupt enabled), the
CAN0 successful reception interrupt request is generated and the MBOX bit in the C0STR register is
changed. It shows the slot number where the message was stored and the RecSucc bit in the
C0STR register is active.
(4) Read the message out of the slot after setting the New Data bit to 0 (the content of the slot is read or
still under processing by the CPU) by program.
(5) If the NewData bit is set to 0 by program or the next CAN message is received successfully before the
receive request for the slot is canceled, the MsgLost bit in the C0MCTLj register is set to 1 (message
has been overwritten). The new received message is transferred to the slot. Generating of an
interrupt request and change of the C0STR register are same as in 3).
17.10.2 Transmission
Figure 17.26 shows the timing of the transmit sequence.
CTx
C0MCTLj register
(4)
C0STR register
TrmSucc bit
j = 0 to 15
(1) If the TrmReq bit in the C0MCTLj register (j = 0 to 15) is set to 1 (Transmission slot) in the bus idle
state, the TrmActive bit in the C0MCTLj register and the TrmState bit in the C0STR register are set to
1 (Transmitting/Transmitter), and CAN module starts the transmission.
(2) If the arbitration is lost after the CAN module starts the transmission, the TrmActive and TrmState bits
are set to 0.
(3) If the transmission has been successful without lost in arbitration, the SentData bit in the C0MCTLj
register is set to 1 (Transmission is successfully completed) and TrmActive bit in the C0MCTLj register
is set to 0 (Waiting for bus idle or completion of arbitration). And when the interrupt enable bits in the
C0ICR register = 1 (Interrupt enabled), CAN0 successful transmission interrupt request is generated
and the MBOX (the slot number which transmitted the message) and TrmSucc bit in the C0STR
register are changed.
(4) When starting the next transmission, set bits SentData and TrmReq to 0. And set the TrmReq bit to
1 after checking that bits SentData and TrmReq are set to 0.
To snoop an SFR address, the target address is written to the CRC snoop Address Register (CRCSAR).
The two most significant bits of this register enable snooping on reads or writes to the target address. If the
target SFR is written to by the CPU or DMA, and the CRC snoop write bit is set (CRCSW=1), the CRC will
latch the data into the CRCIN register. The new CRC code will be set in the CRCD register.
Similarly, if the target SFR is read by the CRC or DMA, and the CRC snoop read bit is set (CRCSR=1), the
CRC will latch the data from the target into the CRCIN register and calculate the CRC.
The CRC circuit can only calculate CRC codes on data byte at a time. Therefore, if a target SFR is
accessed in word (16 bit), only one low-order byte data is stored into the CRCIN register.
AAAAA AAAAA
AAAAAAAAAA
Eight low-order bits Eight high-order bits
AAAAAAAAAA
AAAAAAAAAA AAAAAAAA
AAAAAAAA
CRC code generating circuit
Snoop Address
SnoopB
lock
AAAAAAAA
16
x + x12 + x5 + 1 OR x16 + x15 + x2 + 1
AAAAAA
AAAAAA AAAAAAAA
AAAAAAAA
CRC input register (8) Equal?
AAAAAAAA
(Address 03BE16)
Snoop
enable
Address Bus
Bit
Bitsymbol
Symbol BitBit
name
Name Function RW
CRC
CRC mode
mode polynomial
polynomial 0: X16+X12+X5+1 (CRC-CCITT)
CRCPS
CRCPS RW
selection
selectionbitbit 1: X16+X15+X2+1 (CRC-16)
Nothing is assigned. If necessary, set to 0.
Nothing is assigned.
(b6-b1)
Write "0" when When
writingread,
to thisthe content
bit. is undefined
The value is indeterminate if read.
0: LSB first
CRCMS CRC
CRCMS CRC mode
mode selection
selectionbitbit RW
1: MSB first
NOTE:
1. Set bits CRCSR and CRCSW to 0 if the PLC07 bit in the PLC0 register is set to 1 (PLL on) and the PM20 bit in
the PM2 register is set to 0 (SFR access 2 wait).
b15 b0
(1) Setting 000016 (initial value) CRD data register CRCD
[03BD16, 03BC16]
b7 b0
(2) Setting 0116 CRC input register CRCIN
[03BE16]
2 cycles
After CRC calculation is complete
b15 b0
The code resulting from sending 0116 in LSB first mode is (10000 0000).This the CRC code in the generating polynomial,
(X16 + X12 + X5 + 1), becomes the remainder resulting from dividing (1000 0000)X16 by ( 1 0001 0000 0010 0001) in
conformity with the modulo-2 operation.
Modulo-2 operation is
operation that complies
LSB MSB with the law given below.
1000 1000
1 0001 0000 0010 0001 1000 0000 0000 0000 0000 0000 0+0=0
1000 1000 0001 0000 1 0+1=1
1000 0001 0000 1000 0 1+0=1
1+1=0
1000 1000 0001 0000 1
-1 = 1
1001 0001 1000 1000
LSB MSB
9 8 1 1
Thus the CRC code becomes ( 1001 0001 1000 1000). Since the operation is in LSB first mode, the (1001 0001 1000 1000)
corresponds to 118916 in hexadecimal notation. If the CRC operation in MSB first mode is necessary, set the CRC mode
selection bit to 1. CRC data register stores CRC code for MSB first mode.
b7 b0
CRC input register CRCIN
(3) Setting 2316 [03BE16]
b15 b0
The programmable input/output ports (hereafter referred to simply as “I/O ports”) consist of 71 lines P0, P1,
P2, P3, P6, P7, P8, P9, P10 (except P94) for the 80-pin package, or 55 lines P00 to P03, P15 to P17, P2, P30
to P33, P6, P7, P8, P90 to P93, P10 for the 64-pin package. Each port can be set for input or output every
line by using a direction register, and can also be chosen to be or not be pulled high in sets of 4 lines.
Figures 19.1 to 19.4 show the I/O ports. Figure 19.5 shows the I/O pins.
Each pin functions as an I/O port, a peripheral function input/output.
For details on how to set peripheral functions, refer to each functional description in this manual. If any pin
is used as a peripheral function input, set the direction bit for that pin to 0 (input mode). Any pin used as an
output pin for peripheral functions is directed for output no matter how the corresponding direction bit is set.
The PRC2 bit in the PRCR protects the PACR register. Set the PACR register after setting the PRC2 bit in
the PRCR register.
Filter width : (n+1) x 1/f8 n: count value set in the NDDR register and P17DDR register
The NDDR register and the P17DDR register decrement count value with f8 as the count source. The
NDDR register and the P17DDR register indicate count time. Count value is reloaded if a falling edge or a
rising edge is applied to the pin.
The NDDR register and the P17DDR register can be set 0016 to FF16 when using the digital debounce
function. Setting to FF16 disables the digital filter. See Figure 19.12 for details.
Pull-up selection
Direction register
P00 to P07, (inside dotted-line included)
P100 to P103
(1)
P30 to P37 (inside dotted-line not included)
Analog input
Pull-up selection
(1)
P14 (inside dotted-line not included)
Analog input
Pull-up selection
(1)
P17 (inside dotted-line included)
Pull-up selection
P22 to P27, P30, P60, P61, P64, Direction
P65, P74 to P76, P80, P81 register
(inside dotted-line included) "1"
Output
Data bus Port latch
(1)
Pull-up selection
Direction
register
P20, P21, P70 to P73 "1"
Output
Data bus Port latch
(1)
Switching
between
CMOS and
Nch
Pull-up selection
P82 to P84
Direction register
(1)
Pull-up selection
Direction register
P31, P62, P66, P77
(1)
NOTE:
1. symbolizes a parasitic diode.
Make sure the input voltage on each port will not exceed Vcc.
Pull-up selection
Direction register
P63, P67
“1”
Output
Data bus Port latch
(1)
Pull-up selection
P85
NMI Enable
Direction register
(1)
NMI Enable
SD
Pull-up selection
P91, P92, P97,
P104 to P107 Direction register
(1)
Analog input
Input to respective peripheral functions
NOTE:
1. symbolizes a parasitic diode.
Make sure the input voltage on each port will not exceed Vcc.
(1)
Analog input
Pull-up selection
Direction register
P87
fc
Rf
Pull-up selection
Rd
Direction register
P86
NOTE:
1. symbolizes a parasitic diode.
Make sure the input voltage on each port will not exceed Vcc.
CNVSS
CNVSS signal input
(1)
RESET
RESET signal input
(1)
NOTE:
1. symbolizes a parasitic diode.
Make sure the input voltage on each port will not exceed Vcc.
NOTES:
1. Make sure the PD9 register is written to by the next instruction after setting the PRC2 bit in the
PRCR register to 1(write enabled).
2. Set the PACR register.
In 80-pin package, set bits PACR2, PACR1, PACR0 to 0112.
In 64-pin package, set bits PACR2, PACR1, PACR0 to 0102.
NOTE:
1. Set the PACR register.
In 80-pin package, set bits PACR2, PACR1, PACR0 to 0112.
In 64-pin package, set bits PACR2, PACR1, PACR0 to 0102.
b7 b6 b5 b4 b3 b2 b1 b0
Symbol Address After Reset
P9 03F1 16 Undefined
NOTES:
1. Set the PACR register.
In 80-pin package, set bits PACR2, PACR1, PACR0 to 0112.
In 64-pin package, set bits PACR2, PACR1, PACR0 to 0102.
2. Nothing is assigned. If necessary, set to 0. When read, the content is 0.
NOTES:
1. Set the PACR register by the next instruction after setting the PRC2 bit in the PRCR register to 1 (write
enable).
2. When using the NMI interrupt to exit from stop mode, set the NDDR registert to FF16 before entering
stop mode.
NOTE:
1. When using the INT5 interrupt to exit from stop mode, set the P17DDR registert to FF16 before entering
stop mode.
f8
Reload Value FF 03
Port In
Signal Out
Count Value FF 03 02 01 03 02 01 00 FF
1 2 3 4 5
Reload Value 03 FF
(continued)
Port In
(continued)
Signal Out
(continued)
Count Value FF 03 02 01 00 FF 03 02 FF
(continued)
6 7 8 9
1. (Condition after reset). P17DDR=FF16. Pin input signal will be output directly.
2. Set the P17DDR register to 0316. The P17DDR register starts decrement along the f8 as a counter source, if the pin
input level (e.g.,"L") and the signal output level (e.g.,"H") are not matched.
3. The P17DDR register will stops counting when the pin input level and the signal output level are matched (e.g.,
both levels are "H") while counting.
4. If the pin input level (e.g.,"L") and the signal output level (e.g.,"H") are not matched the P17DDR register will start
decrement again after the setting value is reloaded.
5. When the P17DDR register is underflow, it stops counting and the signal output will output the same as pin input
level (e.g."L").
6. If the pin input level (e.g.,"H") and the signal output level (e.g., "L") are not matched again, the P17DDR register will
start decrement again after the setting value is reloaded.
7. When the P17DDR register is underflow, it stops counting and the signal output will output the same as pin input
level (e.g."H").
8. If the pin input level (e.g.,"H") and the signal output level (e.g., "L") are not matched again, the P17DDR register will
start decrement again after the setting value is reloaded.
9. Set the P17DDR register to FF16. The P17DDR register starts counting after the setting value is reloaded. Pin input
signal will be output directly.
MCU
Port P0 to P3, P6 to P10
(1)
(Input mode)
· ·
· ·
· ·
(Input mode)
(Output mode) Open
XIN
XOUT Open
VCC
AV CC
AVSS
Vref
VSS
In single-chip mode
NOTE:
1. When using the 64-pin package, set bits PACR2, PACR1, and PACR0 to 0102.
When using the 80-pin package, set bits PACR2, PACR1, and PACR0 to 0112.
Erase block See Figures 20.1 to 20.3 Flash Memory Block Diagram
Program method In units of word
Erase method Block erase
Program, erase control method Program and erase controlled by software command
Protect method Blocks 0 to 5 are write protected by FMR16 bit.
In addition, the block 0 and block 1 are write protected by FMR02 bit
Number of commands 5 commands
Program/Erase Block 0 to 5 (program area) 100 times 1,000 times (See Tables 1.6 to 1.8)
Endurance(1) Block A and B (data are) (2) 100 times 10,000 times (See Tables 1.6 to 1.8)
Data Retention 20 years (Topr = 55ϒC)
ROM code protection Parallel I/O, standard serial I/O, and CAN I/O modes are supported.
NOTES:
1. Program and erase endurance definition
Program and erase endurance are the erase endurance of each block. If the program and erase endurance are n
times (n=100,1000,10000), each block can be erased n times. For example, if a 2-Kbyte block A is erased after
writing 1 word data 1024 times, each to different addresses, this is counted as one program and erasure.
However, data cannot be written to the same address more than once without erasing the block. (Rewrite
disabled)
2. To use the limited number of erasure efficiently, write to unused address within the block instead of rewrite. Erase
block only after all possible address are used. For example, an 8-word program can be written 128 times before
erase is necessary. Maintaining an equal number of erasure between Block A and B will also improve efficiency.
We recommend keeping track of the number of times erasure is used.
3. The M16C/29 Group, T-ver./V-ver. does not support the CAN I/O mode.
(Data space)
00F00016
Block B :2K bytes(2)
00F7FF16
00F80016
Block A :2K bytes (2)
00FFFF16
(Program space)
0F000016
NOTES:
1. To specify a block, use the maximum even address in the block.
2. Blocks A and B are enabled to use when the PM10 bit in the PM1
0F7FFF16 Block 2 : 16K bytes register is set to 1.
0F800016 3. Blocks 0 and 1 are enabled for programs and erases when the
FMR02 bit in the FMR0 register is set to 1 and the FMR16 bit in
the FMR1 register is set to 1. (CPU rewrite mode only)
Block 2 : 16K bytes (5) 4. The boot ROM area is reserved. Do not access.
5. Blocks 2 and 3 are enabled for programs and erases when the
FMR16 bit in the FMR1 register is set to 1. (CPU rewrite mode
0FBFFF16 only)
0FC00016
Block 1 : 8K bytes (3)
0FDFFF16
0FE00016
0FF00016
Block 0 : 8K bytes (3)
4K bytes(4)
0FFFFF16 0FFFFF16
User ROM area Boot ROM area
(Data space)
00F00016
Block B :2K bytes (2)
00F7FF16
00F80016
Block A :2K bytes (2)
00FFFF16
(Program space)
0E800016
0EFFFF16
0F000016
NOTES:
1. To specify a block, use the maximum even address in the block.
2. Blocks A and B are enabled for use when the PM10 bit in the PM1
0F7FFF16 Block 2 : 16K bytes register is set to 1.
0F800016 3. Blocks 0 and 1 are enabled for programs and erasure when the
FMR02 bit in the FMR0 register is set to 1 and the FMR16 bit in the
FMR1 register is set to 1. (CPU rewrite mode only)
Block 2 : 16K bytes (5) 4. The Boot ROM area is reserved. Do not rewrite.
5. Blocks 2 to 4 are enabled for programs and erasure when the
FMR16 bit in the FMR1 register is set to 1. (CPU rewrite mode
0FBFFF16 only)
0FC00016
Block 1 : 8K bytes (3)
0FDFFF16
0FE00016
0FF00016
Block 0 : 8K bytes (3)
4K bytes (4)
0FFFFF16 0FFFFF16
User ROM area Boot ROM area
(Data space)
00F00016
Block B :2K bytes(2)
00F7FF16
00F80016
Block A :2K bytes(2)
00FFFF16
(Program space)
0E000016
0E7FFF16
0E800016
0EFFFF16
0F000016
NOTES:
1. To specify a block, use the maximum even address
in the block.
2. Blocks A and B are enabled to use when the PM10
0F7FFF16 Block 2 : 16K bytes bit in the PM1 register is set to 1.
0F800016
3. Blocks 0 and 1 are enabled for programs and
erases when the FMR02 bit in the FMR0 register is
set to 1 and the FMR16 bit in the FMR1 register is
Block 2 : 16K bytes (5) set to 1. (CPU rewrite mode only)
4. The boot ROM area is reserved. Do not access.
5. Blocks 2 to 5 are enabled for programs and erases
0FBFFF16
0FC00016 when the FMR16 bit in the FMR1 register is set to
1. (CPU rewrite mode only)
Block 1 : 8K bytes(3)
0FDFFF16
0FE00016
0FF00016
Block 0 : 8K bytes (3) 4K bytes (Note 4)
0FFFFF16 0FFFFF16
User ROM area Boot ROM area
Figure 20.3 Flash Memory Block Diagram (ROM capacity 128 Kbytes)
NOTES:
1. When the ROM code protect is active by the ROMCP1 bit setting, the flash memory is protected
against reading or rewriting in parallel I/O mode.
2. Set the bit 5 to bit 0 to 1111112 when the ROMCP1 bit is set to a value other than 112. When the bit 5
to bit 0 are set to values other than 1111112, the ROM code protection may not become active by
setting the ROMCP1 bit to a value other than 112.
3. To make the ROM code protection inactive, erase a block including the ROMCP address in standard
serial I/O mode or CPU rewrite mode.
4. The ROMCP address is set to FF16 when a block, including the ROMCP address, is erased.
5. When a value of the ROMCP address is 0016 or FF16, the ROM code protect function is disabled.
Address
0FFFDF16 to 0FFFDC16 ID1 Undefined instruction vector
4 bytes
20.4.1 EW Mode 0
The MCU enters CPU rewrite mode by setting the FMR01 bit in the FMR0 register to 1 (CPU rewrite mode
enabled) and is ready to accept software commands. EW mode 0 is selected by setting the FMR11 bit in
the FMR1 register to 0.
To set the FMR01 bit to 1, set to 1 after first writing 0. The software commands control programming and
erasing. The FMR0 register or the status register indicates whether a programming or erasing operations
is completed.
When entering the erase-suspend during the auto-erasing, set the FMR40 bit to 1 (erase-suspend en-
abled) and the FMR41 bit to 1 (suspend request). After waiting for td(SR-ES) and verifying the FMR46 bit
is set to 1 (auto-erase stop), access to the user ROM area. When setting the FMR41 bit to 0 (erase
restart), auto-erasing is restarted.
20.4.2 EW Mode 1
EW mode 1 is selected by setting the FMR11 bit to 1 after the FMR01 bit is set to 1 (set to 1 after first
writing 0).
The FMR0 register indicates whether or not a programming or an erasing operation is completed. Read
status register cannot be read in EW mode 1.
When an erase/program command is initiated, the CPU halts all program execution until the command
operation is completed or erase-suspend request is generated.
When enabling an erase-suspend function, set the FMR40 bit to 1 (erase suspend enabled) and execute
block erase commands. Also, the interrupt to transfer to erase-suspend must be set enabled preliminar-
ily. When entering erase-suspend after td(SR-ES) from an interrupt is requested, interrupts can be ac-
cepted.
When an interrupt request is generated, the FMR41 bit is automatically set to 1 (suspend request) and an
auto-erasing is suspended. If an auto-erasing has not completed (when the FMR00 bit is 0) after an
interrupt process is completed, set the FMR41 bit to 0 (erase restart) and execute block erase commands
again.
•FMR01 Bit
The MCU can accept commands when the FMR01 bit is set to 1 (CPU rewrite mode). To set the
FMR01 bit to 1, first set it to 0 and then 1. The FMR01 bit is set to 0 only by writing 0.
•FMR02 Bit
The combined settings of bits FMR02 and FMR16 enable program and erase in the user ROM area.
See Table 20.4 for setting details. To set the FMR02 bit to 1, first set it to 0 and then 1. The FMR02
bit is valid only when the FMR01 bit is set to 1 (CPU rewrite mode enable).
•FMSTP Bit
The FMSTP bit initializes the flash memory control circuits and minimizes power consumption in the
flash memory. Access to the on-chip flash memory is disabled when the FMSTP bit is set to 1. Set the
FMSTP bit by program in a space other than the flash memory.
Set the FMSTP bit to 1 if one of the following occurs:
•A flash memory access error occurs during erasing or programming in EW mode 0 (FMR00 bit does
not switch back to 1 (ready)).
•Low-power consumption mode or on-chip oscillator low-power consumption mode is entered.
Figure 20.10 shows a flow chart illustrating how to start and stop the flash memory before and after
entering low power mode. Follow the procedure in this flow chart.
When entering stop or wait mode while the CPU rewrite mode is disabled, do not set the FMR0
register because the on-chip flash memory is automatically turned off and turned back on when
exiting.
•FMR06 Bit
The FMR06 bit is a read-only bit indicating an auto-program operation state. The FMR06 bit is set to
1 when a program error occurs; otherwise, it is set to 0. For details, refer to 20.8.4 Full Status Check.
•FMR07 Bit
The FMR07 bit is a read-only bit indicating an auto-erase operation status. The FMR07 bit is set to 1
when an erase error occurs; otherwise, it is set to 0. For details, refer to 20.8.4 Full Status Check.
Figure 20.8 shows a EW mode 0 set/reset flowchart, Figure 20.9 shows a EW mode 1 set/reset flow-
chart.
•FMR16 Bit
The combined setting of bits FMR02 and FMR16 enables program and erase in the user ROM area.
To set the FMR16 bit to 1, first set it to 0 and then 1. The FMR16 bit is valid only when the FMR01 bit
is set to 1 (CPU rewrite mode enable).
•FMR17 Bit
If the FMR17 bit is set to 1 (with wait state), 1 wait state is inserted when blocks A and B are accessed,
regardless of the content of the PM17 bit in the PM1 register. The PM17 bit setting is reflected to
access other blocks and internal RAM, regardless of the FMR17 bit setting.
Set the FMR17 bit to 1 (with wait state) to rewrite more than 100 times (U7, U9).
•FMR41 Bit
When the FMR41 bit is set to 1 by program during auto-erasing in EW mode 0, erase-suspend mode
is entered. In EW mode 1, the FMR41 bit is automatically set to 1 (suspend request) to enter erase-
suspend mode when an enabled interrupt request is generated. Set the FMR41 bit to 0 (erase restart)
to restart an auto-erasing operation.
•FMR46 Bit
The FMR46 bit is set to 0 during auto-erasing. It is set to 1 in erase-suspend mode.
Do not access to flash memory when the FMR46 bit is set to 0.
FMR01 CPU rewrite mode select bit (1) 0: Disables CPU rewrite mode
(Disables software command) RW
1: Enables CPU rewrite mode
(Enables software commands)
FMR02 Block 0, 1 rewrite enable bit (2) Set write protection for user ROM area
(see Table 20.4) RW
NOTES:
1. Set the FMR01 bit to 1 immediately after setting it first to 0. Do not generate an interrupt or a DMA
transfer between setting the bit to 0 and setting it to 1. Set this bit while the P85/NMI/SD pin is held “H”
when selecting the NMI function. Set by program in a space other than the flash memory in EW mode
0. Set this bit to read alley mode and 0.
2. Set this bit to 1 immediately after setting it first to 0 while the FMR01 bit is set to 1. Do not generate an
interrupt or a DMA transfer between setting this bit to 0 and setting it to 1.
3. Set this bit in a space other than the flash memory by program. When this bit is set to 1, access to
flash memory will be denied. To set this bit to 0 after setting it to 1, wait for 10 usec. or more after
setting it to 1. To read data from flash memory after setting this bit to 0, maintain tps wait time before
accessing flash memory.
4. This bit is set to 0 by executing the clear status command.
5. This bit is enabled when the FMR01 bit is set to 1 (CPU rewrite mode). If the FMR01 bit is set to 0, this
bit can be set to 1 by writing 1 to the FMR01 bit. However, the flash memory does not enter low-power
consumption status and it is not initialized.
FMR16 Block 0 to 5 rewrite enable Set write protection for user ROM
RW
bit (2) space (see Table 20.4)
0: Disable
1: Enable
FMR17 Block A, B access wait bit (3) 0: PM17 enabled RW
1: With wait state (1 wait)
NOTES:
1. Set the FMR11 bit to 1 immediately after setting it first to 0 while the FMR01 bit is set to 1. Do not
generate an interrupt or a DMA transfer between setting the bit to 0 and setting it to 1. Set this bit while
the P85/NMI/SD pin is held "H" when the NMI function is selected. If the FMR01 bit is set to 0, the FMR01
bit and FMR11 bit are both set to 0.
2. Set this bit to 1 immediately after setting it first to 0 while the FMR01 bit is set to 1. Do not generate an
interrupt or a DMA transfer between setting this bit to 0 and setting it to 1.
3. When rewriting more than 100 times, set this bit to 1 (with wait state). When the FMR17 bit is set to1(with
wait state), regardless of the PM17 bit setting, 1 wait state is inserted when accessing to blocks A and B.
The PM17 bit setting is enabled, regardless of the FMR17 bit setting, as to the access to other block and
the internal RAM.
NOTES:
1. Set the FMR40 bit to 1 immediately after setting it first to 0. Do not generate any interrupt or DMA
transfer between setting the bit to 0 and setting it to 1. Set by program in space other than the flash
memory in EW mode 0.
2. The FMR41 bit is valid only when the FMR40 bit is set to 1. The FMR41 bit can be written only
between executing an erase command and completing erase (this bit is set to 0 other than the
above duration). The FMR41 bit can be set to 0 or 1 by program in EW mode 0. In EW mode 1, the
FMR41 bit is automatically set to 1 when the FMR40 bit is 1 and a maskable interrupt is generated
during erasing. The FMR41 bit cannot be set to 1 by program (it can be set to 0 by program).
Transfer a rewrite control program to internal RAM Execute the Read Array command (3)
area
Jump to the rewrite control program transfered to an Write 0 to the FMR01 bit
internal RAM area (in the following steps, use the (CPU rewrite mode disabled)
rewrite control program internal RAM area)
NOTES:
1. Select 10 MHz or below for CPU clock using the CM06 bit in the CM0 register and bits CM17 to 16 in the CM1
register. Also, set the PM17 bit in the PM1 register to 1 (with wait state).
2. Set the FMR01 bit to 1 immediately after setting it to 0. Do not generate an interrupt or a DMA transfer
between setting the bit to 0 and setting it to 1. Set the FMR01 bit in a space other than the internal flash
memory. Also, set only when the P85/NMI/SD pin is “H” at the time of the NMI function selected.
3. Disables the CPU rewrite mode after executing the read array command.
Program in ROM
Single-chip mode
NOTES:
1. Select 10 MHz or below for CPU clock using the CM06 bit in the CM0 register and bits CM17 to 16
in the CM1 register. Also, set the PM17 bit in the PM1 register to 1 (with wait state).
2. Set the FMR01 bits to 1 immediately after setting it to 0. Do not generate an interrupt or a DMA
transfer between setting the bit to 0 and setting the bit to 1. Set the FMR01 bit in a space other than
the internal flash memory. Set only when the P85/NMI/SD pin is “H” at the time of the NMI function
selected.
3. Set the FMR11 bit to 1 immediately after setting it to 0 while the FMR01 bit is set to 1. Do not
generate an interrupt or a DMA transfer between setting the FMR11 bit to 0 and setting it to 1.
Transfer a low power internal consumption mode Set the FMR01 bit to 1 after setting 0 (CPU
program to RAM area rewrite mode enabled) (2)
NOTES:
1. Set the FMRSTP bit to 1 after setting the FMR01 bit to 1 (CPU rewrite mode).
2. Wait until the clock stabilizes to switch the clock source of the CPU clock to the main clock or the sub clock.
3. Add a tps wait time by a program. Do not access the flash memory during this wait time.
Figure 20.10 Processing Before and After Low Power Dissipation Mode
20.6.3 Interrupts
EW Mode 0
• To use interrupts having vectors in a relocatable vector table, the vectors must be relocated to the
RAM area.
_______
• The NMI and watchdog timer interrupts are available since registers FMR0 and FMR1 are forcibly
reset when either interrupt occurs. However, the interrupt program, which allocates the jump
addresses for each interrupt routine to the fixed vector table, is needed. Flash memory rewrite
_______
operation is aborted when the NMI or watchdog timer interrupt occurs. Set the FMR01 bit to 1 and
execute the rewrite and erase program again after exiting the interrupt routine.
• The address match interrupt can not be used since the CPU tries to read data in the flash memory.
EW Mode 1
• Do not acknowledge any interrupts with vectors in the relocatable vector table or the address
match interrupt during the auto program period or auto erase period with erase-suspend function
disabled.
20.6.10 Low Power Consumption Mode and On-Chip Oscillator-Low Power Consumption Mode
If the CM05 bit is set to 1 (main clock stopped), do not execute the following commands.
• Program
• Block erase
Start
NO
FMR00=1?
YES
(2)
Full status check
Program completed
NOTES:
1. Write the command code and data at even address.
2. Refer to Figure 20.14.
Start
NO
FMR00=1?
YES
Full status check (2,3)
NOTES:
1. Write the command code and data at even address.
2. Refer to Figure 20.14.
3. Execute the clear status register command and block erase command at least 3 times
until an erase error is not generated when an erase error is generated.
Figure 20.12 Flow Chart of Block Erase Command (when not using erase suspend function)
(EW mode 0)
FMR40=1 FMR41=1
(EW mode 1)
Start Interrupt service routine
FMR41=0
NO
FMR00=1?
YES
NOTES:
1. Write the command code and data to even address.
2. Execute the clear status register command and block erase command at least 3 times until an
erase error is not generated when an erase error is generated.
3. In EW mode 0, allocate an interrupt vector table of an interrupt, to be used, to the RAM area
4. Refer to Figure 20.14.
FMR06 =1
YES (1) Execute the clear status register command and set
and Command
FMR07=1? sequence error the status flag to 0 whether the command is
entered.
(2) Execute the command again after checking that the
correct command is entered or the program
NO
command or the block erase command is not
executed on the protected blocks.
NO (1) Execute the clear status register command and set
FMR07= Erase error the erase status flag to 0.
0? (2) Execute the block erase command again.
(3) Execute (1) and (2) at least 3 times until an erase
YES error does not occur.
Note 1: If the error still occurs, the block can not be
used.
[During programming]
NO (1) Execute the clear status register command and set
FMR06= Program error the program status flag to 0.
0? (2) Execute the program command again.
YES Note 2: If the error still occurs, the block can not be
used.
Note 3: If bits FMR06 or FMR07 is 1, any of the program or block erase command cannot be
accepted. Execute the clear status register command before executing those commands.
Figure 20.14 Full Status Check and Handling Procedure for Each Error
Table 20.8 Pin Descriptions (Flash Memory Standard Serial I/O Mode)
Pin Name I/O Descriptio
n
VCC,VSS Power input Apply the voltage guaranteed for Program and Erase to Vcc pin and 0
V to Vss pin.
CNVSS CNVS I Connect to Vcc pin.
S
RESET Reset input I Reset input pin. While RESET pin is “L”, wait for td(ROC).
XIN Clock input I Connect a ceramic resonator or crystal oscillator between XIN and
XOUT pins. To input an externally generated clock, input it to XIN pin
XOUT Clock output O and open XOUT pin.
AVCC, AVSS Analog power supply input Connect AVss to Vss and AVcc to Vcc, respectively.
VREF Reference voltage input I Enter the reference voltage for AD conversion.
P00 to P07 Input port P0 I Input “H” or “L” signal or leave open.
P10 to P15, P17 Input port P1 I Input “H” or “L” signal or leave open.
P16 Input port P1 I Connect this pin to Vcc while RESET pin is “L”. (2)
P20 to P27 Input port P2 I Input "H" or “L” level signal or leave open.
P30 to P37 Input port P3 I Input "H" or “L” level signal or leave open.
P60 to P63 Input port P6 I Input "H" or “L” level signal or leave open.
P64 BUSY output O Standard serial I/O mode 1: BUSY signal output pin
Standard serial I/O mode 2: Monitor signal output pin for boot program
operation check
I Standard serial I/O mode 1: Serial clock input pin
P65 SCLK input Standard serial I/O mode 2: Input “L”.
P70 to P77 Input port P7 I Input “H” or “L” signal or leave open.
P80 to P84, Input port P8 I Input “H” or “L” signal or leave open.
P87
P85 RP input I Connect this pin to Vss while RESET pin is “L”. (2)
P86 CE input I Connect this pin to Vcc while RESET pin is “L”. (2)
P90 to P92,
P95 to P97 Input port P9 I Input “H” or “L” signal or leave open.
P93 Input port P93 Normal-ver. I/O “H” signal is output for specific time. Input “H” signal or leave open.
P100 to P107 Input port P10 I Input “H” or “L” signal or leave open.
NOTES: ___________
1. When using standard serial I/O mode 1, to input “H” to the TxD pin is necessary while the RESET pin is held “L”.
Therefore, connect this pin to VCC via a resistor. Adjust the pull-up resistor value on a system not to affect a data
transfer after reset, because this pin changes to a data-output pin
2. Set the following,
_____
either or both.
-Connect the CE pin to VCC.
_____
-Connect the RP pin to VSS and P16 pin to VCC.
(1)
P16
40
39
38
37
36
35
34
33
48
47
46
45
44
43
42
41
49 32
50 31
51 30
52 29
53 28 BUSY
54 27 SCLK
55
M16C/29 Group (64-pin package) 26 RxD
56 25 TxD
57
(Flash memory version) 24
58
(PLQP0064KB-A (64P6Q-A)) 23
59 22
60 21
61 20
62 19
63 18
64 17
10
12
13
14
15
16
11
1
(1)
RESET
Vcc
RP
Vss
CE
NOTE:
1. Set the following, either or both, in serial I/O Mode, while the RESET pin is applied a low-level ("L") signal.
-Connect the CE pin to Vcc.
-Connect the RP pin to Vss and the P16 pin to Vcc.
(1)
P16
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
61 40
62 39
63 38
64 37
65 36
66 35
67 34
69 32
BUSY
(Flash memory version)
70 31
71 30
SCLK
72
(PLQP0080KB-A(80P6Q-A)) 29
RxD
73 28 TxD
74 27
75 26
76 25
77 24
78 23
79 22
80 21
10
12
13
14
15
16
17
18
19
20
11
1
Vcc
Vss
(1)
(1)
RP
CE
NOTE:
1. Set the following, either or both, in serial I/O Mode, while the RESET pin is applied a low-level ("L") signal.
-Connect the CE pin to Vcc.
-Connect the RP pin to Vss and the P16 pin to Vcc.
MCU (1)
SCLK input SCLK
P86(CE)
TxD output TXD (1)
CNVss
(1) Controlling pins and external circuits vary with the serial programmer. For more
information, refer to the user's manual included with the serial programmer.
(2) In this example, a selector controls the input voltage applied to CNVss to switch
between single-chip mode and standard serial I/O mode.
(3) In standard serial input/output mode 1, if the user reset signal becomes “L” while
the MCU is communicating with the serial programmer, break the connection
between the user reset signal and the RESET pin using a jumper switch.
NOTE:
1. Set the following, either or both.
- Connect the CE pin to Vcc
- Connect the RP pin to Vss and the P16 pin to Vcc
MCU
(1)
SCLK P86(CE)
TxD output TxD
(1)
Monitor output BUSY P16
CNVss
P85(RP)
(1)
(1) In this example, a selector controls the input voltage applied to CNVss to switch
between single-chip mode and standard serial I/O mode.
NOTE:
1. Set the following, either or both.
- Connect the CE pin to Vcc
- Connect the RP pin to Vss and the P16 pin to Vcc
In CAN I/O mode, the user ROM area can be rewritten while the MCU is mounted on-board by using a CAN
programmer which is applicable for the M16C/29 group. For more information about CAN programmers,
contact the manufacturer of your CAN programmer. For details on how to use, refer to the user’s manual
included with your CAN programmer.
Table 20.9 lists pin functions for CAN I/O mode. Figures 20.19 and 20.20 show pin connections for CAN I/
O mode.
RESET Reset input I Reset input pin. While RESET pin is "L" level, wait for td(ROC).
XIN Clock input I Connect a ceramic resonator or crystal oscillator between XIN and
XOUT pins. To input an externally generated clock, input it to XIN pin
XOUT Clock output O and open XOUT pin.
AVCC, AVSS Analog power supply input Connect AVss to Vss and AVcc to Vcc, respectively.
VREF Reference voltage input I Enter the reference voltage for AD from this pin.
P00 to P07 Input port P0 I Input "H" or "L" level signal or leave open.
P10 to P15, P17 Input port P1 I Input "H" or "L" level signal or leave open.
P16 Input port P1 I Connect this pin to Vcc while RESET is low. (Note 1)
P20 to P27 Input port P2 I Input "H" or "L" level signal or leave open.
P30 to P37 Input port P3 I Input "H" or "L" level signal or leave open.
P60 to P64, P66 Input port P6 I Input "H" or "L" level signal or leave open.
P70 to P77 Input port P7 I Input "H" or "L" level signal or leave open.
P80 to P84, Input port P8 I Input "H" or "L" level signal or leave open.
P87
P85 RP input I Connect this pin to Vss while RESET is low. (Note 1)
P86 CE input I Connect this pin to Vcc while RESET is low. (Note 1)
P90 to P91,
P95 to P97 Input port P9 I Input "H" or "L" level signal or leave open.
P100 to P107 Input port P10 I Input "H" or "L" level signal or leave open.
NOTE:
1. Set following either or both.
_____
•Connect the CE pin to VCC.
_____
•Connect the RP pin to VSS and the P16 pin to VCC.
Note
P16
40
39
38
37
36
35
34
33
48
47
46
45
44
43
42
41
49 32
50 31
51 30
52 29
53 28
54 27 SCLK
55 M16C/29 Group (64-pin package) 26
56
(Flash memory version) 25 TxD
57 24
58
(PLQ0064KB-A (64P6Q-A)) 23
59 22
60 21
61 20
62 19
CTx 63 18
CRx 64 17
10
12
13
14
15
16
11
1
RESET
Vcc
RP
Vss
CE
NOTE:
1. Set following either or both in serial I/O mode while the RESET pin is held “L”.
•Connect the CE pin to VCC
•Connect the RP pin to VSS and the P16 pin to VCC
(1)
P16
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
61 40
62 39
63 38
64 37
65 36
66 35
67
M16C/29 Group (80-pin package) 34
68 33
69
(Flash memory version) 32
70 31
71 (PLQP0080KB-A (80P6Q-A)) 30
SCLK
72 29
73 28 TxD
74 27
75 26
76 25
77 24
78 23
79 22
80 21
10
12
13
14
15
16
17
18
19
20
11
1
Vcc
Vss
(1)
(1)
RP
CE
NOTE:
1. Set following either or both in serial I/O mode while the RESET pin is held “L”.
•Connect the CE pin to VCC
•Connect the RP pin to VSS and the P16 pin to VCC
MCU
(Note 1)
TXD
SCLK P86(CE)
(Note 1)
CAN transceiver
CAN_H P92/CRx P16
CAN_L P93/CTx
CNVss
(1) Control pins and external circuits vary with the CAN programmer.
For more information, refer to the user's manual include with the CAN programmer.
(2) In this example, a selector controls the input voltage applied to CNVss to switch
between single-chip mode and CAN I/O mode.
NOTE:
1. Refer to Table 1.6.
AAAAA AAAAA
33.3 x VCC-80 MHZ 33.3 x VCC-80 MHZ
AAAAA AAAAA
20.0 20.0
10.0
AAAAA
AAAAA 10.0
AAAAA
AAAAA
0.0
AAAAA
AAAAA 0.0
2.7 3.0 5.5 2.7 3.0 5.5
Table 21.4 Flash Memory Version Electrical Characteristics (1) for 100/1000 E/W cycle products
[Program Space and Data Space in U3 and U5: Program Space in U7 and U9]
Standard
Symbol Parameter Unit
Min. Typ.(2) Max.
- Program and Erase Endurance(3) 100/1000 1)
(4, 1 cycles
- Word Program Time (VCC=5.0V, Topr=25° C) 75 600 µs
- Block Erase Time 2-Kbyte Block 0.2 9 s
(VCC=5.0V, Topr=25° C) 8-Kbyte Block 0.4 9 s
16-Kbyte Block 0.7 9 s
32-Kbyte Block 1.2 9 s
td(SR-ES) Duration between Suspend Request and Erase Suspend 8 ms
tPS Wait Time to Stabilize Flash Memory Circuit 15 µs
- Data Hold Time (5) 20 years
Table 21.5 Flash Memory Version Electrical Characteristics (6) 10000 E/W cycle products (Option)
[Data Space in U7 and U9(7)]
Standard
Symbol Parameter Unit
Min. Typ.(2) Max.
- Program and Erase Endurance(3, 8, 9) 10000 (4, 10) cycles
- Word Program Time (VCC = 5.0 V, Topr = 25° C) 100 µs
- Block Erase Time (VCC = 5.0 V, Topr = 25° C) 0.3 s
(2-Kbyte block)
td(SR-ES) Duration between Suspend Request and Erase Suspend 8 ms
tPS Wait Time to Stabilize Flash Memory Circuit 15 µs
- Data Hold Time (5) 20 years
NOTES:
1. Referenced to VCC = 2.7 to 5.5 V at Topr = 0 to 60° C (program space), unless otherwise specified.
2. VCC = 5.0 V; Topr = 25° C
3. Program and erase endurance is defined as number of program-erase cycles per block.
If program and erase endurance is n cycle (n = 100, 1000, 10000), each block can be erased and programmed n
cycles.
For example, if a 2-Kbyte block A is erased after programming one-word data to each address 1,024 times,
this counts as one program and erase endurance. Data cannot be programmed to the same address more than
once without erasing the block. (rewrite prohibited).
4. Number of E/W cycles for which operation is guranteed (1 to minimum value are guaranteed).
5. Topr = 55° C
6. Referenced to VCC = 2.7 to 5.5 V at Topr = -40 to 85° C(U7) / -20 to 85° C (U9) unless otherwise specifie.
7. Table 21.5 applies for data space in U7 and U9 when program and erase endurance is more than 1,000 cycles.
Otherwise, use Table 21.4.
8. To reduce the number of program and erase endurance when working with systems requiring numerous rewrites,
write to unused word addresses within the block instead of rewrite. Erase block only after all possible addresses
are used. For example, an 8-word program can be written 128 times maximum before erase becomes necessary.
Maintaining an equal number of times erasure between block A and block B will also improve efficiency. It is
recommended to track the total number of erasure performed per block and to limit the number of erasure.
9. If an erase error is generated during block erase, execute the clear status register command and block erase
command at least 3 times until an erase error is not generated.
10. When executing more than 100 times rewrites, set one wait state per block access by setting the FMR17 bit in
the FMR1 register 1 to 1 (wait state). When accessing to all other blocks and internal RAM, wait state can be
set by the PM17 bit, regardless of the FMR17 bit setting value.
11. The program and erase endurance is 100 cycles for program space and data space in U3 and U5; 1,000 cycles
for program space in U7 and U9.
12. Please contact Renesas Technology Corp. or an authorized Renesas Technology Corp. product distributor for
further details on the E/W failure rate.
Erase suspend
request
(interrupt request)
FMR46
td(SR-ES)
Table 21.6 Low Voltage Detection Circuit Electrical Characteristics (Note 1, Note 3)
Standard
Symbol Parameter Measurement Condition Unit
Min. Typ. Max.
Vdet4 Low Voltage Detection Voltage(1) 3.2 3.8 4.45 V
Vdet3 Reset Space Detection Voltage(1) 2.3 2.8 3.4 V
VCC=0.8 to 5.5V
Vdet3s Low Voltage Reset Hold Voltage(2) 1.7 V
Vdet3r Low Voltage Reset Release Voltage 2.35 2.9 3.5 V
NOTES:
1. Vdet4 >Vdet3
2. Vdet3s is the minmum voltage to maintain brown-out detection reset (hardware reset 2).
3. The low Voltage detection circuit is designed to use when VCC is set to 5V.
4. If the supply power voltage is greater than the reset level detection voltage when the reset level detection
voltage is less than 2.7V, the operation at f(BCLK) < 10MHz is guranteed. However, A/D conversion, serial I/O,
flash memory program and erase are excluded.
td(P-R) VCC
Wait time to stabilize internal
supply voltage when power-on
ROC
Interrupt for
td(R-S) (a) Stop mode release
STOP release time or
(b) Wait mode release
td(W-S)
Low power dissipation mode
wait mode release time
CPU clock
(a)
td(R-S)
(b)
td(W-S)
td(S-R)
Brown-out detection Vdet3r
reset (hardware reset 2) VCC
release wait time
td(S-R)
CPU clock
td(E-A)
Voltage detection circuit VC26, VC27
operation start time
td(E-A)
VCC = 5V
Table 21.8 Electrical Characteristics (Note 1)
Standard
Symbol Parameter Condition Unit
Min. Typ. Max.
VOH Output High P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOH=-5mA VCC-2.0 VCC V
("H") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
Output High P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOH=-200µA VCC-0.3 VCC V
VOH ("H") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
High Power IOH=-1mA VCC-2.0 VCC
Output High ("H") Voltage XOUT V
Low Power IOH=-0.5mA VCC-2.0 VCC
VOH
High Power No load applied 2.5
Output High ("H") Voltage XCOUT V
Low Power No load applied 1.6
VOL Output Low P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOL=5mA 2.0 V
("L") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
Output Low P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOL=200µA 0.45 V
VOL
("L") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
High Power IOL=1mA 2.0
Output Low ("L") Voltage XOUT V
Low Power IOL=0.5mA 2.0
VOL
High Power No load applied 0
Output Low ("L") Voltage XCOUT V
Low Power No load applied 0
VT+-VT- Hysteresis TA0IN-TA4IN, TB0IN-TB2IN, INT0-INT5, NMI, ADTRG, CTS0- 0.2 1.0 V
CTS2, SCL, SDA, CLK0-CLK2, TA2OUT-TA4OUT, KI0-KI3, RXD0-
RXD2, SIN3, SIN4
VT+-VT- Hysteresis RESET 0.2 2.5 V
VT+-VT- Hysteresis XIN 0.2 0.8 V
IIH Input High P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, VI=5V 5.0 µA
("H") Current P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
XIN, RESET, CNVSS
IIL Input Low P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, VI=0V -5.0 µA
("L") Current P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
XIN, RESET, CNVSS
RPULLUP Pull-up P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, VI=0V 30 50 170 kΩ
Resistance P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
RfXIN Feedback Resistance XIN 1.5 MΩ
RfXCIN Feedback Resistance XCIN 15 MΩ
VRAM RAM Standby Voltage In stop mode 2.0 V
NOTES:
1. Referenced to VCC=4.2 to 5.5V, VSS=0V at Topr=-20 to 85 ° C / -40 to 85 ° C, f(BCLK)=20MHz unless otherwise specified.
VCC = 5V
Timing Requirements
(VCC = 5V, VSS = 0V, at Topr = – 20 to 85oC / – 40 to 85oC unless otherwise specified)
VCC = 5V
Timing Requirements
(VCC = 5V, VSS = 0V, at Topr = – 20 to 85oC / – 40 to 85oC unless otherwise specified)
Table 21.13 Timer A Input (External Trigger Input in One-shot Timer Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(TA) TAiIN input cycle time 200 ns
tw(TAH) TAiIN input HIGH pulse width 100 ns
tw(TAL) TAiIN input LOW pulse width 100 ns
Table 21.14 Timer A Input (External Trigger Input in Pulse Width Modulation Mode)
Standard
Symbol Parameter Unit
Min. Max.
tw(TAH) TAiIN input HIGH pulse width 100 ns
tw(TAL) TAiIN input LOW pulse width 100 ns
Table 21.15 Timer A Input (Counter Increment/decrement Input in Event Counter Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(UP) TAiOUT input cycle time 2000 ns
tw(UPH) TAiOUT input HIGH pulse width 1000 ns
tw(UPL) TAiOUT input LOW pulse width 1000 ns
tsu(UP-TIN) TAiOUT input setup time 400 ns
th(TIN-UP) TAiOUT input hold time 400 ns
Table 21.16 Timer A Input (Two-phase Pulse Input in Event Counter Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(TA) TAiIN input cycle time 800 ns
tsu(TAIN-TAOUT) TAiOUT input setup time 200 ns
tsu(TAOUT-TAIN) TAiIN input setup time 200 ns
Timing Requirements
VCC = 5V
(VCC = 5V, VSS = 0V, at Topr = – 20 to 85oC / – 40 to 85oC unless otherwise specified)
_______
Table 21.22 External Interrupt INTi Input
Standard
Symbol Parameter Unit
Min. Max.
tw(INH) INTi input HIGH pulse width 250 ns
tw(INL) INTi input LOW pulse width 250 ns
Timing Requirements
VCC = 5V
(VCC = 5V, VSS = 0V, at Topr = – 20 to 85oC / – 40 to 85oC unless otherwise specified)
VCC = 5V
XIN input
tf
tr tw(H) tw(L)
tc
tc(TA)
tw(TAH)
TAiIN input
tw(TAL)
tc(UP)
tw(UPH)
TAiOUT input
tw(UPL)
TAiOUT input
(Up/down input)
During Event Counter Mode
TAiIN input
th(TIN-UP) tsu(UP-TIN)
(When count on falling
edge is selected)
TAiIN input
(When count on rising
edge is selected)
TAiIN input
tsu(TAIN-TAOUT) tsu(TAIN-TAOUT)
tsu(TAOUT-TAIN)
TAiOUT input
tsu(TAOUT-TAIN)
tc(TB)
tw(TBH)
TBiIN input
tw(TBL)
tc(AD)
tw(ADL)
ADTRG input
VCC = 5V
tc(CK)
tw(CKH)
CLKi
tw(CKL)
th(C–Q)
TxDi
td(C–Q) tsu(D–C)
th(C–D)
RxDi
tw(INL)
INTi input
tw(INH)
VCC = 5V
SDA
tHD:STA tsu:STO
tBUF
tLOW
tR tF
p Sr p
S
SCL
VCC = 3V
Table 21.24 Electrical Characteristics (Note 1)
Standard
Symbol Parameter Condition Unit
Min. Typ. Max.
VOH Output High P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOH = -1 mA VCC-0.5 VCC V
("H") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
VCC = 3V
Table 21.25 Electrical Characteristics (2) (Note 1)
Standard
Symbol Parameter Measurement Condition Unit
Min. T yp . Max.
ICC Power Supply Output pins are Mask ROM f(BCLK) = 10 MHz, 8 13 mA
Current left open and main clock, no division
(VCC = 2.7 to 3.6V) other pins are On-chip oscillation, 1 mA
connected to VSS
f2(ROC) selected, f(BCLK) = 1 MHz
Flash memory f(BCLK) = 10 MHz, 8 13 mA
main clock, no division
Flash memory 11 mA
f(BCLK) = 10 MHz, Vcc = 3.0 V
program
Flash memory f(BCLK) = 10 MHz, Vcc= 3.0 V 11 mA
erase
Mask ROM f(BCLK) = 32 kHz, 20 µA
In low-power consumption mode,
Program running on ROM(3)
On-chip oscillation, 25 µA
f2(ROC) selected, f(BCLK) = 1 MHz,
In wait mode
Flash memory f(BCLK) = 32 kHz, 20 µA
In low-power consumption mode,
Program running on RAM(3)
f(BCLK) = 32 kHz, 450 µA
In low-power consumption mode,
Program running on flash memory(3)
On-chip oscillation, 45 µA
f2(ROC) selected, f(BCLK) = 1 MHz,
In wait mode(4)
Mask ROM, f(BCLK) = 32 kHz, In wait mode(2), 6.6 µA
Flash memory Oscillation capacity high
f(BCLK) = 32 kHz, In wait mode(2), 2.2 µA
Oscillation capacity low
While clock stops, Topr = 25° C 0.7 3 µA
Idet4 Low voltage detection dissipation current(4) 0.6 4 µA
Idet3 Reset level detection dissipation current(4) 1.0 5 µA
NOTES:
1. Referenced to VCC = 2.7 to 3.6 V, VSS = 0 V at Topr = -20 to 85 ° C / -40 to 85 ° C, f(BCLK) = 10 MHz unless otherwise
specified.
2. With one timer operates, using fC32.
3. This indicates the memory in which the program to be executed exists.
4. Idet is dissipation current when the following bit is set to 1 (detection circuit enabled).
Idet4: the VC27 bit of the VCR2 register
Idet3: the VC26 bit in the VCR2 register
VCC = 3V
Timing Requirements
(VCC = 3V, VSS = 0V, at Topr = – 20 to 85oC / – 40 to 85oC unless otherwise specified)
VCC = 3V
Timing Requirements
(VCC = 3V, VSS = 0V, at Topr = – 20 to 85oC / – 40 to 85oC unless otherwise specified)
Table 21.29 Timer A Input (External Trigger Input in One-shot Timer Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(TA) TAiIN input cycle time 300 ns
tw(TAH) TAiIN input HIGH pulse width 150 ns
tw(TAL) TAiIN input LOW pulse width 150 ns
Table 21.30 Timer A Input (External Trigger Input in Pulse Width Modulation Mode)
Standard
Symbol Parameter Unit
Min. Max.
tw(TAH) TAiIN input HIGH pulse width 150 ns
tw(TAL) TAiIN input LOW pulse width 150 ns
Table 21.31 Timer A Input (Counter Increment/decrement Input in Event Counter Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(UP) TAiOUT input cycle time 3000 ns
tw(UPH) TAiOUT input HIGH pulse width 1500 ns
tw(UPL) TAiOUT input LOW pulse width 1500 ns
tsu(UP-TIN) TAiOUT input setup time 600 ns
th(TIN-UP) TAiOUT input hold time 600 ns
Table 21.32 Timer A Input (Two-phase Pulse Input in Event Counter Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(TA) TAiIN input cycle time 2 µs
tsu(TAIN-TAOUT) TAiOUT input setup time 500 ns
tsu(TAOUT-TAIN) TAiIN input setup time 500 ns
VCC = 3V
Timing Requirements
(VCC = 3V, VSS = 0V, at Topr = – 20 to 85oC / – 40 to 85oC unless otherwise specified)
_______
Table 21.38 External Interrupt INTi Input
Standard
Symbol Parameter Unit
Min. Max.
tw(INH) INTi input HIGH pulse width 380 ns
tw(INL) INTi input LOW pulse width 380 ns
VCC = 3V
Timing Requirements
(VCC = 3V, VSS = 0V, at Topr = – 20 to 85oC / – 40 to 85oC unless otherwise specified)
VCC = 3V
XIN input
tf
tr tw(H) tw(L)
tc
tc(TA)
tw(TAH)
TAiIN input
tw(TAL)
tc(UP)
tw(UPH)
TAiOUT input
tw(UPL)
TAiOUT input
(Up/down input)
During Event Counter Mode
TAiIN input
th(TIN-UP) tsu(UP-TIN)
(When count on falling
edge is selected)
TAiIN input
(When count on rising
edge is selected)
TAiIN input
tsu(TAIN-TAOUT) tsu(TAIN-TAOUT)
tsu(TAOUT-TAIN)
TAiOUT input
tsu(TAOUT-TAIN)
tc(TB)
tw(TBH)
TBiIN input
tw(TBL)
tc(AD)
tw(ADL)
ADTRG input
VCC = 3V
tc(CK)
tw(CKH)
CLKi
tw(CKL)
th(C–Q)
TxDi
td(C–Q) tsu(D–C)
th(C–D)
RxDi
tw(INL)
INTi input
tw(INH)
VCC = 3V
SDA
tHD:STA tsu:STO
tBUF
tLOW
tR tF
p Sr p
S
SCL
21.2 T version
AAAA AAAA
20.0 MHZ 20.0 MHZ
AAAA AAAA
20.0 20.0
10.0
AAAA
AAAA 10.0
AAAA
AAAA
0.0
AAAA
AAAA 0.0
3.0 5.5 3.0 5.5
Table 21.43 Flash Memory Version Electrical Characteristics (1) for 100/1000 E/W cycle products
[Program Space and Data Space in U3; Program Space in U7]
Standard
Symbol Parameter Unit
Min. Typ.(2) Max.
- Program and Erase Endurance(3) 100/1000 1)
(4, 1 cycles
- Word Program Time (VCC = 5.0 V, Topr = 25° C) 75 600 µs
- Block Erase Time 2-Kbyte Block 0.2 9 s
(VCC = 5.0 V, Topr = 25° C) 8-Kbyte Block 0.4 9 s
16-Kbyte Block 0.7 9 s
32-Kbyte Block 1.2 9 s
td(SR-ES) Duration between Suspend Request and Erase Suspend 8 ms
tPS Wait Time to Stabilize Flash Memory Circuit 15 µs
- Data Hold Time (5) 20 years
Table 21.44 Flash Memory Version Electrical Characteristics (6) for 10000 E/W cycle products
[Data Space in U7(7)]
Standard
Symbol Parameter Unit
Min. Typ.(2) Max.
- Program and Erase Endurance(3, 8, 9) 10000 (4, 10) cycles
- Word Program Time (VCC = 5.0 V, Topr = 25° C) 100 µs
- Block Erase Time (VCC = 5.0V, Topr = 25° C) 0.3 s
(2-Kbyte block)
td(SR-ES) Duration between Suspend Request and Erase Suspend 8 ms
tPS Wait Time to Stabilize Flash Memory Circuit 15 µs
- Data Hold Time (5) 20 years
NOTES:
1. Referenced to VCC = 3.0 to 5.5 V at Topr = 0 to 60° C (program space)/ Topr = -40 to 85° C(data space), unless
otherwise specified.
2. VCC = 5.0 V; TOPR = 25° C
3. Program and erase endurance is defined as number of program-erase cycles per block.
If program and erase endurance is n cycle (n = 100, 1000, 10000), each block can be erased and programmed n
cycles.
For example, if a 2-Kbyte block A is erased after programming one-word data to each address 1,024 times,
this counts as one program and erase endurance. Data cannot be programmed to the same address more than
once without erasing the block. (rewrite prohibited).
4. Number of E/W cycles for which operation is guranteed (1 to minimum value are guranteed).
5. Topr = 55° C
6. Referenced to VCC = 3.0 to 5.5 V at Topr = -40 to 85° C unless otherwise specified.
7. Table 21.44 applies for data space in U7 when program and erase endurance is more than 1,000 cycles.
Otherwise, use Table 21.43.
8. To reduce the number of program and erase endurance when working with systems requiring numerous rewrites,
write to unused word addresses within the block instead of rewrite. Erase block only after all possible addresses
are used. For example, an 8-word program can be written 128 times maximum before erase becomes necessary.
Maintaining an equal number of times erasure between block A and block B will also improve efficiency. It is
recommended to track the total number of erasure performed per block and to limit the number of erasure.
9. If an erase error is generated during block erase, execute the clear status register command and block erase
command at least 3 times until an erase error is not generated.
10. When executing more than 100 times rewrites, set one wait state per block access by setting the FMR17 bit in
the FMR1 register to 1 (wait state). When accessing to all other blocks and internal RAM, wait state can be set
by the PM17 bit, regardless of the FMR17 bit setting value.
11. The program and erase endurance is 100 cycles for program space and data space in U3; 1,000 cycles
for program space in U7.
12. Please contact Renesas Technology Corp. or an authorized Renesas Technology Corp. product distributor for
further details on the E/W failure rate.
Erase suspend
request
(interrupt request)
FMR46
td(SR-ES)
td(P-R) VCC
Wait time to stabilize internal
supply voltage when power-on
ROC
Interrupt for
td(R-S) (a) Stop mode release
STOP release time or
(b) Wait mode release
td(W-S)
Low power dissipation mode
wait mode release time
CPU clock
(a)
td(R-S)
(b)
td(W-S)
VCC = 5V
Table 21.46 Electrical Characteristics (Note 1)
Standard
Symbol Parameter Condition Unit
Min. Typ. Max.
VOH Output High P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOH = -5 mA VCC-2.0 VCC V
("H") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
Output High P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOH = -200 µA VCC-0.3 VCC V
VOH ("H") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
High Power IOH = -1 mA VCC-2.0 VCC
Output High ("H") Voltage XOUT V
Low Power IOH = -0.5 mA VCC-2.0 VCC
VOH
High Power No load applied 2.5
Output High ("H") Voltage XCOUT V
Low Power No load applied 1.6
VOL Output Low P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOL = 5 mA 2.0 V
("L") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
Output Low P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOL = 200 µA 0.45 V
VOL
("L") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
High Power IOL = 1 mA 2.0
Output Low ("L") Voltage XOUT V
Low Power IOL = 0.5 mA 2.0
VOL
High Power No load applied 0
Output Low ("L") Voltage XCOUT V
Low Power No load applied 0
VT+-VT- Hysteresis TA0IN-TA4IN, TB0IN-TB2IN, INT0-INT5, NMI, ADTRG, CTS0- 0.2 1.0 V
CTS2, SCL, SDA, CLK0-CLK2, TA2OUT-TA4OUT, KI0-KI3, RXD0-
RXD2, SIN3, SIN4
VT+-VT- Hysteresis RESET 0.2 2.5 V
VT+-VT- Hysteresis XIN 0.2 0.8 V
IIH Input High P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, VI = 5 V 5.0 µA
("H") Current P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
XIN, RESET, CNVSS
IIL Input Low P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, VI = 0 V -5.0 µA
("L") Current P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
XIN, RESET, CNVSS
RPULLUP Pull-up P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, VI = 0 V 30 50 170 kΩ
Resistance P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
RfXIN Feedback Resistance XIN 1.5 MΩ
RfXCIN Feedback Resistance XCIN 15 MΩ
VRAM RAM Standby Voltage In stop mode 2.0 V
NOTES:
1. Referenced to VCC=4.2 to 5.5V, VSS=0V at Topr=-40 to 85 ° C, f(BCLK)=20MHz unless otherwise specified.
Timing Requirements
VCC = 5V
(VCC = 5V, VSS = 0V, at Topr = – 40 to 85oC unless otherwise specified)
Timing Requirements
VCC = 5V
(VCC = 5V, VSS = 0V, at Topr = – 40 to 85oC unless otherwise specified)
Table 21.51 Timer A Input (External Trigger Input in One-shot Timer Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(TA) TAiIN input cycle time 200 ns
tw(TAH) TAiIN input HIGH pulse width 100 ns
tw(TAL) TAiIN input LOW pulse width 100 ns
Table 21.52 Timer A Input (External Trigger Input in Pulse Width Modulation Mode)
Standard
Symbol Parameter Unit
Min. Max.
tw(TAH) TAiIN input HIGH pulse width 100 ns
tw(TAL) TAiIN input LOW pulse width 100 ns
Table 21.53 Timer A Input (Counter Increment/decrement Input in Event Counter Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(UP) TAiOUT input cycle time 2000 ns
tw(UPH) TAiOUT input HIGH pulse width 1000 ns
tw(UPL) TAiOUT input LOW pulse width 1000 ns
tsu(UP-TIN) TAiOUT input setup time 400 ns
th(TIN-UP) TAiOUT input hold time 400 ns
Table 21.54 Timer A Input (Two-phase Pulse Input in Event Counter Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(TA) TAiIN input cycle time 800 ns
tsu(TAIN-TAOUT) TAiOUT input setup time 200 ns
tsu(TAOUT-TAIN) TAiIN input setup time 200 ns
VCC = 5V
Timing Requirements
(VCC = 5V, VSS = 0V, at Topr = – 40 to 85oC unless otherwise specified)
_______
Table 21.60 External Interrupt INTi Input
Standard
Symbol Parameter Unit
Min. Max.
tw(INH) INTi input HIGH pulse width 250 ns
tw(INL) INTi input LOW pulse width 250 ns
Timing Requirements
VCC = 5V
(VCC = 5V, VSS = 0V, at Topr = – 40 to 85oC unless otherwise specified)
VCC = 5V
XIN input
tf
tr tw(H) tw(L)
tc
tc(TA)
tw(TAH)
TAiIN input
tw(TAL)
tc(UP)
tw(UPH)
TAiOUT input
tw(UPL)
TAiOUT input
(Up/down input)
During Event Counter Mode
TAiIN input
th(TIN-UP) tsu(UP-TIN)
(When count on falling
edge is selected)
TAiIN input
(When count on rising
edge is selected)
TAiIN input
tsu(TAIN-TAOUT) tsu(TAIN-TAOUT)
tsu(TAOUT-TAIN)
TAiOUT input
tsu(TAOUT-TAIN)
tc(TB)
tw(TBH)
TBiIN input
tw(TBL)
tc(AD)
tw(ADL)
ADTRG input
VCC = 5V
tc(CK)
tw(CKH)
CLKi
tw(CKL)
th(C–Q)
TxDi
td(C–Q) tsu(D–C)
th(C–D)
RxDi
tw(INL)
INTi input
tw(INH)
VCC = 5V
SDA
tHD:STA tsu:STO
tBUF
tLOW
tR tF
p Sr p
S
SCL
Timing Requirements
VCC = 3V
(VCC = 3V, VSS = 0V, at Topr = – 40 to 85oC unless otherwise specified)
VCC = 3V
Timing Requirements
(VCC = 3V, VSS = 0V, at Topr = – 40 to 85oC unless otherwise specified)
Table 21.67 Timer A Input (External Trigger Input in One-shot Timer Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(TA) TAiIN input cycle time 300 ns
tw(TAH) TAiIN input HIGH pulse width 150 ns
tw(TAL) TAiIN input LOW pulse width 150 ns
Table 21.68 Timer A Input (External Trigger Input in Pulse Width Modulation Mode)
Standard
Symbol Parameter Unit
Min. Max.
tw(TAH) TAiIN input HIGH pulse width 150 ns
tw(TAL) TAiIN input LOW pulse width 150 ns
Table 21.69 Timer A Input (Counter Increment/decrement Input in Event Counter Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(UP) TAiOUT input cycle time 3000 ns
tw(UPH) TAiOUT input HIGH pulse width 1500 ns
tw(UPL) TAiOUT input LOW pulse width 1500 ns
tsu(UP-TIN) TAiOUT input setup time 600 ns
th(TIN-UP) TAiOUT input hold time 600 ns
Table 21.70 Timer A Input (Two-phase Pulse Input in Event Counter Mode)
Standard
Symbol Parameter Unit
Min. Max.
tc(TA) TAiIN input cycle time 2 µs
tsu(TAIN-TAOUT) TAiOUT input setup time 500 ns
tsu(TAOUT-TAIN) TAiIN input setup time 500 ns
VCC = 3V
Timing Requirements
(VCC = 3V, VSS = 0V, at Topr = – 40 to 85oC unless otherwise specified)
_______
Table 21.76 External Interrupt INTi Input
Standard
Symbol Parameter Unit
Min. Max.
tw(INH) INTi input HIGH pulse width 380 ns
tw(INL) INTi input LOW pulse width 380 ns
VCC = 3V
Timing Requirements
(VCC = 3V, VSS = 0V, at Topr = – 40 to 85oC unless otherwise specified)
VCC = 3V
XIN input
tf
tr tw(H) tw(L)
tc
tc(TA)
tw(TAH)
TAiIN input
tw(TAL)
tc(UP)
tw(UPH)
TAiOUT input
tw(UPL)
TAiOUT input
(Up/down input)
During Event Counter Mode
TAiIN input
th(TIN-UP) tsu(UP-TIN)
(When count on falling
edge is selected)
TAiIN input
(When count on rising
edge is selected)
TAiIN input
tsu(TAIN-TAOUT) tsu(TAIN-TAOUT)
tsu(TAOUT-TAIN)
TAiOUT input
tsu(TAOUT-TAIN)
tc(TB)
tw(TBH)
TBiIN input
tw(TBL)
tc(AD)
tw(ADL)
ADTRG input
VCC = 3V
tc(CK)
tw(CKH)
CLKi
tw(CKL)
th(C–Q)
TxDi
td(C–Q) tsu(D–C)
th(C–D)
RxDi
tw(INL)
INTi input
tw(INH)
VCC = 3V
SDA
tHD:STA tsu:STO
tBUF
tLOW
tR tF
p Sr p
S
SCL
21.3 V Version
20.0 MHz (Topr = -40 C to 105 C) 20.0 MHz (Topr = -40 C to 105 C)
f(XIN) operating maximum frequency [MHZ]
AAA AA
16.0 MHz (Topr = -40 C to 125 C) 16.0 MHz (Topr = -40 C to 125 C)
AAA AA
20.0 20.0
AAA AA
16.0 16.0
10.0
AAA
AAA
10.0
AA
0.0
AAA4.2 5.5
0.0
4.2 5.5
Table 21.81 Flash Memory Version Electrical Characteristics (1) for 100/1000 E/W cycle products
[Program Space and Data Space in U3; Program Space in U7]
Standard
Symbol Parameter Unit
Min. Typ.(2) Max.
- Program and Erase Endurance(3) 100/1000 1)
(4, 1 cycles
- Word Program Time (VCC = 5.0 V, Topr = 25° C) 75 600 µs
- Block Erase Time 2-Kbyte Block 0.2 9 s
(VCC = 5.0 V, Topr = 25° C) 8-Kbyte Block 0.4 9 s
16-Kbyte Block 0.7 9 s
32-Kbyte Block 1.2 9 s
td(SR-ES) Duration between Suspend Request and Erase Suspend 8 ms
tPS Wait Time to Stabilize Flash Memory Circuit 15 µs
- Data Hold Time (5) 20 years
Table 21.82 Flash Memory Version Electrical Characteristics (6) for 10000 E/W cycle products
[Data Space in U7 (7)]
Standard
Symbol Parameter Unit
Min. Typ.(2) Max.
- Program and Erase Endurance(3, 8, 9) 10000 (4, 10) cycles
- Word Program Time (VCC = 5.0 V, Topr = 25° C) 100 µs
- Block Erase Time (VCC = 5.0V, Topr = 25° C) 0.3 s
(2-Kbyte block)
td(SR-ES) Duration between Suspend Request and Erase Suspend 8 ms
tPS Wait Time to Stabilize Flash Memory Circuit 15 µs
- Data Hold Time (5) 20 years
NOTES:
1. Referenced to VCC = 4.2 to 5.5 V at Topr = 0 to 60° C (program space)/ Topr = -40 to 125° C(data space),
unless otherwise specified.
2. VCC = 5.0 V; TOPR = 25° C
3. Program and erase endurance is defined as number of program-erase cycles per block.
If program and erase endurance is n cycle (n = 100, 1000, 10000), each block can be erased and programmed n
cycles.
For example, if a 2-Kbyte block A is erased after programming one-word data to each address 1,024 times,
this counts as one program and erase endurance. Data cannot be programmed to the same address more than
once without erasing the block. (rewrite prohibited).
4. Number of E/W cycles for which operation is guranteed (1 to minimum value are guranteed).
5. Topr = 55° C
6. Referenced to VCC = 4.2 to 5.5 V at Topr = -40 to 125° C unless otherwise specified.
7. Table 21.82 applies for data space in U7 when program and erase endurance is more than 1,000 cycles.
Otherwise, use Table 21.81.
8. To reduce the number of program and erase endurance when working with systems requiring numerous rewrites,
write to unused word addresses within the block instead of rewrite. Erase block only after all possible addresses
are used. For example, an 8-word program can be written 128 times maximum before erase becomes necessary.
Maintaining an equal number of times erasure between block A and block B will also improve efficiency. It is
recommended to track the total number of erasure performed per block and to limit the number of erasure.
9. If an erase error is generated during block erase, execute the clear status register command and block erase
command at least 3 times until an erase error is not generated.
10. When executing more than 100 times rewrites, set one wait state per block access by setting the FMR17 bit in
the FMR1 register to 1 (wait state). When accessing to all other blocks and internal RAM, wait state can be set
by the PM17 bit, regardless of the FMR17 bit setting value.
11. The program and erase endurance is 100 cycles for program space and data space in U3; 1,000 cycles
for program space in U7.
12. Please contact Renesas Technology Corp. or an authorized Renesas Technology Corp. product distributor for
further details on the E/W failure rate.
Erase suspend
request
(interrupt request)
FMR46
td(SR-ES)
td(P-R) VCC
Wait time to stabilize internal
supply voltage when power-on
ROC
Interrupt for
td(R-S) (a) Stop mode release
STOP release time or
(b) Wait mode release
td(W-S)
Low power dissipation mode
wait mode release time
CPU clock
(a)
td(R-S)
(b)
td(W-S)
VCC = 5V
Table 21.84 Electrical Characteristics (1)
Standard
Symbol Parameter Condition Unit
Min. Typ. Max.
VOH Output High P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOH = -5 mA VCC-2.0 VCC V
("H") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
Output High P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOH = -200 µA VCC-0.3 VCC V
VOH ("H") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
High Power IOH = -1 mA VCC-2.0 VCC
Output High ("H") Voltage XOUT V
Low Power IOH = -0.5 mA VCC-2.0 VCC
VOH
High Power No load applied 2.5
Output High ("H") Voltage XCOUT V
Low Power No load applied 1.6
VOL Output Low P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOL = 5 mA 2.0 V
("L") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
Output Low P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, IOL = 200 µA 0.45 V
VOL
("L") Voltage P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
High Power IOL = 1 mA 2.0
Output Low ("L") Voltage XOUT V
Low Power IOL = 0.5 mA 2.0
VOL
High Power No load applied 0
Output Low ("L") Voltage XCOUT V
Low Power No load applied 0
VT+-VT- Hysteresis TA0IN-TA4IN, TB0IN-TB2IN, INT0-INT5, NMI, ADTRG, CTS0- 0.2 1.0 V
CTS2, SCL, SDA, CLK0-CLK2, TA2OUT-TA4OUT, KI0-KI3, RXD0-
RXD2, SIN3, SIN4
VT+-VT- Hysteresis RESET 0.2 2.5 V
VT+-VT- Hysteresis XIN 0.2 0.8 V
IIH Input High P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, VI = 5 V 5.0 µA
("H") Current P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
XIN, RESET, CNVSS
IIL Input Low P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, VI = 0 V -5.0 µA
("L") Current P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
XIN, RESET, CNVSS
RPULLUP Pull-up P00 to P07, P10 to P17, P20 to P27, P30 to P37, P60 to P67, VI = 0 V 30 50 170 kΩ
Resistance P70 to P77, P80 to P87, P90 to P93, P95 to P97, P100 to P107
RfXIN Feedback Resistance XIN 1.5 MΩ
RfXCIN Feedback Resistance XCIN 15 MΩ
VRAM RAM Standby Voltage In stop mode 2.0 V
NOTE:
1. Referenced to VCC = 4.2 to 5.5 V, VSS = 0 V at Topr = -40 to 105 ° C, f(BCLK) = 20 MHz / VCC = 4.2 to 5.5 V, VSS = 0 V at
Topr = -40 to 125 ° C, f(BCLK) = 16 MHz, unless otherwise specified.
VCC = 5V
Table 21.85 Electrical Characteristics (2) (1)
Standard
Symbol Parameter Measurement Condition Unit
Min. Typ. Max.
ICC Power Supply Output pins are Mask ROM f(BCLK) = 20 MHz, 18 25 mA
Current left open and main clock, no division
(VCC=4.2 to 5.5V) other pins are f(BCLK) = 16 MHz, 14 20 mA
connected to VSS
main clock, no division
On-chip oscillation, 2 mA
f2(ROC) selected, f(BCLK) = 1 MHz
Flash memory f(BCLK) = 20 MHz, 18 25 mA
main clock, no division
f(BCLK) = 16 MHz, 14 20 mA
main clock, no division
On-chip oscillation, f2(ROC) selected, 2 mA
f(BCLK) = 1 MHz
Flash memory 11 mA
f(BCLK) = 10 MHz, Vcc = 5.0 V
program
Flash memory f(BCLK) = 10 MHz, Vcc = 5.0 V 11 mA
erase
Mask ROM f(BCLK) = 32 kHz, 25 µA
In low-power consumption mode,
Program running on ROM(3)
On-chip oscillation, 50 µA
f2(ROC) selected, f(BCLK) = 1 MHz, In
wait mode
Flash memory f(BCLK) = 32 kHz, 25 µA
In low-power consumption mode,
Program running on RAM(3)
f(BCLK) = 32 kHz, 450 µA
In low-power consumption mode,
Program running on flash memory(3)
On-chip oscillation, f2(ROC) selected, 50 µA
f(BCLK) = 1 MHz, In wait mode
Mask ROM, f(BCLK) = 32 kHz, In wait mode(2), 8 .5 µA
Flash memory Oscillation capacity high
f(BCLK) = 32 kHz, In wait mode(2), 3 µA
Oscillation capacity low
While clock stops, Topr = 25° C 0 .8 3 µA
NOTES:
1. Referenced to VCC = 4.2 to 5.5 V, VSS = 0 V at Topr = -40 to 105 ° C, f(BCLK) = 20MHz / VCC = 4.2 to 5.5 V, VSS = 0V at
Topr = -40 to 125 ° C, f(BCLK) = 16 MHz, unless otherwise specified.
2. With one timer operates, using fC32.
3. This indicates the memory in which the program to be executed exists.
Timing Requirements
VCC = 5V
(Vcc=5V, Vss=0V, at Topr=-40 to 125°C unless otherwise specified)
Topr=-40° C to 105° C 20 ns
tw(H) External Clock Input High ("H") Width
Topr=-40° C to 125° C 25 ns
Topr=-40° C to 105° C 20 ns
tw(L) External Clock Input Low ("L") Width
Topr=-40° C to 125° C 25 ns
Topr=-40° C to 105° C 9 ns
tr External Clock Rise Time
Topr=-40° C to 125° C 15 ns
Topr=-40° C to 105° C 9 ns
tf External Clock Fall Time
Topr=-40° C to 125° C 15 ns
Timing Requirements
VCC = 5V
(VCC=5V, VSS=0V, at Topr=-40 to 125°C unless otherwise specified)
Table 21.89 Timer A Input (External Trigger Input in One-shot Timer Mode)
Standard
Symbol Parameter Unit
Min. M ax .
tc(TA) TAiIN Input Cycle Time 200 ns
tw(TAH) TAiIN Input High ("H") Width 100 ns
tw(TAL) TAiIN Input Low ("L") Width 100 ns
Table 21.90 Timer A Input (External Trigger Input in Pulse Width Modulation Mode)
Standard
Symbol Parameter Unit
Min. M ax .
tw(TAH) TAiIN Input High ("H") Width 100 ns
tw(TAL) TAiIN Input Low ("L") Width 100 ns
Table 21.91 Timer A Input (Counter Increment/decrement Input in Event Counter Mode)
Standard
Symbol Parameter Unit
Min. M ax .
tc(UP) TAiOUT Input Cycle Time 2000 ns
tw(UPH) TAiOUT Input High ("H") Width 1000 ns
tw(UPL) TAiOUT Input Low ("L") Width 1000 ns
tsu(UP-TIN) TAiOUT Input Setup Time 400 ns
th(TIN-UP) TAiOUT Input Hold Time 400 ns
Table 21.92 Timer A Input (Two-phase Pulse Input in Event Counter Mode)
Standard Unit
Symbol Parameter
Min. Max.
tc(TA) TAiIN Input Cycle Time 800 ns
tsu(TAIN-TAOUT) TAiOUT Input Setup Time 200 ns
tsu(TAOUT-TAIN) TAiIN Input Setup Time 200 ns
Timing Requirements
VCC = 5V
(VCC=5V, VSS=0V, at Topr=-40 to 125°C unless otherwise specified)
Timing Requirements
VCC = 5V
(VCC=5V, VSS=0V, at Topr=-40 to 125°C unless otherwise specified)
VCC = 5V
XIN input
tf
tr tw(H) tw(L)
tc
tc(TA)
tw(TAH)
TAiIN input
tw(TAL)
tc(UP)
tw(UPH)
TAiOUT input
tw(UPL)
TAiOUT input
(Counter increment/
decrement input)
TAiIN input
(When count on rising edge)
TAiIN input
tsu(TAIN-TAOUT) tsu(TAIN-TAOUT)
tsu(TAOUT-TAIN)
TAiOUT input
tsu(TAOUT-TAIN)
tc(TB)
tw(TBH)
TBiIN input
tw(TBL)
tc(AD)
tw(ADL)
ADTRG input
VCC = 5V
tc(CK)
tw(CKH)
CLKi
tw(CKL)
th(C–Q)
TxDi
td(C–Q) tsu(D–C)
th(C–D)
RxDi
tw(INL)
INTi input
tw(INH)
VCC = 5V
SDA
tLOW
tR tF
p Sr p
S
SCL
Standard
Symbol Parameter Unit
Min. Typ. Max.
f(ripple) Power supply ripple allowable frequency(VCC) 10 kHz
Vp-p(ripple) Power supply ripple allowabled amplitude (VCC=5V) 0.5 V
voltage
(VCC=3V) 0.3 V
VCC(|DV/DT|) Power supply ripple rising/falling gradient (VCC=5V) 0.3 V/ms
(VCC=3V) 0.3 V/ms
f(ripple) f(ripple)
Power supply ripple allowable frequency
(VCC)
Vp-p(ripple)
Power supply ripple allowable amplitude VCC Vp-p(ripple)
voltage
2. Set the MR0 bit in the TAiMR register(i=0 to 4) to 0 (pulse is not output) to use the timer A to exit stop
mode.
3. When entering wait mode, insert a JMP.B instruction before a WAIT instruction. Do not excute any
instructions which can generate a write to RAM between the JMP.B and WAIT instructions. Disable the
DMA transfers, if a DMA transfer may occur between the JMP.B and WAIT instructions. After the WAIT
instruction, insert at least 4 NOP instructions. When entering wait mode, the instruction queue reads
ahead the instructions following WAIT, and depending on timing, some of these may execute before the
MCU enters wait mode.
4. When entering stop mode, insert a JMP.B instruction immediately after executing an instruction which
sets the CM10 bit in the CM1 register to 1, and then insert at least 4 NOP instructions. When entering
stop mode, the instruction queue reads ahead the instructions following the instruction which sets the
CM10 bit to 1 (all clock stops), and, some of these may execute before the MCU enters stop mode or
before the interrupt routine for returning from stop mode.
5. Wait until the main clock oscillation stabilization time, before switching the CPU clock source to the
main clock.
Similarly, wait until the sub clock oscillates stably before switching the CPU clock source to the sub
clock.
22.3 Protection
Set the PRC2 bit to 1 (write enabled) and then write to any address, and the PRC2 bit will be cleared to 0
(write protected). The registers protected by the PRC2 bit should be changed in the next instruction after
setting the PRC2 bit to 1. Make sure no interrupts or DMA transfers will occur between the instruction in
which the PRC2 bit is set to 1 and the next instruction.
22.4 Interrupts
22.4.1 Reading Address 0000016
Do not read the address 0000016 in a program. When a maskable interrupt request is accepted, the CPU
reads interrupt information (interrupt number and interrupt request priority level) from the address
0000016 during the interrupt sequence. At this time, the IR bit for the accepted interrupt is cleared to 0.
If the address 0000016 is read in a program, the IR bit for the interrupt which has the highest priority
among the enabled interrupts is cleared to 0. This causes a problem that the interrupt is canceled, or an
unexpected interrupt request is generated.
_______
22.4.3 NMI Interrupt
_______ _______
1. The NMI interrupt is invalid after reset. The NMI interrupt becomes effective by setting the PM24 bit in
_______
the PM2 register to “1”. Set the PM24 bit to "1" when a high-level signal ("H") is applied to the NMI pin.
_______ _______
If the PM24 bit is set to "1" when a low-level signal ("L") is applied, NMI interrupt is generated. Once NMI
interrupt is enabled, it will not be disabled unless a reset is applied.
_______
2. The input level of the NMI pin can be read by accessing the P8_5 bit in the P8 register.
_______ _______
3. When selecting NMI function, stop mode cannot be entered into while input on the NMI pin is low. This
_______
is because while input on the NMI pin is low the CM1 register’s CM10 bit is fixed to 0.
_______ _______
4. When selecting NMI function, do not go to wait mode while input on the NMI pin is low. This is because
_______
when input on the NMI pin goes low, the CPU stops but CPU clock remains active; therefore, the current
consumption in the chip does not drop. In this case, normal condition is restored by an interrupt gener-
ated thereafter.
_______ _______
5. When selecting NMI function, the low and high level durations of the input signal to the NMI pin must
each be 2 CPU clock cycles + 300 ns or more.
_______
6. When using the NMI interrupt for exiting stop mode, set the NDDR register to FF16 (disable digital
debounce filter) before entering stop mode.
Change the interrupt generate factor (including a mode change of peripheral function)
Use the MOV instruction to clear the IR bit to 0 (interrupt not requested) (3)
End of change
IR bit: A bit in the interrupt control register for the interrupt whose interrupt generate factor is to
be changed
NOTES:
1.The above settings must be executed individually. Do not execute two or more settings
simultaneously (using one instruction).
2. Use the I flag for the INTi interrupt (i = 0 to 5).
For the interrupts from peripheral functions other than the INTi interrupt, turn off the
peripheral function that is the source of the interrupt in order not to generate an interrupt
request before changing the interrupt generate factor. In this case, if the maskable interrupts
can all be disabled without causing a problem, use the I flag. Otherwise, use the corresponding
bits ILVL2 to ILVL0 for the interrupt whose interrupt generate factor is to be changed.
3. Refer to 22.4.6 Rewrite the Interrupt Control Register for details about the
instructions to use and the notes to be taken for instruction execution.
______
22.4.5 INT Interrupt
1. Either an “L” level of at least tW(INH) or an “H” level of at least tW(INL) width is necessary for the signal
input to pins INT0 through INT5 regardless of the CPU operation clock.
2. If the POL bit in registers INT0IC to INT5IC or bits IFSR7 to IFSR0 in the IFSR register are changed,
the IR bit may inadvertently set to 1 (interrupt requested). Be sure to clear the IR bit to 0 (interrupt not
requested) after changing any of those register bits.
3. When using the INT5 interrupt for exiting stop mode, set the P17DDR register to FF16 (disable digital
debounce filter) before entering stop mode.
(3) When using the I flag to disable an interrupt, refer to the sample program fragments shown below as
you set the I flag. (Refer to (2) for details about rewrite the interrupt control registers in the sample
program fragments.)
Examples 1 through 3 show how to prevent the I flag from being set to 1 (interrupts enabled) before the
interrupt control register is rewrited, due to the internal bus and the instruction queue buffer.
Example 1: Using the NOP instruction to keep the program waiting until the
interrupt control register is modified
INT_SWITCH1:
FCLR I ; Disable interrupts
AND.B #00h, 0055h ;Set the TA0IC register to 0016
NOP ;
NOP
FSET I ; Enable interrupts
Example 2:Using the dummy read to keep the FSET instruction waiting
INT_SWITCH2:
FCLR I ; Disable interrupts
AND.B #00h, 0055h ; Set the TA0IC register to 0016
MOV.W MEM, R0 ; Dummy read
FSET I ; Enable interrupts
22.5 DMAC
22.5.1 Write to DMAE Bit in DMiCON Register
When both of the conditions below are met, follow the steps below.
(a) Conditions
• The DMAE bit is set to 1 again while it remains set (DMAi is in an active state).
• A DMA request may occur simultaneously when the DMAE bit is being written.
(b) Procedure
(1) Write 1 to the DMAE bit and DMAS bit in DMiCON register simultaneously(1).
(2) Make sure that the DMAi is in an initial state(2) in a program.
If the DMAi is not in an initial state, the above steps should be repeated.
NOTES:
1. The DMAS bit remains unchanged even if 1 is written. However, if 0 is written to this bit, it is
set to 0 (DMA not requested). In order to prevent the DMAS bit from being modified to 0, 1
should be written to the DMAS bit when 1 is written to the DMAE bit. In this way the state of the
DMAS bit immediately before being written can be maintained.
Similarly, when writing to the DMAE bit with a read-modify-write instruction, 1 should be written to
the DMAS bit in order to maintain a DMA request which is generated during execution.
2. Read the TCRi register to verify whether the DMAi is in an initial state. If the read value is equal to
a value which was written to the TCRi register before DMA transfer start, the DMAi is in an initial
state. (If a DMA request occurs after writing to the DMAE bit, the value written to the TCRi register
is 1.) If the read value is a value in the middle of transfer, the DMAi is not in an initial state.
22.6 Timers
22.6.1 Timer A
22.6.1.1 Timer A (Timer Mode)
1. The timer remains idle after reset. Set the mode, count source, counter value, etc. using the TAiMR
(i = 0 to 4) register and the TAi register before setting the TAiS bit in the TABSR register to 1 (count
starts).
Always make sure the TAiMR register is modified while the TAiS bit remains 0 (count stops) regard-
less whether after reset or not.
2. While counting is in progress, the counter value can be read out at any time by reading the TAi
register. However, if the TAi register is read at the same time the counter is reloaded, the read value
is always FFFF16. If the TAi register is read after setting a value in it, but before the counter starts
counting, the read value is the one that has been set in the register.
_____
3. If a low-level signal is applied to the SD pin when the IVPCR1 bit in the TB2SC register is set to 1
_____
(three-phase output forcible cutoff by input on SD pin enabled), the TA1OUT, TA2OUT and TA4OUT
pins go to a high-impedance state.
2. While counting is in progress, the counter value can be read out at any time by reading the TAi
register. However, if the TAi register is read at the same time the counter is reloaded, the read value
is always FFFF16 when the timer counter underflows and 000016 when the timer counter overflows.
If the TAi register is read after setting a value in it, but before the counter starts counting, the read
value is the one that has been set in the register.
_____
3. If a low-level signal is applied to the SD pin when the IVPCR1 bit in the TB2SC register is set to 1
_____
(three-phase output forcible cutoff by input on SD pin enabled), the TA1OUT, TA2OUT and TA4OUT
pins go to a high-impedance state.
3. Output in one-shot timer mode synchronizes with a count source internally generated. When the
external trigger has been selected, a maximun delay of one cycle of the count source occurs be-
tween the trigger input to TAiIN pin and output in one-shot timer mode.
4. The IR bit is set to 1 when timer operation mode is set with any of the following procedures:
• Select one-shot timer mode after reset.
• Change an operation mode from timer mode to one-shot timer mode.
• Change an operation mode from event counter mode to one-shot timer mode.
To use the timer Ai interrupt (the IR bit), set the IR bit to 0 after the changes listed above have been
made.
5. When a trigger occurs while the timer is counting, the counter reloads the reload register value, and
continues counting after a second trigger is generated and the counter is decremented once. To
generate a trigger while counting, space more than one cycle of the timer count source from the first
trigger and generate again.
6. When selecting the external trigger for the count start conditions in timer A one-shot timer mode, do
generate an external trigger 300ns before the count value of timer A is set to 000016. The one-shot
timer does not continue counting and may stop.
_____
7. If a low-level signal is applied to the SD pin when the IVPCR1 bit in the TB2SC register is set to 1
_____
(three-phase output forcible cutoff by input on SD pin enabled), the TA1OUT, TA2OUT and TA4OUT
pins go to a high-impedance state.
2. The IR bit is set to 1 when setting a timer operation mode with any of the following procedures:
• Select the PWM mode after reset.
• Change an operation mode from timer mode to PWM mode.
• Change an operation mode from event counter mode to PWM mode.
To use the timer Ai interrupt (interrupt request bit), set the IR bit to 0 by program after the above
listed changes have been made.
3. When setting TAiS register to 0 (count stop) during PWM pulse output, the following action occurs:
• Stop counting.
• When TAiOUT pin is output “H”, output level is set to “L” and the IR bit is set to 1.
• When TAiOUT pin is output “L”, both output level and the IR bit remains unchanged.
_____
4. If a low-level signal is applied to the SD pin when the IVPCR1 bit in the TB2SC register is set to 1
_____
(three-phase output forcible cutoff by input on SD pin enabled), the TA1OUT, TA2OUT and TA4OUT
pins go to a high-impedance state.
22.6.2 Timer B
22.6.2.1 Timer B (Timer Mode)
1. The timer remains idle after reset. Set the mode, count source, counter value, etc. using the TBiMR
(i = 0 to 2) register and TBi register before setting the TBiS bit in the TABSR register to 1 (count
starts).
Always make sure the TBiMR register is modified while the TBiS bit remains 0 (count stops) regard-
less whether after reset or not.
2. The counter value can be read out at any time by reading the TBi register. However, if this register
is read at the same time the counter is reloaded, the read value is always FFFF16. If the TBi register
is read after setting a value in it but before the counter starts counting, the read value is the one that
has been set in the register.
2. The counter value can be read out at any time by reading the TBi register. However, if this register
is read at the same time the counter is reloaded, the read value is always FFFF16. If the TBi register
is read after setting a value in it but before the counter starts counting, the read value is the one that
has been set in the register.
2. The IR bit in TBiIC register (i=0 to 2) goes to 1 (interrupt request), when an effective edge of a
measurement pulse is input or timer Bi is overflowed. The factor of interrupt request can be deter-
mined by use of the MR3 bit in TBiMR register within the interrupt routine.
3. If the source of interrupt cannot be identified by the MR3 bit such as when the measurement pulse
input and a timer overflow occur at the same time, use another timer to count the number of times
timer B has overflowed.
4. To set the MR3 bit to 0 (no overflow), set TBiMR register with setting the TBiS bit to 1 and counting
the next count source after setting the MR3 bit to 1 (overflow).
5. Use the IR bit in TBiIC register to detect only overflows. Use the MR3 bit only to determine the
interrupt factor within the interrupt routine.
6. When a count is started and the first effective edge is input, an undefined value is transferred to the
reload register. At this time, timer Bi interrupt request is not generated.
7. A value of the counter is undefined at the beginning of a count. MR3 may be set to 1 and timer Bi
interrupt request may be generated between a count start and an effective edge input.
8. For pulse width measurement, pulse widths are successively measured. Use program to check
whether the measurement result is an “H” level width or an “L” level width.
22.7 Timer S
22.7.1 Rewrite the G1IR Register
Bits in the G1IR register are not automatically set to 0 (no interrupt requested) even if a requested inter-
rupt is acknowledged. Set each bit to 0 by program after the interrupt requests are verified.
The IC/OC interrupt is generated when any bit in the G1IR register is set to 1 (interrupt requested) after all
the bits are set to 0. If conditions to generate an interrupt are met when the G1IR register holds the value
other than 0016, the IC/OC interrupt request will not be generated. In order to enable an IC/OC interrupt
request again, clear the G1IR register to 0016. Use the following instructions to set each bit in the G1IR
register to 0.
Subject instructions: AND, BCL
Interrupt(1)
No
G1IRi = 1 ?
Yes
No
G1IRj = 1 ?
Yes
No
G1IR = 0 ?
Yes
Interrupt completed
NOTE:
1. Example for the interrupt operation when using the channel i waveform generating interrupt and
channel j time measurement interrupt.
When initializing Timer S, change the ICOCiIC register setting with the request again after setting regis-
ters IOCiIC and G1IR to 0016.
Table 22.1 Uses of IT Bit in the G1BCR0 Register and G1BTRR Register
IT Bit in the G1BCR0 Register G1BTRR Register
03FFF16 to 0FFFE16 or
1 (bit 14 in the base timer overflows)
0BFFF16 to 0FFFE16
The second IC/OC base timer interrupt request is generated because the base timer overflow request is
generated after one fBT1 clock cycle as soon as the base timer is reset.
One of the following conditions must be met in order not to generate the IC/OC base timer interrupt
request twice:
1) When the RST4 bit is set to 1, set the G1BTRR register with a combination other than what is listed in
Table 22.1.
2) Do not reset the base timer by matching the G1BTRR register. Reset the base timer by matching the
G1P00 register. In other words, do not set the RST4 bit to 1 to reset the base timer. Set the RST1 bit in
the G1BCR1 register to 1 (reset the base timer that matches the G1P00 register).
22.8.1.2 Transmission
When an external clock is selected, the conditions must be met while if the CKPOL bit in the UiC0
register is set to 0 (transmit data output at the falling edge and the receive data taken in at the rising
edge of the transfer clock), the external clock is in the high state; if the CKPOL bit in the UiC0 register
is set to 1 (transmit data output at the rising edge and the receive data taken in at the falling edge of the
transfer clock), the external clock is in the low state.
• The TE bit in UiC1 register is set to 1 (transmission enabled)
• The TI bit in UiC1 register is set to 0 (data
_______
present in UiTB register)
_______
• If CTS function is selected, input on the CTSi pin is set to “L”
22.8.1.3 Reception
1. In operating the clock-synchronous serial I/O, operating a transmitter generates a shift clock. Fix
settings for transmission even when using the device only for reception. Dummy data is output to
the outside from the TxDi pin when receiving data.
2. When an internal clock is selected, set the TE bit in the UiC1 register (i = 0 to 2) to 1 (transmission
enabled) and write dummy data to the UiTB register, and the shift clock will thereby be generated.
When an external clock is selected, set the TE bit in the UiC1 register (i = 0 to 2) to 1 and write dummy
data to the UiTB register, and the shift clock will be generated when the external clock is fed to the CLKi
input pin.
3. When successively receiving data, if all bits of the next receive data are prepared in the UARTi
receive register while the RE bit in the UiC1 register (i = 0 to 2) is set to 1 (data present in the UiRB
register), an overrun error occurs and the UiRB register OER bit is set to 1 (overrun error occurred).
In this case, because the content of the UiRB register is undefined, a corrective measure must be
taken by programs on the transmit and receive sides so that the valid data before the overrun error
occurred will be retransmitted. Note that when an overrun error occurred, the SiRIC register IR bit
does not change state.
4. To receive data in succession, set dummy data in the lower-order byte of the UiTB register every
time reception is made.
5. When an external clock is selected, make sure the external clock is in high state if the CKPOL bit is
set to 0, and in low state if the CKPOL bit is set to 1 before the following conditions are met:
• The RE bit in the UiC1 register is set to 1 (reception enabled)
• The TE bit in the UiC1 register is set to 1 (transmission enabled)
• The TI bit in the UiC1 register= 0 (data present in the UiTB register)
2. When the VCUT bit in ADCON1 register is changed from 0 (Vref not connected) to 1 (Vref connected),
start A/D conversion after passing 1 µs or longer.
3. To prevent noise-induced device malfunction or latchup, as well as to reduce conversion errors, insert
capacitors between the AVCC, VREF, and analog input pins (ANi, AN0i, AN2i(i=0 to 7), and AN3i(i=0 to
2)) each and the AVSS pin. Similarly, insert a capacitor between the VCC1 pin and the VSS pin. Figure
22.4 is an example connection of each pin.
4. Make sure the port direction bits for those pins that are used as analog inputs are set to 0 (input mode).
Also, if the TGR bit in the ADCON0 register is set to 1 (external trigger), make sure the port direction bit
___________
for the ADTRG pin is set to 0 (input mode).
5. When using key input interrupts, do not use any of the four AN4 to AN7 pins as analog inputs. (A key
input interrupt request is generated when the A/D input voltage goes low.)
6. The φAD frequency must be 10 MHz or less. Without sample-and-hold function, limit the φAD frequency
to 250kHZ or more. With the sample and hold function, limit the φAD frequency to 1MHZ or more.
7. When changing an A/D operation mode, select analog input pin again in bits CH2 to CH0 in the
ADCON0 register and bits SCAN1 to SCAN0 in the ADCON1 register.
MCU
VCC VCC
VCC AVCC
C4
VSS VREF
C1 C2
AVSS
C3
ANi
8. If the CPU reads the ADi register (i = 0 to 7) at the same time the conversion result is stored in the ADi
register after completion of A/D conversion, an incorrect value may be stored in the ADi register. This
problem occurs when a divide-by-n clock derived from the main clock or a subclock is selected for CPU
clock.
• When operating in one-shot, single-sweep mode, simultaneous sample sweep mode, delayed
trigger mode 0 or delayed trigger mode 1
Check to see that A/D conversion is completed before reading the target ADi register. (Check the
ADIC register’s IR bit to see if A/D conversion is completed.)
• When operating in repeat mode or repeat sweep mode 0 or 1
Use the main clock for CPU clock directly without dividing it.
9. If A/D conversion is forcibly terminated while in progress by setting the ADST bit in the ADCON0
register to 0 (A/D conversion halted), the conversion result of the A/D converter is undefined. The
contents of ADi registers irrelevant to A/D conversion may also become undefined. If while A/D conver-
sion is underway the ADST bit is cleared to 0 in a program, ignore the values of all ADi registers.
10. When setting the ADST bit in the ADCON register to 0 and terminating forcefully by a program in
single sweep conversion mode, A/D delayed trigger mode 0 and A/D delayed trigger mode 1 during
A/D converting operation, the A/D interrupt request may be generated. If this causes a problem, set the
ADST bit to 0 after an interrupt is disabled.
22.10.2 AL Flag
When the arbitration lost is generated and the AL flag in the S10 register is set to 1 (detected), the AL flag
can be cleared to 0 (not detected) by writing a transmit data to the S00 register. The AL flag should be
cleared at the timing when master geneates the start condition to start a new transfer.
(1) There should be a wait time of 3fCAN or longer (see Table 22.2) before the CPU reads the C0STR
register. (See Figure 22.6)
(2) When the CPU polls the C0STR register, the polling period must be 3fCAN or longer. (See Figure
22.7)
fCAN
Updating period of
CAN module
C0STR register ✕ ✕ ✕ ✕ ✕
b8: State_Reset bit
0: CAN operation
mode
1: CAN reset/initial- ✕: When the CAN module’s State_Reset bit updating period matches the CPU’s read
ization mode period, it does not enter reset mode, for the CPU read has the higher priority.
Figure 22.5 When Updating Period of CAN Module Matches Access Period from CPU
Wait time
Updating period of
the CAN module
C0STR register
b8: State_Reset bit
0: CAN operation
mode
1: CAN reset/initial- : Updated without fail in period of 3fCAN
ization mode
C0STR register ✕
b8: State_Reset bit
0: CAN operation
mode ✕: When the CAN module’s State_Reset bit updating period matches the CPU’s read
1: CAN reset/initial- period, it does not enter reset mode, for the CPU read has the higher priority.
ization mode : Updated without fail in period of 4fCAN
Table 22.3 Pin Connections of CAN Transceiver (In case of PCA82C250: Philips product)
Standby mode High-speed mode
Rs pin (Note 1) “H” “L”
CAN communication impossible possible
Connection
M16C/29 M16C/29
PCA82C250 PCA82C250
Note 1: The pin which controls the operation mode of CAN transceiver.
Note 2: Connect to enabled port to control CAN transceiver.
Table 22.4 Pin Connections of CAN Transceiver (In case of PCA82C252: Philips product)
Sleep mode Normal operation mode
_______
STB pin (Note 1) “L” “H”
EN pin (Note 1) “L” “H”
CAN communication impossible possible
Connection
M16C/29 PCA82C252 M16C/29 PCA82C252
Note 1: The pin which controls the operation mode of CAN transceiver.
Note 2: Connect to enabled port to control CAN transceiver.
2. The input threshold voltage of pins differs between programmable input/output ports and peripheral
functions.
Therefore, if any pin is shared by a programmable input/output port and a peripheral function and the
input level at this pin is outside the range of recommended operating conditions VIH and VIL (neither
“high” nor “low”), the input level may be determined differently depending on which side—the program-
mable input/output port or the peripheral function—is currently selected.
3.When the SM32 bit in the S3C register is set to 1, the P32 pin goes to high-impedance state. When the
SM42 bit in the S4C register is set to 1, the P96 pin goes to high-imepdance state.
4. When the INV03 bit in the INVC0 register is 1(three-phase motor control timer output enabled), an "L"
_______ _____
input on the P85 /NMI/SD pin, has the following effect.
•When the TB2SC register IVPCR1 bit is set to 1 (three-phase output forcible cutoff by input on
_____ __ __ ___
SD pin enabled), the U/ U/ V/ V/ W/ W pins go to a high-impedance state.
•When the TB2SC register IVPCR1 bit is set to 0 (three-phase output forcible cutoff by input on
_____ __ __ ___
SD pin disabled), the U/ U/ V/ V/ W/ W pins go to a normal port.
Therefore, the P85 pin can not be used as programmable I/O port when the INV03 bit is set to 1.
_____ _______ _____
When the SD function isn't used, set to 0 (Input) in PD85 and pullup to H in the P85 /NMI/SD pin from
outside.
22.15.4 Low PowerDissipation Mode, On-Chip Oscillator Low Power Dissipation Mode
If the CM05 bit is set to 1 (main clock stop), the following commands must not be executed.
• Program
• Block erase
22.15.9 Interrupts
EW Mode 0
• Any interrupt which has a vector in the variable vector table can be used providing that its vector is
transferred into the RAM area.
_______
• The NMI and watchdog timer interrupts can be used because the FMR0 register and FMR1 register
are initialized when one of those interrupts occurs. The jump addresses for those interrupt service
routines should be set in the fixed vector table.
_______
Because the rewrite operation is halted when a NMI or watchdog timer interrupt occurs, the rewrite
program must be executed again after exiting the interrupt service routine.
• The address match interrupt cannot be used because the flash memory’s internal data is referenced.
EW Mode 1
• Make sure that any interrupt which has a vector in the variable vector table or address match inter-
rupt will not be accepted during the auto program period or auto erase period with erase-suspend
function disabled.
_______
• The NMI interrupt can be used because the FMR0 register and FMR1 register are initialized when
this interrupt occurs. The jump address for the interrupt service routine should be set in the fixed
vector table.
_______
Because the rewrite operation is halted when a NMI interrupt occurs, the rewrite program must be
executed again after exiting the interrupt service routine.
22.15.15 Flash Memory Version Electrical Characteristics 10,000 E/W cycle products (
Normal: U7, U9; T-ver./V-ver.: U7)
When Block A or B E/W cycles exceed 100, set the FMR17 bit in the FMR1 register to 1 (1 wait) to select
one wait state per block access for products U7 and U9. When the FMR17 bit is set to 1, one wait state is
inserted per access to Block A or B - regardless of the value of the PM17 bit. Wait state insertion during
access to all other blocks, as well as to internal RAM, is controlled by the PM17 bit - regardless of the
setting of the FMR17 bit.
To use the limited number of erasure efficiently, write to unused address within the block instead of
rewite. Erase block only after all possible address are used. For example, an 8-word program can be
written 128 times before erase becomes necessary.
Maintaining an equal number of erasure between Block A and B will also improve efficiency.
We recommend keeping track of the number of times erasure is used.
____________
(1) Apply an "L" signal to the RESET pin and the CNVSS pin.
(2) Bring VCC to more than 2.7V, and wait at least 2 msec. (Internal power supply stable waiting time)
(3) Apply an "H" signal to the CNVSS pin.
____________
(4) Apply an "H" signal to the RESET pin.
When the CNVSS pin is “H” and RESET pin is “L”, P67 pin is connected to the pull-up resister.
22.16 Noise
Connect a bypass capacitor (approximately 0.1µF) across the VCC and VSS pins using the shortest and
thicker possible wiring. Figure 22.8 shows the bypass capacitor connection.
M16C/29 Group
VSS VCC
Bypass Capacitor
HD
*1
D
NOTE)
1. *2"
2.
INCLUDE TRIM OFFSET.
p
HE
E
Reference
*2
c1
c
Symbol
Min Nom Max
D 9.9 10.0 10.1
E 9.9 10.0 10.1
Terminal cross section
A
ZE
c
A
c1 0.125
0° 8°
e 0.5
A1
L
L1 x 0.08
y 0.08
Detail F
ZD 1.25
ZE 1.25
L 0.35 0.5 0.65
L1 1.0
HD
*1
D
41
NOTE)
1. DIMENSIONS "*1" AND "*2"
0 2. DIMENSION "*3" DOES NOT
INCLUDE TRIM OFFSET.
1
c1
HE
E
*2
c1 0.125
0° 10°
e 0.5
A1
L
L1 x 0.08
y 0.08
Detail F ZD 1.25
ZE 1.25
L 0.3 0.5 0.7
L1 1.0
NOTE:
1. Since the M16C/28 group uses the common emulator used in the M16C/29 group, all the functions are available for
M16C/28. When evaluating M16C/28 group, do not access to the SFR which is not built-in the M16C/28 gorup.
Refere to hardware manual for details and electrical characteristics.
Appendix 2.2 Difference between M16C/28 and M16C/29 Group (T-ver./V-ver.) (1)
Item Description M16C/28(T-ver./V-ver.) M16C/29(T-ver./V-ver.)
NOTE:
1. Since the M16C/28 group uses the common emulator used in the M16C/29 group, all the functions are available for
M16C/28. When evaluating M16C/28 group, do not access to the SFR which is not built-in the M16C/28 gorup.
Refere to hardware manual for details and electrical characteristics.
Register Index
A DM0IC 76
DM0SL 93
AD0 to AD7 226
DM1CON 94
ADCON0 to ADCON2 224
DM1IC 76
ADIC 76
DM1SL 94
ADSTAT0 226
DTT 129
ADTRGCON 225
AIER 88 F
B FMR0 341
FMR1 341
BCNIC 76
FMR4 342
BTIC 76
G
C
G1BCR0 142
C01ERRIC 76
G1BCR1 143
C01WKIC 76
G1BT 142
C0AFS 299
G1BTRR 144
C0CONR 297
G1DV 143
C0CTLR 293
G1FE 148
C0ICR 296
G1FS 148
C0IDR 296
G1IE0 150
C0MCTLj 292
G1IE1 150
C0RECIC 76
G1IR 149
C0RECR 298
G1PO0 to G1PO7 147
C0SSTR 295
G1POCR0 to G1POCR7 146
C0STR 294
G1TM0 to G1TM7 146
C0TECR 298
G1TMCR0 to G1TMCR7 145
C0TRMIC 76
G1TPR6 to G1TPR7 145
C0TSR 299
CCLKR 53 I
CM0 49
ICOC0IC 76
CM1 50
ICOC1IC 76
CM2 51
ICTB2 129, 130
CPSRF 105, 118
IDB0 129
CRCD 314
IDB1 129
CRCIN 314
IFSR 77, 85
CRCMR 314
IFSR2A 77
CRCSAR 314
IICIC 76
D INT0IC to INT2IC 76
INT3IC 76
D4INT 40
INT4IC 76
DAR0 95
INT5IC 76
DAR1 95
INVC0 127
DM0CON 94
INVC1 128
K S4BRG 218
S4C 218
KUPIC 76
S4D0 262
N S4IC 76
S4TRR 218
NDDR 327
SAR0 95
O SAR1 95
SCLDAIC 76
ONSF 105
T
P
TA0 to TA4 104
P0 to P3 324
TA0IC to TA4IC 76
P17DDR 327
TA0MR to TA4MR 103
P6 to P10 324
TA11 130
PACR 177, 326
TA1MR 133
PCLKR 52
TA2 130
PCR 326
TA21 130
PD0 to PD3 323
TA2MR 133
PD6 to PD10 323
TA4 130
PDRF 137
TA41 130
PFCR 139
TA4MR 133
PLC0 53
TABSR 104, 118, 132
PM0 44
TB0 to TB2 118
PM1 44
TB0IC to TB2IC 76
PM2 45, 52
TB0MR to TB2MR 117
PRCR 69
TB2 132
PUR0 to PUR2 325
TB2MR 133
R TB2SC 131, 227
TCR0 95
RMAD0 88
TCR1 95
RMAD1 88
TPRC 139
ROCR 50
TRGSR 105, 132
ROMCP 336
U
S
U0BRG to U2BRG 174
S00 258
U0C0 to U2C0 176
S0D0 257
U0C1 to U2C1 177
S0RIC to S2RIC 76
U0MR to U2MR 175
S0TIC to S2TIC 76
U0RB to U2RB 174
S10 260
U0TB to U2TB 174
S1D0 259
U2SMR 178
S20 258
U2SMR2 178
S2D0 263
U2SMR3 179
S31C 76
U2SMR4 179
S3BRG 218
UCON 176
S3C 218
UDF 104
S3D0 261
S3TRR 218
V
VCR1 39
VCR2 39
W
WDC 90
WDTS 90
C-1
REVISION HISTORY M16C/29 Hardware Manual
C-2
REVISION HISTORY M16C/29 Hardware Manual
C-4
REVISION HISTORY M16C/29 Hardware Manual
C-5
REVISION HISTORY M16C/29 Hardware Manual
C-6
REVISION HISTORY M16C/29 Hardware Manual
C-7
REVISION HISTORY M16C/29 Hardware Manual
C-8
REVISION HISTORY M16C/29 Hardware Manual
C-9
REVISION HISTORY M16C/29 Hardware Manual
C-11
REVISION HISTORY M16C/29 Hardware Manual
C-12
REVISION HISTORY M16C/29 Hardware Manual
C-13
REVISION HISTORY M16C/29 Hardware Manual
C-14
REVISION HISTORY M16C/29 Hardware Manual
C-15
RENESAS 16-BIT SINGLE-CHIP MICROCOMPUTER
HARDWARE MANUAL
M16C/29 Group