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 Technology Corp. without notice. Please review the latest information published
by Renesas Technology Corp. through various means, including the Renesas Technology
Corp. website (http://www.renesas.com).
Rev.2.00
Revision Date: Aug 27, 2008
www.renesas.com
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.
1. Handling of Unused Pins
Handle unused pins in accord with the directions given under Handling of Unused Pins in the
manual.
The input pins of CMOS products are generally in the high-impedance state. In operation
with an unused pin in the open-circuit state, extra electromagnetic noise is induced in the
vicinity of LSI, an associated shoot-through current flows internally, and malfunctions occur
due to the false recognition of the pin state as an input signal become possible. Unused
pins should be handled as described under Handling of Unused Pins in the manual.
2. Processing at Power-on
The state of the product is undefined at the moment when power is supplied.
The states of internal circuits in the LSI are indeterminate and the states of register
settings and pins are undefined at the moment when power is supplied.
In a finished product where the reset signal is applied to the external reset pin, the states
of pins are not guaranteed from the moment when power is supplied until the reset
process is completed.
In a similar way, the states of pins in a product that is reset by an on-chip power-on reset
function are not guaranteed from the moment when power is supplied until the power
reaches the level at which resetting has been specified.
3. Prohibition of Access to Reserved Addresses
Access to reserved addresses is prohibited.
The reserved addresses are provided for the possible future expansion of functions. Do
not access these addresses; the correct operation of LSI is not guaranteed if they are
accessed.
4. Clock Signals
After applying a reset, only release the reset line after the operating clock signal has become
stable. When switching the clock signal during program execution, wait until the target clock
signal has stabilized.
When the clock signal is generated with an external resonator (or from an external
oscillator) during a reset, ensure that the reset line is only released after full stabilization of
the clock signal. Moreover, when switching to a clock signal produced with an external
resonator (or by an external oscillator) while program execution is in progress, wait until
the target clock signal is stable.
5. Differences between Products
Before changing from one product to another, i.e. to one with a different part number, confirm
that the change will not lead to problems.
The characteristics of MPU/MCU in the same group but having different part numbers may
differ because of the differences in internal memory capacity and layout pattern. When
changing to products of different part numbers, implement a system-evaluation test for
each of the products.
How to Use This Manual
1.Purpose and Target Readers
This manual is designed to provide the user with an understanding of the hardware functions and electrical
characteristics of the MCU. It is intended for users designing application systems incorporating the MCU. A basic
knowledge of electric circuits, logical circuits, and MCUs is necessary in order to use this manual.
The manual comprises an overview of the product; descriptions of the CPU, system control functions, peripheral
functions, and electrical characteristics; and usage notes.
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 R8C/20 Group and R8C/21 Group. Make sure to refer to the latest versions of
these documents. The newest versions of the documents li sted may be obtained fro m the Renesas Technology Web
site.
memory maps, peripheral function
specifications, electrical characteristics, timing
charts) and operation description
Note: Refer to the application notes for details on
using peripheral functions.
Software manual Description of CPU instruction setR8C/Tiny Series
Application noteInformation on using peripheral functions and
application examples
Sample programs
Information on writing programs in assembly
language and C
Renesas
technical update
Product specifications, updates on documents,
etc.
R8C/20 Group,
R8C/21 Group
Hardware Manual
Software Manual
Available from Renesas
Technology Web site.
REJ03B0120
This hardware
manual
REJ09B0001
2.Notation of Numbers and Symbols
The notation conventions for register names, bit names, numbers, and symbols used in this manual are described
below.
(1)Register Names, Bit Names, and Pin Names
Registers, bits, and pins are referred to in the text by symbols. The symbol is accompanied by the word
“register,” “bit,” or “pin” to distinguish the three categories.
Examples the PM03 bit in the PM0 register
P3_5 pin, VCC pin
(2)Notation of Numbers
The indication “b” is appended to numeric valu es given i n binary format. However, nothing is appended to the
values of single bits. The indication “h” is appended to numeric values given in hexadecimal format. Nothing
is appended to numeric values given in decimal format.
Examples Binary: 11b
Hexadecimal: EFA0h
Decimal: 1234
3.Register Notation
The symbols and terms used in register diagrams are described below.
XXX Register
b7 b6 b5 b4 b3 b2 b1 b0
0
XXX0
XXX1
(b2)
(b3)
XXX4
XXX5
XXX6
XXX7
*1
SymbolAddressAfter Reset
XXXXXX00h
Bit NameBit Symbol
XXX bits
Nothing is assigned. If necessary, set to 0.
When read, the content is undefined.
Reserved bits
XXX bits
XXX bit
b1 b0
1 0: XXX
0 1: XXX
1 0: Do not set.
1 1: XXX
Set to 0.
Function varies according to the operating
mode.
0: XXX
1: XXX
Function
RW
RW
RW
RW
RW
WO
RW
RO
*2
*3
*4
*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
AbbreviationFull Form
ACIAAsynchronous Communication Interface Adapter
bpsbits per second
CRCCyclic Redundancy Check
DMADirect Memory Access
DMACDirect Memory Access Controller
GSMGlobal System for Mobile Communications
Hi-ZHigh Impedance
IEBusInter Equipment Bus
I/OInput / Output
IrDAInfrared Data Association
LSBLeast Significant Bit
MSBMost Significant Bit
NCNon-Connect
PLLPhase Locked Loop
PWMPulse Width Modulation
SIMSubscriber Identity Module
UARTUniversal Asynchronous Receiver / Transmitter
VCOVoltage Controlled Oscillator
All trademarks and registered trademarks are the property of their respective owners.All trademarks and registered trademarks are the property of their respective owners.
Table of Contents
SFR Page Reference ........................................................................................................................... B - 1
1.4Product Information .................................................................................................................................. 5
2.8.1Carry Flag (C) ..................................................................................................................................... 11
2.8.2Debug Flag (D) ................................................................................................................................... 11
2.8.3Zero Flag (Z) ....................................................................................................................................... 11
2.8.4Sign Flag (S) ....................................................................................................................................... 11
2.8.5Register Bank Select Flag (B) ............................................................................................................ 11
2.8.6Overflow Flag (O) .............................................................................................................................. 11
2.8.7Interrupt Enable Flag (I) ................................................................... .................................................. 12
2.8.8Stack Pointer Select Flag (U) .............................................................................................................. 12
2.8.10Reserved Bit ................................................................ ........................................................................ 12
3.1R8C/20 Group ......................................................................................................................................... 13
3.2R8C/21 Group ......................................................................................................................................... 14
4.Special Function Registers (SFRs) ............................................................................................... 15
5.1.1When Power Supply is Stable .................................................................... ......................................... 24
5.1.2Power On ............................................................................................................................................ 24
5.2Power-On Reset Function ....................................................................................................................... 26
6.1VCC Input Voltage .................................................................................................................................. 34
10.4Power Control .......................................................................................................................................... 74
12.1.1Types of Interrupts .............................................................................................................................. 87
12.4Address Match Interrupt ........................... ............................................................................................. 106
12.5Timer RD Interrupt, Clock Synchronous Serial I/O with Chip Select Interrupts and I
2
C bus Interface
Interrupts (Interrupts with Multiple Interrupt Request Sources) ........................................................... 108
12.6Notes on Interrupts ................................................................................................................................ 110
14.1Timer RA ............................................................................................................................................... 120
14.1.5Pulse Period Measurement Mode ..................................................................................................... 133
14.1.6Notes on Timer RA ........................................................................................................................... 136
14.3.12 Notes on Timer RD ................................................................................................................... ........ 251
14.4Timer RE .................................................................................................................................... ........... 257
14.4.2Notes on Timer RE ........................................................................................................................... 264
15.1Clock Synchronous Serial I/O Mode .............. ....................................................................................... 271
15.1.1Polarity Select Function .................................................................................................................... 274
15.1.2LSB First/MSB First Select Function ............................................................................................... 274
15.3Notes on Serial Interface ....................................................................................................................... 281
16.Cloc k Synchronous Serial Interface ............................................................................................ 282
16.2.4Communicatio n Modes and Pin Functions ....................................................................................... 296
16.2.5Clock Synchronous Communication Mode ...................................................................................... 297
16.2.6Operation in 4-Wire Bus Communication Mode .............................................................................. 304
16.2.7SCS
Pin Control and Arbitration ...................................................................................................... 310
16.2.8Notes on Clock Synchronous Serial I/O with Chip Select ............................................................... 311
16.3I
2
C Bus Interface ................................................................................................................................... 312
17.6Notes on Hardware LIN ................................................................................................................ ........ 359
18.3S ample and Hold .................................................... .................................. ............................................. 370
19.4.5Full Status Check .............................................................................................................................. 398
19.5Standard Serial I/O Mode ...................................................................................................................... 400
19.5.1ID Code Check Function .................................................................................................................. 400
21.2Notes on Interrupts ................................................................................................................................ 429
21.2.5Changing Interrupt Control Register Contents ................................................................................. 431
21.3Notes on Timers ......................................................................................................................... ........... 432
21.3.1Notes on Timer RA ........................................................................................................................... 432
21.3.2Notes on Timer RB ........................................................................................................................... 433
21.3.3Notes on Timer RD ........................................................................................................................... 437
21.3.4Notes on Timer RE ........................................................................................................................... 443
21.4Notes on Serial Interface ....................................................................................................................... 444
21.5Clock Synchronous Serial Interface ...................................................................................................... 445
21.5.1Notes on Clock Synchronous Serial I/O with Chip Select ............................................................... 445
21.5.2Notes on I
2
C Bus Interface ............................................................................................................... 445
21.6Notes on Hardware LIN ................................................................................................................ ........ 446
21.7Notes on A/D Converter ........................................................................................................................ 447
A - 5
21.8Notes on Flash Memory ........................................................................................................................ 448
21.9Notes on Noise ...................................................................................................................................... 451
21.9.1Inserting a Bypass Capacitor between VCC and VSS Pins as a Countermeasure against Noise and
Appendix 2. Connection Examples between Serial Writer and On-Chip Debugging Emulator ............ 455
Appendix 3. Example of Oscillation Evaluation Circuit ......................................................................... 456
Index ..................................................................................................................................................... 457
SS Control Register H/IIC Bus Contr ol Regis ter 1
00B9h
SS Control Register L/IIC Bus Control Register 2
00BAh SS Mode Register/IIC Bus Mode Register 1SSMR/ICMR
00BBh SS Enable Register/IIC Bus Interrupt Enable
Register
00BCh SS Status Register/IIC Bus Status RegisterSSSR/ICSR
00BDh SS Mode Register 2/Slave Address RegisterSSMR2/SAR
00BEh SS Transmit Data Register/IIC Bus Transmit
Data Register
00BFh SS Receive Data Register/IIC Bus Receive
Data Register
RegisterSymbolPage
SSCRH/ICCR1
SSCRL/ICCR2
SSER/ICIER
SSTDR/ICDRT
SSRDR/
ICDRR
NOTE:
1. Blank columns are all reserved space. No access is allowed.
A/D Control Register 1ADCON1363, 366, 369
00D8h
00D9h
00DAh
00DBh
00DCh
00DDh
00DEh
00DFh
00E0h
Port P0 RegisterP048
00E1h
Port P1 RegisterP148
00E2h
Port P0 Direction RegisterPD048
00E3h
Port P1 Direction RegisterPD148
00E4h
Port P2 RegisterP248
00E5h
Port P3 RegisterP348
00E6h
Port P2 Direction RegisterPD248
00E7h
Port P3 Direction RegisterPD348
00E8h
Port P4 RegisterP448
00E9h
00EAh
Port P4 Direction RegisterPD448
00EBh
00ECh
Port P6 RegisterP648
00EDh
00EEh
Port P6 Direction RegisterPD648
00EFh
00F0h
00F1h
00F2h
00F3h
00F4h
00F5h
UART1 Function Select RegisterU1SR270
00F6h
00F7h
00F8h Port Mode RegisterPMR
00F9h External Input Enable RegisterINTEN
00FAh INT Input Filter Select RegisterINTF
00FBh Key Input Enable RegisterKIEN
00FCh Pull-Up Control Register 0PUR0
00FDh Pull-Up Control Register 1PUR1
00FEh
00FFh
RegisterSymbolPage
49, 270, 291,
321
101
102
105
49
49
B - 2
Address
0100h Timer RA Control RegisterTRACR
0101h Timer RA I/O Control RegisterTRAIOC
0102h Timer RA Mode RegisterTRAMR
0103h Timer RA Prescaler RegisterTRAPRE
0104h Timer RA RegisterTRA
0105h
0106h LIN Control RegisterLINCR
0107h LIN Status RegisterLINST
0108h Timer RB Control RegisterTRBCR
0109h Timer RB One-Shot Control RegisterTRBOCR
013Dh Timer RD Output Control RegisterTRDOCR
013Eh Timer RD Digital Filter Function Select
Register 0
013Fh Timer RD Digital Filter Function Select
Register 1
RegisterSymbolPage
TRDDF0
TRDDF1
NOTE:
1. Blank columns are all reserved space. No access is allowed.
121
121, 124, 127,
129, 131, 134
122
122
123
347
348
138
138
139, 141, 145,
148, 153
139
140
140
140
260
260
261
261
262
172, 186, 202,
215, 225, 239
172, 186, 203,
216, 226, 240
173, 187, 203
174, 188, 204,
216, 227, 240
189, 205, 217,
228, 241
189, 205, 217,
228, 241
190, 206, 242
175
175
Address
0140h Timer RD Control Register 0TRDCR0
0141h Timer RD I/O Control Register A0TRDIORA0
0142h Timer RD I/O Control Register C0TRDIORC0
0143h Timer RD Status Register 0TRDSR0
0144h Timer RD Interrupt Enable Register 0TRDIER0
0145h Timer RD PWM Mode Output Level Control
Register 0
0146h Timer RD Counter 0TRD0
0148h Timer RD General Register A0TRDGRA0
014Ah Timer RD General Register B0TRDGRB0
014Ch Timer RD General Register C0TRDGRC0
014Eh Timer RD General Register D0TRDGRD0
0150h Timer RD Control Register 1TRDCR1
0151h Timer RD I/O Control Register A1TRDIORA1
0152h Timer RD I/O Control Register C1TRDIORC1
0153h Timer RD Status Register 1TRDSR1
0154h Timer RD Interrupt Enable Register 1TRDIER1
0155h Timer RD PWM Mode Output Level Control
Register 1
0156h Timer RD Counter 1TRD1
0158h Timer RD General Register A1TRDGRA1
015Ah Timer RD General Register B1TRDGRB1
015Ch Timer RD General Register C1TRDGRC1
015Eh Timer RD General Register D1TRDGRD1
01B0h
01B1h
01B2h
01B3h Flash Memory Co ntrol Register 4FMR4
01B4h
01B5h Flash Memory Co ntrol Register 1FMR1
01B6h
01B7h Flash Memory Co ntrol Register 0FMR0
01B8h
01B9h
01BAh
01BBh
FFFFh Option Function Select RegisterOFS
RegisterSymbolPage
TRDPOCR0
TRDPOCR1
176, 191, 206,
218, 229, 243
177, 192
178, 193
179, 194, 207,
219, 230, 244
180, 195, 208,
220, 231, 245
209
180, 195, 209,
220, 232, 2450147h
181, 196, 210,
221, 232, 2460149h
181, 196, 210,
221, 232, 246014Bh
181, 196, 210,
221, 246014Dh
181, 196, 210,
221, 232, 246014Fh
176, 191, 206,
229
177, 192
178, 193
179, 194, 207,
219, 230, 244
180, 195, 208,
220, 231, 245
209
180, 195, 209,
2320157h
181, 196, 210,
221, 232, 2460159h
181, 196, 210,
221, 232, 246015Bh
181, 196, 210,
221, 232, 246015Dh ,
181, 196, 210,
221, 232, 246015Fh
388
387
386
23, 114, 381
B - 3
R8C/20 Group, R8C/21 Group
REJ09B0250-0200
RENESAS MCU
Aug 27, 2008
1.Overview
This MCU is built using the high-performance silicon gate CMOS process using the R8C CPU core and is packaged
in a 48-pin plastic molded LQFP. This MCU operates using sophisticated instructions featuring a high level of
instruction efficiency. With 1 Mbyte of address space, it is capable of executing instructions at high speed. This
Furthermore, the data flash (1 KB x 2 blocks) is embedded in the R8C/21 Group.
The difference between R8C/20 and R8C/21 Groups is only the existence of the data flash. Their peripheral functi ons
are the same.
1.1Applications
Automotive, etc.
Rev.2.00
Rev.2.00 Aug 27, 2008Page 1 of 458
REJ09B0250-0200
R8C/20 Group, R8C/21 Group 1. Overview
1.2Performance Overview
Table 1.1 outlines the Functions and Specifications for R8C/20 Group and Table 1.2 outlines the Functions and
Specifications for R8C/21 Group.
Table 1.1Functions and Specifications for R8C/20 Group
ItemSpecification
CPUNumber of fundamental instructions 89 instructions
Minimum instruction execution time 50 ns (f(XIN) = 20 MHz, VCC = 3.0 to 5.5 V)
100 ns (f(XIN) = 10 MHz, VCC = 2.7 to 5.5 V)
Operating modeSingle-chip
Address space1 Mbyte
Memory capacityRefer to Table 1.3 Product Information for R8C/20 Group
Peripheral
Function
Electric
Characteristics
Flash Memory Programming and erasure voltageVCC = 2.7 to 5.5 V
Operating Ambient Temperature-40 to 85°C
Package48-pin mold-plastic LQFP
NOTES:
1. When using options, be sure to inquire about the specification .
2
2. I
C bus is a registered trademark of Koninklijke Philips Electronics N.V.
1. Do not use addresses 20000h to 23FFFh because these area s are used for the emulator debu gger .
Refer to 23. Notes on Emulator Debugger.
version
Part numberR 5 F 21 20 6 J XXX FP
Package type:
FP: PLQP0048KB-A
(0.5 mm pin-pitch, 7 mm square body)
ROM number
Classification
J: Operating ambient temperature -40°C to 85°C (J version)
K: Operating ambient temperature -40°C to 125°C (K version)
ROM capacity
6: 32 KB
7: 48 KB
8: 64 KB
A: 96 KB
C: 128 KB
R8C/20 Group
R8C/2x Series
Memory type
F: Flash memory version
Renesas MCU
Renesas semiconductors
Figure 1.2Type Number, Memory Size, and Package of R8C/20 Group
Rev.2.00 Aug 27, 2008Page 5 of 458
REJ09B0250-0200
R8C/20 Group, R8C/21 Group 1. Overview
Table 1.4Product Information for R8C/21 GroupCurrent of Aug. 2008
Type No.
ROM Capacity
Program ROM
Data Flash
RAM CapacityPackage T ypeRemarks
R5F21216JFP32 Kbytes1 Kbyte X 22 KbytesPLQP0048KB-A J version Flash
R5F21217JFP48 Kbytes1 Kbyte X 22.5 KbytesPLQP0048KB-A
R5F21218JFP64 Kbytes1 Kbyte X 23 KbytesPLQP0048KB-A
memory
version
R5F2121AJFP96 Kbytes1 Kbyte X 25 KbytesPLQP0048KB-A
R5F2121CJFP
128 Kbytes
(1)
1 Kbyte X 26 KbytesPLQP0048KB-A
R5F21216KFP32 Kbytes1 Kbyte X 22 KbytesPLQP0048KB-A K version
R5F21217KFP48 Kbytes1 Kbyte X 22.5 KbytesPLQP0048KB-A
R5F21218KFP64 Kbytes1 Kbyte X 23 KbytesPLQP0048KB-A
R5F2121AKFP96 Kbytes1 Kbyte X 25 KbytesPLQP0048KB-A
R5F2121CKFP
128 Kbytes
(1)
1 Kbyte X 26 KbytesPLQP0048KB-A
NOTE:
1. Do not use addresses 20000h to 23FFFh because these area s are used for the emulator debu gger .
Refer to 23. Notes on Emulator Debugger.
Part numberR 5 F 21 21 6 J XXX FP
Package type:
FP: PLQP0048KB-A
(0.5 mm pin-pitch, 7 mm square body)
ROM number
Classification
J: Operating ambient temperature -40°C to 85°C (J version)
K: Operating ambient temperature -40°C to 125°C (K version)
ROM capacity
6: 32 KB
7: 48 KB
8: 64 KB
A: 96 KB
C: 128 KB
R8C/21 Group
R8C/2x Series
Memory type
F: Flash memory version
Renesas MCU
Renesas semiconductors
Figure 1.3Type Number, Memory Size, and Package of R8C/21 Group
Rev.2.00 Aug 27, 2008Page 6 of 458
REJ09B0250-0200
2. Can be assigned to the pin in parentheses by a program.
3. Confirm the pin 1 position on the package by referring to the package dimensions.
Figure 1.4Pin Assignments (Top View)
P4_7/XOUT
(1)
P2_7/TRDIOD1
Package: PLQP0048KB-A
0.5 mm pin pitch, 7 mm square body
Rev.2.00 Aug 27, 2008Page 7 of 458
REJ09B0250-0200
R8C/20 Group, R8C/21 Group 1. Overview
1.6Pin Functions
Table 1.5 lists the Pin Functions and Table 1.6 lists the Pin Name Information by Pin Number.
Table 1.5Pin Functions
TypeSymbolI/O TypeDescription
Power Supply InputVCC
VSS
Analog Power Supply
Input
Reset InputRESET
MODEMODEIConnect this pin to VCC via a resistor.
XIN Clock InputXINIThese pins are provided for the XIN clock generation
XIN Clock OutputXOUTO
Interrupt InputINT0 to INT3IINT interrupt input pins.
INT
Key Input InterruptKI0
Timer RATRAIOI/OTimer RA I/O pin.
Timer RETREOODivided clock output pin.
Serial InterfaceCLK0I/OTransfer clock I/O pin.
2
C Bus Interface
I
Clock Synchronous
Serial I/O with Chip
Select
Reference Voltage Input VREFIReference voltage input pin to A/D converter.
A/D ConverterAN0 to AN11IAnalog input pins to A/D converter.
I/O PortP0_0 to P0_7,
Input PortP4_2, P4_6, P4_7IInput only ports.
A VCC, AVSSIApplies the power supply for the A/D converter. Connect
P1_0 to P1_7,
P2_0 to P2_7,
P3_0, P3_1,
P3_3 to P3_5, P3_7,
P4_3 to P4_5,
P6_0 to P6_7
I: InputO: OutputI/O: Input and output
IApply 2.7 V to 5.5 V to the VCC pin. Apply 0 V to the
VSS pin.
a capacitor between A VCC and AVSS.
IInput “L” on this pin resets the MCU.
circuit I/O. Connect a ceramic resonator or a crystal
oscillator between the XIN and XOUT pins. To use an
externally derived clock, input it to the XIN pin and leave
the XOUT pin open.
Timer RD input pins.
INT0
Timer RA input pins.
INT1
I/OTimer RD I/O ports.
I/OChip-select signal I/O pin.
I/OCMOS I/O ports. Each port contains an input/output
select direction register, allowing each pin in that port to
be directed for input or output individually.
Any port set to input can select whether to use a pull-up
resistor or not by a program.
Rev.2.00 Aug 27, 2008Page 8 of 458
REJ09B0250-0200
1. Can be assigned to the pin in parentheses by a program.
Clock Synchronous
Serial I/O
with Chip Select
SCS
2
I
C Bus
Interface
SDA
A/D
Converter
AN1 1
AN10
AN9
AN8
Rev.2.00 Aug 27, 2008Page 9 of 458
REJ09B0250-0200
R8C/20 Group, R8C/21 Group 2. Central Processing Unit (CPU)
2.Central Processing Unit (CPU)
Figure 2.1 shows the CPU Registers. The CPU contains 13 registers. Of these, R0, R1, R2, R3, A0, A1, and FB
comprise a register bank. Two sets of register banks are provided.
b31
R2
R3
b15b8b7
R0H (high-order of R0)
R0 L (low -ord er o f R0 )
R1H (high-order of R1) R1L (low-order of R1)
R2
R3
A0
A1
FB
b15b19
INTBH
The 4-high order bits of INTB are INTBH and
the 16-low order bits of INTB are INTBL.
b19
INTBL
PC
b15
USP
ISP
SB
b0
Data registers
Address registers
Frame base registers
b0
Interrupt table register
b0
Program counter
b0
User stack pointer
Interrupt stack pointer
Static base register
(1)
(1)
(1)
b15
IPL
NOTE:
1. A register bank comprises these registers. Two sets of register banks are provided.
Figure 2.1C PU Registers
b15
b0
FLG
b8
b7
b0
C
DZSBOIU
Flag register
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
Rev.2.00 Aug 27, 2008Page 10 of 458
REJ09B0250-0200
R8C/20 Group, R8C/21 Group 2. Central Processing Unit (CPU)
2.1Data Registers (R0, R1, R2 and R3)
R0 is a 16-bit register for transfer, arithmetic, and logic operations. The same applies to R1 to R3.
R0 can be split into high-order bit (R0H) and low-order bit (R0L) to be used separately as 8-bit data registers. The
same applies to R1H and R1L as R0H and R0L. R2 can be combined with R0 to be used as a 32-bit data register
(R2R0). The same applies R3R1 as R2R0.
2.2Address Registers (A0 and A1)
A0 is a 16-bit register for address register indirect addressing and address register relative addressing. They also
are used for transfer, arithmetic and logic operations. The same applies to A1 as A0.
A1 can be combined with A0 to be used a 32-bit address register (A1A0).
2.3Frame Base Register (FB)
FB is a 16-bit register for FB relative addressing.
2.4Interrupt Table Register (INTB)
INTB, a 20-bit register, indicates the start address of an interrupt vector table.
2.5Program Counter (PC)
PC, 20 bits wide, indicates the address of an instruction to be executed.
2.6User Stack Pointer (USP) and Interrupt Stack Pointer (ISP)
The stack pointer (SP), USP and ISP, are 16 bits wide each.
The U flag of FLG is used to switch between USP and ISP.
2.7Static Base Register (SB)
SB is a 16-bit register for SB relative addressing.
2.8Flag Register (FLG)
FLG is a 11-bit register indicating the CPU status.
2.8.1Carry Flag (C)
The C flag retains a carry, borrow, or shift-out bit that has occurred in the arithmetic and logic unit.
2.8.2Debug Flag (D)
The D flag is for debug only. Set to 0.
2.8.3Zero Flag (Z)
The Z flag is set to 1 when an arithmetic operation resulted in 0; otherwise, 0.
2.8.4Sign Flag (S)
The S flag is set to 1 when an arithmetic operation resulted in a negative value; otherwise, 0.
2.8.5Register Bank Select Flag (B)
The register bank 0 is selected when the B flag is 0. The register bank 1 is selected when this flag is set to 1.
2.8.6Overflow Flag (O)
The O flag is set to 1 when the operation resulted in an overflow; otherwise, 0.
Rev.2.00 Aug 27, 2008Page 11 of 458
REJ09B0250-0200
R8C/20 Group, R8C/21 Group 2. Central Processing Unit (CPU)
2.8.7Interrupt Enable Flag (I)
The I flag enables a maskable interrupt.
An interrupt is disabled when the I flag is set to 0, and are enabled when the I flag is set to 1. The I flag is set to
0 when an interrupt request is acknowledged.
2.8.8Stack Pointer Select Flag (U)
ISP is selected when the U flag is set to 0; USP is selected when the U flag is set to 1.
The U flag is set to 0 when a hardware interrupt request is acknowledged or the INT instruction of software
interrupt numbers. 0 to 31 is executed.
2.8.9Processor Interrupt Priority Level (IPL)
IPL, 3 bits wide, assigns processor interrupt priority levels from level 0 to level 7.
If a requested interrupt has greater priority than IPL, the interrupt is enabled.
2.8.10Reserved Bit
If necessary, set to 0. When read, the content is undefined.
Rev.2.00 Aug 27, 2008Page 12 of 458
REJ09B0250-0200
R8C/20 Group, R8C/21 Group 3. Memory
3.Memory
3.1R8C/20 Group
Figure 3.1 shows a Memory Map of R8C/20 Group. The R8C/20 Group has 1 Mbyte of address space from
address 00000h to FFFFFh.
The internal ROM is allocated lower addresses, beginning with address 0FFFFh. For example, a 48-Kbyte internal
ROM is allocated addresses 04000h to 0FFFFh.
The fixed interrupt vector table is allocated addresses 0FFDCh to 0FFFFh. They store the starting address of each
interrupt routine.
The internal RAM is allocated higher addresses, beginning with address 00400h. For example, a 2.5-Kbyte
internal RAM is allocated addresses 00400h to 00DFFh. The internal RAM is used not only for storing data but
also for calling subroutines and as stacks when interrupt requests are acknowledged.
Special function registers (SFR) are allocated addresses 00000h to 002FFh. The peripheral function control
registers are allocated here. All addresses within the SFR, which have nothing allocated are reserved for future
user and cannot be accessed by users.
00000h
002FFh
00400h
0XXXXh
01300h
02000h
03000h
0SSSSh
0YYYYh
0FFFFh
ZZZZZh
FFFFFh
NOTES:
1. The blank regions are reserved. Do not access locations in these regions.
2. Do not use addresses 20000h to 23FFFh because these areas are used for the emul ator debugger. Refer to 23. Notes onEmulator Debugger.
Rev.2.00 Aug 27, 2008Page 13 of 458
REJ09B0250-0200
R8C/20 Group, R8C/21 Group 3. Memory
3.2R8C/21 Group
Figure 3.2 shows a Memory Map of R8C/21 Group. The R8C/21 Group has 1 Mbyte of address space from
address 00000h to FFFFFh.
The internal ROM (program ROM) is allocated lower addresses, beginning with address 0FFFFh. For example, a
48-Kbyte internal ROM is allocated addresses 04000h to 0FFFFh.
The fixed interrupt vector table is allocated addresses 0FFDCh to 0FFFFh. They store the starting address of each
interrupt routine.
The internal ROM (data flash) is allocated addresses 02400h to 02BFFh.
The internal RAM is allocated higher addresses, beginning with address 00400h. For example, a 2.5-Kbyte
internal RAM is allocated addresses 00400h to 00DFFh. The internal RAM is used not only for storing data but
also for calling subroutines and as stacks when interrupt requests are acknowledged.
Special function registers (SFR) are allocated addresses 00000h to 002FFh. The peripheral function control
registers are allocated them. All addresses within the SFR, which have nothing allocated are reserved for future
use and cannot be accessed by users.
00000h
002FFh
00400h
0XXXXh
01300h
02000h
02400h
02BFFh
03000h
0SSSSh
0YYYYh
0FFFFh
ZZZZZh
FFFFFh
NOTES:
1. Data flash block A (1 Kbyte) and B (1 Kbyte) are shown.
2. The blank regions are reserved. Do not access locati ons in these regions.
3. Do not use addresses 20000h to 23FFFh because these areas are used for t he emulator debugger. Refer to 23. Notes onEmulator Debugger.