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.1.30
Revision Date: Apr 14, 2006
www.renesas.com
Page 2
Keep safety first in your circuit designs!
1.
Renesas Technology Corp. puts the maximum effort into making semiconductor products
better and more reliable, but there is always the possibility that trouble may occur with
them. Trouble with semiconductors may lead to personal injury, fire or property damage.
Remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or (iii) prevention against any malfunction or mishap.
Notes regarding these materials
1.
These materials are intended as a reference to assist our customers in the selection of the
Renesas Technology Corp. product best suited to the customer's application; they do not
convey any license under any intellectual property rights, or any other rights, belonging to
Renesas Technology Corp. or a third party.
2.
Renesas Technology Corp. assumes no responsibility for any damage, or infringement of
any third-party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials.
3.
All information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these
materials, and are subject to change by Renesas Technology Corp. without notice due to
product improvements or other reasons. It is therefore recommended that customers contact Renesas Technology Corp. or an authorized Renesas Technology Corp. product distributor for the latest product information before purchasing a product listed herein.
The information described here may contain technical inaccuracies or typographical errors.
Renesas Technology Corp. assumes no responsibility for any damage, liability, or other
loss rising from these inaccuracies or errors.
Please also pay attention to information published by Renesas Technology Corp. by various means, including the Renesas Technology Corp. Semiconductor home page (http://
www.renesas.com).
4.
When using any or all of the information contained in these materials, including product
data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information
and products. Renesas Technology Corp. assumes no responsibility for any damage, liability or other loss resulting from the information contained herein.
5.
Renesas Technology Corp. semiconductors are not designed or manufactured for use in a
device or system that is used under circumstances in which human life is potentially at
stake. Please contact Renesas Technology Corp. or an authorized Renesas Technology
Corp. product distributor when considering the use of a product contained herein for any
specific purposes, such as apparatus or systems for transportation, vehicular, medical,
aerospace, nuclear, or undersea repeater use.
6.
The prior written approval of Renesas Technology Corp. is necessary to reprint or reproduce in whole or in part these materials.
7.
If these products or technologies are subject to the Japanese export control restrictions,
they must be exported under a license from the Japanese government and cannot be imported into a country other than the approved destination.
Any diversion or reexport contrary to the export control laws and regulations of Japan and/
or the country of destination is prohibited.
8.
Please contact Renesas Technology Corp. for further details on these materials or the
products contained therein.
Page 3
General Precautions in the Handling of MPU/MCU Products
The following usage notes are applicable to all MPU/MC U pr o duct s fr om R e nesas. For d et a il ed usa ge not es on the
products covered by this manual, refer to the relevant sections of the manu a l . If the descri pt ion s un der 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 type number, confirm that the
change will not lead to problems.
The characteristics of MPU/MCU in the same group but having different type numbers may differ
because of the differences in internal memory capacity and layout pattern. When changing to
products of different type numbers, implement a system-evaluation test for each of the products.
Page 4
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/18 Group, R8C/19 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.
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/18 Group,
R8C/19 Group
Hardware Manual
Software Manual
Available from Renesas
Technology Web site.
REJ03B0124
This hardware
manual
REJ09B0001
Page 5
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 t o 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
Page 6
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.
Page 7
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-Connection
PLLPhase Locked Loop
PWMPulse Width Modulation
SFRSpecial Function Registers
SIMSubscriber Identity Module
UARTUniversal Asynchronous Receiver/Transmitter
VCOVoltage Controlled Oscillator
Address RegisterSymbolPage
0080hTimer Z Mode Register TZMR118
0081h
0082h
0083h
0084hTimer Z Waveform Output Control RegisterPUM120
0085hPrescaler Z RegisterPREZ119
0086hTimer Z Secondary RegisterTZSC119
0087hTimer Z Primary RegisterTZPR119
0088h
0089h
008AhTimer Z Output Control RegisterTZOC120
008BhTimer X Mode RegisterTXMR104
008ChPrescaler X RegisterPREX105
008DhTimer X RegisterTX105
008EhTimer Count Source Set RegisterTCSS105,121
008Fh
0090hTimer C RegisterTC137
0091h
0092h
0093h
0094h
0095h
0096hExternal Input Enable RegisterINTEN85
0097h
0098hKey Input Enable RegisterKIEN91
0099h
009AhTimer C Control Register 0TCC0138
009BhTimer C Control Register 1TCC1139
009ChCapture, Compare 0 RegisterTM0137
009Dh
009EhCompare 1 RegisterTM1137
009Fh
00A0hUART0 Transmit/Receive Mode RegisterU0MR149
00A1hUART0 Bit Rate RegisterU0BRG148
00A2hUART0 Transmit Buffer RegisterU0TB148
00A3h
00A4hUART0 Transmit/Receive Control Register 0 U0C0150
00A5hUART0 Transmit/Receive Control Register 1 U0C1151
00A6hUART0 Receive Buffer RegisterU0RB148
00A7h
00A8hUART1 Transmit/Receive Mode RegisterU1MR149
00A9hUART1 Bit Rate RegisterU1BRG148
00AAhUART1 Transmit Buffer RegisterU1TB148
00ABh
00AChUART1 Transmit/Receive Control Register 0 U1C0150
00ADhUART1 Transmit/Receive Control Register 1 U1C1151
00AEhUART1 Receive Buffer RegisterU1RB148
00AFh
00B0hUART Transmit/Receive Control Register 2UCON151
00B1h
00B2h
00B3h
00B4h
00B5h
00B6h
00B7h
00B8h
00B9h
00BAh
00BBh
00BCh
00BDh
00BEh
00BFh
NOTE:
1. The blank regions, 0100h to 01AFh, and 01C0h to 02FFh
are reserved. Do not access locations in these regions.
Address RegisterSymbolPage
00C0hA/D RegisterAD166
00C1h
00C2h
00C3h
00C4h
00C5h
00C6h
00C7h
00C8h
00C9h
00CAh
00CBh
00CCh
00CDh
00CEh
00CFh
00D0h
00D1h
00D2h
00D3h
00D4hA/D Control Register 2ADCON2166
00D5h
00D6hA/D Control Register 0ADCON0165
00D7hA/D Control Register 1ADCON1165
00D8h
00D9h
00DAh
00DBh
00DCh
00DDh
00DEh
00DFh
00E0h
00E1hPort P1 RegisterP133
00E2h
00E3hPort P1 Direction RegisterPD133
00E4h
00E5hPort P3 RegisterP333
00E6h
00E7hPort P3 Direction RegisterPD333
00E8hPort P4 RegisterP433
00E9h
00EAhPort P4 Direction RegisterPD433
00EBh
00ECh
00EDh
00EEh
00EFh
00F0h
00F1h
00F2h
00F3h
00F4h
00F5h
00F6h
00F7h
00F8h
00F9h
00FAh
00FBh
00FChPull-Up Control Register 0PUR034
00FDhPull-Up Control Register 1PUR134
00FEhPort P1 Drive Capacity Control RegisterDRR34
00FFhTimer C Output Control RegisterTCOUT140
01B3hFlash Memory Control Register 4FMR4184
01B4h
01B5hFlash Memory Control Register 1FMR1183
01B6h
01B7hFlash Memory Control Register 0FMR0182
0FFFFh Optional Function Select RegisterOFS98,177
B - 2
Page 16
R8C/18 Group, R8C/19 Group
REJ09B0222-0130
SINGLE-CHIP 16-BIT CMOS MCU
Apr 14, 2006
1.Overview
These MCUs are fabricated using a high-performance silicon gate CMOS process, embedding the
R8C/Tiny Series CPU core, and is packaged in a 20-pin molded-plastic LSSOP, SDIP or a 28-pin plastic
molded-HWQFN. It implements sophisticated instructions for a high level of instruction efficiency. With 1
Mbyte of address space, they are capable of executing instructions at high speed.
Furthermore, the R8C/19 Group has on-chip data flash ROM (1 KB × 2 blocks).
The difference between the R8C/18 Group and R8C/19 Group is only the presence or absence of data
flash ROM. Their peripheral functions are the same.
1.1Applications
Electric household appliances, office equipment, housing equipment (sensors, security systems), general
industrial equipment, audio equipment, etc.
Rev.1.30
Rev.1.30Apr 14, 2006Page 1 of 233
REJ09B0222-0130
Page 17
R8C/18 Group, R8C/19 Group1. Overview
1.2Performance Overview
Table 1.1 outlines the Functions and Specifications for R8C/18 Group and Table 1.2 outlines the
Functions and Specifications for R8C/19 Group.
Table 1.1Functions and Specifications for R8C/18 Group
ItemSpecification
CPUNumber of fundamental
instructions
Minimum instruction execution
time
Operation modeSingle-chip
Address space1 Mbyte
Memory capacityRefer to Table 1.3 Product Information for R8C/18
Peripheral
Functions
Electric
Characteristics
Flash Memory
Operating Ambient Temperature-20 to 85°C
Package20-pin molded-plastic LSSOP
PortsI/O ports: 13 pins (including LED drive port)
Figure 1.6Pin Assignments for PWQN0028KA-B Package (Top View)
Rev.1.30Apr 14, 2006Page 9 of 233
REJ09B0222-0130
Page 25
R8C/18 Group, R8C/19 Group1. Overview
1.6Pin Functions
Table 1.5 lists Pin Functions, Table 1.6 lists Pin Name Information by Pin Number of PLSP0020JB-A,
PRDP0020BA-A packages, and Table 1.7 lists Pin Name Information by Pin Number of PWQN0028KAB package.
Table 1.5Pin Functions
TypeSymbolI/O TypeDescription
Power supply input VCC
VSS
Analog power
supply input
Reset inputRESET
MODEMODEIConnect this pin to VCC via a resistor.
Main clock inputXINIThese pins are provided for main clock generation
Timer ZTZOUTOTimer Z output pin
Timer CTCINITimer C input pin
Serial interfaceCLK0I/OTransfer clock I/O pin
Reference voltage
input
ComparatorAN8 to AN11IAnalog input pins to comparator
I/O portP1_0 to P1_7, P3_3
Input portP4_2, P4_6, P4_7IInput-only ports
I: InputO: OutputI/O: Input and outpu t
AVCC, A VSSIPower supply for the comparator
to KI3IKey input interrupt input pins
CNTR0
CMP0_0 to CMP0_2,
CMP1_0 to CMP1_2
RXD0, RXD1ISerial data input pins
TXD0, TXD1OSerial data output pins
VREFIReference voltage input pin to comparator
to P3_5, P3_7, P4_5
IApply 2.7 V to 5.5 V to the VCC pin. Apply 0 V to
the VSS pin.
Connect a capacitor between AVCC 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 external clock, input it to the XIN pin
and leave the XOUT pin open.
OTimer X output pin
OTimer C output pins
I/OCMOS I/O ports. Each port has an I/O select
direction register, allowing each pin in the port to
be directed for input or output individually.
Any port set to input can be set to use a pull-up
resistor or not by a program.
P1_0 to P1_3 also function as LED drive ports.
Rev.1.30Apr 14, 2006Page 10 of 233
REJ09B0222-0130
Page 26
R8C/18 Group, R8C/19 Group1. Overview
Table 1.6Pin Name Information by Pin Number of PLSP0020JB-A, PRDP0020BA-A packages
Pin
Number
1P3_5CMP1_2
2P3_7
3
4XOUTP4_7
5VSS/AVSS
6XINP4_6
7VCC/AVCC
8MODE
9P4_5
10P1_7
11P1_6CLK0
12P1_5
13P1_4TXD0
14P1_3
15P1_2
16VREFP4_2
17P1_1
18P1_0
19P3_3
20P3_4CMP1_1
Control
Pin
RESET
Port
InterruptTimerSerial InterfaceComparator
INT0
INT10
INT11
KI3
KI2
KI1
KI0
INT3
I/O Pin Functions for Peripheral Modules
CNTR0
CNTR00
CNTR01RXD0
TZOUTAN11
CMP0_2AN10
CMP0_1AN9
CMP0_0AN8
TCIN/CMP1_0
TXD1
RXD1
Rev.1.30Apr 14, 2006Page 11 of 233
REJ09B0222-0130
Page 27
R8C/18 Group, R8C/19 Group1. Overview
Table 1.7Pin Name Information by Pin Number of PWQN0028KA-B package
Rev.1.30Apr 14, 2006Page 12 of 233
REJ09B0222-0130
Page 28
R8C/18 Group, R8C/19 Group2. Central Processing Unit (CPU)
2.Central Processing Unit (CPU)
Figure 2.1 shows the CPU Registers. The CPU contains 13 registers. R0, R1, R2, R3, A0, A1, and FB
configure a register bank. There are two sets of register bank.
b31
R2
R3
b15b8b7
R0H (high-order of R0)
R1H (high-order of R1) R1L (low-order of R1)
R0L (low-order of R0)
R2
R3
A0
A1
FB
b15b19
INTBH
The 4-high order bits of INTB are INTBH and
the 16-low bits of INTB are INTBL.
b19
INTBL
PC
b15
USP
ISP
SB
b0
Data registers
Address registers
Frame base register
b0
Interrupt table register
b0
Program counter
b0
User stack pointer
Interrupt stack pointer
Static base register
(1)
(1)
(1)
b15
IPL
NOTE:
1. These registers comprise a register bank. There are two register banks.
Figure 2.1CPU 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 bit
Processor interrupt priority level
Reserved bit
Rev.1.30Apr 14, 2006Page 13 of 233
REJ09B0222-0130
Page 29
R8C/18 Group, R8C/19 Group2. Central Processing Unit (CPU)
2.1Data Registers (R0, R1, R2, and R3)
R0 is a 16-bit register for transfer, arithmetic, and logic operations. T he same applies to R1 to R3. R0
can be split into high-order bits (R0H) and low-order bits (R0L) to be used separately as 8-bit data
registers. R1H and R1L are analogous to R0H and R0L. R2 can be combined with R0 and used as a
32-bit data register (R2R0). R3R1 is analogous to R2R0.
2.2Address Registers (A0 and A1)
A0 is a 16-bit register for address register indirect addressing and address register relative addressing.
It is also used for transfer, arithmetic and logic operations. A1 is analogous to A0. A1 can be combined
with A0 and used as 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 is a 20-bit register that indicates the start address of an interrupt vector table.
2.5Program Counter (PC)
PC is 20 bits wide, indicates the address of the next instruction to be executed.
2.6User Stack Pointer (USP) and Interrupt Stack Pointer (ISP)
The stack pointer (SP), USP, and ISP, are each 16 bits wide. 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 an 11-bit register indicating the CPU state.
2.8.1Carry Flag (C)
The C flag retains a carry, borrow, or shift-out bits that have been generated by the arithmetic and logic
unit.
2.8.2Debug Flag (D)
The D flag is for debugging only. Set it to 0.
2.8.3Zero Flag (Z)
The Z flag is set to 1 when an arithmetic operation results in 0; otherwise to 0.
2.8.4Sign Flag (S)
The S flag is set to 1 when an arithmetic operation results in a negative value; otherwise to 0.
2.8.5Register Bank Select Flag (B)
Register bank 0 is selected when the B flag is 0. 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 results in an overflow; otherwise to 0.
Rev.1.30Apr 14, 2006Page 14 of 233
REJ09B0222-0130
Page 30
R8C/18 Group, R8C/19 Group2. Central Processing Unit (CPU)
2.8.7Interrupt Enable Flag (I)
The I flag enables maskable interrupts.
Interrupts are 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 is 3 bits wide, assigns processor interrupt priority levels from level 0 to level 7.
If a requested interrupt has higher priority than IPL, the interrupt is enabled.
2.8.10Reserved Bit
If necessary, set to 0. When read, the content is undefined.
Rev.1.30Apr 14, 2006Page 15 of 233
REJ09B0222-0130
Page 31
R8C/18 Group, R8C/19 Group3. Memory
3.Memory
3.1R8C/18 Group
Figure 3.1 is a Memory Map of R8C/18 Group. The R8C/18 Group has 1 Mbyte of address space from
addresses 00000h to FFFFFh.
The internal ROM area is allocated lower addresses, beginning with address 0FFF Fh. For example, a
16-Kbyte internal ROM is allocated addresses 0C000h 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 a ddress 00400h. For example, a 1Kbyte internal RAM area is allocated addresses 00400h to 007FFh. 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 (SFRs) 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 use and cannot be accessed by users.
1. The blank regions are reserved. Do not access locations in these regions.
Part Number
0FFDCh
Watchdog timer
0FFFFh
Internal ROMInternal RAM
SizeAddress 0YYYYh
16 Kbytes
12 Kbytes
8 Kbytes
4 Kbytes
Undefined instruction
Overflow
BRK instruction
Address match
Single step
• oscillation stop detection • voltage monitor 2
Address break
(Reserved)
Reset
SizeAddress 0XXXXh
0C000h
0D000h
0E000h
0F000h
1 Kbyte
768 bytes
512 bytes
384 bytes
007FFh
006FFh
005FFh
0057Fh
Figure 3.1Memory Map of R8C/18 Group
Rev.1.30Apr 14, 2006Page 16 of 233
REJ09B0222-0130
Page 32
R8C/18 Group, R8C/19 Group3. Memory
3.2R8C/19 Group
Figure 3.2 is a Memory Map of R8C/19 Group. The R8C/19 group has 1 Mbyte of address space from
addresses 00000h to FFFFFh.
The internal ROM (program ROM) is allocated lower addresses, beginning with address 0FFFFh. For
example, a 16-Kbyte internal ROM area is allocated addresses 0C000h 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 a ddress 00400h. For example, a 1Kbyte internal RAM area is allocated addresses 00400h to 007FFh. 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 (SFRs) 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 use and cannot be accessed by users.
00E9h
00EAhPort P4 Direction RegisterPD400h
00EBh
00ECh
00EDh
00EEh
00EFh
00F0h
00F1h
00F2h
00F3h
00F4h
00F5h
00F6h
00F7h
00F8h
00F9h
00FAh
00FBh
00FChPull-Up Control Register 0PUR000XX0000b
00FDhPull-Up Control Register 1PUR1XXXXXX0Xb
00FEhPort P1 Drive Capacity Control RegisterDRR00h
00FFhTimer C Output Control RegisterTCOUT00h
01B3hFlash Memory Control Register 4FMR401000000b
01B4h
01B5hFlash Memory Control Register 1FMR11000000Xb
01B6h
01B7hFlash Memory Control Register 0FMR000000001b
0FFFFhOptional Function Select RegisterOFS(Note 2)
(1)
X: Undefined
NOTES:
1. The blank regions, 0100h to 01B2h and 01B8h to 02FFh are all reserved. Do not access locations in these regions.
2. The OFS register cannot be changed by a program. Use a flash programmer to write to it.
Rev.1.30Apr 14, 2006Page 21 of 233
REJ09B0222-0130
Page 37
R8C/18 Group, R8C/19 Group5. Resets
5.Resets
The following resets are implemented: hardware reset, power-on reset, voltage monitor 1 reset, voltage
monitor 2 reset, watchdog timer reset, and software reset. Table 5.1 lists the Reset Names and Sources.
Table 5.1Reset Names an d Sou r ce s
Reset NameSource
Hardware resetInput voltage of RESET
Power-on resetVCC rises.
Voltage monitor 1 resetVCC falls (monitor voltage: Vdet1).
Voltage monitor 2 resetVCC falls (monitor voltage: Vdet2).
Watchdog timer resetUnderflow of watchdog timer
Software resetWrite 1 to PM03 bit in PM0 register.
pin is held “L”
RESET
VCC
Power-on reset
circuit
Voltage
detection
circuit
Watchdog
timer
CPU
Hardware reset
Power-on reset
Voltage monitor 1 reset
Voltage monitor 2 reset
Watchdog timer
reset
Software reset
VCA13: Bit in VCA1 regis ter
VCA26, VCA27: Bits in VCA2 register
VW1C0 to VW1C2, VW1F0, VW1F1, VW1C6, VW1 C7: Bit s in VW1C regi st er
VW2C2, VW2C3: Bits in VW2C register
Pin, CPU, and
SFR bits other than
those listed above
Figure 5.1Block Diagram of Reset Circuit
Rev.1.30Apr 14, 2006Page 22 of 233
REJ09B0222-0130
Page 38
R8C/18 Group, R8C/19 Group5. Resets
Table 5.2 shows the Pin Functions after Reset, Figure 5.2 shows CPU Register Status after Reset and
Figure 5.3 shows Reset Sequence.
Table 5.2Pin Functions after Reset
Pin NamePin Functions
P1Input port
to P3_5, P3_7Input port
P3_3
P4_2, P4_5
to P4_7Input port
b15
0000h
0000h
0000h
0000h
0000h
0000h
0000h
b19
00000h
Content of addresses 0FFFEh to 0FFFCh
b15
0000h
0000h
0000h
b15
0000h
b15
b8
b7
IPL
b0
Data register (R0)
Data register (R1)
Data register (R2)
Data register (R3)
Address register (A0)
Address register (A1)
Frame base register (FB)
b0
Interrupt table register (INTB)
Program counter (PC)
b0
b0
b0
C
DZSBOIU
User stack pointer (USP)
Interrupt stack pointer (ISP)
Static base register (SB)
Flag register (FLG)
Figure 5.2CPU Register Status after Reset
fRING-S
(1)
Internal reset
signal
CPU clock
Address
(internal address
signal)
20 cycles or more needed
Flash memory activation
(CPU clock × 11 cycles)
NOTE:
1. Hardware reset
Figure 5.3Reset Sequence
Rev.1.30Apr 14, 2006Page 23 of 233
REJ09B0222-0130
CPU clock × 28 cycles
0FFFCh
0FFFDh
0FFFEh
Content of reset vector
Page 39
R8C/18 Group, R8C/19 Group5. Resets
5.1Hardware Reset
A reset is applied using the RESET pin. When an “L” signal is applied to the RESET pin while the supply
voltage meets the recommended operating conditions, pins, CPU, and SFRs are reset (refer to Table
5.2 Pin Functions after Reset ). When the input level applied to the RESET
a program is executed beginning with the address indicated by the reset vector. After reset, the lowspeed on-chip oscillator clock divided by 8 is automatically selected as the CPU clock.
Refer to 4. Special Function Registers (SFRs) for the state of the SFRs after reset.
The internal RAM is not reset. If the RESET
progress, the contents of internal RAM will be undefined.
Figure 5.4 shows an Example of Hardware Reset Circuit and Operation and Figure 5.5 shows an
Example of Hardware Reset Circuit (Usage Example of External Supply Voltage Detection Circuit) and
Operation.
pin is pulled “L” while writing to the internal RAM is in
pin changes from “L” to “H”,
5.1.1When Power Supply is Stable
(1) Apply “L” to the RESET pin.
(2) Wait for 500 µs (1/fRING-S × 20).
(3) Apply “H” to the RESET
pin.
5.1.2Power On
(1) Apply “L” to the RESET pin.
(2) Let the supply voltage increase until it meets the recommended operating condition.
(3) Wait for td(P-R) or more to allow the internal power supply to stabilize (refer to 18. Electrical
Characteristics).
(4) Wait for 500 µs (1/fRING-S × 20).
(5) Apply “H” to the RESET
pin.
Rev.1.30Apr 14, 2006Page 24 of 233
REJ09B0222-0130
Page 40
R8C/18 Group, R8C/19 Group5. Resets
VCC
VCC
0V
RESET
RESET
0V
NOTE:
1. Refer to 18. Electrical Characteristics.
2.7 V
td(P-R) + 500 µs or more
Figure 5.4Example of Hardware Reset Circuit and Operation
5 V
VCC
0 V
5 V
RESET
2.7 V
RESETVCC
Power supply
voltage detection
circuit
0.2 VCC or below
0 V
Example when
VCC = 5 V
NOTE:
1. Refer to
td(P-R) + 500
18. Electrical Characteristics.
µs or above
Figure 5.5Example of Hardware Reset Circuit (Usage Exa mpl e of Exte rn al Suppl y Voltage
Detection Circuit) and Operation
Rev.1.30Apr 14, 2006Page 25 of 233
REJ09B0222-0130
Page 41
R8C/18 Group, R8C/19 Group5. Resets
5.2Power-On Reset Function
When the RESET pin is connected to the VCC pin via a pull-up resistor of about 5 kΩ, and the VCC pin
voltage level rises, the power-on reset function is enabled and the MCU resets its pins, CPU, and SFR.
When a capacitor is connected to the RESET
more.
When the input voltage to the VCC pin reaches the Vdet1 level or above, the low-speed on-chip
oscillator clock starts counting. When the low-speed on-chip oscillator clock count reaches 32, the
internal reset signal is held “H” and the MCU enters the reset sequence (refer to Figure 5.3). The lowspeed on-chip oscillator clock divided by 8 is automatically selected as the CPU after reset.
Refer to 4. Special Function Registers (SFRs) for the status of the SFR after power-on reset.
The voltage monitor 1 reset is enabled after power-on reset.
Figure 5.6 shows an Example of Power-On Reset Circuit and Operation.
pin, always keep the voltage to the RESET pin 0.8VCC or
0.1 V to 2.7 V
VCC
VCC
About
5 kΩ
RESET
(3)
V
det1
Vpor1
t
w(por1)
Internal reset signal
NOTES:
1. The supply voltage must be held within the MCU’s operating voltage range (Vccmin or above) over the sampling time.
2. A sampling clock can be selected. Refer to 7. Voltage Detection Circuit for details.
3. Vdet1 indicates voltage detection level for the voltage detection 1 circuit. Refer to 7. Voltage Detection Circuit for details.
4. Refer to 18. Electrical Characteristics.
(active “L”)
tw(Vpor1–Vdet1)
1
f
RING-S
0 V
RESET
0 V
Sampling time
× 32
(1, 2)
tw(por2) tw(Vpor2–Vdet1)
within td(P-R)
Vccmin
Vpor2
0.8 VCC or above
1
f
RING-S
× 32
Vdet1
(3)
Figure 5.6Example of Power-On Reset Circuit and Operation
Rev.1.30Apr 14, 2006Page 26 of 233
REJ09B0222-0130
Page 42
R8C/18 Group, R8C/19 Group5. Resets
5.3Voltage Monitor 1 Reset
A reset is applied using the on-chip voltage detection 1 circuit. The voltage detection 1 circuit monitors
the input voltage to the VCC pin. The voltage to monitor is Vdet1.
When the input voltage to the VCC pin reaches the Vdet1 level or below, the pins, CPU, and SFR are
reset.
When the input voltage to the VCC pin reaches the Vdet1 level or above, the low-speed on-chip
oscillator clock starts counting. When the low-speed on-chip oscillator clock count reaches 32, the
internal reset signal is held “H” and the MCU enters the reset sequence (refer to Figure 5.3). The lowspeed on-chip oscillator clock divided by 8 is automatically selected as the CPU after reset.
Refer to 4. Special Function Registers (SFRs) for the status of the SFR after voltage monitor 1 r eset.
The internal RAM is not reset. When the input vo ltage to the VCC pin reaches th e Vdet1 level or belo w
while writing to the internal RAM is in progress, the contents of internal RAM are undefined.
Refer to 7. Voltage Detection Circuit for details of voltage monitor 1 reset.
5.4Voltage Monitor 2 Reset
A reset is applied using the on-chip voltage detection 2 circuit. The voltage detection 2 circuit monitors
the input voltage to the VCC pin. The voltage to monitor is Vdet2.
When the input voltage to the VCC pin reaches the Vdet2 level or below, pins, CPU, and SFR are reset
and the program beginning with the address indicated by the reset vector is executed. After reset, the
low-speed on-chip oscillator clock divided by 8 is automatically selected as the CPU clock.
The voltage monitor 2 does not reset some SFRs. Refer to 4. Special Function Registers (SFRs) for
details.
The internal RAM is not reset. When the input vo ltage to the VCC pin reaches th e Vdet2 level or belo w
while writing to the internal RAM is in progress, the contents of internal RAM are undefined.
Refer to 7. Voltage Detection Circuit for details of voltage monitor 2 reset.
5.5Watchdog Timer Reset
When the PM12 bit in the PM1 register is set to 1 (reset when watchdog timer underflows), the MCU
resets its pins, CPU, and SFR if the watchdog timer underflows. Then the program beginning with the
address indicated by the reset vector is executed. After reset, the low-speed on-chip oscillator clock
divided by 8 is automatically selected as the CPU clock.
The watchdog timer reset does not reset some SFRs. Refer to 4. Special Function Registers (SFRs)
for details.
The internal RAM is not reset. When the watchdog timer underflows, the contents of internal RAM are
undefined.
Refer to 13. Watchdog Timer for details of watchdog timer.
5.6Software Reset
When the PM03 bit in the PM0 register is set to 1 (MCU reset), the MCU resets its pins, CPU, and SFR.
The program beginning with the address indicated by the reset vector is executed. After reset, the lowspeed on-chip oscillator clock divided by 8 is automatically selected for the CPU clock.
The software reset does not reset some SFRs. Refer to 4. Special Function Registers (SFRs) for
details.
The internal RAM is not reset.
Rev.1.30Apr 14, 2006Page 27 of 233
REJ09B0222-0130
There are 13 programmable Input/Output ports ( I/O ports) P1, P3_3 to P3_5, P3_7, and P4_5. P4_2 can be
used as an input-only port. Also, P4_6 and P4_7 can be used as input-only ports if the main clock oscillation
circuit is not used. Table 6.1 lists an Overview of Programmable I/O Ports.
Table 6.1Overview of Programmable I/O Ports
PortsI/OType of OutputI/O Setting
P1I/OCMOS3 StateSet per bit
P3_3, P4_5I/OCMOS3 StateSet per bit
P3_4, P3_5, P3_7I/OCMOS3 StateSet per bit
(3)
P4_2, P4_6, P4_7
NOTES:
1. In input mode, whether an internal pull-up resistor is connected or not can be selected by regi ste rs PU R 0 and
PUR1.
2. These ports can be used as the LED drive port by setting the DRR register to 1 (high).
3. When the main clock oscillation circuit is not used, P4_6 and P4_7 can be used as input-only ports.
I(No output function)NoneNoneNone
Internal Pull-Up
Resistor
Set every 4 bits
Set every bit
Set every 3 bits
(1)
(1)
(1)
6.1Functions of Programmable I/O Ports
The PDi_j (j=0 to 7) bit in the PDi (i=1, 3, and 4) register controls I/O of ports P1, P3_3 to P3_5, P3_7,
and P4_5. The Pi register consists of a port latch to hold output data and a circuit to read pin states.
Figures 6.1 to 6.3 show the Configurations of Programmable I/O Ports.
Table 6.2 lists the Functions of Programmable I/O Ports. Also, Figure 6.5 shows Registers PD1, PD3,
and PD4. Figure 6.6 shows Registers P1, P3, and P4, Figure 6.7 sho ws Registers PUR0 an d PUR1, and
Figure 6.8 shows the DRR Register.
Drive Capacity
Selection
Set every bit
to P1_3
None
None
(2)
of P1_0
Table 6.2Functions of Programmable I/O Ports
Operation when
Accessing
Pi Register
ReadingRead pin input levelRead the port latch
WritingWrite to the port latchWrite to the port latch. The value written to the
NOTE:
1. Nothing is assigned to bits PD3_0 to PD3_2, PD3_6, PD4_0 to PD4_4, PD4_6, and PD4_7.
When PDi_j Bit is Set to 0 (Input Mode)When PDi_j Bit is Set to 1 (Output Mode)
Value of PDi_j Bit in PDi Register
port latch is output from the pin.
(1)
6.2Effect on Peripheral Functions
Programmable I/O ports function as I/O ports for peripheral functions (Refer to Table 1.6 Pin Name
Information by Pin Number of PLSP0020JB-A, PRDP0020BA-A packages). Table 6.3 lists the
Settings of PDi_j Bit when Functioning as I/O Ports for Peripheral Functions. Refer to the description of
each function for information on how to set peripheral functions.
Table 6.3Settings of PDi_j Bit when Functioning as I/O Ports for Peripheral Functions
I/O of Peripheral FunctionsPPDi_j Bit Settings for Shared Pin Functions
InputSet this bit to 0 (input mode).
OutputThis bit can be set to either 0 or 1 (output regardless of the port setting).
6.3Pins Other than Programmable I/O Ports
Figure 6.4 shows the Configuration of I/O Pins.
Rev.1.30Apr 14, 2006Page 28 of 233
REJ09B0222-0130
Bits PD3_0 to PD3_2, and PD3_6 in the PD3 register are unavailable on this MCU.
1.
I f it is necessary to set bits PD3_0 to PD3_2, and PD3_6, set to 0 (input m o de). When read, the content is 0.
Bits PD4_0 to PD4_4, PD4_6, and PD4_7 in the PD4 register are unavailable on this MCU. If it is necessary to set bits
2.
PD4_0 to PD4_4, PD4_6, and PD4_7, set to 0 (input mode). When read, the content is 0.
b1 b0
SymbolAddressAfter Reset
PD1
PD3
PD4
Bit SymbolBit NameFunctionRW
PDi_0
PDi_1
PDi_2
PDi_3Port Pi3 direction bit
PDi_4
PDi_5
PDi_6
PDi_7Port Pi7 direction bitRW
(1, 2)
00E3h00h
00E7h00h
00EAh00h
Port P i0 direction bit
Port P i1 direction bit
Port P i2 direction bit
Port P i4 direction bit
Port P i5 direction bit
Port P i6 direction bitRW
Figure 6.5Registers PD1, PD3, and PD4
(functions as an input port)
1 : Output mode
(functions as an output port)
RW0 : Input mode
RW
RW
RW
RW
RW
Port Pi Register (i = 1, 3, 4)
b7 b6 b5 b4b0
b3 b2 b1
(1, 2)
SymbolAddressAfter Reset
P1
P3
P4
Bit SymbolBit NameFunctionRW
Pi_0
Pi_1
Pi_2
Pi_3
Pi_4
Pi_5
Pi_6
Pi_7
Port Pi1 bit
Port Pi2 bit
Port Pi3 bit
Port Pi4 bit
Port Pi5 bit
Port Pi6 bitRW
Port Pi7 bit
NOTES:
1.
Bits P3_0 to P3_2, and P3_6 in the P3 register are unavailable on this M CU.
If it is necessary to set bits P3_0 to P3_2, and P3_6, set to 0 (“L” level). When read, the content is 0.
2.
Bits P 4_0 to P4_1, and P4_3 to P4_4 in the P4 register are unavailable on this MCU.
If it is necessary to set bits P4_0 to PD4_1, and P4_3 to P4_4, set to 0 (“L” level). When read, the content is 0.
Figure 6.6Registers P1, P3, and P4
00E1hUndefined
00E5hUndefined
00E8hUndefined
The pi n level of any I/O port which is set
to input m ode can be read by reading the
corresponding bit in this register. The pin
level of any I/O port which is set to output
mode can be controlled by writing to the
corresponding bit in this register.
0 : “L” level
1 : “H” level
(1)
RWPort Pi0 bit
RW
RW
RW
RW
RW
RW
Rev.1.30Apr 14, 2006Page 33 of 233
REJ09B0222-0130
00XXXXXX00bXInput port (not pulled up)
01XXXXXX00bXInput port (pulled up)
00X1XXXX00bXKI3
00XX1111b00bXComparator input (AN11)
Setting
Value
X: 0 or 1
1X0XXXXX00bXOutput port
1X1XXXXX00bXOutput port (high drive)
XX0XXXXX01b1Output port
XX1XXXXX01b1Output port (high drive)
XXXXXXXX01b0TZOUT output
XXXXXXXX1XbXTZOUT output
CH2, CH1, CH0,
ADGSEL0
TZMOD1,
TZMOD0
TZOCNT
Function
input
Table 6.8Port P1_4/TXD0
RegisterPD1PUR0U0MRU0C0
BitPD1_4PU03SMD2 to SMD0NCH
00000bXInput port (not pulled up)
01000bXInput port (pulled up)
1X000bXOutput port
001b
Setting
Value
X: 0 or 1
XX
XX
100b
101b
110b
001b
100b
101b
110b
Table 6.9Port P1_5/RXD0/ CNT R0 1/ INT 11
RegisterPD1PUR0UCONTXMR
BitPD1_5PU03CNTRSELTXMOD1, TXMOD0
00XXXInput port (not pulled up)
01XXXInput port (pulled up)
Setting
Value
X: 0 or 1
0XXOther than 01bRXD0 input
0X1Other than 01bCNTR01/INT11
1XXOther than 01bOutput port
1X101bCNTR01 output
Function
0TXD0 output, CMOS output
1TXD0 output, N-channel open output
Function
input
Rev.1.30Apr 14, 2006Page 36 of 233
REJ09B0222-0130
Table 6.18 lists Unassigned Pin Handling. Figure 6.9 shows Unassigned Pin Handling.
Table 6.18Unassigned Pin Handling
Pin NameConnection
Ports P1, P3_3 to P3_5,
P3_7, P4_5
Ports P4_6, P4_7
Port P4_2/VREFConnect to VCC
RESET
(3)
NOTES:
1. If these ports are set to output mode and left o pen, they remain in input mo de until they are switched
to output mode by a program. The voltage level of these pins may be undefined and the power
supply current may increase while the ports remain in input mode.
The content of the direction registers may change due to noise or program runaway caused by
noise. In order to enhance program reliability, the program should periodically repeat the setting of
the direction registers.
2. Connect these unassigned pins to the MCU using the shortest wire length (2 cm or less) possible.
3. When the power-on reset function is in use.
• After setting to input mode, connect each pin to VSS via a resistor (pull-
(1, 2)
(2)
down) or connect each pin to VCC via a resistor (pull-up).
• After setting to output mode, leave these pins open.
Connect to VCC via a pull-up resistor
Connect to VCC via a pull-up resistor
(2)
(2)
Port P1, P3_3 to P3_5,
NOTE:
1. When the power-on reset function is in use.
P3_7, P4_5
Figure 6.9Unassigned Pin Handling
MCU
(Input mode)
(Input mode)
(Output mode)
Port P4_6, P4_7
Port P4_2/VREF
:
:
RESET
:
:
Open
(1)
Rev.1.30Apr 14, 2006Page 39 of 233
REJ09B0222-0130
Page 55
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
7.Voltage Detection Circuit
The voltage detection circuit monitors the input voltage to the VCC pin. This circuit can be used to monitor
the VCC input voltage by a program. Alternately, voltage monitor 1 reset, voltage monitor 2 interrupt, and
voltage monitor 2 reset can also be used.
Ta ble 7.1 lists the Specifications of Voltage Detection Circuit and Figures 7.1 to 7.3 show the Block
Diagrams. Figures 7.4 to 7.6 show the Associated Registers.
Table 7.1Specifications of Voltage Detection Circuit
enabled/disabled
Sampling time(Divide-by-n of fRING-S)
by rising or falling
Reset at Vdet1 > VCC;
restart CPU operation at
VCC > Vdet1
AvailableAvailable
x 4
n: 1, 2, 4, and 8
Passing through Vdet2 by
rising or falling
register
Whether VCC is higher or
lower than Vdet2
Reset at Vdet2 > VCC;
restart CPU operation
after a specified time
interrupt
Interrupt request at Vdet2
> VCC and VCC > Vdet2
when digital filter is
enabled;
interrupt request at Vdet2
> VCC or VCC > Vdet2
when digital filter is
disabled
(Divide-by-n of fRING-S)
x 4
n: 1, 2, 4, and 8
Rev.1.30Apr 14, 2006Page 40 of 233
REJ09B0222-0130
Page 56
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
VCC
VCA27
+
Internal
reference
voltage
-
≥ Vdet2
VCA26
+
-
≥ Vdet1
Figure 7.1Block Diagram of Voltage Detection Circuit
Voltage monitor 1 reset generation circuit
Voltage detection 1 circuit
VCA26
fRING-S
VW1F1 to VW1F0
1/21/21/2
= 00b
= 01b
= 10b
= 11b
Noise filter
Voltage detection 2
signal
VCA1 register
b3
VCA13 bit
Voltage detection 1
signal
VCC
+
Internal
-
reference
voltage
VW1C0 to VW1C1, VW1F0 to VW1F1, VW1C6, VW1C7: Bits in VW1C register
VCA26: Bit in VCA2 register
Voltage detection 1
signal is held “H” when
VCA26 bit is set to 0
(disabled).
Voltage
detection 1
signal
VW1C1
VW1C7
Digital
filter
Figure 7.2Block Diagram of Voltage Monitor 1 Reset Generation Circuit
VW1C0
VW1C6
Voltage
monitor 1
reset
signal
Rev.1.30Apr 14, 2006Page 41 of 233
REJ09B0222-0130
Page 57
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
Voltage monitor 2 interrupt/reset ge ne rat io n c irc u it
VW2F1 to VW2F0
= 00b
Voltage detection 2 circuit
VCA27
VCC
+
Internal
reference
voltage
Watchdog timer block
Noise filter
(Filter width: 200 ns)
VW2C0 to VW2C3, VW2F0, VW2F1, VW2C6, VW2C7: Bits in VW2C register
VCA13: Bit in VCA1 register
VCA27: Bit in VCA2 register
Voltage detection 2 signal
is held “H” when VCA27 bit
is set to 0 (disabled).
Watchdog timer
underflow signal
fRING-S
VCA13
Voltage
detection
2 signal
1/21/21/2
VW2C3
VW2C7
This bit is set to 0 (not detected) by writing 0
by a program.
= 01b
= 10b
= 11b
VW2C1
VW2C2 bit is set to 0 (not detected) by
writing 0 by a program.
When VCA27 bit is set to 0 (voltage
detection 2 circuit disabled), VW2C2
bit is set to 0.
Digital
filter
VW2C0
VW2C2
VW2C6
Watchdog
timer interrupt
signal
Voltage monitor 2
interrupt signal
Oscillation stop
detection
interrupt signal
Non-maskable
interrupt signal
Voltage
monitor 2
reset signal
Figure 7.3Block Diagram of Voltage Monitor 2 Interrupt/Reset Generation Circuit
Rev.1.30Apr 14, 2006Page 42 of 233
REJ09B0222-0130
Page 58
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
Vol tage Det ect i on Regi st er 1
b7 b6 b5 b4 b3 b2 b1 b0
0000
NOTES:
1.2.The VCA13 bit is enabled when the VCA27 bit in the VCA2 register is set to 1 (voltage detection 2 circuit enabled).
The VCA13 bit is set to 1 (VCC ≥ Vdet 2) w hen the VCA27 bit in the VCA2 register is set to 0 (voltage detection 2
circuit disabled).
The software reset, watchdog timer reset, and voltage monitor 2 reset do not affect this register.
0
00
SymbolAddressAfter Reset
VCA 1
0031h00001000b
(2)
Bit SymbolBit NameFunctionRW
—
Reserved bits
Set to 0.
(b2-b0)
VCA13
Voltage detection 2 signal monitor
(1)
flag
0 : VCC < Vdet2
1 : VCC ≥ Vdet2 or voltage detection 2
circuit disabled
—
Reserved bitsSet to 0.
(b7-b4)
RW
RO
RW
Vol t ag e Det ect i on Regi st er 2
b7 b6 b5 b4 b3 b2 b1 b0
000000
(1)
SymbolAddress
VCA20032hPower-on reset, voltage monitor 1 reset
Bit SymbolBit NameFunctionRW
—
Reserved bitsSet to 0.
(b5-b0)
VCA26
VCA27
Voltage detection 1 enable bit
Voltage detection 1 enable bit
NOTES:
Set the PRC3 bit in the PRC R register to 1 (w rite enable) before w riting to this register.
1.
To use the voltage monitor 1 reset, set the VCA26 bit to 1.
2.
After the VCA26 bit is set to 1 from 0, the voltage detection circuit waits for td(E-A) to elapse before starting
operation.
To use the voltage monitor 2 interrupt/reset or the VCA13 bit in the VCA1 register, set the VCA27 bit to 1.
3.
After the VCA27 bit is set to 1 from 0, the voltage detection circuit waits for td(E-A) to elapse before starting
operation.
Softw are reset, w atchdog timer reset, and voltage monitor 2 reset do not affect this register.
4.
Figure 7.4Registers VCA1 and VCA2
After Reset
(4)
Hardware reset : 00h
: 01000000b
RW
(2)
(3)
0 : Voltage detection 1 circuit disabled
1 : Voltage detection 1 circuit enabled
0 : Voltage detection 2 circuit disabled
1 : Voltage detection 2 circuit enabled
RW
RW
Rev.1.30Apr 14, 2006Page 43 of 233
REJ09B0222-0130
Page 59
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
Vol tage Mo ni tor 1 Circui t Control Regi st er
b7 b6 b5 b4 b3 b2
b1 b0
0
SymbolAddressAfter reset
VW1C0036hHardw are reset : 0000X000b
Bit SymbolBit N ameFunctionRW
VW1C0RW
Voltage moni tor 1 reset enable
(3)
bit
Voltage moni tor 1 digi tal filter
VW1C1
VW1C2
—
disable mode select bit
Reserved bit
Reserved bit
(b3)
Sampli ng clock select bits
VW1F0RW
VW1F1RW
Voltage moni tor 1 circuit mode
VW1C6
select bit
(1)
(2)
Power-on reset, voltage monitor 1 reset :
0100X001b
0 : Disable
1 : Enable
0 : Digital filter enabled mode
(digital filter circuit enabled)
1 : Digital filter disabled mode
(digital filter circuit disabled)
Set to 0.
When read, the content is undefined.
b5 b4
0 0 : fRING-S divided by 1
0 1 : fRING-S divided by 2
1 0 : fRING-S divided by 4
1 1 : fRING-S divided by 8
When the VW1C0 bit is set to 1 (voltage
monitor 1 reset enabled), set to 1.
RW
RW
RO
RW
VW1C7
NOTES:
1.
Set the PRC3 bit in the PRCR register to 1 (w rite enable) before w riting to this register.
When rewriting the VW1C register, the VW1C2 bit may be set to 1. Set the VW1C2 bit to 0 after rew riting the VW1C
register.
2.
The value rem ains unchanged after a softw are reset, w atchdog tim er reset, or voltage monitor 2 reset.
3.
The VW1C 0 bit is enabled when the VCA26 bit in the VCA2 register is set to 1 (voltage detection 1 circuit enabled).
Set the VW1C0 bit to 0 (disable), when the VCA26 bit is set to 0 (voltage detection 1 circuit disabled).
Figure 7.5VW1C Register
Voltage moni tor 1 reset generation
condition select bit
When the VW1C1 bit is set to 1 (digital filter
disabled mode), set to 1.
RW
Rev.1.30Apr 14, 2006Page 44 of 233
REJ09B0222-0130
Page 60
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
Vol tage M oni tor 2 Circui t Cont rol Regi st er
b7 b6 b5 b4
b2
b1 b0b3
SymbolAddressAfter Reset
VW2C0037h00h
Bit SymbolBit NameFunctionRW
VW2C0
Voltage moni tor 2 interrupt/reset
enable bit
(6, 10)
Voltage moni tor 2 digi tal filter
VW2C1
VW2C2
VW2C3
disable mode select bit
Voltage change detection flag
WDT detection flag
Sampli ng clock select bits
VW2F0RW
VW2F1RW
VW2C6
Voltage moni tor 2 circuit mode
select bi t
(5)
Voltage moni tor 2 interrupt/reset
generation condition select bit
VW2C7
(1)
(4, 8)
(8)
0 : Disable
1 : Enable
(2)
0 : Digital filter enabled mode
(digital filter circuit enabled)
1 : Digital filter disabled mode
RW
RW
(digital filter circuit disabled)
(3, 4, 8)
0 : Not detected
1 : Vdet2 crossing detected
0 : Not detected
1 : Detected
b5 b4
RW
RW
0 0 : fRING-S divide by 1
0 1 : fRING-S divide by 2
1 0 : fRING-S divide by 4
1 1 : fRING-S divide by 8
0 : Voltage monitor 2 interrupt mode
1 : Voltage monitor 2 reset mode
0 : When VCC reaches Vdet2 or above.
(7, 9)
1 : When VCC reaches Vdet2 or below .
RW
RW
NOTES:
Set the PRC3 bit in the PRC R register to 1 (rewrite enable) before w riting to this register.
1.
When rewriting the VW2C register, the VW2C2 bit may be set to 1. Set the VW2C2 bit to 0 after rew riting the VW2C
register.
When the voltage monitor 2 interrupt is used to exit stop mode and to return again, write 0 to the VW2C1bit before
2.
writing 1.
This bit is enabled w hen the VCA27 bit in the VCA2 register is set to 1 (voltage detection 2 circuit enabled).
3.
Set this bit to 0 by a program. When 0 is written by a program, it is set to 0 (and remains unchanged even if 1 is
4.
w ritten to it).
5.
This bit is enabled when the VW2C0 bit is set to 1 (voltage monitor 2 interrupt/enabled reset).
6.
The VW2C 0 bit is enabled when the VCA27 bit in the VCA2 register is set to 1 (voltage detection 2 circuit
enabled). Set the VW2C0 bit to 0 (disable) w hen the VCA27 bit is set to 0 (voltage detection 2 circuit disabled).
7.
The VW2C7 bit is enabled when the VW2C1 bit is set to 1 (digital filter disabled mode).
8.
Bits VW2C2 and VW2C3 remain unchanged after a softw are reset, watchdog timer reset, or voltage monitor 2
9.
When the VW2C6 bit is set to 1 (voltage monitor 2 reset mode), set the VW2C7 bit to 1 (when VCC reaches Vdet2 or
below). (Do not set to 0.)
10.
Set the VW2C0 bit to 0 (disabled) w hen the VCA13 bit in the VCA1 register is set to 1 (VCC ≥ Vdet2 or voltage
detection 2 circuit disabled), the VW2C1 bit is set to 1 (digital filter disabled mode), and the VW2C7 bit is set to 0
(w hen VCC reaches Vdet2 or above).
Set the VW2C0 bit to 0 (disabled) w hen the VCA13 bit is set to 0 (VCC < Vdet2), the VW2C1 bit is set to 1 (digital
filter disabled mode), and the VW2C7 bit is set to 1 (w hen VCC reaches Vdet2 or below).
Figure 7.6VW2C Register
Rev.1.30Apr 14, 2006Page 45 of 233
REJ09B0222-0130
Page 61
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
7.1VCC Input Voltage
7.1.1Monitoring Vdet1
Vdet1 cannot be monitored.
7.1.2Monitoring Vdet2
Set the VCA27 bit in the VCA2 register to 1 (voltage detection 2 circuit enabled). After td(E-A) has
elapsed (refer to 18. Electrical Characteristics), Vdet2 can be monitored by the VCA13 bit in the
VCA1 register.
7.1.3Digital Filter
A digital filter can be used for monitoring the VCC input voltage. When the VW1C1 bit in the VW1C
register is set to 0 (digital filter enabled) for the voltage monitor 1 circuit and the VW2C1 bit in the
VW2C register is set to 0 (digital filter enabled) for the voltage monitor 2 circuit, the digital filter circuit
is enabled.
fRING-S divided by 1, 2, 4, or 8 may be selected as a sampling clock.
The level of VCC input voltage is sampled every sampling clock cycle, and when the sampled input
level matches two times, the internal reset signal changes to “L” or a voltage monitor 2 interrupt
request is generated.
Rev.1.30Apr 14, 2006Page 46 of 233
REJ09B0222-0130
Page 62
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
Voltage monitor 1 reset
VCC
Vdet1
Sampling
timing
Internal reset signal
Sampling clock of digital filter x 4 cycles
Operation when the VW1C1 bit in the VW1C register is set to 0 (digital filter enabled).
Voltage monitor 2 interrupt
VCC
Vdet2
Sampling
timing
VW2C2 bit in
VW2C register
Voltage monitor 2
interrupt request
Operation when the VW2C1 bit in the VW2C register is set to 0 (digital filter enabled)
and the VW2C6 bit is set to 0 (voltage monitor 2 interrupt mode).
Sampling clock of digital filter x 4 cyclesSampling clock of digital filter x 4 cycles
1
0
Set to 0 by a program
1
0
Set to 0 by an interrupt
request acknowledgment
Figure 7.7Operating Example of Digital Filter
Rev.1.30Apr 14, 2006Page 47 of 233
REJ09B0222-0130
Page 63
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
7.2Voltage Monitor 1 Reset
Table 7.2 lists the Setting Procedure of Voltage Monitor 1 Reset Associated Bits and Figure 7.8 shows
an Operating Example of Voltage Monitor 1 Reset. To use voltage monitor 1 reset to exit stop mode, set
the VW1C1 bit in the VW1C register to 1 (digital filter disabled).
Table 7.2Setting Procedure of Voltage Monitor 1 Reset Associated Bits
StepWhen Using Digital FilterWhen Not Using Digital Filter
1Set the VCA26 bit in the VCA2 register to 1 (voltage detection 1 circuit enabled).
2Wait for td(E-A)
Select the sampling clock of the digital filter
(1)
3
by bits VW1F0 to VW1F1 in the VW1C
register.
(1)
4
(1)
5
Set the VW1C1 bit in the VW1C register to 0
(digital filter enabled).
Set the VW1C6 bit in the VW1C register to 1 (voltage monitor 1 reset mode).
6Set the VW1C2 bit in the VW1C register to 0.
7Set the CM14 bit in the CM1 register to 0
(low-speed on-chip oscillator on).
8Wait for 4 cycles of the sampling clock of the
digital filter.
9Set the VW1C0 bit in the VW1C register to 1 (voltage monitor 1 reset enabled).
Set the VW1C7 bit in the VW1C register to 1.
Set the VW1C1 bit in the VW1C register to 1
(digital filter disabled).
−
− (No wait time)
NOTE:
1. When the VW1C0 bit is set to 0 (disabled), steps 3, 4, and 5 can be executed simultaneously (with
1 instruction).
VCC
Vdet1
(Typ. 2.85 V)
1
fRING-S
1
fRING-S
× 32
× 32
When the VW1C1 bit is set
to 0 (digital filter enabled).
When the VW1C1 bit is set
to 1 (digital filter disabled)
and the VW1C7 bit is set
to 1.
VW1C1 and VW1C7: Bits in VW1C register
Internal reset signal
Internal reset signal
The above applies under the following conditions.
• VCA26 bit in VCA2 register = 1 (voltage detection 1 circuit enabled)
• VW1C0 bit in VW1C register = 1 (voltage monitor 1 r eset enabled)
• VW1C6 bit in VW1C register = 1 (voltage monitor 1 reset mode)
When the internal reset signal is held “L”, the pins, CPU and SFR are reset.
The internal reset signal level ch an ges f ro m “L” t o “H”, an d a pro gram is execut e d begi nn ing with th e addre ss ind icated by
the reset vector.
Refer to
Sampling clock of
digital filter
4. Special Function Registers (SFRs), for the SFR status after reset.
× 4 cycles
Figure 7.8Operating Example of Voltage Monitor 1 Reset
Rev.1.30Apr 14, 2006Page 48 of 233
REJ09B0222-0130
Page 64
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
7.3Voltage Monitor 2 Interrupt and Voltage Monitor 2 Reset
Table 7.3 lists the Setting Procedure of Voltage Monitor 2 Interrupt and Voltage Monitor 2 Reset
Associated Bits. Figure 7.9 shows an Operating Example of Voltage Monitor 2 Interrupt and Voltage
Monitor 2 Reset. To use voltage monitor 2 interrupt or voltage monitor 2 reset to exit stop mode, set the
VW2C1 bit in the VW2C register to 1 (digital filter disabled).
Table 7.3Setting Procedure of Voltage Monitor 2 Interrupt and Voltage Monitor 2 Reset
Associated Bits
When Using Digital FilterWhen Not Using Digital Filter
Step
1Set the VCA27 bit in the VCA2 register to 1 (voltage detection 2 circuit enabled).
2Wait for td(E-A)
(2)
3
(2)
4
(2)
5
6Set the VW2C2 bit in the VW2C register to 0 (passing of Vdet2 is not detected).
7Set the CM14 bit in the CM1 register to 0
8Wait for 4 cycles of the sampling clock of the
9Set the VW2C0 bit in the VW2C register to 1 (voltage monitor 2 interrupt/reset enabled).
NOTES:
1. Set the VW2C7 bit to 1 (when VCC reaches Vdet2 or below) for the voltage monitor 2 reset.
2. When the VW2C0 bit is set to 0 (disabled), steps 3, 4 and 5 can be executed simult aneously (with 1
instruction).
Voltage Monitor 2
Interrupt
Voltage Monitor 2
Reset
Select the sampling clock of the digital filter
by bits VW2F0 to VW2F1 in the VW2C
register.
Set the VW2C1 bit in the VW2C register to 0
(digital filter enabled).
Set the VW2C6 bit in
the VW2C register to
0 (voltage monitor 2
interrupt mode).
Set the VW2C6 bit in
the VW2C register to
1 (voltage monitor 2
reset mode).
(low-speed on-chip oscillator on).
digital filter.
Voltage Monitor 2
Interrupt
Voltage Monitor 2
Reset
Select the timing of the interrupt and reset
request by the VW2C7 bit in the VW2C
register
(1)
.
Set the VW2C1 bit in the VW2C register to 1
(digital filter disabled).
Set the VW2C6 bit in
the VW2C register to
0 (voltage monitor 2
interrupt mode).
Set the VW2C6 bit in
the VW2C register to
1 (voltage monitor 2
reset mode).
−
− (No wait time)
Rev.1.30Apr 14, 2006Page 49 of 233
REJ09B0222-0130
Page 65
R8C/18 Group, R8C/19 Group7. Volt age Detection Circuit
When the VW2C1 bit is set
to 0 (digital filter enabled).
When the VW2C1 bit is
set to 1 (digital filter
disabled) and the
VW2C7 bit is set to 0
(Vdet2 or above).
When the VW2C1 bit is
set to 1 (digital filter
disabled) and the
VW2C7 bit is set to 1
(Vdet2 or below).
Vdet2
(Typ. 3.30 V)
(1)
2.7 V
VCA13 bit
VW2C2 bit
Voltage monitor 2
interrupt request
(VW2C6 = 0)
Internal reset signal
(VW2C6 = 1)
VW2C2 bit
Voltage monitor 2
interrupt request
(VW2C6 = 0)
VW2C2 bit
Voltage monitor 2
interrupt request
(VW2C6 = 0)
Internal reset signal
(VW2C6 = 1)
VCC
1
0
Sampling clock of digital filter
× 4 cycles
1
0
1
0
1
0
Sampling clock of digital filter
× 4 cycles
Set to 0 by a program
Set to 0 by interrupt request
acknowledgement
Set to 0 by a program
Set to 0 by interrupt
request acknowledgement
Set to 0 by a program
Set to 0 by interrupt
request
acknowledgement
VCA13: Bit in VCA1 register
VW2C1, VW2C2, VW2C6, VW2C7: Bit in VW2C register
The above applies under the following conditions.
• VCA27 bit in VCA2 register = 1 (voltage detection 2 circuit enabled)
• VW2C0 bit in VW2C register = 1 (voltage monitor 2 interrupt and voltage monitor 2 reset enabled)
NOTE:
1. If voltage monitor 1 reset is not used, set the power supply to VCC ≥ 2.7.
Figure 7.9Operating Example of Voltage Monitor 2 Interrupt and Voltage Monitor 2 Reset
Rev.1.30Apr 14, 2006Page 50 of 233
REJ09B0222-0130
Page 66
R8C/18 Group, R8C/19 Group8. Processor Mode
8.Processor Mode
8.1Processor Modes
Single-chip mode can be selected as the processor mode. Table 8.1 lists Features of Processor Mode.
Figure 8.1 shows the PM0 Register and Figure 8.2 shows the PM1 Register.
Table 8.1Features of Processor Mode
Processor ModeAccessible AreasPins Assignable as I/O Port Pins
Single-chip modeSFR, internal RAM, internal ROM All pins are I/O port s or periphera l function
I/O pins.
Proces sor M ode Regi st er 0
b7 b6 b5 b4
NOTE:
b3 b2—b1 b0
000
1.
Set the PRC1 bit in the PRCR register to 1 (w rite enable) before rewriting the PM0 register.
SymbolAddressAfter Reset
PM00004h00h
Bit SymbolBit NameFunctionRW
—
(b2-b0)
PM03
—
(b7-b4)
Figure 8.1PM0 Register
Proces sor M ode Regi st er 1
b7 b6 b5 b4
0
b3 b2—b1 b0
0
SymbolAddressAfter Reset
PM10005h00h
(1)
Reserved bitsSet to 0.
Software reset bit
Nothing is assigned. If necessary, set to 0.
When read, the content is 0.
(1)
The MCU is reset w hen this bit is set to 1.
When read, the content is 0.
RW
RW
Bit SymbolBit NameFunctionRW
—
(b0)
—
(b1)
PM12
—
(b6-b3)
—
(b7)
NOTES:
1.
Set the PRC1 bit in the PRCR register to 1 (w rite enable) before rewriting the PM1 register.
2.—The PM12 bit is set to 1 by a program (and remains unchanged even if 0 is w ritten to it).
When the CSPRO bit in the CSPR register is set to 1 (count source protect mode enabled), the PM12 bit is
automatically set to 1.
Nothing is assigned. If necessary, set to 0.
When read, the content is undefined.
Reserved bitSet to 0.
WDT interrupt/reset switch bit
Nothing is assigned. If necessary, set to 0.
When read, the content is 0.
Reserved bitSet to 0.
Figure 8.2PM1 Register
Rev.1.30Apr 14, 2006Page 51 of 233
REJ09B0222-0130
The bus cycles differ when accessing ROM/RAM, and when accessing SF R. Table 9.1 lists Bus Cycles by
Access Space of the R8C/18 Group and Table 9.2 lists Bus Cycles by Access Space of the R8C/19 Group.
ROM/RAM and SFR are connected to the CPU by an 8-bit bus. When accessing in word (16-bit) units,
these areas are accessed twice in 8-bit units. Table 9.3 lists Access Units and Bus Operations.
Table 9.1Bus Cycles by Access Space of the R8C/18 Group
Access AreaBus Cycle
SFR2 cycles of CPU clock
ROM/RAM1 cycle of CPU clock
Table 9.2Bus Cycles by Access Space of the R8C/19 Group
Access AreaBus Cycle
SFR/data flash2 cycles of CPU clock
Program ROM/RAM1 cycle of CPU clock
Table 9.3Access Units and Bus Operations
Area
Even address
Byte access
Odd address
Byte access
Even address
Word access
Odd address
Word access
CPU clock
Address
Data
CPU clock
Address
Data
CPU clock
Address
Data
CPU clock
Address
Data
SFR, data flash
Even
Odd
Data
Data
Even + 1Even
Odd + 1Odd
Data
Data
Data
Data
CPU clock
Address
Data
CPU clock
Address
Data
CPU clock
Address
Data
CPU clock
Address
Data
ROM (program ROM), RAM
Even
Data
Odd
Data
Even
Data
Odd
Data
Even + 1
Odd + 1
Data
Data
Rev.1.30Apr 14, 2006Page 52 of 233
REJ09B0222-0130
• On-chip oscillator (oscillation stop detection function)
Ta ble 10.1 lists Specifications of Clock Generation Circuit. Figure 10.1 shows a Clock Generation Circuit.
Figures 9.2 to 10.5 show clock associated registers.
Table 10.1Specifications of Clock Generation Circuit
Item
Applications• CPU clock source
Clock frequency0 to 20 MHzApprox. 8 MHzApprox. 125 kHz
Connectable
oscillator
Oscillator
connect pins
Oscillation stop,
restart function
Oscillator status
after reset
OthersExternally
NOTE:
1. These pins can be used as P4_6 or P4_7 when using the on-chip oscillator clock as the CPU clock
while the main clock oscillation circuit is not used.
0 : Peripheral function clock does not stop
in wait mode.
1 : Peripheral function clock stops in
w ait mode.
—
Reserved bitSet to 1.
(b3)
—
Reserved bitSet to 0.
(b4)
(2, 4)
CM05
CM06
—
Main clock (XIN-XOUT ) stop bit
Syste m clock division select b it 0
Reserved bitSet to 0.
0 : Main clock oscillates.
1 : M ain clock stops.
(5)
0 : CM16, CM17 enabled
1 : Divide-by-8 mode
(3)
(b7)
NOTES:
1.
Set the PRC0 bit in the PRC R register to 1 (w rite enable) before rewriting the CM0 register.
2.
The CM05 bit stops the main clock when the on-chip oscillator mode is selected.
Do not use this bit to detect w hether the main clock is stopped. To stop the main clock, set the bits in the following
order:
(a) Set bits OCD 1 and OCD0 in the OCD register to 00b (oscillation stop detection function disabled).
(b) Set the OCD2 bit to 1 (selects on-chip oscillator clock).
3.
To i nput an external clock, set the CM05 bit to 1 (m ain clock stops) and the CM13 bit in the CM1 register to 1
(XIN-XOUT pin).
4.
When the CM05 bit is set to 1 (main clock stops), P4_6 and P4_7 can be used as input ports.
5. When entering stop mode from high or medi um speed m od e, the CM06 bit is set to 1 (divide-by-8 mode).
RW
RW
RW
RW
RW
RW
RW
Figure 10.2CM0 Register
Rev.1.30Apr 14, 2006Page 55 of 233
REJ09B0222-0130
Set the PRC0 bit in the PRC R register to 1 (w rite enable) before rewriting the CM1 register.
2.
When entering stop mode from high or medium speed mode, this bit is set to 1 (drive capacity high).
When the CM06 bit is set to 0 (bits CM16, CM17 enabled), bits C M16 to CM17 are enabled.
3.
I f the CM10 bit is set to 1 (stop mode), the on-chip feedback resistor is disabled.
4.
When the OCD2 bit is set to 0 (main clock selected), the CM14 bit is set to 1 (low -speed on-chip oscillator stopped).
5.
When the OCD2 bit is set to 1 (on-chip oscillator clock selected), the CM14 bit is set to 0 (low -speed on-chip
oscillator on). And remains unchanged even if 1 is w ritten to it.
6.
When using the voltage detection interrupt, set the CM14 bit to 0 (low-speed on-chip oscillator on).
When the CM10 bit is set to 1 (stop mode), or the CM05 bit in the CM0 register to 1 (main clock stops) and the CM13
7.
bit is set to 1 (XI N-XOUT pin), the XOUT (P4_7) pin becomes “H”.
When the CM13 bit is set to 0 (input ports, P 4_6, P4_7), P4_7 (XOUT) enters input mode.
Set the PRC0 bit in the PRC R register to 1 (w rite enable) before rewriting to this register.
2.
The OCD2 bit is automatically set to 1 (on-chip oscillator clock selected) if a main clock oscillation stop is detected
while bi ts OCD1 to OCD 0 are set to 11b (oscillation stop detection function enabled). If the OCD3 bit is set to 1 (main
clock stops), the OCD2 bit remains unchanged even w hen set to 0 (main clock selected).
3.
The OCD3 bit is enabled w hen bits OCD1 to OCD0 are set to 11b (oscillation stop detection function enabled).
4.
Set bits OCD1 to OC D0 to 00b (oscillation stop detection function disabled) before entering stop or on-chip oscillator
mode (mai n clock stops).
5.
The OCD3 bit remains 0 (main clock oscillates) if bits OCD1 to OCD0 are set to 00b.
6.
The CM14 bit i s set to 0 (low-speed on-chip oscillator on) if the OCD2 bit is set to 1 (on-chip oscillator clock
selected).
7.
Ref er to
Clock
Figure 10.9 Procedure for Switching Clock Source from Low-Speed On-Chip Oscillator to Main
for the switching procedure w hen the main clock re-oscillates after detecting an oscillation stop.
SymbolAddressAfter Reset
OCD
Bit SymbolBit NameFunctionRW
Oscillation stop detection enable
OCD0RW
bits
OCD1RW
System clock select bit
OCD2
OCD3
—
Clock m onitor bit
Reserved bitsSet to 0.
(b7-b4)
(1)
000Ch04h
b1 b0
0 0 : Oscillation stop detection function
disabled
0 1 : Do not set.
1 0 : Do not set.
1 1 : Oscillation stop detection function
enabled
(6)
0 : Selects main clock.
(4, 7)
(7)
1 : Selects on-chip oscillator clock.
(3, 5)
0 : Main clock oscillates.
1 : Main clock stops.
(2)
RW
RO
RW
Figure 10.4OCD Register
Rev.1.30Apr 14, 2006Page 57 of 233
REJ09B0222-0130
High-Sp eed On-Chi p Oscil l ator Cont rol Regi st er 0
b7 b6 b5 b4 b3 b2 b1 b0
000000
SymbolAddressAfter Reset
HRA0
Bit SymbolBit NameFunctionRW
HRA00RW
HRA01RW
—
High-speed on-chip oscillator enable
bit
High-speed on-chip oscillator select
(2)
bit
Reserved bitsSet to 0.
(b7-b2)
NOTES:
1.
Set the PRC0 bit in the PRCR register to 1 (w rite enable) before rew riting the HRA0 register.
2.
Change the HRA01 bit under the following conditions.
• HRA00 = 1 (high-speed on-chip oscillation)
• The CM14 bit in the CM1 register = 0 (low -speed on-chip oscillator on)
3.
When setting the HRA01 bit to 0 (low-speed on-chip oscillator selected), do not set the HRA00 bit to 0 (high-speed
on-chip oscillator off) at the same time.
Set the H RA00 bit to 0 after setting the HRA01 bit to 0.
Figure 10.5HRA0 Register
(1)
0020h00h
0 : High-speed on-chip oscillator off
1 : High-speed on-chip oscillator on
High-Sp eed On-Chi p Oscil l at o r Cont rol Regi st er 1
b7 b6 b5 b4 b3 b2 b1 b0
SymbolAddressAfter Reset
HRA1
0021h
The frequency of the high-speed on-chip oscillator is adjusted w ith bits 0 to 7.
High-speed on-chip oscillator frequency = 8 MH z
(HRA1 register = value when shipping ; fRING-fast mode 0)
Setting the HRA1 register to a lower value (minimum value: 00h), results in a higher
frequency.
Setting the HRA1 register to a higher value (maximum value: FFh), results in a lower
frequency.
NOTE:
1.
Set the PRC0 bit in the PRCR register to 1 (w rite enable) before rew riting the HRA1 register.
High-Sp eed On-Chi p Oscil l ator Cont rol Regi st er 2
The clocks generated by the clock generation circuits are described below.
10.1Main Clock
This clock is supplied by a main clock oscillation circuit. This clock is used as the clock source for the
CPU and peripheral function clocks. The main clock oscillation circuit is configured by connecting
resonator between the XIN and XOUT pins. The main clock oscillation circuit includes an on-chip
feedback resistor, which is disconnected from the oscillation circuit in stop mode in order to reduce the
amount of power consumed by the chip. The main clock oscillation circuit may also be configured by
feeding an externally generated clock to the XIN pin. Figure 10.7 shows Examples of Main Clock
Connection Circuit. During reset and after reset, the main clock stops.
The main clock starts oscillating when the CM05 bit in the CM0 register is set to 0 (main clock on) after
setting the CM13 bit in the CM1 register to 1 (XIN- XOUT pin).
To use the main clock for the CPU clock source, set the OCD2 bit in the OCD register to 0 (selects main
clock) after the main clock is oscillating stably.
The power consumption can be reduced by setting the CM05 bit in the CM0 register to 1 (main clock
stops) if the OCD2 bit is set to 1 (select on-chip oscillator clock).
When an external clock is input to the XIN pin, the main clock does not stop if the CM05 bit is set to 1. If
necessary, use an external circuit to stop the clock.
In stop mode, all clocks including the main clock stop. Refer to 10.4 Power Control for details.
MCU
(on-chip feedback resistor)
XIN
XOUT
Rd
(1)
COUTCIN
Ceramic resonator external circuit
NOTE:
1. Insert a damping resistor if required. The resistance will vary depending on the oscillator and the
oscillation drive capacity setting. Use the value recommended by the manufacturer of the oscillator.
When the oscillation drive capacity is set to low, check that oscillation is stable. Also, if the oscillator
manufacturer's data sheet specifies that a feedback resistor be added to the chip externally, insert a
feedback resistor between XIN and XOUT following the instructions.
Figure 10.7Examples of Main Clock Connection Circuit
MCU
(on-chip feedback resistor)
XIN
Externally derived clock
VCC
VSS
External clock input circuit
XOUT
Open
Rev.1.30Apr 14, 2006Page 60 of 233
REJ09B0222-0130
These clocks are supplied by the on-chip oscillators (high-speed on-chip oscillator and a low-speed onchip oscillator). The on-chip oscillator clock is selected by the HRA01 bit in the HRA0 register.
10.2.1Low-Speed On-Chip Oscillator Clock
The clock generated by the low-speed on-chip oscillator is used as the clock source for the CPU
clock, peripheral function clock, fRING, fRING128, and fRING-S.
After reset, the on-chip oscillator clock generated by the low-speed on-chip oscillator divided by 8 is
selected as the CPU clock.
If the main clock stops oscillating when bits OCD1 to OCD0 in the OCD register are set to 11b
(oscillation stop detection function enabled), the low-speed on-chip oscillator automatically starts
operating, supplying the necessary clock for the MCU .
The frequency of the low-speed on-chip oscillator varies depending on the supply voltage and the
operating ambient temperature. Application products must be designed with sufficient margin to
allow for the frequency changes.
10.2.2High-Speed On-Chip Oscillator Clock
The clock generated by the high-speed on-chip oscillator is used as the clock source for the CPU
clock, peripheral function clock, fRING, fRING128, and fRING1-fast.
After reset, the on-chip oscillator clock generated by the high -speed on-chip oscillator stops.
Oscillation is started by setting the HRA00 bit in the HRA0 register to 1 (high-speed on-chip oscillator
on). The frequency can be adjusted by registers HRA1 and HRA2.
Since there are differences in delay among the bits in the HRA1 register, make adjustments by
changing the settings of individual bits.
The high-speed on-chip oscillator frequency may be changed in flash memory CPU rewrite mode
during auto-program operation or auto- erase operation. Refer to 10.6.4 High-Speed On-ChipOscillator Clock for details.
Rev.1.30Apr 14, 2006Page 61 of 233
REJ09B0222-0130
There are a CPU clock to operate the CPU and a peripheral function clock to operate the peripheral
functions. Refer to Fig ure 10.1 Clock Generation Circuit.
10.3.1System Clock
The system clock is the clock source for the CPU and peripheral function clocks. Either the main
clock or the on-chip oscillator clock can be selected.
10.3.2CPU Clock
The CPU clock is an operating clock for the CPU and watchdog timer.
The system clock can be divided by 1 (no division), 2, 4, 8, or 16 to produce the CPU clock. Use the
CM06 bit in the CM0 register and bits CM16 to CM17 in the CM1 register to select the value of the
division.
After reset, the low-speed on-chip oscillator clock divided by 8 provides the CPU clock. When
entering stop mode from high-speed or medium-sp eed mode, the CM06 bit is set to 1 (Divid e-by-8
mode).
10.3.3Peripheral Function Clock (f1, f2, f4, f8, and f32)
The peripheral function clock is the operating clock for the peripheral functions.
The clock fi (i = 1, 2, 4, 8, and 32) is generated by the system clock divided by i. The clock fi is used
for timers X, Y, Z, and C, the serial interface and the comparator.
When the WAIT instruction is executed after setting the CM02 bit in the CM0 register to 1 (peripheral
function clock stops in wait mode), the clock fi stops.
10.3.4fRING and fRING128
fRING and fRING128 are operating clocks for the peripheral functions.
fRING runs at the same frequency as the on-chip oscillator clock and can be used as the source for
the timer X. fRING128 is generated from fRING by dividing it by 128, and it can be used as timer C.
When the WAIT instruction is executed, the clocks fRING and fRING128 do not stop.
10.3.5fRING-fast
fRING-fast is used as the count source for timer C. fRING-fast is generated by the high-speed onchip oscillator and supplied by setting the HRA00 bit to 1.
When the WAIT instruction is executed, the clock fRING-fast d oes not stop.
10.3.6fRING-S
fRING-S is an operating clock for the watchdog timer and voltage detection circuit. fRING-S is
supplied by setting the CM14 bit to 0 (low-speed on-chip oscillator on) and uses the clock generated
by the low-speed on-chip oscillator. When the WAIT instruction is executed or in count source protect
mode of the watchdog timer, fRING-S does not stop.
Rev.1.30Apr 14, 2006Page 62 of 233
REJ09B0222-0130
There are three power control modes. All modes other than wait mode and stop mode are referred to as
standard operating mode.
10.4.1Standard Operating Mode
Standard operating mode is further separated into four modes.
In standard operating mode, the CPU clock and the peripheral function clock are supplied to operate
the CPU and the peripheral function clocks. Power consumption control is enabled by controlling the
CPU clock frequency. The higher the CPU clock frequency, the more processing power increases.
The lower the CPU clock frequency, the more power consumption decreases. When unnecessary
oscillator circuits stop, power consumption is further reduced.
Before the clock sources for the CPU clock can be switched over, the new clock source needs to be
oscillating and stable. If the new clock source is the main clock, allow sufficient wait time in a
program until oscillation is stabilized before exiting.
Table 10.2Settings and Modes of Clock Associated Bits
Modes
High-speed mode000b100
Mediumspeed
mode
High-speed,
low-speed
on-chip
oscillator
(1)
mode
NOTE:
1. The low-speed on-chip oscillator is used as the on-chip oscillator clock when the CM14 bit in the
CM1 register is set to 0 (low-speed on-chip oscillator on) and the HRA01 bit in the HRA0 register is
set to 0. The high-speed on-chip oscillator is used as the on-chip oscillator clock when the HRA00
bit in the HRA0 register is set to 1 (high-speed on-chip oscillator A on) and the HRA01 bit in the
HRA0 register is set to 1.
Divide-by-2
Divide-by-4
Divide-by-8
Divide-by-16
No division100b−0−
The main clock divided by 1 (no division) provides th e CPU clock. If the CM14 bit is set to 0 (lowspeed on-chip oscillator on) or the HRA00 bit in the HRA0 register is set to 1 (high-speed on-chip
oscillator on), fRING and fRING128 can be used as timers X and C. When the HRA00 bit is set to 1,
fRING-fast can be used as timer C. When the CM14 bit is set to 0 (low-speed on-chip oscillator on),
fRING-S can be used for the watchdog timer and voltage detection circuit.
10.4.1.2Medium-Speed Mode
The main clock divided by 2, 4, 8, or 16 provides the CPU clock. If the CM14 bit is se t to 0 (lo w-speed
on-chip oscillator on) or the HRA00 bit in the HRA0 register is set to 1 (high-speed on-chip oscillator
on), fRING and fRING128 can be used as timers X and C. When the HRA00 bit is set to 1, fRINGfast can be used as timer C. When the CM14 bit is set to 0 (low-speed on-chip oscillator on), fRINGS can be used for the watchdog timer and voltage detection circui t.
10.4.1.3High-Speed and Low-Speed On-Chip Oscillator Modes
The on-chip oscillator clock divided by 1 (no division), 2, 4, 8, or 16 provides the CPU clock. The onchip oscillator clock is also the clock source for the peripheral function clocks. When the HRA00 bit is
set to 1, fRING-fast can be used as timer C. When the CM14 bit is set to 0 (low-speed on-chip
oscillator on), fRING-S can be used for the watchdog timer and voltage detection circuit.
10.4.2Wait Mode
Since the CPU clock stops in wait mode, the CPU, which operates using the CPU clock and the
watchdog timer when count source protection mode is disabled stop. The main clock and on-chip
oscillator clock do not stop and the peripheral functions using these clocks continue operating.
10.4.2.1Peripheral Function Clock Stop Function
If the CM02 bit is set to 1 (peripheral function clock stops in wait mode), the f1, f2, f4, f8, and f32
clocks stop in wait mode. This reduces power consumption.
10.4.2.2Entering Wait Mode
The MCU enters wait mode when the WAIT instruction is executed.
10.4.2.3Pin Status in Wait Mode
The status before wait mode was entered is maintained.
Rev.1.30Apr 14, 2006Page 64 of 233
REJ09B0222-0130
The MCU exits wait mode by a hardware reset or a peripheral function interrupt. To use a hardware
reset to exit wait mode, set bits ILVL2 to ILVL0 for the peripheral function interrupts to 000b
(interrupts disabled) before executing the WAIT instruction.
The peripheral function interrupts are affected by the CM02 bit. When the CM02 bit is set to 0
(peripheral function clock does not stop in wait mode), all peripheral function interrupts can be used
to exit wait mode. When the CM02 bit is set to 1 (peripheral function clock stops in wait mode), the
peripheral functions using the peripheral function clock stop operating and the peripheral functions
operated by external signals can be used to exit wait mode.
Table 10.3 lists Interrupts to Exit Wait Mode and Usage Conditions.
To use a peripheral function interrupt to exit wait mode, set up the following before executing the
WAIT instruction.
(1) Set the interrupt priority level in bits ILVL2 to ILVL0 in the interrupt control registers of the
peripheral function interrupts to be used for exiting wait mode. Set bits ILVL2 to ILVL0 of the
peripheral function interrupts that are not to be used for exiting wait mode to 000b (interrupt
disabled).
(2) Set the I flag to 1.
(3) Operate the peripheral function to be used for exiting wait mode.
When exiting by a peripheral function interrupt, the interrupt sequence is executed when an interrupt
request is generated and the CPU clock supply is started.
The CPU clock, when exiting wait mode by a peripheral function interrupt, is the same clock as the
CPU clock when the WAIT instruction is executed.
Table 10.3Interrupts to Exit Wait Mode and Usage Conditions
InterruptCM02 = 0CM02 = 1
Serial interface interruptUsable when operating with
internal or external clock
Key input interruptUsableUsable
Comparator conversion interrupt Usabl e in on e- sh ot mod e(Do not use)
Timer X interruptUsable in all modesUsable in event counter mode
Timer Z interruptUsable in all modes(Do not use)
Timer C interruptUsable in all modes(Do not use)
INT
interrupt
Voltage monitor 2 interruptUsableUsable
Oscillation stop detection
interrupt
Watchdog timer interruptUsable in count source protect
Usable
Usable(Do no t us e)
mode
Usable when operating with
external clock
Usable (INT0 and INT3 can be
used if there is no filter.)
Usable in count source protect
mode
Rev.1.30Apr 14, 2006Page 65 of 233
REJ09B0222-0130
Since the oscillator circuits stop in stop mode, the CPU clock and peripheral function clock stop and
the CPU and peripheral functions that use these clocks stop operating. The least power required to
operate the MCU is in stop mode. If the voltage applied to the VCC pin is VRAM or more, the
contents of internal RAM is maintained.
The peripheral functions clocked by external signals continue operating. Table 10.4 lists Interrupts to
Exit Stop Mode and Usage Conditions.
Table 10.4Interrupts to Exit Stop Mode and Usage Conditions
InterruptUsage Conditions
Key input interrupt−
INT0
to INT1 interruptsINT0 can be used if there is no filter.
INT3
interrupt
Timer X interruptWhen external pulse is counted in event counter mode.
Serial interface interruptWhen external clock is selected.
Volt age monitor 2 interruptUsable in digital filter disabled mode (VW2C1 bit in VW2C register
No filter. Interr upt request is generated at INT3
TCC0 register is set to 1).
is set to 1)
input (TCC06 bit in
10.4.3.1Entering Stop Mode
The MCU enters stop mode when the CM10 bit in the CM1 register is set to 1 (all clocks sto p). At the
same time, the CM06 bit in the CM0 register is set to 1 (Divide-by-8 mode) and the CM15 bit in the
CM10 register is set to 1 (main clock oscillation circuit drive capacity high).
When using stop mode, set bits OCD1 to OCD0 to 00b (oscillation stop detection function disabled)
before entering stop mode.
10.4.3.2Pin Status in Stop Mode
The status before wait mode was entered is maintained.
However, when the CM13 bit in the CM1 register is set to 1 (XIN-XOUT pins), the XOUT(P4_7) pin is
held “H”. When the CM13 bit is set to 0 (input ports P4_6 and P4_7), the P4_7(XOUT) pin is held in
input status.
10.4.3.3Exiting Stop Mode
The MCU exits stop mode by a hardware reset or peripheral function interrupt.
When using a hardware reset to exit stop mode, set bits ILVL2 to ILVL0 for the peripheral function
interrupts to 000b (interrupts disabled) before setting the CM10 bit to 1.
When using a peripheral function interrupt to exit stop mode, set up the following before setting the
CM10 bit to 1.
(1) Set the interrupt priority level in bits ILVL2 to ILVL0 of the peripheral function interrupts to be
used for exiting stop mode. Set bits ILVL2 to ILVL0 of the peripher al function inte rrupt s that are
not to be used for exiting stop mode to 000b (interrupt disabled).
(2) Set the I flag to 1.
(3) Operate the peripheral function to be used for exiting stop mode.
When exiting by a peripheral function interrupt, the interrupt sequence is executed when an interrupt
request is generated and the CPU clock supply is started.
The CPU clock, when exiting stop mode by a peripheral function interrupt, is the Divide-by-8 of the
clock which was used before stop mode was entered.
Rev.1.30Apr 14, 2006Page 66 of 233
REJ09B0222-0130
The oscillation stop detection function detects the stop of the main clock oscillation circuit. The
oscillation stop detection function can be enabled and disabled by bits OCD1 to OCD0 in the OCD
register.
Table 10.5 lists the Specifications of Oscillation Stop Detection Function.
When the main clock is the CPU clock source and bits OCD1 to OCD0 are set to 11b (oscillation stop
detection function enabled), the system is placed in the following state if the main clock stops.
• OCD2 bit in OCD register = 1 (on-chip oscillator clock selected)
• OCD3 bit in OCD register = 1 (main clock stops)
• CM14 bit in CM1 register = 0 (low-speed on-c hip oscillator oscillates )
• Oscillation stop detection interrupt request is generated.
Table 10.5Specifications of Oscillation Stop Detection Function
ItemSpecification
Oscillation stop detection enable clock
and frequency bandwidth
Enabled condition for oscillation stop
detection function
Operation at oscillation stop detectionOscillation stop detection interrupt is generated
f(XIN) ≥ 2 MHz
Set bits OCD1 to OCD0 to 11b (oscillation stop detection
function enabled).
10.5.1How to Use Oscillation Stop Detection Function
• The oscillation stop detection interrupt shares a vector with the voltage monitor 2 interrupt, and
the watchdog timer interrupt. When using the oscillation stop detection interrupt and watchdog
timer interrupt, the interrupt source needs to be determined . Table 10.6 lists Determining Interrupt
Source for Oscillation Stop Detection, Watchdog Timer, and Voltage Monitor 2 Interrupts.
• When the main clock restarts after oscillation stop, switch the main clock to the clock source of
the CPU clock and peripheral functions by a program.
• Figure 10.9 shows the Procedure for Switching Clock Source from Low-Speed On-Chip Oscillator
to Main Clock.
• To enter wait mode while using the oscillation stop detection function, set the CM02 bit to 0
(peripheral function clock does not stop in wait mode).
• Since the oscillation stop detection function is a function for cases where the main clock is
stopped by an external cause, set bits OCD1 to OCD0 to 00b (oscillation stop detection function
disabled) when the main clock stops or is started by a program, (stop mode is selected or the
CM05 bit is changed).
• This function cannot be used when the main clock frequency is 2 MHz or below. In this case, set
bits OCD1 to OCD0 to 00b (oscillation stop detection function disabled).
• To use the low-speed on-chip oscillator clock for the CPU clock and clock sources of peripheral
functions after detecting the oscillation stop, set the HRA01 bit in the HRA0 register to 0 (lowspeed on-chip oscillator selected) and bits OCD1 to OCD0 to 11b (oscillation stop detection
function enabled).
To us e the high-speed on-chip oscillator clock for the CPU cloc k and clock sources of peripheral
functions after detecting the oscillation stop, set the HRA01 bit to 1 (high-speed on-chip oscillator
selected) and bits OCD1 to OCD0 to 11b (oscillation stop detection function enabled).
Rev.1.30Apr 14, 2006Page 68 of 233
REJ09B0222-0130
Table 10.6Determining Interrupt Source for Oscillation Stop Detection, Watchdog Timer, and
Voltage Monitor 2 Interrupts
Generated Interrupt SourceBit Showing Interrupt Cause
Oscillation stop detection
((a) or (b))
(a) OCD3 bit in OCD register = 1
(b) Bits OCD1 to OCD0 in OCD register = 11b and OCD2 bit = 1
Watchdog timerVW2C3 bit in VW2C register = 1
Voltage monitor 2VW2C2 bit in VW2C register = 1
Switch to main clock
Determine OCD3 bit
0 (main clock oscillates)
Judge several times
Determine several times that the main clock is supplied
Set bits OCD1 to OCD0 to 00b
(oscillation stop detection function
disabled)
Set OCD2 bit to 0
(select main clock)
End
1 (main clock stops)
OCD3 to OCD0: Bits in OCD regist er
Figure 10.9Procedure for Switching Clock Source from Low-Speed On-Chip Oscillator to Main
Clock
Rev.1.30Apr 14, 2006Page 69 of 233
REJ09B0222-0130
When entering stop mode or wait mode, an instruction queue pre-reads 4 bytes from the WAIT
instruction or an instruction that sets the CM10 bit in the CM1 register to 1 (stops all clocks) before the
program stops. Therefore, insert at least four NOPs after the WAIT instruction or an instr uction that
sets the CM10 bit to 1.
10.6.2Oscillation Stop Detection Function
Since the oscillation stop detection function cannot be used if the main clock frequency is below 2
MHz, set bits OCD1 to OCD0 to 00b (oscillation stop detection function disabled) in this case.
10.6.3Oscillation Circuit Constants
Ask the manufacturer of the oscillator to specify the best oscillation circuit constants for your system.
10.6.4High-Speed On-Chip Oscillator Clock
The high-speed on-chip oscillator frequency may be changed up to 10%(1) in flash memory CPU
rewrite mode during auto-program operation or auto-erase operation.
The high-speed on-chip oscillator frequency after auto-program operation ends or auto-erase
operation ends is held the state before the program command or block era se command is gene ra ted.
Also, this note is not applicable when the read array command, read status register command, or
clear status register command is generated. The application products must be designed with careful
considerations for the frequency change.
NOTE:
1. Change ratio to 8 MHz frequency adjusted in shipping.
Rev.1.30Apr 14, 2006Page 70 of 233
REJ09B0222-0130
Page 86
R8C/18 Group, R8C/19 Group11. Protection
r
11. Protection
The protection function protects important registers from being easily overwritten when a program runs out
of control. Figure 11.1 shows the PRCR Register. The registers protected by the PRCR register are listed
below.
• Registers protected by PRC0 bit: Registers CM0, CM1, OCD, HRA0, HRA1, and HRA2
• Registers protected by PRC1 bit: Registers PM0 and PM1
• Registers protected by PRC3 bit: Registers VCA2, VW1C, and VW2C
Prot ect Regist e
b3 b2 b1 b0b7 b6 b5 b4
000
SymbolAddressAfter Reset
PRCR
Bit SymbolBit NameFunctionRW
Protect bit 0Writing to registers CM0, CM , OCD, HRA0, HRA1,
PRC0RW
Protect bit 1Writing to registers PM0 and PM1 is enabled.
PRC1RW
000Ah00h
and HRA2 is enabled.
0 : Disables w riting
1 : Enables w riting
0 : Disables w riting
1 : Enables w riting
—
(b2)
PRC3
—
(b5-b4)
—
(b7-b6)
Figure 11.1PRCR Register
Reserved bitSet to 0.
Protect bit 3Writing to registers VCA2, VW1C, and VW2C is
enabled.
0 : Disables w riting
1 : Enables w riting
Reserved bitsSet to 0.
Reserved bitsWhen read, the content is 0.
RW
RW
RW
RO
Rev.1.30Apr 14, 2006Page 71 of 233
REJ09B0222-0130
Page 87
R8C/18 Group, R8C/19 Group12. Interrupts
12. Interrupts
12.1Interrupt Overview
12.1.1Types of Interrupts
Figure 12.1 shows the types of Interrupts.
Undefined instruction (UND instruction)
Software
(non-maskable interrupts)
Overflow (INTO instruction)
BRK instruction
INT instruction
Interrupt
Special
(non-maskable interrupts)
Hardware
Peripheral Function
(maskable interrupts)
NOTES:
1. Peripheral function interrupts in the MCU are us ed to generate peripheral interrupts.
2. Do not use this interrupt. This is for use with development tools only.
(1)
Watchdog timer
Oscillation stop detection
Voltage monitor 2
Single step
Address match
Figure 12.1Interrupts
• Maskable interrupts: The interrupt enable flag (I flag) enables or disables these interrupts.
The interrupt priority order can be changed based on the interrupt
priority level.
• Non-maskable interrupts: The interrupt enable flag (I flag) does not enable or disable interrupts.
The interrupt priority order cannot be changed based on interrupt
priority level.
(2)
Rev.1.30Apr 14, 2006Page 72 of 233
REJ09B0222-0130
Page 88
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.2Software Interrupts
A software interrupt is generated when an instruction is executed. Software interrupts are nonmaskable.
12.1.2.1Undefined Instruction Interrupt
The undefined instruction interrupt is generated when the UND instruction is executed.
12.1.2.2Overflow Interrupt
The overflow interrupt is generated when the O flag is set to 1 (arith metic operation o verflow) and the
INTO instruction is executed. Instructions that set the O flag are: ABS, ADC, ADCF, ADD, CMP, DIV,
DIVU, DIVX, NEG, RMPA, SBB, SHA, and SUB.
12.1.2.3BRK Interrupt
A BRK interrupt is generated when the BRK instruction is executed.
12.1.2.4INT Instruction Interrupt
An INT instruction interrupt is generated when the INT instruction is executed. The INT instruction
can select software interrupt numbers 0 to 63. Sof tware interr upt numbers 4 to 31 are assig ned to the
peripheral function interrupt. Therefore, the MCU executes the same interrupt routine when the INT
instruction is executed as when a peripheral function interrupt is generated. For software interrupt
numbers 0 to 31, the U flag is saved to the stack during instruction execution and the U flag is set to
0 (ISP selected) before the interrupt sequence is executed. The U flag is restored from the stack
when returning from the interrupt routine. For software interrupt numbers 32 to 63, the U flag does
not change state during instruction execution, and the selected SP is used.
Rev.1.30Apr 14, 2006Page 73 of 233
REJ09B0222-0130
Page 89
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.3Special Interrupts
Special interrupts are non-maskable.
12.1.3.1Watchdog Timer Interrupt
The watchdog timer interrupt is generated by the watchdog timer. Reset the watchdog timer af ter the
watchdog timer interrupt is generated. For details, refer to 13. Watchdog Timer.
12.1.3.2Oscillation Stop Detection Interrupt
The oscillation stop detection interrupt is generated by the oscillation stop detection function. For
details of the oscillation stop detection function, refer to 10. Clock Generation Circuit.
12.1.3.3Voltage Monitor 2 Interrupt
The voltage monitor 2 interrup t is genera ted by th e volt age detection circuit. For de t ails of the volt age
detection circuit, refer to 7. Voltage Detection Circuit.
12.1.3.4Single-Step Interrupt, and Address Break Interrupt
Do not use these interrupts. They are for use by development tools only.
12.1.3.5Address Match Interrupt
The address match interrupt is generated immediately before executing an instruction that is stored
at an address indicated by registers RMAD0 to RMAD1 when the AIER0 or AIER1 bit in the AIER
register is set to 1 (address match interrupt enable). For details of the address match interrupt, refer
to 12.4 Address Match Interrupt.
12.1.4Peripheral Function Interrupt
The peripheral function interrupt is generated by the internal peripheral function of the MCU and is a
maskable interrupt. Refer to Table 12.2 Relocatable Vector Tables for sources of the peripheral
function interrupt. For details of peripheral functions, refer to the descriptions of individual peripheral
functions.
Rev.1.30Apr 14, 2006Page 74 of 233
REJ09B0222-0130
Page 90
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.5Interrupts and Interrupt Vectors
There are 4 bytes in each vector. Set the starting address of an interrupt routine in each interrupt
vector. When an interrupt request is acknowledged, the CPU branches to the address set in the
corresponding interrupt vector. Figure 12.2 shows an Interrupt Vector.
MSBLSB
Vector address (L)
Low address
Mid address
High address0 0 0 0
Vector address (H)
Figure 12.2Interrupt Vector
0 0 0 00 0 0 0
12.1.5.1Fixed Vector Tables
The fixed vector tables are allocated addresses 0FFDChto 0FFFFh. Table 12.1 lists the Fixed Vector
Tables. The vector addresses (H) of fixed vectors are used by the ID code check function. For
details, refer to 17.3 Functions to Prevent Rewriting of Flash Memory.
Table 12.1Fixed Vector Tables
Interrupt Source
Undefined instruction0FFDCh to 0FFDFhInterrupt on UND
Overflow0FFE0h to 0FFE3hInterrupt on INTO
BRK instruction0FFE4h to 0FFE7hIf the content of address
Address match0FFE8h to 0FFEBh12.4 Address Match
Single step
• Watchdog timer
• Oscillation stop
detection
• Voltage monitor 2
Address break
(Reserved)0FFF8h to 0FFFBh
Reset0FFFCh to 0FFFFh5. Resets
NOTE:
1. Do not use these interrupts. They are for use by development tools only.
(1)
(1)
Vector Addresses
Address (L) to (H)
instruction
instruction
0FFE7h is FFh, program
execution starts from the
address shown by the
vector in the relocatable
vector table.
0FFECh to 0FFEFh
0FFF0h to 0FFF3h• 13. Watchdog Timer
0FFF4h to 0FFF7h
RemarksReference
R8C/Tiny Series Sof tware
Manual
Interrupt
• 10. Clock Generation
Circuit
• 7. Voltage Detection
Circuit
Rev.1.30Apr 14, 2006Page 75 of 233
REJ09B0222-0130
Page 91
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.5.2Relocatable Vector Tables
The relocatable vector tables occupy 256 bytes beginning from the starting address set in the INTB
register. Table 12.2 lists the Relocatable Vector Tables.
Table 12.2Relocatable Vector Tables
Interrupt Source
BRK instruction
(2)
Vector Address
Address (L) to Address (H)
+0 to +3 (0000h to 0003h)0R8C/Tiny Series
(1)
(Reserved)1 to 12
Key input+52 to +55 (0034h to 0037h)1312.3 Key Input Interrupt
Comparator conversion +56 to +59 (0038h to 003Bh)1416. Comparator
(Reserved)15
Compare 1+64 to +67 (0040h to 0043h)1614.3 Timer C
UART0 transmit+68 to +71 (0044h to 0047h)1715. Serial Interface
UART0 receive+72 to +75 (0048h to 004Bh)18
UART1 transmit+76 to +79 (004Ch to 004Fh)19
UART1 receive+80 to +83 (0050h to 0053h)20
(Reserved)21
Timer X+88 to +91 (0058h to 005Bh)2214.1 Timer X
(Reserved)23
Timer Z+96 to +99 (0060h to 0063h)2414.2 Timer Z
INT1
INT3
+100 to +103 (0064h to 0067h)25
+104 to +107 (0068h to 006Bh)26
Timer C+108 to +111 (006Ch to 006Fh)2714.3 Timer C
Compare 0+112 to +115 (0070h to 0073h)28
INT0
+116 to +119 (0074h to 0077h)29
(Reserved)30
(Reserved)31
Software interrupt
(2)
+128 to +131 (0080h to 0083h) to
+252 to +255 (00FCh to 00FFh)
NOTES:
1. These addresses are relative to those in the INTB register.
2. The I flag does not disable these interrupts.
Software
Interrupt Number
Software Manual
12.2 INT
12.2 INT
32 to 63R8C/Tiny Series
Software Manual
Reference
interrupt
interrupt
Rev.1.30Apr 14, 2006Page 76 of 233
REJ09B0222-0130
Page 92
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.6Interrupt Control
The following describes enabling and disabling the maskable interrupts and setting the priority for
acknowledgement. The explanation does not apply to nonmaskable interrupts.
Use the I flag in the FLG register, IPL, and bits ILVL2 to ILVL0 in each interrupt control register to
enable or disable maskable interrupts. Whether an interrupt is requested is indicated by the IR bit in
each interrupt control register.
Figure 12.3 shows the Interrupt Control Register and Figure 12.4 shows the INT0IC Register
Noth ing is assi gned. If necessary, set to 0.
When read, the content is undefined.
12.5.5 Changing Interrupt
(1)
RW
(3)
RW
RW
—
Figure 12.4INT0IC Register
Rev.1.30Apr 14, 2006Page 78 of 233
REJ09B0222-0130
Page 94
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.6.1I Flag
The I flag enables or disables maskable interrupts. Setting the I flag to 1 (enabled) ena bles maskable
interrupts. Setting the I flag to 0 (disabled) disables all maskable interrupts.
12.1.6.2IR Bit
The IR bit is set to 1 (interrupt requested) when an interrupt request is generated. Then, when the
interrupt request is acknowledged and the CPU branches to the corresponding interrupt vector, the
IR bit is set to 0 (= interrupt not requested).
The IR bit can be set to 0 by a program. Do not write 1 to this bit.
12.1.6.3Bits ILVL2 to ILVL0 and IPL
Interrupt priority levels can be set using bits ILVL2 to ILVL0.
Table 12.3 lists the Settings of Interrupt Priority Levels and Table 12.4 lists the Interrupt Priority
Levels Enabled by IPL.
The following are conditions under which an interrupt is acknowledged:
• I flag = 1
• IR bit = 1
• Interrupt priority level > IPL
The I flag, IR bit, bits ILVL2 to ILVL0 and IPL are independent of each other. They do not affect one
another.
IPLEnabled Interrupt Priority Levels
000bInterrupt level 1 and above
001bInterrupt level 2 and above
010bInterrupt level 3 and above
011bInterrupt level 4 and above
100bInterrupt level 5 and above
101bInterrupt level 6 and above
110bInterrupt level 7 and above
111bAll maskable interrupts are disabled
Rev.1.30Apr 14, 2006Page 79 of 233
REJ09B0222-0130
Page 95
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.6.4Interrupt Sequence
An interrupt sequence is performed between an interrupt re quest acknowledge ment and interrupt
routine execution.
When an interrupt request is generated while an instruction is being executed, the CPU determines
its interrupt priority level after the instruction is completed. The CPU starts the interrupt sequence
from the following cycle. However, for the SMOVB, SMOVF, SSTR, or RMPA instruction, if an
interrupt request is generated while the instruction is being executed, the MCU suspends the
instruction to start the interrupt sequence. The interrupt sequence is perform ed as indicated below.
Figure 12.5 shows the Ti me Required for Executing Interrupt Sequence.
(1) The CPU gets interrupt information (interrupt number and interrupt request level) by reading
address 00000h. The IR bit for the corresponding interrupt is set to 0 (interrupt not req uested).
(2) The FLG register is saved to a temporary register
the interrupt sequence.
(3) The I, D, and U flags in the FLG register are set as follows:
The I flag is set to 0 (interrupts disabled).
The D flag is set to 0 (single-step interrupt disabled).
The U flag is set to 0 (ISP selected).
However, the U flag does not change state if an INT instruction for software interrupt numbers
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 acknowledged interrupt is set in the IPL.
(7) The starting address of the interrupt routine set in the interrupt vector is stored in the PC.
(1)
in the CPU immediately before entering
After the interrupt sequence is completed, instructions are executed from the starting address of the
interrupt routine.
NOTE:
1. This register cannot be used by user.
CPU clock
Address bus
Data bus
The undefined state depends on the instruction queue buffer. A read cycle occurs when the i nstruction queue buffer is
ready to acknowledge instructions.
1234567891011121314151617181920
RD
WR
Address
0000h
Interrupt
information
Undefined
Undefined
Undefined
SP-2 SP-1 SP-4SP-3VECVEC+1VEC+2PC
SP-2
contents
SP-1
contents
SP-4
contents
SP-3
contents
contents
VEC
VEC+1
contents
VEC+2
contents
Figure 12.5Time Required for Executing Interrupt Sequen ce
Rev.1.30Apr 14, 2006Page 80 of 233
REJ09B0222-0130
Page 96
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.6.5Interrupt Response Time
Figure 12.6 shows the Interrupt Response Time. The interrupt response time is the period between
an interrupt request generation and the execution of the first instruction in the interrupt routine. The
interrupt response time includes the period between interrupt request generation and the completion
of execution of the instruction (refer to (a) in Figure 12.6) and the period required to perform the
interrupt sequence (20 cycles, refer to (b) in Figure 12.6).
Interrupt request is generated. Interrupt request is acknowledged.
Time
InstructionInterrupt sequence
(a)20 cycles (b)
Interrupt response time
(a) Period between interrupt request generation and the completion of execution of an
instruction. The length of time varies depending on the instruction being executed. The
DIVX instruction requires the longest time, 30 cycles (assuming no wait states and that a
register is set as the divisor).
(b) 21 cycles for address match and s ingle-step interrupts.
Instruction in
interrupt routine
Figure 12.6Interrupt Response Time
12.1.6.6IPL Change when Interrupt Request is Acknowledged
When an interrupt request of a maskable interrupt is acknowledged, the interrupt priority level of the
acknowledged interrupt is set in the IPL.
When a software interrupt or special interrupt request is acknowledged, the level listed in Table 12.5
is set in the IPL. Table 12.5 lists the IPL Value When Software or Special Interrupt Is Acknowledged.
Table 12.5IPL Value When Software or Special Interrupt Is Acknowledged
Interrupt SourceValue Set in IPL
Watchdog timer, oscillation stop detection, voltage monitor 27
Software, address match, single-step, address breakNot changed
Rev.1.30Apr 14, 2006Page 81 of 233
REJ09B0222-0130
Page 97
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.6.7Saving a Register
In the interrupt sequence, the FLG register and PC are saved to the sta ck.
After an extended 16 bits, 4 high-order bits in the PC and 4 high-order (IPL) and 8 low-order bits in
the FLG register, are saved to the stack, the 16 low-order bits in the PC are saved. Figure 12.7
shows the Stack State Before and After Acknowledgement of Interrupt Request.
The other necessary registers are saved by a program at the beginning of the interrupt routine. The
PUSHM instruction can save several registers in the register bank being currently used
single instruction.
NOTE:
1. Selectable from registers R0, R1, R2, R3, A0, A1, SB, and FB.
(1)
with a
Address
m−4
m−3
m−2
m−1
m
m+1
Stack state before interrupt request
is acknowledged
Stack
Previous stack contents
Previous stack contents
NOTE:
1.When executing software number 32 to 63 INT instructions,
this SP is specified by the U flag. Otherwise it is ISP.
LSBMSB
[SP]
SP value before
interrupt is generat ed
Address
m−4
m−3
m−2
m−1
m
Previous stack contents
m+1
Previous stack contents
Stack state after interrupt request
is acknowledged
Stack
PCL
PCM
FLGL
FLGHPCH
LSBMSB
[SP]
New SP value
PCH: 4 high-order bits of PC
PCM : 8 middle-order bits of PC
PCL: 8 low-order bits of PC
FLGH : 4 high-order bits of FLG
FLGL : 8 low-order bits of FLG
Figure 12.7Stack State Before and After Acknowledgement of Interrupt Request
The register saving operation, which is performed as p art of the interrupt seq uence, sa ved in 8 bits at
a time in four steps. Figure 12.8 shows the Register Saving Operation.
.
Address
[SP]−5
[SP]−4
[SP]
−3
[SP]
−2
[SP]−1
[SP]
NOTE:
1. [SP] indicates the initial value of the SP when an interrupt request is acknowledged.
After registers are saved, the SP content is [SP] minus 4. When executing software number 32 to 63
INT instructions, this SP is specified by the U flag. Otherwise it is ISP.
Stack
PCL
PCM
FLGL
FLGHPCH
Figure 12.8Register Saving Operation
Rev.1.30Apr 14, 2006Page 82 of 233
REJ09B0222-0130
Sequence in which
order registers are
saved
(3)
(4)
Saved, 8 bits at a time
(1)
(2)
Completed saving
registers in four
operations.
PCH: 4 high-order bits of PC
PCM: 8 middle-order bits of PC
PCL: 8 low-order bits of PC
FLGH : 4 high-order bits of FLG
FLGL : 8 low-order bits of FLG
Page 98
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.6.8Returning from an Interrupt Routine
When the REIT instruction is executed at the end of an interrupt routine, the FLG register and PC,
which have been saved to the stack, are automatically restored. The program, that was running
before the interrupt request was acknowledged, starts running again.
Restore registers saved by a program in an interrupt routine using the POPM instruction or others
before executing the REIT instruction.
12.1.6.9Interrupt Priority
If two or more interrupt requests are generated while a single instruction is being executed, the
interrupt with the higher priority is acknowledged.
Set bits ILVL2 to ILVL0 to select the desired priority level for maskable interrupts (peripheral
functions). However, if two or more maskable interrupts have the same priority level, their interrupt
priority is resolved by hardware, and the higher priority interrupts acknowledged.
The priority levels of special interrupts, such as reset (reset has the highest priority) and watchdog
timer, are set by hardware. Figure 12.9 shows the Priority Levels of Hardware Interrupts.
The interrupt priority does not affect software interrupts. The MCU jumps to the interrupt routine
when the instruction is executed.
Reset
Address break
Watchdog timer
Oscillation stop detection
Voltage monitor 2
Peripheral function
Single step
Address match
Figure 12.9Priority Levels of Hardware Interrupts
High
Low
Rev.1.30Apr 14, 2006Page 83 of 233
REJ09B0222-0130
Page 99
R8C/18 Group, R8C/19 Group12. Interrupts
12.1.6.10 Interrupt Priority Judgement Circuit
The interrupt priority judgement circuit selects the highest priority in terrupt, a s shown in Figu re 12.10.
Priority level of each interrupt
Compare 0
INT3
Timer Z
Timer X
INT0
Timer C
INT1
UART1 receive
UART0 receive
Compare 1
Comparator conversion
UART1 transmit
UART0 transmit
Level 0 (default value)
Highest
Priority of peripheral function interrupts
(if priority levels are same)
Rev.1.30Apr 14, 2006Page 84 of 233
REJ09B0222-0130
Page 100
R8C/18 Group, R8C/19 Group12. Interrupts
_
_
_
12.2INT Interrupt
12.2.1INT0 Interrupt
The INT0 interrupt is generated by an INT0 input. When using the INT0 interrupt, the INT0EN bit in
the INTEN register is set to 1 (enable). The edge polarity is selected using the INT0PL bit in the
INTEN register and the POL bit in the INT0IC register.
Inputs can be passed through a digital filter with three different sampling clocks.
The INT0
Figure 12.11 shows Registers INTEN and INT0F.
Ext ernal Input E nabl e Regi st e r
0
000RW00
NOTES:
1.
2.
3.
pin is shared with the external trigger input pin of timer Z.
b3 b2 b1 b0b7 b6 b5 b4
SymbolAddressAfter Reset
INTEN
Bit SymbolBit NameFunctionRW
INT0EN
INT0PL
—
(b7-b2)
Set the INT0EN bit while the INOSTG bit in the PUM register is set to 0 (one-shot trigger disabled).
When setting the INT0PL bit to 1 (both edges), set the POL bit in the INT0IC register to 0 (selects falling edge).
The IR bit in the INT0IC register may be set to 1 (requests interrupt) w hen the INT0PL bit is rew ritten. Refer to
Changing Interrupt Sources
____
INT0
input enable bi t
____
INT0
input polarity select bit
.
0096h00h
(1)
(2, 3)
0 : Disable
1 : Enable
0 : One edge
1 : Both edges
Set to 0.Reserved bits
RW
RW
12.5.5
_____
INT0
Input Fi l t er Select Regist er
b3 b2 b1 b0b7 b6 b5 b4
0
SymbolAddressAfter Reset
INT0F
Bit SymbolBit Nam eFunctionRW
_____
INT0
INT0F0RW
INT0F1RW
—
(b2)
—
(b7-b3)
input filter select bits
Reserved bit
Noth ing is assi gned. If necessar y, set to 0.
When read, the content is 0.
001Eh00h
Figure 12.11Registers INTEN and INT0F
b1 b0
0 0 : No filter
0 1 : Filter with f1 sampling
1 0 : Filter with f8 sampling
1 1 : Filter with f32 sampling
Set to 0.
RW
—
Rev.1.30Apr 14, 2006Page 85 of 233
REJ09B0222-0130
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.