Before using this material, please visit our website to verify that this is the most
updated document available.
Rev. 2.30
Revision date: Sep 01, 2004
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
How to Use This Manual
1. Introduction
This hardware manual provides detailed information on the M16C/62P Group (M16C/62P, M16C/62PT) of
microcomputers.
Users are expected to have basic knowledge of electric circuits, logical circuits and microcomputers.
2. Register Diagram
The symbols, and descriptions, used for bit function in each register are shown below.
XXX Register
b7 b6 b5 b4 b3 b2 b1 b0
0
0
Symbol Address After Reset
XXX XXX 00h
Bit Symbol
XXX0
XXX1
(b2)
(b4 - b3)
XXX5
XXX6
XXX7
*1
Bit Name
b1b0
0 0: XXX
XXX Bit
Nothing is assigned.
When write, set to "0". When read, its content is indeterminate.
Reserved Bit
XXX Bit
XXX Bit
0 1: XXX
1 0: Do not set a value
1 1: XXX
Set to "0"
Function varies depending on mode
of operation
0: XXX
1: XXX
Function
*5
*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 concerned. As the bit may be use for future functions,
set to "0" when writing to this bit.
• Do not set to this value
The operation is not guaranteed when a value is set.
• Function varies depending on mode of operation
Bit function varies depending on peripheral function mode.
Refer to respective register for each mode.
*5
Follow the text in each manual for binary and hexadecimal notations.
RW
*2
RW
RW
*3
WO
*4
RW
RW
RO
Page 4
3. M16C Family Documents
The following documents were prepared for the M16C family.
Document Contents
Short SheetHardware overview
Data SheetHardware overview and electrical characteristics
Hardware ManualHardware specifications (pin assignments, memory maps, peripheral
12.5 Interrupt Control ......................................................................................................94
12.5.1 I Flag...............................................................................................................................................96
12.5.2 IR Bit...............................................................................................................................................96
12.5.3 ILVL2 to ILVL0 Bits and IPL..........................................................................................................96
Table 1.1 to table 1.3 list performance outline of M16C/62P group (M16C/62P, M16C/62PT).
Table 1.1 Performance Outline of M16C/62P group (M16C/62P) (128-pin version)
ItemPerformance
M16C/62P
CPU
Peripheral
Function
Electric
Characteristics
Flash Memory
Version
Operating Ambient Temperature–20 to 85oC
Package128-pin plastic mold LQFP
NOTES:
1. I2C bus is a registered trademark of Koninklijke Philips Electronics N. V.
2. IEBus is a registered trademark of NEC Electronics Corporation.
3. See Table 1.8 Product Code for the program and erase endurance, and operating ambient temperature.
In addition 1,000 times/10,000 times are under development as of Sep., 2004. Please inquire about a release schedule.
4. All options are on request basis.
Number of Basic Instructions91 instructions
Minimum Instruction Execution Time41.7ns(f(BCLK)=24MHz, VCC1=3.0 to 5.5V)
100ns(f(BCLK)=10MHz, VCC1=2.7 to 5.5V)
Operation ModeSingle-chip, memory expansion and microprocessor mode
Memory Space1 Mbyte (Available to 4 Mbytes by memory space
expansion function)
Memory CapacitySee Table 1.4 and 1.5 Product List
PortInput/Output : 113 pins, Input : 1 pin
Multifunction TimerTimer A : 16 bits x 5 channels, Timer B : 16 bits x 6 channels
Three phase motor control circuit
Serial I/O3 channels
Program/Erase Supply Voltage
Program and Erase Endurance
3.3 ± 0.3 V or 5.0 ± 0.5 V
100 times (all area)
5.0 ± 0.5 V
or 1,000 times (user ROM area without block 1)
/ 10,000 times (block A, block 1)
(3)
Operating Ambient Temperature–20 to 85oCT version : –40 to 85oC
–40 to 85oC
(3)
V version : –40 to 125oC
Package100-pin plastic mold QFP, LQFP
NOTES:
2
C bus is a registered trademark of Koninklijke Philips Electronics N. V.
1. I
2. IEBus is a registered trademark of NEC Electronics Corporation.
3. See Table 1.8 and 1.9 Product Code for the program and erase endurance, and operating ambient temperature.
In addition 1,000 times/10,000 times are under development as of Sep., 2004. Please inquire about a release schedule.
4. Use the M16C/62PT on VCC1 = VCC2.
5. All options are on request basis.
(Note 4)
1. Overview
page 3
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 18
M16C/62P Group (M16C/62P, M16C/62PT)
Table 1.3 Performance outline of M16C/62P group (M16C/62P, M16C/62PT) (80-pin version)
ItemPerformance
M16C/62PM16C/62PT
CPU
Peripheral
function
Electric
characteristics
Flash
memory
Version
Operating Ambient Temperature–20 to 85oCT version : –40 to 85oC
Package80-pin plastic mold QFP
NOTES :
2
1. I
2. IEBus is a registered trademark of NEC Electronics Corporation.
3. See Table 1.8 and 1.9 Product Code for the program and erase endurance, and operating ambient temperature.
In addition 1,000 times/10,000 times are under development as of Sep., 2004. Please inquire about a release schedule.
4. All options are on request basis.
Number of Basic Instructions 91 instructions
Minimum Instruction Execution Time
41.7ns(f(BCLK)=24MHz, VCC1=3.0 to 5.5V)41.7ns(f(BCLK)=24MHz, VCC1=4.0 to 5.5V)
100ns(f(BCLK)=10MHz, VCC1=2.7 to 5.5V)
Operation ModeSingle-chip mode
Memory Space1 Mbyte
Memory CapacitySee Table 1.4 to 1.7 Product List
PortInput/Output : 70 pins, Input : 1pin
Multifunction TimerTimer A : 16 bits x 5 channels (Timer A1 and A2 are internal timer)
Timer B : 16 bits x 6 channels (Timer B1 is internal timer)
Serial I/O2 channels
Clock synchronous, UART,
2
C bus
I
(1)
, IEBus
(2)
1 channel
Clock synchronous,
2
C bus
I
(1)
, IEBus
(2)
2 channels
Clock synchronous (1 channel is only for transmission)
A/D Converter10-bit A/D converter: 1 circuit, 26 channels
D/A Converter8 bits x 2 channels
DMAC2 channels
CRC Calculation CircuitCCITT-CRC
Watchdog Timer15 bits x 1 channel (with prescaler)
InterruptInternal: 29 sources, External: 5 sources, Software: 4 sources,
Priority level: 7 levels
Clock Generating Circuit4 circuits
Main clock generation circuit (*),
Subclock generation circuit (*),
On-chip oscillator, PLL synthesizer
(*)Equipped with a built-in feedback resistor.
Oscillation Stop Detection Function
Voltage Detection CircuitAvailable (option
Supply Voltage
Stop detection of main clock oscillation, re-oscillation detection function
(4)
)Absent
VCC1=3.0 to 5.5V, (f(BCLK)=24MHz)VCC1=4.0 to 5.5V, (f(BCLK)=24MHz)
VCC1=2.7 to 5.5V, (f(BCLK)=10MHz)
Power Consumption
14 mA (VCC1=5V, f(BCLK)=24MHz)
14 mA (VCC1=5V, f(BCLK)=24MHz)
8 mA (VCC1=3V, f(BCLK)=10MHz) 2.0 µA (VCC1=5V,
1.8 µA (VCC1=3V,
f(XCIN)=32kHz, wait mode)0.8 µ A (VCC1=5V, stop mode)
f(XCIN)=32kHz, wait mode)
0.7 µ A (VCC1=3V, stop mode)
Program/Erase Supply Voltage 3.3 ± 0.3 V or 5.0 ± 0.5 V5.0 ± 0.5 V
Program and Erase Endurance
100 times (all area)
or 1,000 times (user ROM area without block 1)
/ 10,000 times (block A, block 1)
(3)
–40 to 85oC(option)V version : –40 to 125oC
C bus is a registered trademark of Koninklijke Philips Electronics N. V.
1. Overview
page 4
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 19
M16C/62P Group (M16C/62P, M16C/62PT)
A
1. Overview
1.3 Block Diagram
Figure 1.1 is a block diagram of the M16C/62P Group (M16C/62P, M16C/62PT) 128-pin and 100-pin version, figure 1.2 is a block diagram of the M16C/62P Group (M16C/62P, M16C/62PT) 80-pin version.
8
Port P0
Internal peripheral functions
Port P18Port P2
Timer (16-bit)
Output (timer A): 5
Input (timer B): 6
Three-phase motor
control circuit
Watchdog timer
(15 bits)
DMAC
(2 channels)
D/A converter
(8 bits X 2 channels)
8888
Port P4Port P3
<VCC2 ports>
Expandable up to 26 channels)
CRC arithmetic circuit (CCITT )
(4)
A/D converter
(10 bits X 8 channels
clock synchronous serial I/O
(Polynomial : X
UART or
(8 bits X 3 channels)
16+X12+X5
+1)
M16C/60 series16-bit CPU core
R0LR0H
R1HR1L
R2
R3
A0
A1
FB
INTB
PC
Port P5
System clock
generation circuit
XIN-XOUT
XCIN-XCOUT
PLL frequency synthesizer
On-chip oscillator
Clock synchronous serial I/O
(8 bits X 2 channels)
SB
USP
ISP
FLG
AAA
8
Port P6
<VCC1 ports>
Memory
(1)
ROM
(2)
RAM
Multiplier
(4)
<VCC1 ports>
(4)
Port P7
8
Port P8
7
Port P8_5
Port P9
8
Port P10
8
<VCC1 ports>
Port P11
(3)
(4)
Port P14
(3)(3)
<VCC2 ports>
Port P12
(4)
Port P13
(3)
8882
NOTES :
1. ROM size depends on microcomputer type.
2. RAM size depends on microcomputer type.
3. Ports P11 to P14 exist only in 128-pin version.
4. Use M16C/62PT on VCC1= VCC2.
Figure 1.1 M16C/62P Group (M16C/62P, M16C/62PT) 128-pin and 100-pin version Block Diagram
page 5
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 20
M16C/62P Group (M16C/62P, M16C/62PT)
1. Overview
8
Port P0
Internal peripheral functions
Timer (16-bit)
Output (timer A): 5
Input (timer B): 6
Watchdog timer
(15 bits)
DMAC
(2 channels)
D/A converter
(8 bits X 2 channels)
8
Port P28Port P38Port P44Port P58Port P6
(4)
A/D converter
(10 bits X 8 channels
Expandable up to 26 channels)
UART or
clock synchronous serial I/O (2 channels)
UART(1 channel)
CRC arithmetic circuit (CCITT )
(Polynomial : X
16+X12+X5
(3)
+1)
M16C/60 series16-bit CPU core
R0LR0H
R1HR1L
R2
R3
A0
A1
FB
SB
USP
ISP
INTB
PC
FLG
System clock
generation circuit
XIN-XOUT
XCIN-XCOUT
PLL frequency synthesizer
On-chip oscillator
Clock synchronous serial I/O
(8 bits X 2 channels)
Memory
ROM
RAM
Multiplier
Port P7
4
Port P8
7
Port P8_5
(4)
(1)
(2)
Port P9
7
Port P10
8
NOTES :
1. ROM size depends on microcomputer type.
2. RAM size depends on microcomputer type.
3. To use a UART2, set the CRD bit in the U2C0 register to “1” (CTS/RTS function disabled).
4. There is no external connections for port P1, P4_4 to P4_7, P7_2 to P7_5 and P9_1 in 80-pin version.
Set the direction bits in these ports to “1” (output mode), and set the output data to “0” (“L”) using the program.
Figure 1.2 M16C/62P Group (M16C/62P, M16C/62PT) 80-pin version Block Diagram
page 6
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 21
M16C/62P Group (M16C/62P, M16C/62PT)
1. Overview
1.4 Product List
Tables 1.4 to 1.7 list the product list, figure 1.3 shows the type numbers, memory sizes and packages, table
1.8 lists the product code of flash memory version and ROMless version for M16C/62P, and table 1.9 lists
the product code of flash memory version for M16C/62PT. Figure 1.4 shows the marking diagram of flash
memory version and ROMless version for M16C/62P, and figure 1.5 shows the marking diagram of flash
memory version for M16C/62PT. Please specify the mark of the mask ROM version at the time of ROM
order.
Table 1.4 Product List (1) (M16C/62P)
Type No.
M30622M6P-XXXFP
M30622M6P-XXXGP
M30623M6P-XXXGP
1. P7_0 and P7_1 are N channel open-drain output pins.
Figure 1.9 Pin Configuration (Top View)
page 16
Z0320-5810B90JER
Package: 80P6S-A
463fo4002,10peS03.2.veR
Page 31
M16C/62P Group (M16C/62P, M16C/62PT)
Page 32
M16C/62P Group (M16C/62P, M16C/62PT)
Table 1.11 Pin Description (100-pin and 128-pin Version) (2)
I
O
I
O
O
O
I
I
I
I
I/O
I
I
I
O
I
O
I/O
I
I
O
O
O
I/O
I/O
Power
Supply
VCC1
VCC1
VCC1
VCC1
VCC2
VCC2
VCC1
VCC2
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
VCC1
(1)
I/O pins for the main clock generation circuit. Connect a ceramic resonator or
crystal oscillator between XIN and XOUT
clock from XIN and leave XOUT open.
I/O pins for a sub clock oscillation circuit. Connect a crystal oscillator between
XCIN and XCOUT
(3)
. To use the external clock, input the clock from XCIN and
leave XCOUT open.
Outputs the BCLK signal.
The clock of the same cycle as fC, f8, or f32 is outputted.
______
Input pins for the INT interrupt
Input pin for the NMI interrupt. Pin states can be read by the P8_5 bit in the P8
_______
register.
Input pins for the key input interrupt
These are timer A0 to timer A4 I/O pins. (except the output of TAOUT for the Nchannel open drain output.)
These are timer A0 to timer A4 input pins.
Input pin for the Z-phase.
These are timer B0 to timer B5 input pins.
These are Three-phase motor control output pins.
These are send control input pins.
These are receive control output pins.
These are transfer clock I/O pins.
These are serial data input pins.
These are serial data input pins.
These are serial data output pins. (except TXD2 for the N-channel open drain
output.)
These are serial data output pins.
This is output pin for transfer clock output from multiple pins function.
These are serial data I/O pins. (except SDA2 for the N-channel open drain
output.)
These are transfer clock I/O pins. (except SCL2 for the N-channel open drain
output.)
Signal Name Pin Name I/O TypeDescription
(2)
XIN
XOUT
XCIN
XCOUT
BCLK
CLKOUT
________________
INT0 to INT2
________________
INT3 to INT5
_______
NMI
___________
KI0 to KI3
Main clock input
Main clock output
Sub clock input
Sub clock output
BCLK output
Clock output
______
INT interrupt input
_______
NMI interrupt input
Key input interrupt
input
Timer A
TA0OUT to
TA4OUT
TA0IN to
TA4IN
ZP
Timer B
Three-phase motor
control output
Serial I/O
TB0IN to
TB5IN
____
U, U, V, V,
__
W, W
__________________
CTS0 to CTS2
________________
RTS0 to RTS2
CLK0 to CLK4
RXD0 to RXD2
SIN3, SIN4
TXD0 to
TXD2
SOUT3, SOUT4
CLKS1
I2C mode
SDA0 to SDA2
SCL0 to SCL2
I : Input O : Output I/O : Input and output
1. Overview
(3)
. To use the external clock, input the
NOTES:
1. When use VCC1 > VCC2, contacts due to some points or restrictions to be checked.
2. This pin function in M16C/62PT cannot be used.
3. Ask the oscillator maker the oscillation characteristic.
page 18
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 33
M16C/62P Group (M16C/62P, M16C/62PT)
Page 34
M16C/62P Group (M16C/62P, M16C/62PT)
Table 1.13 Pin Description (80-pin Version) (1)
Signal Name Pin Name I/O TypeDescription
Power supply input
VCC1,
VSS
Analog power
supply input
Reset input
CNVSS
AVCC,
AVSS
____________
RESET
CNVSS
(BYTE)
Main clock input
Main clock output
Sub clock input
Sub clock output
Clock output
______
INT interrupt input
_______
NMI interrupt input
Key input interrupt
XIN
XOUT
XCIN
XCOUT
CLKOUT
________________
INT0 to INT2
_______
NMI
____________
KI0 to KI3
input
Timer A
TA0OUT,
I/O
TA3OUT,
TA4OUT
TA0IN,
TA3IN,
TA4IN
ZP
Timer B
Serial I/O
TB0IN,
TB2IN to TB5IN
_________ _________
CTS0, CTS2
_________ _________
RTS0, RTS2
CLK0, CLK1,
I/O
CLK3, CLK4
RXD0 to RXD2
SIN4
TXD0 to TXD4
SOUT3, SOUT4
CLKS1
I2C mode
SDA0 to SDA2
SCL0 to SCL2
I/O
I/O
I : Input O : Output I/O : Input and output
Power
Supply
I
I
-
VCC1
Apply 2.7 to 5.5 V to the VCC1 pin and 0 V to the VSS pin.
Applies the power supply for the A/D converter. Connect the AVCC pin to
VCC1. Connect the AVSS pin to VSS.
I
VCC1
I
VCC1
The microcomputer is in a reset state when applying "L" to the this pin.
Switches processor mode. Connect this pin to V
start up in single-chip mode. Connect this pin to V
cessor mode. As for the BYTE pin of the 80-pin versions, pull-up processing
is performed within the microcomputer.
I
VCC1
O
VCC1
I/O pins for the main clock generation circuit. Connect a ceramic resonator or
crystal oscillator between XIN and XOUT
the clock from XIN and leave XOUT open.
I
VCC1
O
VCC1
I/O pins for a sub clock oscillation circuit. Connect a crystal oscillator between
XCIN and XCOUT
(3)
. To use the external clock, input the clock from XCIN
and leave XCOUT open.
O
VCC2
I
VCC1
I
VCC1
I
VCC1
VCC1
The clock of the same cycle as fC, f8, or f32 is outputted.
Input pins for the INT interrupt
______
_______
Input pin for the NMI interrupt.
Input pins for the key input interrupt
These are timer A0, timer A3 and Timer A4 I/O pins. (except the output of
TAOUT for the N-channel open drain output.)
I
VCC1
I
VCC1
I
VCC1
I
VCC1
O
VCC1
VCC1
I
VCC1
I
VCC1
O
VCC1
These are timer A0, timer A3 and Timer A4 input pins.
Input pin for the Z-phase.
These are timer B0, timer B2 to timer B5 input pins.
These are send control input pins.
These are receive control output pins.
These are transfer clock I/O pins.
These are serial data input pins.
These are serial data input pins.
These are serial data output pins. (except TXD2 for the N-channel open drain
output.)
O
VCC1
O
VCC1
VCC1
These are serial data output pins.
This is output pin for transfer clock output from multiple pins function.
These are serial data I/O pins. (except SDA2 for the N-channel open drain
output.)
VCC1
These are transfer clock I/O pins. (except SCL2 for the N-channel open drain
output.)
1. Overview
(2)
SS
to when after a reset to
CC1
to start up in micropro-
(3)
. To use the external clock, input
NOTES:
1. In this manual, hereafter, VCC refers to VCC1 unless otherwise noted.
2. In M16C/62PT, apply 4.0 to 5.5 V to the VCC1 pin.
3. Ask the oscillator maker the oscillation characteristic.
page 20
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 35
M16C/62P Group (M16C/62P, M16C/62PT)
Page 36
M16C/62P Group (M16C/62P, M16C/62PT)
2. Central Processing Unit (CPU)
2. Central Processing Unit (CPU)
Figure 2.1 shows the CPU registers. The CPU has 13 registers. Of these, R0, R1, R2, R3, A0, A1 and FB
comprise a register bank. There are two register banks.
Figure 2.1 Central Processing Unit Register
2.1 Data Registers (R0, R1, R2 and R3)
The R0 register consists of 16 bits, and is used mainly for transfers and arithmetic/logic operations. R1 to
R37Tj 0 0 12 53f 16 bits, and is used ma1ic/logic 19
page 22
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 37
M16C/62P Group (M16C/62P, M16C/62PT)
2. Central Processing Unit (CPU)
2.3 Frame Base Register (FB)
FB is configured with 16 bits, and is used for FB relative addressing.
2.4 Interrupt Table Register (INTB)
INTB is configured with 20 bits, indicating the start address of an interrupt vector table.
2.5 Program Counter (PC)
PC is configured with 20 bits, indicating the address of an instruction to be executed.
2.6 User Stack Pointer (USP) and Interrupt Stack Pointer (ISP)
Stack pointer (SP) comes in two types: USP and ISP, each configured with 16 bits.
Your desired type of stack pointer (USP or ISP) can be selected by the U flag of FLG.
2.7 Static Base Register (SB)
SB is configured with 16 bits, and is used for SB relative addressing.
2.8 Flag Register (FLG)
FLG consists of 11 bits, indicating the CPU status.
2.8.1 Carry Flag (C Flag)
This flag retains a carry, borrow, or shift-out bit that has occurred in the arithmetic/logic unit.
2.8.2 Debug Flag (D Flag)
The D flag is used exclusively for debugging purpose. During normal use, it must be set to “0”.
2.8.3 Zero Flag (Z Flag)
This flag is set to “1” when an arithmetic operation resulted in 0; otherwise, it is “0”.
2.8.4 Sign Flag (S Flag)
This flag is set to “1” when an arithmetic operation resulted in a negative value; otherwise, it is “0”.
2.8.5 Register Bank Select Flag (B Flag)
Register bank 0 is selected when this flag is “0” ; register bank 1 is selected when this flag is “1”.
2.8.6 Overflow Flag (O Flag)
This flag is set to “1” when the operation resulted in an overflow; otherwise, it is “0”.
2.8.7 Interrupt Enable Flag (I Flag)
This flag enables a maskable interrupt.
Maskable interrupts are disabled when the I flag is “0”, and are enabled when the I flag is “1”. The I flag
is cleared to “0” when the interrupt request is accepted.
2.8.8 Stack Pointer Select Flag (U Flag)
ISP is selected when the U flag is “0”; USP is selected when the U flag is “1”.
The U flag is cleared to “0” when a hardware interrupt request is accepted or an INT instruction for
software interrupt Nos. 0 to 31 is executed.
2.8.9 Processor Interrupt Priority Level (IPL)
IPL is configured with three bits, for specification of up to eight processor interrupt priority levels from level
0 to level 7.
If a requested interrupt has priority greater than IPL, the interrupt is enabled.
2.8.10 Reserved Area
When write to this bit, write “0”. When read, its content is indeterminate.
page 23
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 38
M16C/62P Group (M16C/62P, M16C/62PT)
A
A
A
A
3. Memory
Figure 3.1 is a memory map of the M16C/62P group. The address space extends the 1M bytes from
address 00000h to FFFFFh.
The internal ROM is allocated in a lower address direction beginning with address FFFFFh. For example, a
64-Kbyte internal ROM is allocated to the addresses from F0000h to FFFFFh.
As for the flash memory version, 4-Kbyte space (block A) exists in 0F000h to 0FFFFh. 4-Kbyte space is
mainly for storing data. In addition to storing data, 4-Kbyte space also can store programs.
The fixed interrupt vector table is allocated to the addresses from FFFDCh to FFFFFh. Therefore, store the
start address of each interrupt routine here.
The internal RAM is allocated in an upper address direction beginning with address 00400h. For example,
a 10-Kbyte internal RAM is allocated to the addresses from 00400h to 02BFFh. In addition to storing data,
the internal RAM also stores the stack used when calling subroutines and when interrupts are generated.
The SRF is allocated to the addresses from 00000h to 003FFh. Peripheral function control registers are
located here. Of the SFR, any area which has no functions allocated is reserved for future use and cannot
be used by users.
The special page vector table is allocated to the addresses from FFE00h to FFFDBh. This vector is used by
the JMPS or JSRS instruction. For details, refer to the M16C/60 and M16C/20 Series Software Manual.
In memory expansion and microprocessor modes, some areas are reserved for future use and cannot be
used by users. Use M16C/62P (80-pin version) and M16C/62PT in single-chip mode. The memory expansion and microprocessor modes cannot be used.
3. Memory
00000h
SFR
00400h
Internal RAM
Internal RAM
Size
Address XXXXXh
4K bytes013FFh
5K bytes
10K bytes
12K bytes
20K bytes
24K bytes
31K bytes
017FFh
02BFFh
033FFh
043FFh16K bytes
053FFh
063FFh
07FFFh
Internal ROM
48K bytes
64K bytes
96K bytes
128K bytes
192K bytes
256K bytes
320K bytes
384K bytes
512K bytes
Address YYYYYhSize
(3)
F4000h
F0000h
E8000h
E0000h
D0000h
C0000h
B0000h
A0000h
80000h
XXXXXh
0F000h
0FFFFh
10000h
27000h
28000h
80000h
YYYYYh
FFFFFh
Reserved area
Internal ROM
(data area)
External area
AAAAAAAA
Reserved area
AAAA
External area
AAAA
Reserved area
Internal ROM
(program area)
(1)
(3)
(2)
(5)
NOTES:
1. During memory expansion and microprocessor modes, can not be used.
2. In memory expansion mode, can not be used.
3. As for the flash memory version, 4-Kbyte space (block A) exists.
4. Shown here is a memory map for the case where the PM10 bit in the PM1 register is “1”
and the PM13 bit in the PM1 register is “1”.
5. When using the masked ROM version, write nothing to internal ROM area.
FFE00h
FFFDCh
FFFFFh
Special page
vector table
Undefined instruction
Overflow
BRK instruction
Address match
Single step
Watchdog timer
DBC
NMI
Reset
Figure 3.1 Memory Map
page 24
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 39
M16C/62P Group (M16C/62P, M16C/62PT)
e
4. Special Function Register (SFR)
4. Special Function Register (SFR)
SFR(Special Function Register) is the control register of peripheral functions. Table 4.1 to 4.6 list the SFR
information.
Chip Select Control Register
Address Match Interrupt Enable RegisterAIERXXXXXX00b
0009h
Protect RegisterPRCRXX000000b
000Ah
000Bh
Data Bank Register
000Ch
Oscillation Stop Detection Register
000Dh
Watchdog Timer Start RegisterWDTSXXh
000Eh
000Fh
Watchdog Timer Control RegisterWDC00XXXXXXb
0010h
Address Match Interrupt Register 0RMAD000h
0011h
0012h
0013h
0014h
Address Match Interrupt Register 1RMAD100h
0015h
0016h
0017h
0018h
0019h
Voltage Detection Register 1
Voltage Detection Register 2
001Ah
Chip Select Expansion Control Register
001Bh
PLL Control Register 0PLC00001X010b
001Ch
001Dh
Processor Mode Register 2PM2XXX00000b
001Eh
Voltage Down Detection Interrupt Register
001Fh
0020h
DMA0 Source Pointer SAR0XXh
0021h
0022h
0023h
0024h
DMA0 Destination PointerDAR0XXh
0025h
0026h
0027h
0028h
DMA0 Transfer CounterTCR0XXh
0029h
002Ah
002Bh
002Ch
DMA0 Control RegisterDM0CON00000X00b
002Dh
002Eh
002Fh
0030h
DMA1 Source PointerSAR1XXh
0031h
0032h
0033h
0034h
DMA1 Destination Pointer DAR1XXh
0035h
0036h
0037h
0038h
DMA1 Transfer CounterTCR1XXh
0039h
003Ah
003Bh
003Ch
DMA1 Control RegisterDM1CON00000X00b
003Dh
003Eh
003Fh
NOTES :
1. The blank areas are reserved and cannot be accessed by users.
2. The PM00 and PM01 bits do not change at software reset, watchdog timer reset and oscillation stop detection reset.
3. The CM20, CM21, and CM27 bits do not change at oscillation stop detection reset.
4. The WDC5 bit is “0” (cold start) immediately after power-on. It can only be set to “1” in a program. It is set to “0” when the input voltage
5. This register does not change at software reset, watchdog timer reset and oscillation stop detection reset.
6. This register in M16C/62PT cannot be used.
X : Nothing is mapped to this bit
CC1 pin drops to Vdet2 or less while the VC25 bit in the VCR2 register is set to “1” (RAM retention limit detection circuit enabl
at the V
(6)
(1)
RegisterSymbol After Reset
(2)
(6)
(5, 6)
(5, 6)
(3)
(6)
(6)
PM000000000b(CNVSS pin is “L”)
00000011b(CNVSS pin is “H”)
CSR00000001b
DBR00h
CM20X000000b
00h
X0h
00h
X0h
VCR100001000b
VCR200h
CSE00h
D4INT00h
XXh
XXh
XXh
XXh
XXh
XXh
XXh
XXh
XXh
XXh
(4)
page 25
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 40
M16C/62P Group (M16C/62P, M16C/62PT)
4. Special Function Register (SFR)
Table 4.2 SFR information (2)
A d d r e s s
0 0 4 0 h
0 0 4 1 h
0 0 4 2 h
0 0 4 3 h
N T 3 I
X 0 0 X 0 0 0
0 0 4 4 h
I N T 3 I n t e r r u p t C o n t r o l R e g i s t e rI
0 0 4 5 h
Timer B5 Interrupt Contr ol Re gis terTB5ICXXXXX000b
0 0 4 6 h
T i m e r B 4 I n t e r r u p t C o n t r o l R e g i s t e r , U A R T 1 B U S C o l l i s i o n D e t e c t i o n I n t e r r u p t C o n t r o l R e g i s t e rT B 4 I C , U 1 B C N I C
0 0 4 7 h
T i m e r B 3 I n t e r r u p t C o n t r o l R e g i s t e r , U A R T 0 B U S C o l l i s i o n D e t e c t i o n I n t e r r u p t C o n t r o l R e g i s t e rT B 3 I C , U 0 B C N I C
X 0 0 X 0 0 0
0 0 4 8 h
S I / O 4 I n t e r r u p t C o n t r o l R e g i s t e r ( S 4 I C ) , I N T 5 I n t e r r u p t C o n t r o l R e g i s t e rS 4 I C
3 I
X 0 0 X 0 0 0
0 0 4 9 h
S I / O 3 I n t e r r u p t C o n t r o l R e g i s t e r , I N T 4 I n t e r r u p t C o n t r o l R e g i s t e rS
C N I
0 0 4 A h
0 0 4 B h
0 0 4 C h
0 0 4 D h
0 0 4 E h
0 0 4 F h
0 0 5 0 h
0 0 5 1 h
0 0 5 2 h
0 0 5 3 h
0 0 5 4 h
0 0 5 5 h
0 0 5 6 h
0 0 5 7 h
0 0 5 8 h
0 0 5 9 h
0 0 5 A h
0 0 5 B h
0 0 5 C h
0 0 5 D h
0 0 5 E h
0 0 5 F h
0 0 6 0 h
0 0 6 1 h
0 0 6 2 h
0 0 6 3 h
0 0 6 4 h
0 0 6 5 h
0 0 6 6 h
0 0 6 7 h
0 0 6 8 h
0 0 6 9 h
0 0 6 A h
0 0 6 B h
0 0 6 C h
0 0 6 D h
0 0 6 E h
0 0 6 F h
0 0 7 0 h
0 0 7 1 h
0 0 7 2 h
0 0 7 3 h
0 0 7 4 h
0 0 7 5 h
0 0 7 6 h
0 0 7 7 h
0 0 7 8 h
0 0 7 9 h
0 0 7 A h
0 0 7 B h
0 0 7 C h
0 0 7 D h
0 0 7 E h
0 0 7 F h
NO T E S :
X : N o t h i n g i s m a p p e d t o t h i s b i t
X X X X 0 0 0
U A R T 2 B u s C o l l i s i o n D e t e c t i o n I n t e r r u p t C o n t r o l R e g i s t e rB
M 0 I
X X X X 0 0 0
D M A 0 I n t e r r u p t C o n t r o l R e g i s t e rD
M 1 I
X X X X 0 0 0
D M A 1 I n t e r r u p t C o n t r o l R e g i s t e rD
U P I
X X X X 0 0 0
K e y I n p u t I n t e r r u p t C o n t r o l R e g i s t e rK
A/D Conversion Interrupt Control RegisterADICXXXXX000b
UART2 Transmit Interrupt Control Register
UART2 Receive Interrupt Control Register
X X X X 0 0 0
U A R T 0 T r a n s m i t I n t e r r u p t C o n t r o l R e g i s t e r
X X X X 0 0 0
U A R T 0 R e c e i v e I n t e r r u p t C o n t r o l R e g i s t e r
X X X X 0 0 0
U A R T 1 T r a n s m i t I n t e r r u p t C o n t r o l R e g i s t e r
X X X X 0 0 0
U A R T 1 R e c e i v e I n t e r r u p t C o n t r o l R e g i s t e r
Timer A0 Interrupt Contr ol Re gis terTA0ICXXXXX000b
A 1 I
X X X X 0 0 0
T i m e r A 1 I n t e r r u p t C o n t r o l R e g i s t e rT
A 2 I
X X X X 0 0 0
T i m e r A 2 I n t e r r u p t C o n t r o l R e g i s t e rT
Timer A3 Interrupt Contr ol Re gis terTA3ICXXXXX000b
A 4 I
X X X X 0 0 0
T i m e r A 4 I n t e r r u p t C o n t r o l R e g i s t e rT
B 0 I
X X X X 0 0 0
T i m e r B 0 I n t e r r u p t C o n t r o l R e g i s t e r T
Timer B1 Interrupt Contr ol Re gis terTB1ICXXXXX000b
B 2 I
X X X X 0 0 0
T i m e r B 2 I n t e r r u p t C o n t r o l R e g i s t e rT
INT0 Interrupt Control RegisterINT0ICXX00X000b
N T 1 I
X 0 0 X 0 0 0
I N T 1 I n t e r r u p t C o n t r o l R e g i s t e rI
N T 2 I
X 0 0 X 0 0 0
I N T 2 I n t e r r u p t C o n t r o l R e g i s t e rI
1 . T h e b l a n k a r e a s a r e r e s e r v e d a n d c a n n o t b e a c c e s s e d b y u s e r s .
Flash Identification Register
Flash Memory Control Register 1
Flash Memory Control Register 0
Address Match Interrupt Register 2RMAD200h
Address Match Interrupt Enable Register 2
Address Match Interrupt Register 3RMAD300h
to
Peripheral Clock Select RegisterPCLKR00000011b
to
(1)
Register
(2)
(2)
(2)
NOTES :
1. The blank areas are reserved and cannot be accessed by users.
2. This register is included in the flash memory version.
Symbol
After Reset
FIDRXXXXXX00b
FMR10X00XX0Xb
FMR000000001b
00h
X0h
AIER2XXXXXX00b
00h
X0h
X : Nothing is mapped to this bit
page 27
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 42
M16C/62P Group (M16C/62P, M16C/62PT)
4. Special Function Register (SFR)
Table 4.4 SFR information (4)
Address
0340h
Timer B3, 4, 5 Count Start FlagTBSR000XXXXXb
0341h
0342h
Timer A1-1 RegisterTA11XXh
0343h
0344h
Timer A2-1 RegisterTA21XXh
0345h
0346h
Timer A4-1 RegisterTA41XXh
0347h
0348h
Three-Phase PWM Control Register 0INVC000h
0349h
Three-Phase PWM Control Register 1INVC100h
034Ah
Three-Phase Output Buffer Register 0IDB000h
034Bh
Three-Phase Output Buffer Register 1IDB100h
034Ch
Dead Time TimerDTTXXh
034Dh
Timer B2 Interrupt Occurrence Frequency Set CounterICTB2XXh
034Eh
034Fh
0350h
Timer B3 RegisterTB3XXh
0351h
0352h
Timer B4 RegisterTB4XXh
0353h
0354h
Timer B5 RegisterTB5XXh
0355h
0356h
0357h
0358h
0359h
035Ah
035Bh
Timer B3 Mode RegisterTB3MR00XX0000b
035Ch
Timer B4 Mode Register TB4MR00XX0000b
035Dh
Timer B5 Mode RegisterTB5MR00XX0000b
035Eh
Interrupt Cause Select Register 2IFSR2A00XXXXXXb
035Fh
Interrupt Cause Select Register IFSR00h
0360h
SI/O3
0361h
0362h
0363h
0364h
0365h
0366h
0367h
0368h
0369h
036Ah
036Bh
036Ch
036Dh
036Eh
036Fh
0370h
0371h
0372h
0373h
0374h
0375h
0376h
0377h
0378h
0379h
037Ah
037Bh
037Ch
037Dh
037Eh
037Fh
NOTES :
1. The blank areas are reserved and cannot be accessed by users.
Transmit/Receive Register
SI/O3 Control RegisterS3C01000000b
SI/O3
Bit Rate Generator
SI/O4
Transmit/Receive Register
SI/O4 Control RegisterS4C01000000b
SI/O4
Bit Rate Generator
UART0 Special Mode Register 4U0SMR400h
UART0 Special Mode Register 3U0SMR3000X0X0Xb
UART0 Special Mode Register 2 U0SMR2X0000000b
UART0 Special Mode Register U0SMRX0000000b
UART1 Special Mode Register 4U1SMR400h
UART1 Special Mode Register 3U1SMR3000X0X0Xb
UART1 Special Mode Register 2U1SMR2X0000000b
UART1 Special Mode RegisterU1SMRX0000000b
UART2 Special Mode Register 4U2SMR400h
UART2 Special Mode Register 3U2SMR3000X0X0Xb
UART2 Special Mode Register 2U2SMR2X0000000b
UART2 Special Mode RegisterU2SMRX0000000b
UART2 Transmit/Receive Mode Register
UART2 Bit Rate Generator
UART2 Transmit Buffer Register
UART2 Transmit/Receive Control Register 0
UART2 Transmit/Receive Control Register 1
UART2 Receive Buffer Register
(1)
RegisterSymbol After Reset
XXh
XXh
XXh
XXh
XXh
XXh
S3TRRXXh
S3BRGXXh
S4TRRXXh
S4BRGXXh
U2MR00h
U2BRGXXh
U2TBXXh
XXh
U2C000001000b
U2C100000010b
U2RBXXh
XXh
X : Nothing is mapped to this bit
page 28
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 43
M16C/62P Group (M16C/62P, M16C/62PT)
4. Special Function Register (SFR)
Table 4.5 SFR information (5)
Address
0380h
Count Start FlagTABSR00h
0381h
Clock Prescaler Reset FagCPSRF0XXXXXXXb
0382h
One-Shot Start FlagONSF00h
0383h
Trigger Select Register TRGSR00h
0384h
Up-Down FlagUDF00h
0385h
0386h
Timer A0 RegisterTA0XXh
0387h
0388h
Timer A1 RegisterTA1XXh
0389h
038Ah
Timer A2 RegisterTA2XXh
038Bh
038Ch
Timer A3 RegisterTA3XXh
038Dh
038Eh
Timer A4 RegisterTA4XXh
038Fh
0390h
Timer B0 RegisterTB0XXh
0391h
0392h
Timer B1 RegisterTB1XXh
0393h
0394h
Timer B2 RegisterTB2XXh
0395h
0396h
Timer A0 Mode RegisterTA0MR00h
0397h
Timer A1 Mode Register TA1MR00h
0398h
Timer A2 Mode RegisterTA2MR00h
0399h
Timer A3 Mode RegisterTA3MR00h
039Ah
Timer A4 Mode RegisterTA4MR00h
039Bh
Timer B0 Mode RegisterTB0MR00XX0000b
039Ch
Timer B1 Mode RegisterTB1MR00XX0000b
039Dh
Timer B2 Mode RegisterTB2MR00XX0000b
039Eh
Timer B2 Special Mode RegisterTB2SCXXXXXX00b
039Fh
03A0h
UART0 Transmit/Receive Mode Register
03A1h
UART0 Bit Rate Generator U0BRGXXh
03A2h
UART0 Transmit Buffer RegisterU0TBXXh
03A3h
03A4h
UART0 Transmit/Receive Control Register 0
03A5h
UART0 Transmit/Receive Control Register 1
03A6h
UART0 Receive Buffer Register U0RBXXh
03A7h
03A8h
UART1 Transmit/Receive Mode Register
03A9h
UART1 Bit Rate GeneratorU1BRGXXh
03AAh
UART1 Transmit Buffer RegisterU1TBXXh
03ABh
UART1 Transmit/Receive Control Register 0
03ACh
03ADh
UART1 Transmit/Receive Control Register 1
03AEh
UART1 Receive Buffer Register U1RBXXh
03AFh
03B0h
UART Transmit/Receive Control Register 2
03B1h
03B2h
03B3h
03B4h
03B5h
03B6h
03B7h
03B8h
DMA0 Request Cause Select RegisterDM0SL00h
03B9h
DMA1 Request Cause Select RegisterDM1SL00h
03BAh
03BBh
03BCh
CRC Data RegisterCRCDXXh
03BDh
03BEh
CRC Input Register CRCINXXh
03BFh
NOTES :
1.The blank areas are reserved and cannot be accessed by users.
2. Bits 7 to 5 in the Up-down flag are “
(1)
RegisterSymbol
0” by reset. However, The values in these bits when read are indeterminate.
After Reset
(2)
XXh
XXh
XXh
XXh
XXh
XXh
XXh
XXh
U0MR00h
XXh
U0C000001000b
U0C100XX0010b
XXh
U1MR00h
XXh
U1C000001000b
U1C100XX0010b
XXh
UCONX0000000b
XXh
X : Nothing is mapped to this bit
page 29
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 44
M16C/62P Group (M16C/62P, M16C/62PT)
4. Special Function Register (SFR)
Table 4.6 SFR information (6)
Address
03C0h
A/D Register 0AD0XXh
03C1h
03C2h
A/D Register 1AD1XXh
03C3h
03C4h
A/D Register 2AD2XXh
03C5h
03C6h
A/D Register 3 AD3XXh
03C7h
03C8h
A/D Register 4AD4XXh
03C9h
03CAh
A/D Register 5 AD5XXh
03CBh
03CCh
A/D Register 6AD6XXh
03CDh
03CEh
A/D Register 7 AD7XXh
03CFh
03D0h
03D1h
03D2h
03D3h
03D4h
A/D Control Register 2ADCON200h
03D5h
A/D Control Register 0ADCON000000XXXb
03D6h
A/D Control Register 1 ADCON100h
03D7h
03D8h
D/A Register 0 DA000h
03D9h
03DAh
D/A Register 1DA100h
03DBh
03DCh
D/A Control RegisterDACON00h
03DDh
Port P14 Control RegisterPC14XX00XXXXb
03DEh
Pull-Up Control Register 3PUR300h
03DFh
03E0h
Port P0 RegisterP0XXh
Port P1 RegisterP1XXh
03E1h
03E2h
Port P0 Direction RegisterPD000h
03E3h
Port P1 Direction RegisterPD100h
Port P2 RegisterP2XXh
03E4h
03E5h
Port P3 RegisterP3XXh
Port P2 Direction RegisterPD200h
03E6h
03E7h
Port P3 Direction RegisterPD300h
Port P4 RegisterP4XXh
03E8h
03E9h
Port P5 RegisterP5XXh
03EAh
Port P4 Direction RegisterPD400h
Port P5 Direction RegisterPD500h
03EBh
03ECh
Port P6 RegisterP6XXh
Port P7 RegisterP7XXh
03EDh
Port P6 Direction RegisterPD600h
03EEh
03EFh
Port P7 Direction RegisterPD700h
Port P8 RegisterP8XXh
03F0h
Port P9 RegisterP9XXh
03F1h
Port P8 Direction RegisterPD800X00000b
03F2h
Port P9 Direction RegisterPD900h
03F3h
Port P10 RegisterP10XXh
03F4h
Port P11 RegisterP11XXh
03F5h
Port P10 Direction RegisterPD1000h
03F6h
Port P11 Direction Register PD1100h
03F7h
03F8h
Port P12 RegisterP12XXh
03F9h
Port P13 RegisterP13XXh
Port P12 Direction RegisterPD1200h
03FAh
Port P13 Direction Register PD1300h
03FBh
Pull-Up Control Register 0 PUR000h
03FCh
Pull-Up Control Register 1PUR100000000b
03FDh
Pull-Up Control Register 2 PUR200h
03FEh
03FFh
Port Control Register PCR00h
(1)
Register
(3)
(3)
(3)
(3)
(3)
(3)
(3)
(3)
NOTES :
1. The blank areas are reserved and cannot be accessed by users.
2. At hardware reset 1 or hardware reset 2, the register is as follows:
SS
• “00000000b” where “L” is inputted to the CNV
• “00000010b” where “H” is inputted to the CNV
pin
SS
pin
At software reset, watchdog timer reset and oscillation stop detection reset, the register is as follows:
• “00000000b” where the PM01 to PM00 bits in the PM0 register are “00b” (single-chip mode)
• “00000010b” where the PM01 to PM00 bits in the PM0 register are “01b” (memory expansion mode) or
“11b” (microprocessor mode)
3. These registers do not exist in M16C/62P (80-pin version), and M16C/62PT (80-pin version).
X : Nothing is mapped to this bit
Symbol After Reset
XXh
XXh
XXh
XXh
XXh
XXh
XXh
XXh
(2)
00000010b
page 30
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 45
M16C/62P Group (M16C/62P, M16C/62PT)
5. Reset
Hardware reset 1, voltage down detection reset (hardware reset 2), software reset, watchdog timer reset
and oscillation stop detection reset are available to reset the microcomputer.
5. Reset
5.1 Hardware Reset 1
____________
The microcomputer resets pins, the CPU and SFR by setting the RESET pin. If the supply voltage meets
the recommended operating conditions, the microcomputer resets all pins when an “L” signal is applied to
_______________________
the RESET pin (see Table 5.1 Pin Status When RESET Pin Level is “L”). The oscillation circuit is also
reset and the main clock starts oscillation. The microcomputer resets the CPU and SFR when the signal
____________
applied to the RESET pin changes low (“L”) to high (“H”). The microcomputer executes the program in an
address indicated by the reset vector. The internal RAM is not reset. When an “L” signal is applied to the
____________
RESET pin while writing data to the internal RAM, the internal RAM is in an indeterminate state.
Figure 5.1 shows an example of the reset circuit. Figure 5.2 shows a reset sequence. Table 5.1 lists pin
____________
states while the RESET pin is held low (“L”). Figure 5.3 shows CPU register states after reset. Refer to 4.
SFR for SFR states after reset.
5.1.1 Reset on a Stable Supply Voltage
(1) Apply “L” to the RESET pin
(2) Apply 20 or more clock cycles to the XIN pin
(3) Apply an “H” signal to the RESET pin
5.1.2 Power-on Reset
(1) Apply “L” to the RESET pin
(2) Raise the supply voltage to the recommended operating level
(3) Insert td(P-R) ms as wait time for the internal voltage to stabilize
(4) Apply 20 or more clock cycles to the XIN pin
(5) Apply “H” to the RESET pin
____________
____________
____________
____________
5.2 Voltage Down Detection Reset (Hardware Reset 2)
The microcomputer resets pins, the CPU or SFR by setting the built-in voltage detect circuit. The voltage
detect circuit monitors the voltage applied to the VCC1 pin.
When the VC26 bit in the VCR2 register is set to “1” (reset level detect circuit enabled), the microcomputer
resets pins, the CPU and SFR as soon as the voltage that is applied to the VCC1 pin drops to Vdet3 or
below.
Then, the microcomputer initializes pins, the CPU and SFR as soon as the voltage to the VCC1 pin reaches
Vdet3r or above. The microcomputer executes the program in an address determined by the reset vector.
The microcomputer executes the program td(S-R) ms after detecting Vdet3r. The same pins and registers
are reset by the hardware reset 1 and voltage down detection reset (hardware reset 2) , and are also placed
in the same reset state.
The microcomputer cannot exit stop mode by voltage down detection reset (hardware reset 2) .
page 31
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 46
M16C/62P Group (M16C/62P, M16C/62PT)
VCC1
RESET
VCC1
5. Reset
Recommended
operation voltage
0V
RESET
0V
NOTES:
1. If VCC1>VCC2, the VCC2 voltage must be lower than that of VCC1 when the power
is being turned on or off.
0.2VCC1
or below
0.2VCC1 or below
Supply a clock with td(P-R) + 2
0 or more cycles to the XIN pin
Figure 5.1 Example Reset Circuit
5.3 Software Reset
The microcomputer resets pins, the CPU and SFR when the PM03 bit in the PM0 register is set to “1”
(microcomputer reset). Then the microcomputer executes the program in an address determined by the
reset vector.
Set the PM03 bit to “1” while the main clock is selected as the CPU clock and the main clock oscillation is
stable.
In the software reset, the microcomputer does not reset a part of the SFR. Refer to 4. SFR for details.
Processor mode remains unchanged since the PM01 to PM00 bits in the PM0 register are not reset.
Figure 5.2 shows the reset sequence.
5.4 Watchdog Timer Reset
The microcomputer resets pins, the CPU and SFR when the CM06 bit in the CM0 register is set to “1”
(reset) and the watchdog timer underflows. Then the microcomputer executes the program in an address
determined by the reset vector.
In the watchdog timer reset, the microcomputer does not reset a part of the SFR. Refer to 4. SFR for
details. Processor mode remains unchanged since the PM01 to PM00 bits in the PM0 register are not
reset.
5.5 Oscillation Stop Detection Reset
The microcomputer resets and stops pins, the CPU and SFR when the CM27 bit in the CM2 register is 0, if
it detects main clock oscillation circuit stop. Refer to 10.6 Oscillation Stop, Re-Oscillation DetectionFunction for details.
In the oscillation stop detection reset, the microcomputer does not reset a part of the SFR. Refer to 4. SFR
for details. Processor mode remains unchanged since the PM01 to PM00 bits in the PM0 register are not
reset.
page 32
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 47
M16C/62P Group (M16C/62P, M16C/62PT)
VCC1, VCC2
XIN
t
Microprocessor
mode BYTE = H
RESET
d(P-R)
More than
20 cycles
are needed
BCLK 28cycles
5. Reset
BCLK
Address
RD
WR
CS0
Microprocessor
mode BYTE = L
Address
RD
WR
CS0
Single chip
mode
Address
Figure 5.2 Reset Sequence
FFFFCh
FFFFChFFFFEh
FFFFCh
FFFFDh
Content of reset vector
FFFFEh
Content of reset vector
FFFFEh
Content of reset vector
page 33
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 48
M16C/62P Group (M16C/62P, M16C/62PT)
A
5. Reset
Table 5.1 Pin Status When RESET Pin Level is “L”
____________
Pin Name
P0
P1
P2, P3, P4_0 to P4_3
P4_4
P4_5 to P4_7
P5_0
P5_1
P5_2
P5_3
P5_4
P5_5
CNVSS = VSS
Input port
Input port
Input port
Input port
Input port
Input port
Input port
Input port
Input port
Input port
Input port
Data input
Data input
Address output (undefined)
CS0 output (“H” is output)
Input port (
WR output (“H” is output)
BHE output (undefined)
RD output (“H” is output)
BCLK output
HLDA output (The output value
depends on the input to the
HOLD pin)
HOLD input
Status
CNVSS = VCC1
BYTE = VSSBYTE = VCC
Pulled high
)
(1)
Data input
Input port
Address output (undefined)
CS0 output (“H” is output)
Input port (
Pulled high
WR output (“H” is output)
BHE output (undefined)
RD output (“H” is output)
BCLK output
HLDA output (The output value
depends on the input to the
HOLD pin)
HOLD input
)
P5_6
P5_7
P6, P7, P8_0 to P8_4,
P8_6, P8_7, P9, P10
P11, P12, P13,
P14_0, P14_1
(2)
Input port
Input port
Input port
Input port
ALE output (“L” is output)
RDY input
ALE output (“L” is output)
RDY input
Input port Input port
Input port
Input port
NOTES :
1. Shown here is the valid pin state when the internal power supply voltage has stabilized after power-on.
When CNVSS = VCC1, the pin state is indeterminate until the internal power supply voltage stabilizes.
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
User Stack Pointer(USP)
Interrupt Stack Pointer(ISP)
Static Base Register(SB)
b15
b15
IPL
0000h
b7 b8
Figure 5.3 CPU Register Status After Reset
page 34
Z0320-5810B90JER
463fo4002,10peS03.2.veR
b0
Flag Register(FLG)
b0
CDZSBOIU
Page 49
M16C/62P Group (M16C/62P, M16C/62PT)
6. Voltage Detection Circuit
6. Voltage Detection Circuit
Note
6. Voltage Detection Circuit is described in the M16C/62P only as an example.
The M16C/62PT do not use this function.
The voltage detection circuit monitors the voltage applied to the VCC1 pin in Vdet3 and Vdet 4. The VC26
to VC27 bits in the VCR2 register determine whether this circuit is enabled or disabled.
The reset level detect circuit is required for the voltage down detection reset (hardware reset 2) .
The voltage down detection circuit detects whether VCC1 is more than or less than Vdet4. The VC13 bit in
the VCR1 register determines the detection result. The voltage detect interrupt is available.
Figure 6.1 shows a voltage detection circuit Block
R E S E T
V C C 1
CM10 Bit=1
(Stop Mode)
V C R 2 R e g i s t e r
b7 b6
Figure 6.1 Voltage Detection Circuit Block
Write to WDC register
Internal power on reset
+
≥Vdet3
E
+
≥Vdet4
E
Noise Rejection
WDC5 Bit
SRQ
1 shot
>T
V C R 1 R e g i s t e r
WARM/COLD
(Cold start, warm start)
Voltage Down Detect Reset
(Hardware Reset 2
Release Wait Time)
t d ( S - R )
Q
I n t e r n a l R e s e t S i g n a l
( “ L ” a c t i v e )
V o l t a g e D o w n
D e t e c t S i g n a l
b 3
VC13 Bit
page 35
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 50
M16C/62P Group (M16C/62P, M16C/62PT)
6. Voltage Detection Circuit
V o l t a g e D o w n D e t e c t i o n I n t e r r u p t R e g i s t e r
d d r e s
f t e r R e s e
0 1 F
b 7 b 6 b 5 b4 b 3 b 2 b 1 b 0
N O T E S :
1 . W r i t e t o t h i s r e g i s t e r a f t e r s e t t i n g t h e P R C 3 b i t i n t h e P R C R r e g i s t e r t o “ 1 ” ( w r i t e e n a b l e ) .
2 . U s e f u l w h e n t h e V C 2 7 b i t i n t h e V C R 2 r e g i s t e r i s s e t t o “ 1 ” ( v o l t a g e d o w n d e t e c t i o n c i r c u i t e n a b l e d ) . I f t h e
V C 2 7 b i t i s s e t t o “ 0 ” ( v o l t a g e d o w n d e t e c t i o n c i r c u i t d i s a b l e ) , t h e D 4 2 b i t i s s e t t o “ 0 ” ( N o t d e t e c t ) .
3 . T h i s b i t i s s e t t o “ 0 ” b y w r i t i n g a “ 0 ” i n a p r o g r a m . ( W r i t i n g a “ 1 ” h a s n o e f f e c t . )
4 . I f t h e v o l t a g e d o w n d e t e c t i o n i n t e r r u p t n e e d s t o b e u s e d t o g e t o u t o f s t o p m o d e a g a i n a f t e r o n c e u s e d f o r t h a t
p u r p o s e , r e s e t t h e D 4 1 b i t b y w r i t i n g a “ 0 ” a n d t h e n a “ 1 ” .
5 . T h e D 4 0 b i t i s e f f e c t i v e w h e n t h e V C 2 7 b i t = 1 . T o s e t t h e D 4 0 b i t t o “ 1 , ” s e t b i t s i n t h e f o l l o w i n g o r d e r .
( a ) S e t t h e V C 2 7 b i t t o “ 1 ” .
( b ) W a i t f o r t d ( E – A ) u n t i l t h e d e t e c t i o n c i r c u i t i s a c t u a t e d .
( c7222 -10.7778f9.3889 10.7778 TD( 0.7778 (c72223s)Tj-24.8889 10.7778 TD( )Tj25.3889 -10. TD( )Tj13.666778 TD( .8889 10D( )Tj.)Tj-24.7222 -1.11 -10.7778 TD(i)Tj8 TD( )Tj28.944.7778 TD( )Tj20.8 TD( 5889 -109r )Tj13.58 TD( 5889 -109r )-10.77j13.58 b8 TD( )Tj277737lD( )Tj 10.7778 .277737l 10.77.20.8 TD( )Tj277737lD( )Tj 10.77737lD(7l 10.77.20.8 TD( )0.77j13.58 b8 7lD(7l)Tj 10.77737lD(7ld 7lD(7l)Tj 10.77737lD.7778 TD( )Tj20.8 TD( 7l)Tj 1)Tj-25.3889 10.77778 TD22 -10.7778 TD( )T.3889 10 10.77926.7222 -10.7778 TD(t TD( )Tj28.3889 4667 -9.6667 TD(o)Tj )Tj5.1-10.772TD( )Tj( )Tj3)Tj.)Tj-24.7222 -1.1101
0
S y m b o lA
D 4 I N T0
B i t S y m b o l
Voltage Down Detection
D 4 0
Interrupt Enable Bit
STOP Mode Deactivation
D 4 1
Control Bit
Voltage Change Detection
D 4 2
Flag
WDT Overflow Detect Flag
D 4 3
Sampling Clock Select Bit
D F 0
D F 1
( 1 )
sA
h0
B i t N a m e
(5)
0 : D i s a b l e ( d o n o t u s e t h e p o w e r
(4)
(2)
s u p p l y d o w n d e t e c t i o n
i n t e r r u p t t o g e t o u t o f s t o p m o d e )
1 : E n a b l e ( u s e t h e v o l t a g e
d o w n d e t e c t i o n i n t e r r u p t t o g e t
o u t o f s t o p m o d e )
t
h
0 : D i s a b l e
1 : E n a b l e
0 : N o t d e t e c t e d
1 : V d e t 4 p a s s i n g d e t e c t i o n
0 : N o t d e t e c t e d
1 : D e t e c t e d
0 0 : C P U c l o c k d i v i d e d b y 8
0 1 : C P U c l o c k d i v i d e d b y 1 6
1 0 : C P U c l o c k d i v i d e d b y 3 2
1 1 : C P U c l o c k d i v i d e d b y 6 4
page 36
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 51
M16C/62P Group (M16C/62P, M16C/62PT)
6. Voltage Detection Circuit
VCC1
RESET
Internal Reset Signal
VC13 bit in
VCR1 register
VC26 bit in
VCR2 register
VC27 bit in
VCR2 register
(1)
NOTES :
1. VC26 bit is invalid (the microcomputer is not reset even if input voltage of VCC1 pin
becomes lower than Vdet3).
Vdet4
Vdet3r
Vdet3
Vdet3s
VSS
Indefinite
Indefinite
Indefinite
5.0V
5.0V
Set to “1” by program (reset level detect circuit enable)
Set to “1” by program
(voltage down detect circuit enable)
Figure 6.3 Typical Operation of Voltage Down Detection Reset (Hardware Reset 2)
page 37
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 52
M16C/62P Group (M16C/62P, M16C/62PT)
6. Voltage Detection Circuit
6.1 Voltage Down Detection Interrupt
If the D40 bit in the D4INT register is set to “1” (voltage down detection interrupt enabled), the voltage down
detection interrupt request is generated when the voltage applied to the VCC1 pin is above or below Vdet4.
The voltage down detection interrupt shares the same interrupt vector with the watchdog timer interrupt and
oscillation stop, re-oscillation detection interrupt.
Set the D41 bit in the D4INT register to “1” (enabled) to use the voltage down detection interrupt to exit stop
mode.
The D42 bit in the D4INT register is set to “1” as soon as the voltage applied to the VCC1 pin reaches Vdet4
due to the voltage rise and voltage drop. When the D42 bit changes “0” to “1”, the voltage down detection
interrupt request is generated. Set the D42 bit to “0” by program. However, when the D41 bit is set to “1”
and the microcomputer is in stop mode, the voltage down detection interrupt request is generated regardless of the D42 bit state if the voltage applied to the VCC1 pin is detected to be above Vdet4. The microcomputer then exits stop mode.
Table 6.1 shows how the voltage down detection interrupt request is generated.
The DF1 to DF0 bits in the D4INT register determine the sampling period that detects the voltage applied to
the VCC1 pin reaches Vdet4. Table 6.2 shows the sampling periods.
Table 6.1 Voltage Down Detection Interrupt Request Generation Conditions
D41 BitVC27 BitOperation ModeD40 BitD42 BitCM02 BitVC13 Bit
Normal
Operation
(1)
Mode
Wait Mode
Stop Mode
NOTES:
1. The status except the wait mode and stop mode is handled as the normal mode.(Refer to 10. Clock generating circuit)
2. Refer to 6.2 Limitations on stop mode, 6.3 Limitations on wait mode.
3. An interrupt request for voltage reduction is generated a sampling time after the value of the VC13 bit has changed.
(2)
(2)
See the Figure 6.5 Voltage Down Detection Interrupt Generation Circuit Operation Example for details.
1
1
1
0 to 1
0 to 1
0
1
0
(3)
0 to 1
(3)
1 to 0
(3)
0 to 1
(3)
1 to 0
0 to 1
0 to 1
– : “0”or “1”
Table 6.2 Sampling Periods
CPU
Clock
(MHz)
DF1 to DF0=00
(CPU clock divided by 8)
(CPU clock divided by 16)
Sampling Period (µs)
DF1 to DF0=01
DF1 to DF0=10
(CPU clock divided by 32)
DF1 to DF0=11
(CPU clock divided by 64)
163.06.012.024.0
page 38
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 53
M16C/62P Group (M16C/62P, M16C/62PT)
Voltage down detection interrupt generation circuit
Voltage Down Detection Circuit
D4INT clock(the
VC27
VCC1
+
Noise
VREF
Watchdog Timer Block
Rejection
(Rejection Range:200 ns)
WAIT instruction(wait mode)
clock with which it
operates also in
wait mode)
VC13
Voltage down
detection signal
The Voltage down detection
signal becomes “H” when the
VC27 bit is set to “0” (disabled)
Watchdog timer
underflow signal
CM10
CM02
DF1, DF0
00b
01b
10b
11b
1/2
Noise Rejection
Circuit
1/2
1/21/8
D41
D43
This bit is set to “0”(not detected) by program.
The D42 bit is set to “0” (not detected)
by program. the VC27 bit is set to “0”
(voltage down detect circuit disabled),
the D42 bit is set to “0”.
D42
Digital
Filter
D40
6. Voltage Detection Circuit
Watchdog
timer interrupt
signal
Voltage down
detection
interrupt signal
Oscillation stop,
re-oscillation
detection
interrupt signal
Non-maskable
interrupt signal
Figure 6.4 Power Supply Down Detection Interrupt Generation Block
VCC1
VC13 bit in VCR1 register
Output of the digital filter
D42 bit in D4INT register
Voltage downdetection
interrupt signal
sampling
(2)
samplingsamplingsampling
No voltage down detection interrupt signals are
generated when the D42 bit is “H”.
Set to “0” by program (not detected)
NOTES :
1. D40 bit in the D4INT register is set to “1” (voltage down
detection interrupt enabled).
2. Output of the digital filter is shown in Figure 6.5.
Figure 6.5 Power Supply Down Detection Interrupt Generation Circuit Operation Example
page 39
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 54
M16C/62P Group (M16C/62P, M16C/62PT)
6. Voltage Detection Circuit
6.2 Limitations on Exiting Stop Mode
The voltage down detection interrupt is immediately generated and the microcomputer exits stop mode if
the CM10 bit in the CM1 register is set to “1” under the conditions below.
• the VC27 bit in the VCR2 register is set to “1” (voltage down detection circuit enabled),
• the D40 bit in the D4INT register is set to “1” (voltage down detection interrupt enabled),
•
the D41 bit in the D4INT register is set to “1” (voltage down detection interrupt is used to exit stop mode), and
• the voltage applied to the VCC1 pin is higher than Vdet4 (the VC13 bit in the VCR1 register is “1”)
If the microcomputer is set to enter stop mode when the voltage applied to the VCC1 pin drops below Vdet4
and to exit stop mode when the voltage applied rises to Vdet4 or above, set the CM10 bit to “1” when VC13
bit is “0” (VCC1 < Vdet4).
6.3 Limitations on Exiting Wait Mode
The voltage down detection interrupt is immediately generated and the microcomputer exits wait mode If
WAIT instruction is executed under the conditions below.
• the CM02 bit in the CM0 register is set to “1” (stop peripheral function clock),
• the VC27 bit in the VCR2 register is set to “1” (voltage down detection circuit enabled),
• the D40 bit in the D4INT register is set to “1” (voltage down detection interrupt enabled),
•
the D41 bit in the D4INT register is set to “1” (voltage down detection interrupt is used to exit wait mode), and
• the voltage applied to the VCC1 pin is higher than Vdet4 (the VC13 bit in the VCR1 register is “1”)
If the microcomputer is set to enter wait mode when the voltage applied to the VCC1 pin drops below Vdet4
and to exit wait mode when the voltage applied rises to Vdet4 or above, perform WAIT instruction when
VC13 bit is “0” (VCC1 < Vdet4).
page 40
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 55
M16C/62P Group (M16C/62P, M16C/62PT)
7. Processor Mode
7. Processor Mode
Note
7. Processor Mode is described in the M16C/62P (128-pin version and 100-pin version)
only as an example.
The M16C/62P (80-pin version) and M16C/62PT do not use memory expansion mode,
and microprocessor mode.
7.1 Types of Processor Mode
Three processor modes are available to choose from: single-chip mode, memory expansion mode, and
microprocessor mode. Table 7.1 shows the features of these processor modes.
Table 7.1 Features of Processor Modes
Processor Modes
Single-Chip ModeSFR, Internal RAM, Internal ROM
Memory Expansion Mode
Microprocessor Mode
NOTES :
1. Refer to 8. Bus.
SFR, Internal RAM, Internal ROM,
External Area
SFR, Internal RAM, External Area
Access SpacePins which are Assigned I/O Ports
(1)
All pins are I/O ports or peripheral
function I/O pins
Some pins serve as bus control pins
(1)
Some pins serve as bus control pins
(1)
(1)
page 41
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 56
M16C/62P Group (M16C/62P, M16C/62PT)
7. Processor Mode
7.2 Setting Processor Modes
Processor mode is set by using the CNVSS pin and the PM01 to PM00 bits in the PM0 register.
Table 7.2 shows the processor mode after hardware reset. Table 7.3 shows the PM01 to PM00 bit set
values and processor modes.
Table 7.2 Processor Mode After Hardware Reset
CNVSS Pin Input LevelProcessor Mode
VSSSingle-Chip Mode
(1, 2)
VCC1
NOTES :
1. If the microcomputer is reset in hardware by applying VCC1 to the CNVSS pin (hardware reset 1
or hardware reset 2), the internal ROM cannot be accessed regardless of PM10 to PM00 bits.
2. The multiplexed bus cannot be assigned to the entire CS space.
Table 7.3 PM01 to PM00 Bits Set Values and Processor Modes
Microprocessor Mode
page 42
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 57
M16C/62P Group (M16C/62P, M16C/62PT)
7. Processor Mode
Processor Mode Register 0
b7 b6 b5 b4 b3 b2 b1 b0
(1)
SymbolAddressAfter Reset
(4)
PM00004h00000000b (CNVSS pin = L)
00000011b (CNVSS pin = H)
Bit NameFunctionBit symbol
PM00
Processor Mode Bit
(4)
PM01
PM02
PM03
PM04
R/W Mode Select Bit
Software Reset Bit
Multiplexed Bus Space
Select Bit
(2)
PM05
PM06
PM07
Port P4_0 to P4_3
Function Select Bit
BCLK Output
Disable Bit
(2)
(2)
NOTES:
1. Write to this register after setting the PRC1 bit in the PRCR register to “1” (write enable).
2. Effective when the PM01 to PM00 bits are set to “01b” (memory expansion mode) or “11b” (microprocessor
mode).
3. To set the PM01 to PM00 bits are “01b” and the PM05 to PM04 bits are “11b” (multiplexed bus assigned to
the entire CS space), apply an “H” signal to the BYTE pin (external data bus is 8 bits wide). While the CNVSS
pin is held “H” (= VCC1), do not rewrite the PM05 to PM04 bits to “11b” after reset.
If the PM05 to PM04 bits are set to “11b” during memory expansion mode, P3_1 to P3_7 and P4_0 to P4_3
become I/O ports, in which case the accessible area for each CS is 256 bytes.
4. The PM01 to PM00 bits do not change at software reset, watchdog timer reset and oscillation stop detection
reset.
b1 b0
0 0: Single-chip mode
0 1: Memory expansion mode
1 0: Do not set
1 1: Microprocessor mode
(2)
0 : RD,BHE,WR
1 : RD,WRH,WRL
Setting this bit to “1” resets the
microcomputer. When read, its content
is “0”.
b5 b4
0 0 : Multiplexed bus is unused
(Separate bus in the entire CS
space)
0 1 : Allocated to CS2 space
1 0 : Allocated to CS1 space
1 1 : Allocated to the entire CS space
0 : Address output
1 : Port function
(Address is not output)
0 : BCLK is output
1 : BCLK is not output
(Pin is left high-impedance)
RW
RW
RW
RW
RW
RW
RW
(3)
RW
RW
Figure 7.1 PM0 Register
page 43
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 58
M16C/62P Group (M16C/62P, M16C/62PT)
7. Processor Mode
Processor Mode Register 1
b7 b6 b5 b4 b3 b2 b1 b0
0
(1)
SymbolAddressAfter Reset
PM10005h0X001000b
Bit NameFunctionBit Symbol
PM10
PM11
PM12
PM13
PM14
PM15
(b6)
PM17
NOTES:
1. Write to this register after setting the PRC1 bit in the PRCR register to “1” (write enable).
2. Set the PM10 bit to “0” for Mask ROM version. For flash memory version, the PM10 bit controls whether
Block A is enabled or disabled. When the PM10 bit is set to “1”, 0F000h to 0FFFFh can be used as internal
ROM area. In addition, the PM10 bit is automatically set to “1” while the FMR01 bit in the FMR0 register is set
to “1” (CPU rewrite mode).
3. Effective when the PM01 to PM00 bits are set to “01b” (memory expansion mode) or “11b” (microprocessor
mode).
4. PM12 bit is set to “1” by writing a “1” in a program (writing a “0” has no effect).
5. When PM17 bit is set to “1” (with wait state), one wait state is inserted when accessing the internal RAM, or
internal ROM.
When PM17 bit is set to “1” and accesses an external area, set the CSiW bit in the CSR register (i=0 to 3) to “0”
(with wait state).
6. The PM13 bit is automatically set to “1” when the FMR01 bit in the FMR0 register is “1” (CPU rewrite mode).
7. The access area is changed by the PM13 bit as listed in the table below.
Access Area
Internal
External
RAM
Up to Addresses 00400h to 03FFFh (15 Kbytes)
ROM
Up to Addresses D0000h to FFFFFh (192 Kbytes)
Addresses 04000h to 07FFFh are usable
Addresses 80000h to CFFFFh are usable
PM13=0 PM13=1
CS2 Area Switch Bit
(Data Block Enable Bit)
Port P3_7 to P3_4
Function Select Bit
Watchdog Timer Function
Select Bit
Internal Reserved Area
Expansion Bit
Memory Area
Expansion Bit
Reserved Bit
(5)
Wait Bit
(6)
(3)
(3)
0: 08000h to 26FFFh
(2)
(Block A disable)
1: 10000h to 26FFFh
(Block A enable)
(Do not expand)
0 1 : Do not be set
1 0 : Do not be set
1 1 : 4-Mbyte mode
Set to “0”.
0 : No wait state
1 : With wait state (1 wait)
The entire area is usable
The entire area is usable
Addresses 04000h to 07FFFh are reserved
Addresses 80000h to CFFFFh are reserved
(4)
RW
RW
RW
RW
RW
RW
RW
RW
RW
Figure 7.2 PM1 Register
page 44
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 59
M16C/62P Group (M16C/62P, M16C/62PT)
7. Processor Mode
Single-Chip Mode
00000h
00400h
Internal RAM
XXXXXh
Can not use
YYYYYh
Internal ROM
FFFFFh
SFR
PM13=0
Capacity
4 Kbytes
5 Kbytes
10 Kbytes
12 Kbytes
16 Kbytes
20 Kbytes
24 Kbytes
31 Kbytes
PM13=1
Capacity
4 Kbytes
5 Kbytes
10 Kbytes
12 Kbytes
16 Kbytes
20 Kbytes
24 Kbytes
31 Kbytes
Internal RAMInternal ROM
Address XXXXXh
013FFh
017FFh
02BFFh
033FFh
03FFFh
03FFFh
03FFFh
03FFFh
Internal RAM
Address XXXXXh
013FFh
017FFh
02BFFh
033FFh
043FFh
053FFh
063FFh
07FFFh
(2)
(2)
(2)
(2)
Capacity
48 Kbytes
64 Kbytes
96 Kbytes
128 Kbytes
192 Kbytes
256 Kbytes
320 Kbytes
384 Kbytes
512 Kbytes
Internal ROM
Capacity
48 Kbytes
64 Kbytes
96 Kbytes
128 Kbytes
192 Kbytes
256 Kbytes
320 Kbytes
384 Kbytes
512 Kbytes
Address YYYYYh
F4000h
F0000h
E8000h
E0000h
D0000h
D0000h
D0000h
D0000h
D0000h
Address YYYYYh
F4000h
F0000h
E8000h
E0000h
D0000h
C0000h
B0000h
A0000h
80000h
(2)
(2)
(2)
(2)
NOTES :
1. For the mask ROM version, set the PM10 bit to “0” (08000h to 26FFFh for CS2 area).
2. If PM13 bit is set to “0”, 15 Kbytes of the internal RAM and 192 Kbytes of the internal ROM can be used.
Figure 7.3 Memory Map in Single Chip Mode
page 45
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 60
M16C/62P Group (M16C/62P, M16C/62PT)
8. Bus
Note
8. Bus is described in the M16C/62P (128-pin version and 100-pin version)
only as an example.
The M16C/62P (80-pin version) and M16C/62PT do not use memory expansion mode,
and microprocessor mode.
8. Bus
During memory expansion or microprocessor mode, some pins serve as the bus control pins to perform
data input/output to and from external devices. These bus control pins include A0 to A19, D0 to D15, CS0
to CS3, RD, WRL/WR, WRH/BHE, ALE, RDY, HOLD, HLDA and BCLK.
8.1 Bus Mode
The bus mode, either multiplexed or separate, can be selected using the PM05 to PM04 bits in the PM0
register. Table 8.1 shows the difference between a separate bus and multiplexed bus.
8.1.1 Separate Bus
In this bus mode, data and address are separate.
8.1.2 Multiplexed Bus
In this bus mode, data and address are multiplexed.
8.1.2.1 When the input level on BYTE pin is high (8-bit data bus)
D0 to D7 and A0 to A7 are multiplexed.
8.1.2.2 When the input level on BYTE pin is low (16-bit data bus)
D0 to D7 and A1 to A8 are multiplexed. D8 to D15 are not multiplexed. Do not use D8 to D15. External
devices connecting to a multiplexed bus are allocated to only the even addresses of the microcomputer. Odd addresses cannot be accessed.
_______
Table 8.1 Difference between a separate bus and multiplexed bus
Pin Name
P0_0 to P0_7/D0 to D7
P1_0 to P1_7/D8 to D15
P2_0/A0 (/D0/-)
P2_1 to P2_7/A1 to A7
(/D1 to D7/D0 to D6)
P3_0/A8 (/-/D7)
NOTES :
1. See Table 8.6 Pin Functions for Each Processor Mode for bus control signals other than the above.
2. It changes with a setup of PM05 to PM04, and area to access.
See Table 8.6 Pin Functions for Each Processor Mode for details.
(1)
Separate Bus
D0 to D7
D8 to D15
A0
A1 to A7
A8
BYTE = H
(NOTE 2)(NOTE 2)
I/O Port
P1_0 to P1_7
A0D0
A1 to A7
A8
Multiplex Bus
D1 to D7
BYTE = L
(NOTE 2)
A0
A1 to A7 D0 to D6
A8D7
page 46
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 61
M16C/62P Group (M16C/62P, M16C/62PT)
8.2 Bus Control
The following describes the signals needed for accessing external devices and the functionality of software wait.
8.2.1 Address Bus
The address bus consists of 20 lines, A0 to A19. The address bus width can be chosen to be 12, 16 or 20
bits by using the PM06 bit in the PM0 register and the PM11 bit in the PM1 register. Table 8.2 shows the
PM06 and PM11 bit set values and address bus widths.
Table 8.2 PM06 and PM11 Bits Set Value and Address Bus Width
Set Value
PM11=1P3_4 to P3_7
PM06=1P4_0 to P4_3
PM11=0A12 to A15
PM06=1P4_0 to P4_3
PM11=0A12 to A15
PM06=0A16 to A19
NOTES :
1. No values other than those shown above can be set.
When processor mode is changed from single-chip mode to memory extension mode, the address bus is
indeterminate until any external area is accessed.
(1)
Pin Function
Address Bus Width
12 bits
16 bits
20 bits
8. Bus
8.2.2 Data Bus
When input on the BYTE pin is high(data bus is 8 bits wide), 8 lines D0 to D7 comprise the data bus; when
input on the BYTE pin is low(data bus is 16 bits wide), 16 lines D0 to D15 comprise the data bus.
Do not change the input level on the BYTE pin while in operation.
8.2.3 Chip Select Signal
The chip select (hereafter referred to as the CSi) signals are output from the CSi (i = 0 to 3) pins. These
pins can be chosen to function as I/O ports or as CS by using the CSi bit in the CSR register.
Figure 8.1 shows the CSR register.
During 1-Mbyte mode, the external area can be separated into up to 4 by the CSi signal which is output
from the CSi pin. During 4-Mbyte mode, CSi signal or bank number is output from the CSi pin. Refer to 9.Memory space expansion function. Figure 8.2 shows the example of address bus and CSi signal
output in 1-Mbyte mode.
__________________
Chip Select Control Register
b7 b6 b5 b4 b3 b2 b1 b0
NOTES :
1. Where the RDY signal is used in the area indicated by CSi (i = 0 to 3) or the multiplex bus is used, set the
CSiW bit to “0” (with wait state).
2. If the PM17 bit in the PM1 register is set to “1” (with wait state), set the CSiW bit to “0” (with wait state).
3. When the CSiW bit = 0 (with wait state), the number of wait states (interms of clock cycles) can be selected
using the CSEi1W to CSEi0W bits in the CSE register.
SymbolAddress After Reset
CSR0008h00000001b
Bit Symbol
CS0
CS1
CS2
CS3
CS0W
CS1W
CS2W
CS3W
____________
_____
Bit Name
CS0 Output Enable Bit
CS1 Output Enable Bit
CS2 Output Enable Bit
CS3 Output Enable Bit
CS0 Wait Bit
CS1 Wait Bit
CS2 Wait Bit
CS3 Wait Bit
To access the external area indicated by CSj in the next cycle after
accessing the external area indicated by CSi
The address bus and the chip select signal both change state between
these two cycles.
Access to the external
area indicated by CSi
BCLK
Read signal
Data bus
Address bus
CSi
CSj
Example 3
To access the external area indicated by CSi in the next cycle after
accessing the external area indicated by the same CSi
Address
Access to the external
area indicated by CSj
Data
Data
Address
Example 2
To access the internal ROM or internal RAM in the next cycle after
accessing the external area indicated by CSi
The chip select signal changes state but the address bus does not
change state
Access to the external
area indicated by CSi
BCLK
Read signal
Data bus
Address bus
CSi
Example 4
Not to access any area (nor instruction prefetch generated) in the next cycle after
accessing the external area indicated by CSi
Address
Access to the internal
ROM or internal RAM
Data
The address bus changes state but the chip select signal does not
change state
Access to the external
area indicated by CSi
BCLK
Read signal
Data bus
Address bus
CSi
NOTES :
1. These examples show the address bus and chip select signal when accessing areas in two successive cycles. The chip select bus cycle
may be extended more than two cycles depending on a combination of these examples.
Shown above is the case where separate bus is selected and the area is accessed for read without wait states. i = 0 to 3, j = 0 to 3
(not including i, however)
Address
Access to the same
external area
DataData
Address
______
Neither the address bus nor the chip select signal changes state between
these two cycles
Access to the external
area indicated by CSi
BCLK
Read signal
Data bus
Address bus
CSi
Data
Address
Figure 8.2 Example of Address Bus and CSi Signal Output in 1-Mbyte mode
No access
page 48
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 63
M16C/62P Group (M16C/62P, M16C/62PT)
8. Bus
8.2.4 Read and Write Signals
When the data bus is 16 bits wide, the read and write signals can be chosen to be a combination of RD,
___________________ ________________
BHE and WR or a combination of RD, WRL and WRH by using the PM02 bit in the PM0 register. When
the data bus is 8 bits wide, use a combination of RD, WR and BHE.
Table 8.3 shows the operation of RD, WRL, and WRH signals. Table 8.4 shows the operation of opera-
_____ ______________
_____ _________________
tion of RD, WR, and BHE signals.
Table 8.3 Operation of RD, WRL and WRH Signals
_____ _________________
Data Bus Width
16-bit
( BYTE pin
input = L)
L
H
H
H
_____ ______________
H
L
H
L
Table 8.4 Operation of RD, WR and BHE Signals
Data Bus WidthA0
16-bit
(BYTE pin
input = L)
8-bit (BYTE pin
input = H)
RD
HLL
LHL
HLH
LHH
HLLL
LHLL
HLH or L
LHH or L
BHEWR
Not used
Not used
_____ ______________
WRHWRLRD
H
H
L
L
Read data
Write 1 byte of data to an even address
Write 1 byte of data to an odd address
Write data to both even and odd addresses
H
H
L
L
Status of External Data Bus
Status of External Data Bus
Write 1 byte of data to an odd address
Read 1 byte of data from an odd address
Write 1 byte of data to an even address
Read 1 byte of data from an even address
Write data to both even and odd addresses
Read data from both even and odd addresses
Write 1 byte of data
Read 1 byte of data
_____
8.2.5 ALE Signal
The ALE signal latches the address when accessing the multiplex bus space. Latch the address when the
ALE signal falls.
When BYTE Pin Input = HWhen BYTE Pin Input = L
ALE
A0/D0 to A7/D7
A8 to A19
NOTES :
1. If the entire CS space is assigned a multiplexed bus, these pins function as I/O ports.
Address Data
Address
(1)
Figure 8.3 ALE Signal, Address Bus, Data Bus
A1/D0 to A8/D7
ALE
A0
A9 to A19
Address
Address Data
Address
page 49
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 64
M16C/62P Group (M16C/62P, M16C/62PT)
________
8.2.6 The RDY Signal
This signal is provided for accessing external devices which need to be accessed at low speed. If input
________
on the RDY pin is asserted low at the last falling edge of BCLK of the bus cycle, one wait state is inserted
in the bus cycle. While in a wait state, the following signals retain the state in which they were when the
________
RDY signal was acknowledged.
8. Bus
A0 to A19, D0 to D15, CS0 to CS3, RD, WRL, WRH, WR, BHE, ALE, HLDA
Then, when the input on the RDY pin is detected high at the falling edge of BCLK, the remaining bus cycle
________
is executed. Figure 8.4 shows example in which the wait state was inserted into the read cycle by the
________________
RDY signal. To use the RDY signal, set the corresponding bit (CS3W to CS0W bits) in the CSR register
________________
to “0” (with wait state). When not using the RDY signal, process the RDY pin as an unused pin.
In an instance of separate bus
BCLK
RD
CSi
(i=0 to 3)
RDY
tsu(RDY - BCLK)
Accept timing of RDY signal
In an instance of multiplexed bus
BCLK
RD
CSi
(i=0 to 3)
RDY
tsu(RDY - BCLK)
: Wait using RDY signal
: Wait using software
Shown above is the case where CSEi1W to CSEi0W (i = 0 to 3) bits in the CSE register are “00b” (one wait state).
Accept timing of RDY signal
________
Figure 8.4 Example in which Wait State was Inserted into Read Cycle by RDY Signal
page 50
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 65
M16C/62P Group (M16C/62P, M16C/62PT)
__________
8.2.7 HOLD Signal
This signal is used to transfer control of the bus from the CPU or DMAC to an external circuit. When the
input on HOLD pin is pulled low, the microcomputer is placed in a hold state after the bus access then in
process finishes. The microcomputer remains in the hold state while the HOLD pin is held low, during
which time the HLDA pin outputs a low-level signal.
Table 8.5 shows the microcomputer status in the hold state.
Bus-using priorities are given to HOLD, DMAC, and CPU in order of decreasing precedence. However,
if the CPU is accessing an odd address in word units, the DMAC cannot gain control of the bus during two
separate accesses.
__________
__________
__________
__________
__________
HOLD > DMAC > CPU
Figure 8.5 Bus-Using Priorities
Table 8.5 Microcomputer Status in Hold State
8. Bus
Item
BCLK
A0 to A19, D0 to D15, CS0 to CS3, RD, WRL,
_________ _______ _______
______________ _____ ________
Output
High-impedance
Status
WRH, WR, BHE
I/O portsP0, P1, P3, P4
(1)
__________
P6 to P14
HLDA
Internal Peripheral Circuits
ALE Signal
(2)
High-impedance
__________
Maintains status when HOLD signal is received
Output “L”
ON (but watchdog timer stops)
Undefined
NOTES:
1. P11 to P14 are included in the 128-pin version.
2. When I/O port function is selected.
3. The watchdog timer dose not stop when the PM22 bit in the PM2 register is set to “1” (the count
source for the watchdog timer is the on-chip oscillator clock).
8.2.8 BCLK Output
If the PM07 bit in the PM0 register is set to “0” (output enable), a clock with the same frequency as that of
the CPU clock is output as BCLK from the BCLK pin. Refer to 10.2 CPU clock and pheripheral clock.
page 51
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 66
M16C/62P Group (M16C/62P, M16C/62PT)
Table 8.6 Pin Functions for Each Processor Mode
Processor ModeMemory Expansion Mode or Microprocessor Mode
00b(separate bus)
PM05 to PM04 Bits
01b(CS2 is for multiplexed bus and
others are for separate bus)
10b(CS1 is for multiplexed bus and
others are for separate bus)
8. Bus
Memory Expansion
Mode
11b (multiplexed
bus for the entire
(1)
space)
Data Bus Width
BYTE Pin
8 bits
“H”
P0_0 to P0_7D0 to D7D0 to D7
P1_0 to P1_7I/O portsD8 to D15I/O ports
P2_0A0A0
P2_1 to P2_7A1 to A7A1 to A7
P3_0A8A8A8
16 bits
“L”
8 bits
“H”
D0 to D7
(2)
A0/D0
A1 to A7
/D1 to D7
(4)
(2)
16 bits
“L”
D0 to D7
D8 to D15
(4)
(4)
I/O ports
I/O ports
A0A0/D0
A1 to A7
/D0 to D6
(2)
A8/D7
(2)
A1 to A7/D1 to D7
A8
8 bits
“H”
P3_1 to P3_3A9 to A11I/O ports
P3_4 to
P3_7
P4_0 to
P4_3
P4_4
PM11=0
PM11=1
PM06=0
PM06=1
CS0=0
CS0=1
P4_5
CS1=0
CS1=1
P4_6
CS2=0
CS2=1
P4_7
CS3=0
CS3=1
P5_0
PM02=0
PM02=1
P5_1BHE
PM02=0
PM02=1WRH
P5_2
P5_3
P5_4
P5_5
A12 to A15
I/O ports
A16 to A19
I/O ports
I/O ports
CS0
I/O ports
CS1
I/O ports
CS2
I/O ports
CS3
WR
RD
BCLK
HLDA
HOLD
(3)
(3)
WRL
WRH
(3)
(3)
WRL
I/O ports
I/O ports
(3)
(3)
P5_6ALE
P5_7
RDY
I/O ports: Function as I/O ports or peripheral function I/O pins.
NOTES :
1. To set the PM01 to PM00 bits are set to “01b” and the PM05 to PM04 bits are set to “11b” (multiplexed bus assigned to the entire CS
space), apply “H” to the BYTE pin (external data bus 8 bits wide). While the CNVSS pin is held “H” (= VCC1), do not rewrite the PM05 to
PM04 bits to “11b” after reset. If the PM05 to PM04 bits are set to “11b” during memory expansion mode, P3_1 to P3_7 and P4_0 to
P4_3 become I/O ports, in which case the accessible area for each CS is 256 bytes.
2. In separate bus mode, these pins serve as the address bus.
3. If the data bus is 8 bits wide, make sure the PM02 bit is set to “0” (RD, BHE, WR).
4. When accessing the area that uses a multiplexed bus, these pins output an indeterminate value during a write.
page 52
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 67
M16C/62P Group (M16C/62P, M16C/62PT)
8.2.9 External Bus Status When Internal Area Accessed
Table 8.7 shows the external bus status when the internal area is accessed.
Table 8.7 External Bus Status When Internal Area Accessed
ItemSFR Accessed Internal ROM, RAM Accessed
A0 to A19 Address output Maintain status before accessed
address of external area or SFR
D0 to D15 When ReadHigh-impedanceHigh-impedance
When WriteOutput dataUndefined
RD, WR, WRL, WRHRD, WR, WRL, WRH outputOutput “H”
BHEBHE outputMaintain status before accessed
status of external area or SFR
CS0 to CS3Output “H”Output “H”
ALEOutput “L”Output “L”
8.2.10 Software Wait
Software wait states can be inserted by using the PM17 bit in the PM1 register, the CS0W to CS3W bits
in the CSR register, and the CSE register. The SFR area is unaffected by these control bits. This area is
always accessed in 2 BCLK or 3 BCLK cycles as determined by the PM20 bit in the PM2 register. See
Table 8.8 Bit and Bus Cycle Related to Software Wait for details.
To use the RDY signal, set the corresponding CS3W to CS0W bit to “0” (with wait state). Figure 8.6
shows the CSE register. Table 8.8 shows the software wait related bits and bus cycles. Figure 8.7 and
8.8 show the typical bus timings using software wait.
________
8. Bus
Chip Select Expansion Control Register
b7 b6 b5 b4 b3 b2 b1 b0
NOTES :
1. Set the CSiW bit (i = 0 to 3) in the CSR register to “0” (with wait state) before writing to the CSEi1W to
CSEi0W bits. If the CSiW bit needs to be set to “1” (without wait state), set the CSEi1W to CSEi0W bits to
“00b” before setting it.
SymbolAddress After Reset
CSE001Bh00h
Bit Symbol
CSE00W
CSE01W
CSE10W
CSE11W
CSE20W
CSE21W
CSE30W
CSE31W
Bit Name
CS0 Wait Expansion Bit
CS1 Wait Expansion Bit
CS2 Wait Expansion Bit
CS3 Wait Expansion Bit
b1 b0
(1)
0 0: 1 wait
0 1: 2 waits
1 0: 3 waits
1 1: Do not set
b3 b2
(1)
0 0: 1 wait
0 1: 2 waits
1 0: 3 waits
1 1: Do not set
b5 b4
(1)
0 0: 1 wait
0 1: 2 waits
1 0: 3 waits
1 1: Do not set
b7 b6
(1)
0 0: 1 wait
0 1: 2 waits
1 0: 3 waits
1 1: Do not set
Function
RW
RW
RW
RW
RW
RW
RW
RW
RW
Figure 8.6 CSE Register
page 53
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 68
M16C/62P Group (M16C/62P, M16C/62PT)
Table 8.8 Bit and Bus Cycle Related to Software Wait
CSR Register
0
1
PM1 Register
(5)
PM17 Bit
0
1
0
1
1
(2)
PM2 Register
PM20 Bit
Area
SFR
Internal
RAM, ROM
External
Area
NOTES :
1. To use the RDY signal, set this bit to “0”.
2. To access in multiplexed bus mode, set the corresponding bit of CS0W to CS3W to “0” (with wait state).
3. When the selected CPU clock source is the PLL clock, the number of wait cycles can be altered by the PM20 bit in the PM2 register. When using a
16 MHz or higher PLL clock, be sure to set the PM20 bit to “0” (2 wait cycles).
4. After reset, the PM17 bit is set to “0” (without wait state), all of the CS0W to CS3W bits are set to “0” (with wait state), and the CSE register is set to
“00h” (one wait state for CS0 to CS3). Therefore, the internal RAM and internal ROM are accessed with no wait states, and all external areas are
accessed with one wait state.
5. When PM17 bit is set to “1” and accesses an external area, set the CSiW (i=0 to 3) bits to “0” (with wait state).
Bus Mode
Separate Bus
Multiplexed
Bus
CS3W Bit
CS2W Bit
CS1W Bit
CS0W Bit
1
0
0
0
0
0
0
0
0
(1)
(1)
(1)
(1)
CSE Register
CSE31W to CSE30W Bit
CSE21W to CSE20W Bit
CSE11W to CSE10W Bit
CSE01W to CSE00W Bit
Figure 8.7 Typical Bus Timings Using Software Wait (1)
-
page 55
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 70
M16C/62P Group (M16C/62P, M16C/62PT)
(1) Separate Bus, 3-Wait Setting
BCLK
Write signal
Read signal
Bus cycle
(1)
Bus cycle
8. Bus
(1)
Data bus
Address bus
CS
(2) Multiplexed Bus, 1- or 2-Wait Setting
BCLK
Write signal
Read signal
ALE
Address bus
Address bus/
Data bus
CS
(3) Multiplexed Bus, 3-Wait Setting
Address
Bus cycle
Address
Bus cycle
Output
Address
(1)
Data output
(1)
Address
Bus cycle
Address
(1)
Bus cycle
Input
Address
Input
(1)
BCLK
Write signal
Read signal
ALE
Address bus
Address bus/
Data bus
NOTES :
1. These example timing charts indicate bus cycle length. After this bus cycle sometimes come read and write cycles in
succession.
Address
CS
Address
Data output
Address
Figure 8.8 Typical Bus Timings Using Software Wait (2)
Address
Input
page 56
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 71
M16C/62P Group (M16C/62P, M16C/62PT)
9. Memory Space Expansion Function
9. Memory Space Expansion Function
Note
9. Memory Space Expansion Function is described in the M16C/62P (128-pin version and
100-pin version) only as an example.
The M16C/62P (80-pin version) and M16C/62PT do not use this function.
The following describes a memory space extension function.
During memory expansion or microprocessor mode, the memory space expansion function allows the
access space to be expanded using the appropriate register bits.
Table 9.1 shows the way of setting memory space expansion function, memory spaces.
Table 9.1 The Way of Setting Memory Space Expansion Function, Memory Space
Memory Space Expansion Function How to Set (PM15 to PM14)Memory Space
1-Mbyte Mode00b1 Mbyte (no expansion)
4-Mbyte Mode11b4 Mbytes
9.1 1-Mbyte Mode
In this mode, the memory space is 1 Mbytes. In 1-Mbyte mode, the external area to be accessed is
specified using the CSi (i = 0 to 3) signals (hereafter referred to as the CSi area). Figures 9.2 to 9.3 show
the memory mapping and CS area in 1-Mbyte mode.
____________
_____
9.2 4-Mbyte Mode
In this mode, the memory space is 4 Mbytes. Figure 9.1 shows the DBR register. The BSR2 to BSR0 bits
in the DBR register select a bank number which is to be accessed to read or write data. Setting the OFS bit
to “1” (with offset) allows the accessed address to be offset by 40000h.
In 4-Mbyte mode, the CSi (i=0 to 3) pin functions differently for each area to be accessed.
9.2.1 Addresses 04000h to 3FFFFh, C0000h to FFFFFh
____________
• The CSi signal is output from the CSi pin (same operation as 1-Mbyte mode. However the last
address of CS1 area is 3FFFFh)
9.2.2 Addresses 40000h to BFFFFh
______
• The CS0 pin outputs “L”
____________
• The CS1 to CS3 pins output the value of setting as the BSR2 to BSR0 bits (bank number)
Figures 9.4 to 9.5 show the memory mapping and CS area in 4-Mbyte mode. Note that banks 0 to 6 are
data-only areas. Locate the program in bank 7 or the CSi area.
______
_______
______
______
page 57
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 72
M16C/62P Group (M16C/62P, M16C/62PT)
9. Memory Space Expansion Function
Data Bank Register
b7 b6 b5 b4 b3 b2 b1 b0
NOTES:
1. Effective when the PM01 to PM00 bits in the PM0 register are set to “01b” (memory expansion mode) or
“11b” (microprocessor mode).
Figure 9.1 DBR Register
(1)
SymbolAddressAfter Reset
DBR000Bh00h
Bit Symbol
(b1-b0)
OFS
BSR0
BSR1
BSR2
(b7-b6)
Bit NameFunction
Nothing is assigned. When write, set to “0”. When read, its content is
“0”.
Offset Bit
Bank Selection Bits
Nothing is assigned. When write, set to “0”. When read, its content is
“0”.
0: Not offset
1: Offset
b5 b4 b3b5 b4 b3
0 0 0: Bank 00 0 1: Bank 1
0 1 0: Bank 20 1 1: Bank 3
1 0 0: Bank 41 0 1: Bank 5
1 1 0: Bank 61 1 1: Bank 7
RW
RW
RW
RW
RW
page 58
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 73
M16C/62P Group (M16C/62P, M16C/62PT)
9. Memory Space Expansion Function
Memory expansion mode
00000h
00400h
XXXXXh
08000h
Reserved, external area
10000h
27000h
28000h
30000h
80000h
YYYYYh
FFFFFh
PM13=1
Capacity
10 Kbytes
12 Kbytes
20 Kbytes
24 Kbytes
Address XXXXXh
SFR
Internal RAM
Reserved area
External area
Reserved area
Internal ROM
02BFFh
033FFh
053FFh
063FFh
(1)
Capacity
128 Kbytes
256 Kbytes
384 Kbytes
512 Kbytes
Microprocessor mode
Address YYYYYh
E0000h
C0000h
A0000h
80000h
(PM10=0: 124 Kbytes)
CS2
(32 Kbytes)
CS1
CS0
(Microprocessor mode:832 Kbytes)
page 59
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 74
M16C/62P Group (M16C/62P, M16C/62PT)
9. Memory Space Expansion Function
Memory expansion mode
00000h
00400h
h
XXXXX
04000h
08000h
Reserved, external area
10000h
27000h
28000h
40000h
C0000h
D0000h
YYYYYh
FFFFFh
SFR
Internal RAM
Reserved area
(3)
Reserved area
External area
Reserved area
Internal ROM
Microprocessor mode
SFR
Internal RAM
Reserved area
Reserved, external area
Reserved area
External area
(3)
(16 Kbytes)
CS3
(PM10=0: 124 Kbytes)
CS2
(PM10=1: 92 Kbytes)
CS2
(96 Kbytes)
CS1
Other than the CS area
CS0
(512 Kbytes X 8 banks)
CS0
(Memory expansion mode:64 Kbytes )
(Microprocessor mode:256 Kbytes)
PM13=0
Internal RAMInternal ROM
Capacity
10 Kbytes
12 Kbytes
16 Kbytes
20 Kbytes
24 Kbytes
31 Kbytes
NOTES :
Address XXXXXh
4 Kbytes
013FFh
5 Kbytes
017FFh
02BFFh
033FFh
03FFFh
03FFFh
03FFFh
03FFFh
1. The CS0 pin outputs a low signal, and the CS1–CS3 pins output a bank number.
2. If PM13 bit in the PM1 register is set to “0”, 15 Kbytes of the internal RAM and 192 Kbytes of the internal ROM can be used.
3. For flash memory version, when the PM10 bit in the PM1 register is set to “1”, 0F000h to 0FFFFh can be used as internal ROM area.
Capacity
48 Kbytes
64 Kbytes
96 Kbytes
128 Kbytes
192 Kbytes
(2)
(2)
256 Kbytes
(2)
320 Kbytes
(2)
384 Kbytes
512 Kbytes
Address YYYYYh
F4000h
F0000h
E8000h
E0000h
D0000h
(2)
D0000h
(2)
D0000h
(2)
D0000h
(2)
D0000h
CS0
Memory expansion mode
C0000h–CFFFFh
Microprocessor mode
C0000h–FFFFFh
______
External area
CS1
28000h–
3FFFFh
CS2
When PM10=0
08000h–26FFFh
When PM10=1
10000h–26FFFh
Figure 9.4 Memory Mapping and CS Area in 4-Mbyte mode (PM13=0)
CS3
04000h–
07FFFh
Other than the CS area
40000h–BFFFFh
(1)
Memory expansion mode
00000h
00400h
h
XXXXX
08000h
Reserved, external area
10000h
27000h
28000h
40000h
80000h
C0000h
YYYYYh
FFFFFh
SFR
Internal RAM
Reserved area
(2)
Reserved area
External area
Reserved area
Internal ROM
Microprocessor mode
SFR
Internal RAM
Reserved area
Reserved, external area
Reserved area
External area
(2)
(PM10=0: 124 Kbytes)
CS2
(PM10=1: 92 Kbytes)
CS2
(96 Kbytes)
CS1
Other than the CS area
*Two 256 Kbytes X 8 banks can be used by changing the offset.
1. The CS0 pin outputs a low signal, and the CS1–CS3 pins output a bank number.
2. For flash memory version, when the PM10 bit in the PM1 register is set to “1”, 0F000h to 0FFFFh can be used as internal ROM area.
043FFh
053FFh
063FFh
07FFFh
Internal ROM
Capacity
48 Kbytes
64 Kbytes
96 Kbytes
128 Kbytes
192 Kbytes
256 Kbytes
320 Kbytes
384 Kbytes
512 Kbytes
Address YYYYYh
F4000h
F0000h
E8000h
E0000h
D0000h
C0000h
B0000h
A0000h
80000h
CS0
Microprocessor mode
C0000h–FFFFFh
______
External area
CS1
28000h–
3FFFFh
CS2
When PM10=0
08000h–26FFFh
When PM10=1
10000h–26FFFh
Figure 9.5 Memory Mapping and CS Area in 4-Mbyte mode (PM13=1)
CS3
No area
Other than the CS area
Memory expansion mode
40000h–7FFFFh
Microprocessor mode
40000h–BFFFFh
(1)
page 60
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 75
M16C/62P Group (M16C/62P, M16C/62PT)
9. Memory Space Expansion Function
Figure 9.6 shows the external memory connect example in 4-Mbyte mode.
In this example, the CS pin of 4-Mbyte ROM is connected to the CS0 pin of microcomputer. The 4 Mbyte
____________
_______ ______________
ROM address input AD21, AD20 and AD19 pins are connected to the CS3, CS2 and CS1 pins of microcomputer, respectively. The address input AD18 pin is connected to the A19 pin of microcomputer. Figures 9.7 to 9.9 show the relationship of addresses between the 4-Mbyte ROM and the microcomputer for
the case of a connection example in Figure 9.6.
In microprocessor mode, or in memory expansion mode where the PM13 bit in the PM1 register is “0”,
banks are located every 512 Kbytes. Setting the OFS bit in the DBR register to “1” (offset) allows the
accessed address to be offset by 40000h, so that even the data overlapping a bank boundary can be
accessed in succession.
In memory expansion mode where the PM13 bit is “1,” each 512-Kbyte bank can be accessed in 256 Kbyte
units by switching them over with the OFS bit.
Because the SRAM can be accessed on condition that the chip select signals S2 = H and S1 =L, CS0 and
________________
CS2 can be connected to S2 and S1, respectively. If the SRAM does not have the input pins to accept “H”
__________________
___________
active and “L” active chip select signals(S1, S2), CS0 and CS2 should be decoded external to the chip.
D0 to D7
A0 to A16
A17
A19
8
17
DQ0 to DQ7
AD0 to AD16
AD17
AD18
CS1
CS2
CS3
Microcomputer
RD
CS0
WR
AD19
AD20
AD21
OE
CS
DQ0 to DQ7
AD0 to AD16
OE
S2
(1)
S1
W
4M bytes ROM
128K bytes SRAM
NOTES:
1. If only one chip select pin (S1 or S2) is present,
decoding by use of an external circuit is required.
Figure 9.6 External Memory Connect Example in 4-Mbyte Mode
page 61
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 76
M16C/62P Group (M16C/62P, M16C/62PT)
Memory expansion mode where PM13 =0
9. Memory Space Expansion Function
ROM addressMicrocomputer address
OFS bit in DBR
register = 0
000000h
bank 0
040000h
(512 Kbytes)
080000h
bank 1
0C0000h
(512 Kbytes)
100000h
bank 2
140000h
(512 Kbytes)
180000h
Data
1C0000h
bank 3
(512 Kbytes)
200000h
bank 4
240000h
(512 Kbytes)
280000h
bank 5
2C0000h
(512 Kbytes)
300000h
bank 6
(512 Kbytes)
bank 7
(512 Kbytes)
Program
or data
Program
or data
340000h
380000h
3C0000h
3FFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
OFS bit in DBR
register = 1
40000h
bank 0
(512 Kbytes)
BFFFFh
40000h
bank 1
(512 Kbytes)
BFFFFh
40000h
bank 2
(512 Kbytes)
BFFFFh
40000h
bank 3
(512 Kbytes)
BFFFFh
40000h
bank 4
(512 Kbytes)
BFFFFh
40000h
bank 5
(512 Kbytes)
BFFFFh
40000h
bank 6
(512 Kbytes)
BFFFFh
Bank
Number
0
OFS
Access
40000h
0
BFFFFh
40000h
1
BFFFFh
40000h
0
1
BFFFFh
40000h
1
BFFFFh
40000h
0
2
BFFFFh
40000h
1
BFFFFh
40000h
0
3
4
5
6
BFFFFh
40000h
1
BFFFFh
40000h
0
BFFFFh
40000h
1
BFFFFh
40000h
0
BFFFFh
40000h
1
BFFFFh
40000h
0
BFFFFh
40000h
1
BFFFFh
40000h380000h
7FFFFh
80000h3C0000h
70
BFFFFh
C0000h3C0000h
CFFFFh
D0000h
DFFFFh
D0000h
DFFFFh
N.C.: No connected
Output from the Microcomputer Pins
Area
CS OutputAddress Output
CS3 CS2 CS1 A19A17 A16
0
000100
0001011
0001000
0010111
0010100
0011011
0011000
0100111
0100100
0101011
0101000
0110111
0110100
0111011
0111000
1000111
1000100
1001011
1001000
1010111
1010100
1011011
1011000
1100111
1100100
1101011
1101000
1110111
1110100 0000h
1110111
1111000 0000h
1111011
1111100 0000h
1111100
A20 A19 A18
A21
Address Input for 4-Mbyte ROM
A18
N.C.
A17 A16
A15 to A0
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
FFFFh
FFFFh
FFFFh
A15 to A0
000000h
07FFFFh
040000h
0BFFFFh
080000h
0FFFFFh
0C0000h
13FFFFh
100000h
17FFFFh
140000h
1BFFFFh
180000h
1FFFFFh
1C0000h
23FFFFh
200000h
27FFFFh
240000h
2BFFFFh
280000h
2FFFFFh
2C0000h
33FFFFh
300000h
37FFFFh
340000h
3BFFFFh
3BFFFFh
3FFFFFh
3CFFFFh
Internal ROM access
Internal ROM access
Internal ROM access
Internal ROM access
Address input for
4-Mbyte ROM
Figure 9.7 Relationship Between Addresses on 4-Mbyte ROM and Those on Microcomputer (1)
page 62
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 77
M16C/62P Group (M16C/62P, M16C/62PT)
Memory expansion mode where PM13 =1
9. Memory Space Expansion Function
ROM addressMicrocomputer address
OFS bit in DBR
register = 0
000000h
bank 0
(256 Kbytes)
040000h
080000h
bank 1
(256 Kbytes)
0C0000h
100000h
bank 2
(256 Kbytes)
140000h
180000h
bank 3
(256 Kbytes)
Data
1C0000h
Program
or data
200000h
240000h
280000h
2C0000h
300000h
340000h
380000h
3C0000h
3FFFFFh
bank 4
(256 Kbytes)
bank 5
(256 Kbytes)
bank 6
(256 Kbytes)
bank 7
(256 Kbytes)
40000h
7FFFFh
40000h
7FFFFh
40000h
7FFFFh
40000h
7FFFFh
40000h
7FFFFh
40000h
7FFFFh
40000h
7FFFFh
40000h
7FFFFh
OFS bit in DBR
register = 1
40000h
bank 0
(256 Kbytes)
7FFFFh
40000h
bank 1
(256 Kbytes)
7FFFFh
40000h
bank 2
(256 Kbytes)
7FFFFh
40000h
bank 3
(256 Kbytes)
7FFFFh
40000h
bank 4
(256 Kbytes)
7FFFFh
40000h
bank 5
(256 Kbytes)
7FFFFh
40000h
bank 6
(256 Kbytes)
7FFFFh
40000h
bank 7
(256 Kbytes)
7FFFFh
Bank
Number
0
OFS
Access
40000h
0
7FFFFh
40000h
1
7FFFFh
40000h
0
1
7FFFFh
40000h
1
7FFFFh
40000h
0
2
7FFFFh
40000h
1
7FFFFh
40000h
0
3
4
7FFFFh
40000h
1
7FFFFh
40000h
0
7FFFFh
40000h
1
7FFFFh
40000h
0
7FFFFh
5
6
40000h
1
7FFFFh
40000h
0
7FFFFh
40000h
1
7FFFFh
40000h380000h
7FFFFh
0
7
80000h
FFFFFh
40000h
7FFFFh
1
7
80000h
FFFFFh
N.C.: No connected
Output from the Microcomputer Pins
Area
CS OutputAddress Output
CS3 CS2 CS1 A19A17 A16
000100
0
0000111
0001000
0001011
0010100
0010111
0011000
0011011
0100100
0100111
0101000
0101011
0110100
0110111
0111000
0111011
1000100
1000111
1001000
1001011
1010100
1010111
1011000
1011011
1100100
1100111
1101000
1101011
11101000000h
1110111
11110000000h
1111011FFFFh
A20 A19 A18
A21
A18
N.C.
Address Input for 4-Mbyte ROM
A17 A16
A15 to A0
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
0000h
FFFFh
FFFFh
A15 to A0
000000h
03FFFFh
040000h
07FFFFh
080000h
0BFFFFh
0C0000h
0FFFFFh
100000h
13FFFFh
140000h
17FFFFh
180000h
1BFFFFh
1C0000h
1FFFFFh
200000h
23FFFFh
240000h
27FFFFh
280000h
2BFFFFh
2C0000h
2FFFFFh
300000h
33FFFFh
340000h
37FFFFh
3BFFFFh
Internal ROM access
Internal ROM access
3C0000h
3FFFFFh
Internal ROM access
Internal ROM access
Address input for
4-Mbyte ROM
Figure 9.8 Relationship Between Addresses on 4-Mbyte ROM and Those on Microcomputer (2)
page 63
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 78
M16C/62P Group (M16C/62P, M16C/62PT)
Microprocessor mode
9. Memory Space Expansion Function
ROM addressMicrocomputer address
OFS bit in DBR
register = 0
000000h
bank 0
040000h
(512 Kbytes)
080000h
bank 1
0C0000h
(512 Kbytes)
100000h
bank 2
140000h
(512 Kbytes)
180000h
Data
1C0000h
bank 3
(512 Kbytes)
200000h
bank 4
240000h
(512 Kbytes)
280000h
bank 5
2C0000h
(512 Kbytes)
300000h
bank 6
(512 Kbytes)
bank 7
(512 Kbytes)
Program
or data
Program
or data
340000h
380000h
3C0000h
3FFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
BFFFFh
40000h
7FFFFh
C0000h
FFFFFh
OFS bit in DBR
register = 1
40000h
bank 0
(512 Kbytes)
BFFFFh
40000h
bank 1
(512 Kbytes)
BFFFFh
40000h
bank 2
(512 Kbytes)
BFFFFh
40000h
bank 3
(512 Kbytes)
BFFFFh
40000h
bank 4
(512 Kbytes)
BFFFFh
40000h
bank 5
(512 Kbytes)
BFFFFh
40000h
bank 6
(512 Kbytes)
BFFFFh
Bank
OFS
Number
40000h
0
0
1
BFFFFh
40000h
1
BFFFFh
40000h
0
40000h
1
BFFFFh
40000h
0
2
3
4
5
6
BFFFFh
1
BFFFFh
0
BFFFFh
40000h
1
0
BFFFFh
1
BFFFFh
0
BFFFFh
40000h
1
BFFFFh
0
BFFFFh
1
40000h380000h
7FFFFh
70
80000h3C0000h
BFFFFh
C0000h3C0000h111
FFFFFh
N.C.: No connected
Access
Area
Output from the Microcomputer Pins
CS OutputAddress Output
CS3 CS2 CS1 A19A17 A16 A15 to A0
0
000100
000 1011
0001000
0010111
001 0100
0011011BFFFFhFFFFh0FFFFFh
001 1000
010 0111
010 0100
0101011
011 0111
011101
011 1000
1000111BFFFFhFFFFh23FFFFh
1001011
1010111
101 1011
101 1000
110 0111
110 1011
1110111BFFFFhFFFFh3BFFFFh
11101000000h
1110111
1111000 0000h
1111011
1111111
A20 A19 A18 N.C. A17 A16
A21
A18
1
00040000h0000h
0
10040000h0000h
0
10040000h0000h
1
00040000h0000h
0
10040000h0000h
0
10040000h0000h
1
00040000h0000h
1
100 0000h
Address Input for 4-Mbyte ROM
1
0000h
FFFFh
0000h
FFFFh
0000h
0000h
FFFFh
0000h
FFFFh
FFFFh
FFFFh
0000h
FFFFh
FFFFh
FFFFh
0000h
FFFFh
FFFFh
FFFFh
FFFFh
FFFFh
A15 to A0
000000h
07FFFFh
040000h
0BFFFFh
080000h
0C0000h
13FFFFh
100000h
17FFFFh
140000h010
1BFFFFh
180000h011
1FFFFFh
1C0000h
200000h100
27FFFFh
240000h100
2BFFFFh
280000h101
2FFFFFh
2C0000h
33FFFFh
300000h110
37FFFFh
340000h110
3BFFFFh
3FFFFFh
3FFFFFh
Address Input for
4-Mbyte ROM
Figure 9.9 Relationship Between Addresses on 4-Mbyte ROM and Those on Microcomputer (3)
page 64
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 79
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
10. Clock Generating Circuit
10.1 Types of the Clock Generating Circuit
Four circuits are incorporated to generate the system clock signal :
• Main clock oscillation circuit
• Sub clock oscillation circuit
• On-chip oscillator
• PLL frequency synthesizer
Table 10.1 lists the clock generation circuit specifications. Figure 10.1 shows the clock generation circuit.
Figures 10.2 to 10.6 show the clock-related registers.
1. Write to this register after setting the PRC0 bit in the PRCR register to “1” (write enable).
2. The CM03 bit is set to “1” (high) while the CM04 bit is set to “0,” or when entered to stop mode.
3. This bit is provided to stop the main clock when the low power dissipation mode or on-chip oscillator low power dissipation
mode is selected. This bit cannot be used for detection as to whether the main clock stopped or not. To stop the main clock,
set bits in the following order.
(a) Set the CM07 bit to “1” (Sub-clock select) or the CM21 bit of CM2 register to “1” (On-chip oscillator select) with the
sub-clock stably oscillating.
(b) Set the CM20 bit of CM2 register to “0” (Oscillation stop, re-oscillation detection function disabled).
(c) Set the CM05 bit to “1” (Stop).
4. During external clock input, Set the CM05 bit to “0” (oscillate).
5. When CM05 bit is set to “1”, the XOUT pin goes “H”. Furthermore, because the internal feedback resistor remains connected,
the XIN pin is pulled “H” to the same level as XOUT via the feedback resistor.
6. After setting the CM04 bit to “1” (XCIN-XCOUT oscillator function), wait until the sub-clock oscillates stably before switching
the CM07 bit from “0” to “1” (sub-clock).
7. When entering stop mode from high or middle speed mode, on-chip oscillator mode or on-chip oscillator low power mode,
the CM06 bit is set to “1” (divide-by-8 mode).
8. The fC32 clock does not stop. During low speed or low power dissipation mode, do not set this bit to “1” (peripheral clock
turned off when in wait mode).
9. To use a sub-clock, set this bit to “1”. Also make sure ports P8_6 and P8_7 are directed for input, with no pull-ups.
10. When the PM21 bit of PM2 register is set to “1” (clock modification disable), writing to the CM02, CM05, and CM07 bits has
no effect.
11. If the PM21 bit needs to be set to “1,” set the CM07 bit to “0” (main clock) before setting it.
12. To use the main clock as the clock source for the CPU clock, set bits in the following order.
(a) Set the CM05 bit to “0” (oscillate).
(b) Wait the main clock oscillation stabilizes.
(c) Set the CM11, CM21 and CM07 bits all to “0”.
13. When the CM21 bit = 0 (on-chip oscillator turned off) and the CM05 bit = 1 (main clock turned off), the CM06 bit is fixed to “1”
(divide-by-8 mode) and the CM15 bit is fixed to “1” (drive capability High).
14. To return from on-chip oscillator mode to high-speed or middle-speed mode, set the CM06 and CM15 bits both to “1”.
Clock Output Function
Select Bit
(Valid only in single-chip
mode)
0 : Do not stop peripheral function clock in wait mode
(10)
1 : Stop peripheral function clock in wait mode
0 : LOW
1 : HIGH
0 : I/O port P8_6, P8_7
1 : XCIN-XCOUT generation function
0 : On
(4, 5)
1 : Off
0 : CM16 and CM17 valid
1 : Division by 8 mode
0 : Main clock, PLL clock, or on-chip oscillator clock
1 : Sub-clock
FunctionBit Symbol
(8)
(9)
RW
RW
RW
RW
RW
RW
RW
RW
RW
Figure 10.2 CM0 Register
page 67
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 82
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
System Clock Control Register 1
b7 b6 b5 b4 b3 b2 b1 b0
000
NOTES:
1. Write to this register after setting the PRC0 bit in the PRCR register to “1” (write enable).
2. When entering stop mode from high or middle speed mode, or when the CM05 bit is set to “1” (main clock turned off) in low
speed mode, the CM15 bit is set to “1” (drive capability high).
3. Effective when the CM06 bit is “0” (CM16 and CM17 bits enable).
4. If the CM10 bit is “1” (stop mode), XOUT goes “H” and the internal feedback resistor is disconnected. The XCIN and XCOUT
pins are placed in the high-impedance state. When the CM11 bit is set to “1” (PLL clock), or the CM20 bit in the CM2 register is
set to “1” (oscillation stop, re-oscillation detection function enabled), do not set the CM10 bit to “1”.
5. After setting the PLC07 bit in the PLC0 register to “1” (PLL operation), wait until Tsu (PLL) elapses before setting the CM11 bit to
“1” (PLL clock).
6. When the PM21 bit in the PM2 register is set to “1” (clock modification disable), writing to the CM10, CM11 bits has no effect.
When the PM22 bit in the PM2 register is set to “1” (watchdog timer count source is on-chip oscillator clock), writing to the CM10
bit has no effect.
7. Effective when CM07 bit is “0” and CM21 bit is “0” .
SymbolAddressAfter Reset
CM10007h00100000b
CM10
CM11
(b4-b2)
CM15
CM16
CM17
(1)
Bit
All Clock Stop Control Bit
(4, 6)
System Clock Select Bit 1
(6, 7)
Reserved Bit
XIN-XOUT Drive Capacity
Select Bit
Main Clock Division
Select Bit 1
Name
(2)
(3)
FunctionBit Symbol
0 : Clock on
1 : All clocks off (stop mode)
0 : Main clock
1 : PLL clock
Set to
0 : LOW
1 : HIGH
b7 b6
0 0 : No division mode
0 1 : Division by 2 mode
1 0 : Division by 4 mode
1 1 : Division by 16 mode
(5)
“0”
RW
RW
RW
RW
RW
RW
RW
Figure 10.3 CM1 Register
page 68
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 83
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
Oscillation Stop Detection Register
b7 b6 b5 b4 b3 b2 b1 b0
00
NOTES:
1. Write to this register after setting the PRC0 bit in the PRCR register to “1” (write enable).
2. When the CM20 bit is “1” (oscillation stop, re-oscillation detection function enabled), the CM27 bit is “1”
(oscillation stop, re-oscillation detection interrupt), and the CPU clock source is the main clock, the
CM21 bit is set to “1” (on-chip oscillator clock) if the main clock stop is detected.
3. If the CM20 bit is “1” and the CM23 bit is “1” (main clock turned off), do not set the CM21 bit to “0”.
4. This flag is set to “1” when the main clock is detected to have stopped and when the main clock is
detected to have restarted oscillating. When this flag changes state from “0” to “1,” an oscillation stop or
an oscillation restart detection interrupt is generated. Use this flag in an interrupt routine to discriminate
the causes of interrupts between the oscillation stop and oscillation restart detection interrupts and the
watchdog timer interrupt. The flag is cleared to “0” by writing a “0” in a program. (Writing a “1” has no
effect. Nor is it cleared to “0” by an oscillation stop or an oscillation restart detection interrupt request
acknowledged.)
If when the CM22 bit = 1 an oscillation stoppage or an oscillation restart is detected, no oscillation
stop and oscillation restart detection interrupts are generated.
5. Read the CM23 bit in an oscillation stop, re-oscillation detection interrupt handling routine to determine
the main clock status.
6. Effective when the CM07 bit in the CM0 register is “0”.
7. When the PM21 bit in the PM2 register is “1” (clock modification disabled), writing to the CM20 bit has no
effect.
8. Where the CM20 bit is “1” (oscillation stop, re-oscillation detection function enabled), the CM27 bit is “1”
(oscillation stop, re-oscillation detection interrupt), and the CM11 bit is “1” (the CPU clock source is PLL
clock), the CM21 bit remains unchanged even when main clock stop is detected. If the CM22 bit is “0”
under these conditions, oscillation stop, re-oscillation detection interrupt occur at main clock stop
detection; it is, therefore, necessary to set the CM21 bit to “1” (on-chip oscillator clock) inside the interrupt
routine.
9. Set the CM20 bit to “0” (disable) before entering stop mode. After exiting stop mode, set the CM20 bit
back to “1” (enable).
10.Set the CM20 bit to “0” (disable) before setting the CM05 bit in the CM0 register.
11.The CM20, CM21 and CM27 bits do not change at oscillation stop detection reset.
12.When the CM21 bit = 0 (on-chip oscillator turned off) and the CM05 bit = 1 (main clock turned off), the
CM06 bit is fixed to “1” (divide-by-8 mode) and the CM15 bit is fixed to “1” (drive capability High).
SymbolAddressAfter Reset
CM2000Ch
Bit Symbol
CM20
CM21
CM22
CM23
(b5-b4)
(b6)
CM27
(1)
0X000000b
Bit Name
Oscillation Stop,
Re-Oscillation Detection
(7, 9, 10, 11)
Bit
System Clock
Select Bit 2
(2, 3, 6, 8, 11, 12)
Oscillation Stop,
Re-Oscillation Detection
(4)
Flag
XIN Monitor Flag
Reserved Bit
Nothing is assigned. When write, set to “0”. When read, its
content is indeterminate.
Operation Select Bit
(when an oscillation stop,
re-oscillation is detected)
(11)
(5)
0: Oscillation stop, re-oscillation
detection function disabled
1: Oscillation stop, re-oscillation
detection function enabled
0: Main clock or PLL clock
1: On-chip oscillator clock
(On-chip oscillator oscillating)
0: Main clock stop, re-oscillation
not detected
1: Main clock stop, re-oscillation
detected
0: Main clock oscillating
1: Main clock turned off
1. Write to this register after setting the PRC0 bit in the PRCR register to “1” (write enable).
Processor Mode Register 2
b7 b6 b5 b4 b3 b2 b1 b0
Bit Symbol
(1)
SymbolAddress When Reset
PCLKR025Eh00000011b
Bit Name
Timers A, B Clock Select
Bit (Clock source for
Timers A, B, and the dead
timer)
SI/O Clock Select Bit
(Clock source for UART0
to UART2, SI/O3, SI/O4)
Reserved bitSet to
(1)
SymbolAddress After Reset
PM2001EhXXX00000b
Bit Name
0 : f2
1 : f1
0 : f2SIO
1 : f1SIO
“0”
Function
Function
RW
RW
RW
RW
RW
Figure 10.5 PCLKR Register and PM2 Register
page 70
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 85
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
PLL Control Register 0
b7 b6 b5 b4 b3 b2 b1 b0
0 10
NOTES:
1. Write to this register after setting the PRC0 bit in the PRCR register to “1” (write enable).
2. When the PM21 bit in the PM2 register is “1” (clock modification disable), writing to this register has no effect.
3.
These three bits can only be modified when the PLC07 bit = 0 (PLL turned off). The value once written to this bit
cannot be modified.
4. Before setting this bit to “1,” set the CM07 bit in the CM0 register to “0” (main clock), set the CM17 to CM16
bits in the CM1 register to “00b” (main clock undivided mode), and set the CM06 bit in the CM0 register to
“0” (CM16 and CM17 bits enable).
(1, 2)
Symbol Address After Reset
PLC0 001Ch 0001X010b
Bit
Symbol
PLC00
PLC01
PLC02
(b3)
(b4)
(b6-b5)
PLC07
Bit Name
PLL Multiplying Factor
Select Bit
Nothing is assigned. When write, set to “0”.
When read, its content is indeterminate.
Reserved Bit
Reserved BitSet to “0”
Operation Enable Bit
(3)
b1b0b2
0 0 0:
0 0 1: Multiply by 2
0 1 0: Multiply by 4
0 1 1: Multiply by 6
1 0 0: Multiply by 8
1 0 1:
1 1 0:
1 1 1:
Set to “1”
(4)
0: PLL Off
1: PLL On
Do not set
Function
Do not set
RW
RW
RW
RW
RW
RW
RW
Figure 10.6 PLC0 Register
page 71
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 86
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
The following describes the clocks generated by the clock generation circuit.
10.1.1 Main Clock
This clock is used as the clock source for the CPU and peripheral function clocks. This clock is used as
the clock source for the CPU and peripheral function clocks. The main clock oscillator circuit is configured by connecting a resonator between the XIN and XOUT pins. The main clock oscillator circuit contains a feedback resistor, which is disconnected from the oscillator circuit during stop mode in order to
reduce the amount of power consumed in the chip. The main clock oscillator circuit may also be configured by feeding an externally generated clock to the XIN pin. Figure 10.7 shows the examples of main
clock connection circuit.
After reset, the main clock divided by 8 is selected for the CPU clock.
The power consumption in the chip can be reduced by setting the CM05 bit in the CM0 register to “1”
(main clock oscillator circuit turned off) after switching the clock source for the CPU clock to a sub clock or
on-chip oscillator clock. In this case, XOUT goes “H”. Furthermore, because the internal feedback
resistor remains on, XIN is pulled “H” to XOUT via the feedback resistor. Note that if an externally
generated clock is fed into the XIN pin, the main clock cannot be turned off by setting the CM05 bit to “1,”
unless the sub clock is chosen as a CPU clock. If necessary, use an external circuit to turn off the clock.
During stop mode, all clocks including the main clock are turned off. Refer to 10.4 Power Control.
Microcomputer
(Built-in feedback resistor)
XINXOUT
(1)
Rd
CIN
NOTES:
1. Place a damping resistor if required. The resistance will vary depending on the oscillator and the oscillation drive
capacity setting. Use the value recommended by each oscillator the oscillator manufacturer.
When the oscillation drive capacity is set to low, check that oscillation is stable. Also, place a feedback resistor
between XIN and XOUT if the oscillator manufacturer recommends placing the resistor externally.
COUT
Figure 10.7 Examples of Main Clock Connection Circuit
Microcomputer
(Built-in feedback resistor)
XINXOUT
Open
Externally derived clock
VCC1
VSS
page 72
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 87
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
10.1.2 Sub Clock
The sub clock is generated by the sub clock oscillation circuit. This clock is used as the clock source for
the CPU clock, as well as the timer A and timer B count sources. In addition, an fc clock with the same
frequency as that of the sub clock can be output from the CLKOUT pin.
The sub clock oscillator circuit is configured by connecting a crystal resonator between the XCIN and
XCOUT pins. The sub clock oscillator circuit contains a feedback resistor, which is disconnected from the
oscillator circuit during stop mode in order to reduce the amount of power consumed in the chip. The sub
clock oscillator circuit may also be configured by feeding an externally generated clock to the XCIN pin.
Figure 10.8 shows the examples of sub clock connection circuit.
After reset, the sub clock is turned off. At this time, the feedback resistor is disconnected from the
oscillator circuit.
To use the sub clock for the CPU clock, set the CM07 bit in the CM0 register to “1 ” (sub clock) after the
sub clock becomes oscillating stably.
During stop mode, all clocks including the sub clock are turned off. Refer to 10.4 Power Control.
Microcomputer
(Built-in feedback resistor)
XCINXCOUT
CCINCCOUT
NOTES:
1. Place a damping resistor if required. The resistance will vary depending on the oscillator and the oscillation drive
capacity setting. Use the value recommended by each oscillator the oscillator manufacturer.
When the oscillation drive capacity is set to low, check that oscillation is stable. Also, place a feedback resistor
between XCIN and XCOUT if the oscillator manufacturer recommends placing the resistor externally.
(1)
RCd
Figure 10.8 Examples of Sub Clock Connection Circuit
Microcomputer
(Built-in feedback resistor)
XCINXCOUT
Externally derived clock
VCC1
VSS
Open
Z0320-5810B90JER
page 73
463fo4002,10peS03.2.veR
Page 88
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
10.1.3 On-chip Oscillator Clock
This clock, approximately 1MHz, is supplied by a on-chip oscillator. This clock is used as the clock
source for the CPU and peripheral function clocks. In addition, if the PM22 bit in the PM2 register is “1”
(on-chip oscillator clock for the watchdog timer count source), this clock is used as the count source for
the watchdog timer (Refer to 13.1 Count Source Protective Mode).
After reset, the on-chip oscillator is turned off. It is turned on by setting the CM21 bit in the CM2 register
to “1” (on-chip oscillator clock), and is used as the clock source for the CPU and peripheral function
clocks, in place of the main clock. If the main clock stops oscillating when the CM20 bit in the CM2
register is “1” (oscillation stop, re-oscillation detection function enabled) and the CM27 bit is “1” (oscillation stop, re-oscillation detection interrupt), the on-chip oscillator automatically starts operating, supplying
the necessary clock for the microcomputer.
10.1.4 PLL Clock
The PLL clock is generated PLL frequency synthesizer. This clock is used as the clock source for the
CPU and peripheral function clocks. After reset, the PLL clock is turned off. The PLL frequency synthesizer is activated by setting the PLC07 bit to “1” (PLL operation). When the PLL clock is used as the clock
source for the CPU clock, wait tsu(PLL) for the PLL clock to be stable, and then set the CM11 bit in the
CM1 register to “1”.
Before entering wait mode or stop mode, be sure to set the CM11 bit to “0” (CPU clock source is the main
clock). Furthermore, before entering stop mode, be sure to set the PLC07 bit in the PLC0 register to “0”
(PLL stops). Figure 10.9 shows the procedure for using the PLL clock as the clock source for the CPU.
The PLL clock frequency is determined by the equation below.
PLL clock frequency=f(XIN) X (multiplying factor set by the PLC02 to PLC00 bits in the PLC0 register
(However, 10 MHz ≤ PLL clock frequency ≤ 24 MHz)
The PLC02 to PLC00 bits can be set only once after reset. Table 10.2 shows the example for setting PLL
clock frequencies.
Table 10.2 Example for Setting PLL Clock Frequencies
XIN
PLC02PLC01PLC00Multiplying FactorPLL Clock
(MHz)
100012
50104
3.330116
2.51008
12
6
4
3
0012
0104
0116
1008
NOTES :
1. 10MHz ≤ PLL clock frequency ≤ 24MHz.
page 74
Z0320-5810B90JER
463fo4002,10peS03.2.veR
(MHz)
20
24
(1)
Page 89
M16C/62P Group (M16C/62P, M16C/62PT)
Using the PLL clock as the clock source for the CPU
Set the CM07 bit to “0” (main clock), the CM17 to CM16
bits to “00b”(main clock undivided), and the CM06 bit to “0”
(CM16 and CM17 bits enabled).
Set the PLC02 to PLC00 bits (multiplying factor).
(When PLL clock > 16MHz)
Set the PM20 bit to “0” (2 wait states).
Set the PLC07 bit to “1” (PLL operation).
10. Clock Generating Circuit
(1)
Wait until the PLL clock becomes stable (tsu(PLL)).
Set the CM11 bit to “1” (PLL clock for the CPU clock source).
END
NOTES :
1. PLL operation mode can be entered from high speed mode.
Figure 10.9 Procedure to Use PLL Clock as CPU Clock Source
Z0320-5810B90JER
page 75
463fo4002,10peS03.2.veR
Page 90
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
10.2 CPU Clock and Peripheral Function Clock
Two type clocks: CPU clock to operate the CPU and peripheral function clocks to operate the peripheral
functions.
10.2.1 CPU Clock and BCLK
These are operating clocks for the CPU and watchdog timer.
The clock source for the CPU clock can be chosen to be the main clock, sub clock, on-chip oscillator clock
or the PLL clock.
If the main clock or on-chip oscillator clock is selected as the clock source for the CPU clock, the selected
clock source can be divided by 1 (undivided), 2, 4, 8 or 16 to produce the CPU clock. Use the CM06 bit
in CM0 register and the CM17 to CM16 bits in the CM1 register to select the divide-by-n value.
When the PLL clock is selected as the clock source for the CPU clock, the CM06 bit should be set to “0”
and the CM17 to CM16 bits to “00b” (undivided).
After reset, the main clock divided by 8 provides the CPU clock.
During memory expansion or microprocessor mode, a BCLK signal with the same frequency as the CPU
clock can be output from the BCLK pin by setting the PM07 bit in the PM0 register to “0” (output enabled).
Note that when entering stop mode from high or middle speed mode, on-chip oscillator mode or on-chip
oscillator low power dissipation mode, or when the CM05 bit in the CM0 register is set to “1” (main clock
turned off) in low-speed mode, the CM06 bit in the CM0 register is set to “1” (divide-by-8 mode).
These are operating clocks for the peripheral functions.
Of these, fi (i = 1, 2, 8, 32) and fiSIO are derived from the main clock, PLL clock or on-chip oscillator clock
by dividing them by i. The clock fi is used for timers A and B, and fiSIO is used for serial I/O. The f8 and
f32 clocks can be output from the CLKOUT pin.
The fAD clock is produced from the main clock, PLL clock or on-chip oscillator clock, and is used for the
A/D converter.
When the WAIT instruction is executed after setting the CM02 bit in the CM0 register to “1” (peripheral
function clock turned off during wait mode), or when the microcomputer is in low power dissipation mode,
the fi, fiSIO and fAD clocks are turned off.
The fC32 clock is produced from the sub clock, and is used for timers A and B. This clock can be used
when the sub clock is on.
10.3 Clock Output Function
During single-chip mode, the f8, f32 or fC clock can be output from the CLKOUT pin. Use the CM01 to
CM00 bits in the CM0 register to select.
page 76
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 91
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
10.4 Power Control
Normal operation mode, wait mode and stop mode are provided as the power consumption control. All
mode states, except wait mode and stop mode, are called normal operation mode in this document.
10.4.1 Normal Operation Mode
Normal operation mode is further classified into seven modes.
In normal operation mode, because the CPU clock and the peripheral function clocks both are on, the
CPU and the peripheral functions are operating. Power control is exercised by controlling the CPU clock
frequency. The higher the CPU clock frequency, the greater the processing capability. The lower the
CPU clock frequency, the smaller the power consumption in the chip. If the unnecessary oscillator circuits are turned off, the power consumption is further reduced.
Before the clock sources for the CPU clock can be switched over, the new clock source to which switched
must be oscillating stably. If the new clock source is the main clock, sub clock or PLL clock, allow a
sufficient wait time in a program until it becomes oscillating stably.
Note that operation modes cannot be changed directly from low speed or low power dissipation mode to
on-chip oscillator or on-chip oscillator low power dissipation mode. Nor can operation modes be changed
directly from on-chip oscillator or on-chip oscillator low power dissipation mode to low speed or low power
dissipation mode. Where the CPU clock source is changed from the on-chip oscillator to the main clock,
change the operation mode to the medium speed mode (divided by 8 mode) after the clock was divided
by 8 (the CM06 bit in the CM0 register was set to “1”) in the on-chip oscillator mode.
10.4.1.1 High-speed Mode
The main clock divided by 1 provides the CPU clock. If the sub clock is on, fC32 can be used as the
count source for timers A and B.
10.4.1.2 PLL Operation Mode
The main clock multiplied by 2, 4, 6 or 8 provides the PLL clock, and this PLL clock serves as the CPU
clock. If the sub clock is on, fC32 can be used as the count source for timers A and B. PLL operation
mode can be entered from high speed mode. If PLL operation mode is to be changed to wait or stop
mode, first go to high speed mode before changing.
10.4.1.3 Medium-Speed Mode
The main clock divided by 2, 4, 8 or 16 provides the CPU clock. If the sub clock is on, fC32 can be
used as the count source for timers A and B.
10.4.1.4 Low-Speed Mode
The sub clock provides the CPU clock. The main clock is used as the clock source for the peripheral
function clock when the CM21 bit in the CM2 register is set to “0” (on-chip oscillator turned off), and the
on-chip oscillator clock is used when the CM21 bit is set to “1” (on-chip oscillator oscillating).
The fC32 clock can be used as the count source for timers A and B.
10.4.1.5 Low Power Dissipation Mode
In this mode, the main clock is turned off after being placed in low speed mode. The sub clock
provides the CPU clock. The fC32 clock can be used as the count source for timers A and B.
Simultaneously when this mode is selected, the CM06 bit becomes “1” (divided by 8 mode). In the low
power dissipation mode, do not change the CM06 bit. Consequently, the medium speed (divided by
8) mode is to be selected when the main clock is operated next.
10.4.1.6 On-chip Oscillator Mode
The on-chip oscillator clock divided by 1 (undivided), 2, 4, 8 or 16 provides the CPU clock. The onchip oscillator clock is also the clock source for the peripheral function clocks. If the sub clock is on,
fC32 can be used as the count source for timers A and B.
Z0320-5810B90JER
page 77
463fo4002,10peS03.2.veR
Page 92
M16C/62P Group (M16C/62P, M16C/62PT)
10.4.1.7 On-chip Oscillator Low Power Dissipation Mode
The main clock is turned off after being placed in on-chip oscillator mode. The CPU clock can be
selected as in the on-chip oscillator mode. The on-chip oscillator clock is the clock source for the
peripheral function clocks. If the sub clock is on, fC32 can be used as the count source for timers A
and B. When the operation mode is returned to the high and medium speed modes, set the CM06 bit
in the CM0 register to “1” (divided by 8 mode).
Table 10.3 Setting Clock Related Bit and Modes
Modes
PLL Operation Mode0100b 00
High-Speed Mode 0000b
Medium-
Speed
Mode
Low-Speed Mode 101
Low Power Dissipation Mode
On-chip
Oscillator
Mode
On-chip Oscillator Low Power
Dissipation Mode
NOTES :
divided by 2
divided by 4
divided by 8
divided by 16
divided by 1
divided by 2
divided by 4
divided by 8
divided by 16
1. When the CM05 bit is set to “1” (main clock turned off) in low-speed mode, the mode goes to low power
dissipation mode and CM06 bit is set to “1” (divided by 8 mode) simultaneously.
2. The divide-by-n value can be selected the same way as in on-chip oscillator mode.
CM2 Register
CM21
0001b
0010b 000
00010
0011b 000
0
100b
101b
110b000
1010
111b
1
CM1 Register
CM11CM17, CM16
0
0
0
0
0
0
0
0
(NOTE 2)
CM07CM06CM05CM04
CM0 Register
0
000
000
1
000
000
000
0
(1)
1
(NOTE 2)1
1
(1)
10. Clock Generating Circuit
1
: “0” or “1”
10.4.2 Wait Mode
In wait mode, the CPU clock is turned off, so are the CPU (because operated by the CPU clock) and the
watchdog timer. However, if the PM22 bit in the PM2 register is “1” (on-chip oscillator clock for the
watchdog timer count source), the watchdog timer remains active. Because the main clock, sub clock
and on-chip oscillator clock all are on, the peripheral functions using these clocks keep operating.
10.4.2.1 Peripheral Function Clock Stop Function
If the CM02 bit in the CM0 register is “1” (peripheral function clocks turned off during wait mode), the
f1, f2, f8, f32, f1SIO, f8SIO, f32SIO and fAD clocks are turned off when in wait mode, with the power
consumption reduced that much. However, fC32 remains on.
10.4.2.2 Entering Wait Mode
The microcomputer is placed into wait mode by executing the WAIT instruction.
When the CM11 bit = 1 (CPU clock source is the PLL clock), be sure to clear the CM11 bit in the CM1
register to “0” (CPU clock source is the main clock) before going to wait mode. The power consumption of the chip can be reduced by clearing the PLC07 bit in the PLC0 register to “0” (PLL stops).
10.4.2.3 Pin Status During Wait Mode
Table 10.4 lists pin status during wait mode
10.4.2.4 Exiting Wait Mode
The microcomputer is moved out of wait mode by a hardware reset, NMI interrupt or peripheral function interrupt.
If the microcomputer is to be moved out of exit wait mode by a hardware reset or NMI interrupt, set the
peripheral function interrupt priority ILVL2 to ILVL0 bits to “000b” (interrupts disabled) before executing the WAIT instruction.
The peripheral function interrupts are affected by the CM02 bit. If CM02 bit is “0” (peripheral function
clocks not turned off during wait mode), peripheral function interrupts can be used to exit wait mode. If
CM02 bit is “1” (peripheral function clocks turned off during wait mode), the peripheral functions using
the peripheral function clocks stop operating, so that only the peripheral functions clocked by external
signals can be used to exit wait mode.
______
______
page 78
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 93
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
Table 10.4 Pin Status During Wait Mode
PinMemory Expansion ModeSingle-Chip Mode
Microprocessor Mode
A0 to A19, D0 to D15, CS0 to CS3,
______________
________
BHE
_____ ______ ________ _________
Retains status before wait mode
Does not become a bus
control pin.
RD, WR, WRL, WRH“H”
HLDA, BCLK“H”
ALE“L”
I/O ports
CLKOUTWhen fC selectedDoes not stop
When f8, f32 selected
Retains status before wait modeRetains status before wait mode
Does not become a CLKOUT
pin.
Does not stop when the CM02
bit is “0”.
When the CM02 bit is “1”, the
status immediately prior to
entering wait mode is maintained.
Table 10.5 Interrupts to Exit Wait Mode
Interrupt CM02=0 CM02=1
NMI Interrupt Can be used
Serial I/O Interrupt
Key Input Interrupt Can be usedCan be used
A/D Conversion
Interrupt
Timer A Interrupt Can be used in all modesCan be used in event counter
Timer B Interrupt
INT Interrupt
Can be used when operating
with internal or external clock
Can be used in one-shot mode
or single sweep mode
Can be used
Can be used
Can be used when operating
with external clock
(Do not use)
mode or when the count
source is fC32
Can be used
Table 10.5 lists the interrupts to exit wait mode.
If the microcomputer is to be moved out of wait mode by a peripheral function interrupt, set up the
following before executing the WAIT instruction.
(1) Set the ILVL2 to ILVL0 bits in the interrupt control register, for peripheral function interrupts used
to exit wait mode,
The ILVL2 to ILVL0 bits in all other interrupt control registers, for peripheral function interrupts not
used to exit wait mode, are set to “000b” (interrupt disable).
(2) Set the I flag to “1”.
(3) Start operating the peripheral functions used to exit wait mode.
When the peripheral function interrupt is used, an interrupt routine is performed as soon as an
interrupt request is acknowledged and the CPU clock is supplied again.
When the microcomputer exits wait mode by the peripheral function interrupt, the CPU clock is the
same clock as the CPU clock executing the WAIT instruction.
page 79
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 94
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
10.4.3 Stop Mode
In stop mode, all oscillator circuits are turned off, so are the CPU clock and the peripheral function clocks.
Therefore, the CPU and the peripheral functions clocked by these clocks stop operating. The least
amount of power is consumed in this mode. If the voltage applied to VCC1 and VCC2 pins is VRAM or
more, the internal RAM is retained. When applying 2.7 or less voltage to VCC1 and VCC2 pins, make
sure VCC1 ≥ VCC2 ≥ VRAM.
However, the peripheral functions clocked by external signals keep operating. The following interrupts
can be used to exit stop mode.
______
• NMI interrupt
• Key interrupt
______
• INT interrupt
• Timer A, Timer B interrupt (when counting external pulses in event counter mode)
• Serial I/O interrupt (when external clock is selected)
• Voltage down detection interrupt (Refer to 6.1 Voltage Down Detection Interrupt for an Oper-
ating Condition)
10.4.3.1 Entering Stop Mode
The microcomputer is placed into stop mode by setting the CM10 bit in the CM1 register to “1” (all
clocks turned off). 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 CM1 register is set to “1” (main clock oscillator circuit drive capability high).
Before entering stop mode, set the CM20 bit in the CM2 register to “0” (oscillation stop, re-oscillation
detection function disable).
Also, if the CM11 bit in the CM1 register is “1” (PLL clock for the CPU clock source), set the CM11 bit
to “0” (main clock for the CPU clock source) and the PLC07 bit in the PLC0 register to “0” (PLL turned
off) before entering stop mode.
10.4.3.2 Pin Status in Stop Mode
Table 10.6 lists pin status during stop mode.
page 80
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 95
M16C/62P Group (M16C/62P, M16C/62PT)
10.4.3.3 Exiting Stop Mode
10. Clock Generating Circuit
Table 10.6 Pin Status in Stop Mode
PinMemory Expansion ModeSingle-Chip Mode
Microprocessor Mode
A0 to A19, D0 to D15, CS0 to CS3,
________
______________
Retains status before stop mode
BHE
_____ ______ ________ _________
RD, WR, WRL, WRH“H”
__________
HLDA, BCLK“H”
ALEindeterminate
I/O ports
Retains status before stop mode
CLKOUTWhen fC selected“H”
When f8, f32 selected
Retains status before stop mode
Retains status before stop mode
Z0320-5810B90JER
page 81
463fo4002,10peS03.2.veR
Page 96
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
Figure 10.10 shows the state transition from normal operation mode to stop mode and wait mode. Figure
10.11 shows the state transition in normal operation mode.
Table 10.7 shows a state transition matrix describing allowed transition and setting. The vertical line
shows current state and horizontal line shows state after transition.
1. Do not go directly from PLL operation mode to wait or stop mode.
2. PLL operation mode can be entered from high speed mode. Similarly, PLL operation mode can be changed back to high speed mode.
3. Shown above is the case where the PM21 bit in the PM2 register = 0 (system clock protective function unused).
4. The on-chip oscillator clock divided by 8 provides the CPU clock.
5. Write to the CM0 and CM1 registers per 16 bit with CM21=0 (on-chip oscillator stops).
Since the operation starts from the main clock after exiting stop mode, the time until the CPU operates can be reduced.
6. Before entering stop mode, be sure to clear the CM20 bit in the CM2 register to “0” (oscillation stop and oscillation restart detection function disabled).
Figure 10.10 State Transition to Stop Mode and Wait Mode
page 82
Z0320-5810B90JER
463fo4002,10peS03.2.veR
Page 97
M16C/62P Group (M16C/62P, M16C/62PT)
CM05=0
0
10. Clock Generating Circuit
Main clock oscillation
PLL operation mode
CPU clock: f(PLL)
CM07=0
CM06=0
CM17=0
CM16=0
PLL operation
mode
CPU clock: f(PLL)
CM07=0
CM06=0
CM17=0
CM16=0
CM04=0
PLC07=1
CM11=1
PLC07=0
CM11=0
PLC07=1
CM11=1
PLC07=0
CM11=0
(6)
(7)
(6)
(7)
High-speed mode
CPU clock: f(XIN)
CM07=0
CM06=0
CM17=0
CM16=0
High-speed mode
CPU clock: f(XIN)
CM07=0
CM06=0
CM17=0
CM16=0
Middle-speed mode
(divide by 2)
CPU clock: f(XIN)/2
CM07=0
CM06=0
CM17=0
CM16=1
Middle-speed mode
(divide by 2)
CPU clock: f(XIN)/2
CM07=0
CM06=0
CM17=0
CM16=1
CM07=1
CM05=1
Middle-speed mode
(divide by 4)
CPU clock: f(XIN)/4
Middle-speed mode
(divide by 4)
CPU clock: f(XIN)/4CPU clock: f(XIN)/8CPU clock: f(XIN)/16
(3)
Low-speed mode
CPU clock: f(XCIN)
(1, 9)
Low power dissipation mode
CPU clock: f(XCIN)
CM07=0
CM06=0
CM17=1
CM16=0
CM07=0
CM06=0
CM17=1
CM16=0
CM07=0
CM07=0
CM06=1
CM15=1
Middle-speed mode
(divide by 8)
CPU clock: f(XIN)/8CPU clock: f(XIN)/16
Middle-speed mode
(divide by 8)
Middle-speed mode
(divide by 16)
CM07=0
CM06=1
CM07=0
CM06=1
CM07=0
CM06=0
CM17=1
CM16=1
CM04=0CM04=1CM04=1CM04=1CM04=0CM04=1
Middle-speed mode
(divide by 16)
CM07=0
CM06=0
CM17=1
CM16=1
(2, 4)
CM07=0
CM05=0
CM21=0
CM21=1
CM21=0
CM21=1
CM21=0
CM21=1
On-chip oscillator mode
CPU clock
(8)
f(Ring)
f(Ring)/2
f(Ring)/4
f(Ring)/8
f(Ring)/16
On-chip oscillator
mode
(8)
CPU clock
f(Ring)
f(Ring)/2
f(Ring)/4
f(Ring)/8
f(Ring)/16
Low-speed mode
CPU clock: f(XCIN)
CM07=0
CM05=1
CM04=0
CM05=0
(1)
CM05=1
On-chip oscillator clock
oscillation
On-chip oscillator low power
dissipation mode
CPU clock
f(Ring)
f(Ring)/2
f(Ring)/4
f(Ring)/8
f(Ring)/16
On-chip oscillator
low power
dissipation mode
CPU clock
f(Ring)
f(Ring)/2
f(Ring)/4
f(Ring)/8
f(Ring)/16
(1)
Sub clock oscillation
NOTES:
1. Avoid making a transition when the CM20 bit in the CM2 register is set to “1” (oscillation stop, re-oscillation detection function enabled).
Set the CM20 bit to “0” (oscillation stop, re-oscillation detection function disabled) before transiting.
2. Wait the main clock oscillation stabilizes.
3. Switch clock after oscillation of sub-clock is sufficiently stable.
4. Change CM17 and CM16 bits in the CM1 register before changing CM06 bit in the CM0 register.
5. Transit in accordance with arrow.
6. The PM20 bit in the PM2 register become effective when the PLC07 bit in the PLC0 register is set to “1” (PLL on). Change the PM20 bit when the PLC07 bit is set to “0” (PLL off).
Set the PM20 bit to “0” (2 waits) when PLL clock >16MHz.
7. PLL operation mode can only be changed to high speed mode. If the PM20 bit = 0 (SFR accessed with two wait states), set PLC07 bit to “0” (PLL off) before setting the PM20 bit to “1”
(SFR accessed with one wait state).
8. Set the CM06 bit to “1” (division by 8 mode) before changing back the operation mode from on-chip oscillator mode to high- or middle-speed mode.
9. When the CM21 bit in the CM2 register = 0 (on-chip oscillator turned off) and the CM05 bit in the CM0 register = 1 (main clock turned off), the CM06 bit is fixed to “1” (divide-by-8 mode) and
the CM15 bit in the CM1 register is fixed to “1” (drive capability High).
Figure 10.11 State Transition in Normal Mode
Z0320-5810B90JER
page 83
463fo4002,10peS03.2.veR
Page 98
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
Table 10.7 Allowed Transition and Setting
State after transition
High-Speed Mode,
Middle-Speed Mode
High-Speed Mode,
Middle-Speed Mode
Low-Speed Mode
Low Power Dissipation
Mode
PLL Operation Mode
On-chip Oscillator Mode
Current state
On-chip Oscillator
Low Power Dissipation
Mode
Stop Mode
Wait Mode
NOTES :
1. Avoid making a transition when the CM21 bit is set in to “1” (oscillation stop, re-oscillation detection function enabled).
Set the CM21 bit to “0” (oscillation stop, re-oscillation detection function disabled) before transiting.
2. On-chip oscillator clock oscillates and stops in low-speed mode. In this mode, the on-chip oscillator can be used as peripheral function clock.
Sub clock oscillates and stops in PLL operation mode. In this mode, sub clock can be used as peripheral function clock.
3. PLL operation mode can only be entered from and changed to high-speed mode.
4. Set the CM06 bit to “1” (division by 8 mode) before transiting from on-chip oscillator mode to high- or middle-speed mode.
5. When exiting stop mode, the CM06 bit is set to “1” (division by 8 mode).
6. If the CM05 bit set to “1” (main clock stop), then the CM06 bit is set to “1” (division by 8 mode).
7. A transition can be made only when sub clock is oscillating.
8. State transitions within the same mode (divide-by-n values changed or subclock oscillation turned on or off) are shown in the table below.
CPU clock no division mode
CPU clock division by 2 mode
CPU clock division by 4 mode
CPU clock division by 16 mode
CPU clock division by 8 mode
Main clock, PLL clock,
or on-chip oscillator clock selected
Main clock selected
PLL clock selected
Main clock or PLL clock selected
Exit stop mode or wait mode
(NOTE 3)
(NOTE 4)
--
(NOTE 5)
Divided
by 8
Low-Speed Mode
(10)
Divided
by 16
(7)
(7)
(7)
(7)
----
--
(2)
--
(9)
(6)
(6)
(6)
(6)
--
--
(2)
(NOTE 7)
Low Power
(2)
Dissipation Mode
--
(NOTE 1,6)
(11)
--
--
--
--
-----(18)(18)--
No
Divided
Division
by 2
(1)
--
(1)
--
--
--
--
--
--
--
(4)
(3)
(3)
(4)
(3)
(4)
(3)
(4)
PLL Operation
(2)
Mode
(13)
--
--
(NOTE 3)
On-chip Oscillator
Mode
(15)--
--
--
--
--
(NOTE 8)
(10)
--
(18)
--
Divided
Divided
by 4
--
----
(1)
--
-(5)
(5)(7)
(5)
(5)
CM04, CM05, CM06, CM07 : Bits in CM0 register
CM10, CM11, CM16, CM17 : Bits in CM1 register
CM20, CM21 : Bits in CM2 register
PLC07 : Bit in PLC0 register
Divided
by 8
by 16
--
--
------
(1)
--
(1)
-(6)
(7)
(6)
(6)
(7)
(6)
(7)
--: Cannot transit
(NOTE 5)
On-chip Oscillator
Low Power
Dissipation Mode
--
--
--
(NOTE 1)
(11)
(NOTE 8)
(NOTE 5)
(18)
(18)(18)(18)(18)(18)
Stop ModeWait Mode
(NOTE 1)
(16)
(16)
(16)
(NOTE 1)
(NOTE 1)
(17)
(17)
(17)
--
(NOTE 1)
(16)
(16)
(NOTE 1)
(17)
(17)
--
--: Cannot transit
--
page 84
463fo4002,10peS03.2.veR
Z0320-5810B90JER
Page 99
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
10.5 System Clock Protection Function
The system clock protection function prohibits the CPU clock from changing clock sources when the main
clock is selected the CPU clock source. This prevents the CPU clock from stopping should the program
crash. This function is available when the main clock is selected as the CPU clock source.
When the PM21 bit in the PM2 register is set to “1” (clock change disabled), the following bits cannot be
written to:
• The CM02 bit, CM05 bit and CM07 bit in the CM0 register
• The CM10 bit and CM11 bit in the CM1 register
• The CM20 bit in the CM2 register
• All bits in the PLC0 register
When using the system clock protection function, set the CM05 bit in the CM0 register to “0” (main clock
oscillation) and CM07 bit to “0” (main clock as BCLK clock source) and follow the procedure below.
(1) Set the PRC1 bit in the PRCR register to “1” (write enable).
(2) Set the PM21 bit in the PM2 register to “1” (protects the clock).
(3) Set the PRC1 bit in the PRCR register to “0” (write disable).
When the PM21 bit is set to “1,” do not execute the WAIT instruction.
10.6 Oscillation Stop and Re-oscillation Detect Function
The oscillation stop and re-oscillation detect function is such that main clock oscillation circuit stop and reoscillation are detected. At oscillation stop, re-oscillation detection, reset or oscillation stop, re-oscillation
detection interrupt are generated. Which is to be generated can be selected using the CM27 bit in the CM2
register. The oscillation stop detection function can be enabled and disabled by the CM20 bit in the CM2
register. Table 10.8 lists an specification overview of the oscillation stop and re-oscillation detect function.
Table 10.8 Specification Overview of Oscillation Stop and Re-Oscillation Detect Function
ItemSpecification
Oscillation Stop Detectable Clock andf(XIN) ≥ 2 MHz
Frequency Bandwidth
Enabling Condition for Oscillation Stop, Set CM20 bit to “1”(enable)
Re-Oscillation Detection Function
Operation at Oscillation Stop,•Reset occurs (when CM27 bit =0)
Re-Oscillation Detection•
Oscillation stop, re-oscillation detection interrupt occurs (when CM27 bit =1)
Z0320-5810B90JER
page 85
463fo4002,10peS03.2.veR
Page 100
M16C/62P Group (M16C/62P, M16C/62PT)
10. Clock Generating Circuit
10.6.1 Operation When CM27 bit = 0 (Oscillation Stop Detection Reset)
Where main clock stop is detected when the CM20 bit is “1” (oscillation stop, re-oscillation detection
function enabled), the microcomputer is initialized, coming to a halt (oscillation stop reset; refer to 4.SFR, 5. Reset).
This status is reset with hardware reset 1 or hardware reset 2. Also, even when re-oscillation is detected,
the microcomputer can be initialized and stopped; it is, however, necessary to avoid such usage (During
main clock stop, do not set the CM20 bit to “1” and the CM27 bit to “0”).
10.6.2
Operation When CM27 bit = 0 (Oscillation Stop and Re-oscillation Detect Interrupt)
Where the main clock corresponds to the CPU clock source and the CM20 bit is “1” (oscillation stop and
re-oscillation detect function enabled), the system is placed in the following state if the main clock comes
to a halt:
• Oscillation stop and re-oscillation detect interrupt request occurs.
• The on-chip oscillator starts oscillation, and the on-chip oscillator clock becomes the clock source
for CPU clock and peripheral functions in place of the main clock.
• CM21 bit = 1 (on-chip oscillator clock for CPU clock source)
• CM22 bit = 1 (main clock stop detected)
• CM23 bit = 1 (main clock stopped)
Where the PLL clock corresponds to the CPU clock source and the CM20 bit is “1,” the system is placed
in the following state if the main clock comes to a halt: Since the CM21 bit remains unchanged, set it to “1”
(on-chip oscillator clock) inside the interrupt routine.
• Oscillation stop and re-oscillation detect interrupt request occurs.
• CM22 bit = 1 (main clock stop detected)
• CM23 bit = 1 (main clock stopped)
• CM21 bit remains unchanged
Where the CM20 bit is “1,” the system is placed in the following state if the main clock re-oscillates from
the stop condition:
• Oscillation stop and re-oscillation detect interrupt request occurs.
• CM22 bit = 1 (main clock re-oscillation detected)
• CM23 bit = 0 (main clock oscillation)
• CM21 bit remains unchanged
page 86
Z0320-5810B90JER
463fo4002,10peS03.2.veR
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.