Regarding the change of names mentioned in the document, such as Mitsubishi
Electric and Mitsubishi XX, to Renesas Technology Corp.
The semiconductor operations of Hitachi and Mitsubishi Electric were transferred to Renesas
Technology Corporation on April 1st 2003. These operations include microcomputer, logic, analog
and discrete devices, and memory chips other than DRAMs (flash memory, SRAMs etc.)
Accordingly, although Mitsubishi Electric, Mitsubishi Electric Corporation, Mitsubishi
Semiconductors, and other Mitsubishi brand names are mentioned in the document, these names
have in fact all been changed to Renesas Technology Corp. Thank you for your understanding.
Except for our corporate trademark, logo and corporate statement, no changes whatsoever have been
made to the contents of the document, and these changes do not constitute any alteration to the
contents of the document itself.
Note : Mitsubishi Electric will continue the business operations of high frequency & optical devices
and power devices.
Renesas Technology Corp.
Customer Support Dept.
April 1, 2003
Under
development
Description
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Description
The M16C/80 group of single-chip microcomputers are built using the high-performance silicon gate CMOS
process using a M16C/80 Series CPU core and are packaged in a 100-pin and 144-pin plastic molded
QFP. The peripheral functions of 100-pin and 144-pin are common. These single-chip microcomputers
operate using sophisticated instructions featuring a high level of instruction efficiency. With 16M bytes of
address space, they are capable of executing instructions at high speed. They also feature a built-in multiplier and DMAC, making them ideal for controlling office, communications, industrial equipment, and other
high-speed processing applications.
Features
• Memory capacity..................................ROM (See ROM expansion figure.)
(built-in feedback resistance, and external ceramic or quartz oscillator)
Specifications written in this manual are believed to be accurate, but are not guaranteed to be entirely free of error.
Specifications in this manual may be changed for functional or performance improvements. Please make sure
your manual is the latest edition.
_______
Applications
Audio, cameras, office equipment, communications equipment, portable equipment, etc.
------Table of Contents------
CPU ..............................................................13
Note 1: ROM size depends on MCU type.
Note 2: RAM size depends on MCU type.
Note 3: Ports P11 to P15 exist in 144-pin version.
Figure 1.1.4. Block diagram of the M16C/80 group
87885
(Note 3)
5
Under
development
Description
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Performance Outline
Table 1.1.1 is a performance outline of M16C/80 group.
Table 1.1.1. Performance outline of M16C/80 group
ItemPerformance
Number of basic instructions106 instructions
Shortest instruction execution time50ns(f(XIN)=20MHz)
MemorySee ROM expansion figure.
capacity10 to 24 K bytes
I/O portP0 to P10 (except P85) 8-bit x 10, 7-bit x 1
Input port1 bit x 1
Multifunction16 bits x 5
timer16 bits x 6
Serial I/O(UART or clock synchronous) x 5
A-D converter10 bits x (8 + 2) channels
D-A converter8 bits x 2
DMAC4 channels
DRAM controllerCAS before RAS refresh, self-refresh, EDO, FP
CRC calculation circuitCRC-CCITT
X-Y converter16 bits X 16 bits
Watchdog timer15 bits x 1 (with prescaler)
Interrupt29 internal and 8 external sources, 5 software sources, 7
P0 to P15 (except P85) 8-bit x 13, 7-bit x 2, 5-bit x 1
levels
(built-in feedback resistance, and external ceramic or
quartz oscillator)
and flash memory versions
2.7 to 5.5V (f(XIN)=10MHz) Mask ROM, external ROM
and flash memory versions
Mask ROM 128 Kbytes version
6
Under
development
Description
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi plans to release the following products in the M16C/80 group:
(1) Support for mask ROM version, external ROM version and flash memory version
(2) ROM capacity
(3) Package
100P6S-A: Plastic molded QFP (mask ROM version and flash memory version)
100P6Q-A: Plastic molded QFP (mask ROM version and flash memory version)
144P6Q-A: Plastic molded QFP (mask ROM version and flash memory version)
ROM Size
(Byte)
M30805SGP-BL
M30803SFP/GP-BL
Preliminary Specifications REV.D
External
ROM
M30802SGP-BL
M30800SFP/GP-BL
M30805SGP
M30803SFP/GP
M30802SGP
M30800SFP/GP
Mitsubishi Microcomputers
M16C/80 group
256K
128K
M30803MG-XXXFP/GP
M30805MG-XXXGP
M30800MC-XXXFP/GP
M30802MC-XXXGP
Mask ROM version
M30803FGFP/GP
M30805FGGP
M30800FCFP/GP
M30802FCGP
Flash memory
version
External ROM version
Figure 1.1.5. ROM expansion
The M16C/80 group products currently supported are listed in Table 1.1.2.
Specifications in this manual are tentative and subject to change.
Boot loader
Package type:
FP : Package100P6S-A
GP : Package100P6Q-A, 144P6Q-A
ROM No.
Omitted for blank external ROM version
and flash memory version
ROM capacity:
C : 128K bytes
G : 256K bytes
Memory type:
M : Mask ROM version
S : External ROM version
F : Flash memory version
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Figure 1.1.6. Type No., memory size, and package
Shows RAM capacity, pin count, etc
(The value itself has no specific meaning)
M16C/80 Group
M16C Family
8
Under
development
Pin Description
Specifications in this manual are tentative and subject to change.
Pin Description (1)
Preliminary Specifications REV.D
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Pin name
VCC, V
CNV
SS
RESET
X
IN
X
OUT
BYTE
AV
CC
AV
SS
V
REF
SS
Signal name
Power supply
input
CNV
SS
Reset input
Clock input
Clock output
External data
bus width
select input
Analog power
supply input
Analog power
supply input
Reference
voltage input
I/O type
I
I
I
O
I
I
Function
CC
Supply 4.2 (2.7) to 5.5 V to the V
This pin switches between processor modes. Connect it to the V
pin. Supply 0 V to the VSS pin.
SS
when operating in single-chip or memory expansion mode after reset.
Connect it to the V
CC
when in microprocessor mode after reset.
An “L” on this input resets the microcomputer.
These pins are provided for the main clock generating circuit. Connect
a ceramic resonator or crystal between the X
use an externally derived clock, input it to the X
X
OUT
pin open.
IN
and the X
IN
pin and leave the
OUT
pins. To
This pin selects the width of an data bus in the external area 3. A 16-
-bit width is selected when this input is “L”; an 8-bit width is selected
when this input is “H”. This input must be fixed to either “H” or “L”.
When not using the external bus, connect this pin to V
SS
.
This pin is a power supply input for the A-D converter. Connect this
pin to V
CC
.
This pin is a power supply input for the A-D converter. Connect this
pin to V
SS
.
This pin is a reference voltage input for the A-D converter.
P00 to P0
D0 to D
7
P10 to P1
D8 to D
15
P20 to P2
A0 to A
7
A0/D0 to
A
P30 to P3
A8 to A
15
A8/D8 to
A
15/D15
7
7
7
7/D7
7
I/O port P0
I/O port P1
I/O port P2
I/O port P3
I/O
This is an 8-bit CMOS I/O port. It has an input/output port direction
register that allows the user to set each pin for input or output
individually. When set for input in single chip mode, the user can
specify in units of four bits via software whether or not they are tied to
a pull-up resistance. In memory expansion and microprocessor
mode, an built-in pull-up resistance cannot be used. However, it is
possible to select pull-up resistance presence to the usable port as I/
O port by setting.
When set as a separate bus, these pins input and output data (D
I/O
This is an 8-bit I/O port equivalent to P0. P1
I/O
5
to P17 also function as
external interrupt pins as selected by software.
When set as a separate bus, these pins input and output data
I/O
This is an 8-bit I/O port equivalent to P0.
I/O
0–A7
O
These pins output 8 low-order address bits (A
If a multiplexed bus is set, these pins input and output data (D
I/O
and output 8 low-order address bits (A
0–A7
).
) separated in time by
multiplexing.
This is an 8-bit I/O port equivalent to P0.
I/O
These pins output 8 middle-order address bits (A
O
If the external bus is set as a 16-bit wide multiplexed bus, these pins
I/O
input and output data (D
bits (A
8–A15
) separated in time by multiplexing.
8–D15
) and output 8 middle-order address
8–A15
0–D7
).
(D8–D15).
0–D7
)
).
MA0 to MA7
If accessing to DRAM area, these pins output row address and
O
column address separated in time by multiplexing.
9
Under
development
Pin Description
Specifications in this manual are tentative and subject to change.
Pin Description (2)
Preliminary Specifications REV.D
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Signal nameFunctionPin nameI/O type
P40 to P4
7
A16 to A22,
23
A
0
to CS
CS
3
MA8 to MA12
P5
0
to P5
7
WRL / WR,
WRH / BHE,
RD,
BCLK,
HLDA,
HOLD,
ALE,
RDY
I/O port P4This is an 8-bit I/O port equivalent to P0.I/O
O
O
O
I/O port P5I/O
O
O
O
O
O
O
I
These pins output 8 high-order address bits (A
23
address bit (A
) outputs inversely.
16–A22
, A23). Highest
These pins output CS0–CS3 signals. CS0–CS3 are chip select
signals used to specify an access space.
If accessing to DRAM area, these pins output row address and
column address separated in time by multiplexing.
This is an 8-bit I/O port equivalent to P0. P53 in this port outputs a
IN
divide-by-8 or divide-by-32 clock of X
CIN
frequency as X
as selected by software.
or a clock of the same
Output WRL, WRH (WR and BHE), RD, BCLK, HLDA, and ALE
signals. WRL and WRH, and BHE and WR can be switched using
software control.
WRL, WRH, and RD selected
With a 16-bit external data bus, data is written to even addresses
I
when the WRL signal is “L” and to the odd addresses when the
WRH signal is “L”. Data is read when RD is “L”.
WR, BHE, and RD selected
Data is written when WR is “L”. Data is read when RD is “L”. Odd
addresses are accessed when BHE is “L”. Use this mode when
using an 8-bit external data bus.
While the input level at the HOLD pin is “L”, the microcomputer is
placed in the hold state. While in the hold state, HLDA outputs an “L”
level. ALE is used to latch the address. While the input level of the
RDY pin is “L”, the bus of microcomputer is in the wait state.
DW,
CASL,
CASH,
RAS
P60 to P6
P70 to P77
0
to P84,
P8
6
,
P8
7
,
P8
5
P8
P90 to P9
7
7
I/O port P6
I/O port P7
I/O port P8
I/O port P8
I/O port P9
O
O
O
O
I/O
When accessing to DRAM area while DW signal is “L”, write to DRAM.
CASL and CASH show timing when latching to line address. When
CASL accesses to even address, and CASH to odd, these two pins
become “L”. RAS signal shows timing when latching to row address.
This is an 8-bit I/O port equivalent to P0. When set for input in single
chip mode, microprocessor mode and memory expansion mode the
user can specify in units of four bits via software whether or not they
are tied to a pull-up resistance. Pins in this port also function as
UART0 and UART1 I/O pins as selected by software.
0
I/O
This is an 8-bit I/O port equivalent to P6 (P7
open drain output). Pins in this port also function as timer A
and P71 are N-channel
0–A3
,
timer B5 or UART2 I/O pins as selected by software.
I/O
I/O
I/O
5
P80 to P84, P86, and P87 are I/O ports with the same functions as P6.
Using software, they can be made to function as the I/O pins for timer
6
A4 and the input pins for external interrupts. P8
and P87 can be set
using software to function as the I/O pins for a sub clock generation
circuit. In this case, connect a quartz oscillator between P8
I
pin) and P8
7
(X
CIN
pin). P85 is an input-only port that also functions
6
(X
COUT
for NMI. The NMI interrupt is generated when the input at this pin
changes from “H” to “L”. The NMI function cannot be canceled using
software. The pull-up cannot be set for this pin.
I/O
This is an 8-bit I/O port equivalent to P6. Pins in this port also
function as UART3 and UART4 I/O pins, Timer B0–B4 input pins, D-A
converter output pins, A-D converter extended input pins, or A-D
trigger input pins as selected by software.
P100 to P10
10
7
I/O port P10
I/O
This is an 8-bit I/O port equivalent to P6. Pins in this port also
4
function as A-D converter input pins. Furthermore, P10
–P107 also
function as input pins for the key input interrupt function.
Under
development
Pin Description
Specifications in this manual are tentative and subject to change.
Pin Description (3)
(Note)
Preliminary Specifications REV.D
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Signal nameFunctionPin nameI/O type
II/OI/O port P11P110 to P114 This is an 5-bit I/O port equivalent to P6.
0
to P127 This is an 8-bit I/O port equivalent to P6.
(Note)
(Note)
0
to P146 This is an 7-bit I/O port equivalent to P6.
(Note)
(Note)
II/OI/O port P12P12
II/OI/O port P13P130 to P137 This is an 8-bit I/O port equivalent to P6.
II/OI/O port P14P14
II/OI/O port P15P150 to P157 This is an 8-bit I/O port equivalent to P6.
Note : Port P11 to P15 exist in 144-pin version.
11
Under
A
A
development
Memory
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Operation of Functional Blocks
The M16C/80 group accommodates certain units in a single chip. These units include ROM and RAM to
store instructions and data and the central processing unit (CPU) to execute arithmetic/logic operations.
Also included are peripheral units such as timers, serial I/O, D-A converter, DMAC, CRC calculation circuit,
A-D converter, DRAM controller and I/O ports.
The following explains each unit.
Memory
Figure 1.2.1 is a memory map of the M16C/80 group. The address space extends the 16 Mbytes from
address 00000016 to FFFFFF16. From FFFFFF16 down is ROM. For example, in the M30800MC-XXXFP,
there is 128K bytes of internal ROM from FE000016 to FFFFFF16. The vector table for fixed interrupts such
as the reset and NMI are mapped to FFFFDC16 to FFFFFF16. The starting address of the interrupt routine
is stored here. The address of the vector table for timer interrupts, etc., can be set as desired using the
internal register (INTB). See the section on interrupts for details.
From 00040016 up is RAM. For example, in the M30800MC-XXXFP, 10 Kbytes of internal RAM is mapped
to the space from 00040016 to 002BFF16. In addition to storing data, the RAM also stores the stack used
when calling subroutines and when interrupts are generated.
The SFR area is mapped to 00000016 to 0003FF16. This area accommodates the control registers for
peripheral devices such as I/O ports, A-D converter, serial I/O, and timers, etc. Figure 1.5.1 to 1.5.4 are
location of peripheral unit control registers. Any part of the SFR area that is not occupied is reserved and
cannot be used for other purposes.
The special page vector table is mapped to FFFE0016 to FFFFDB16. If the starting addresses of subroutines or the destination addresses of jumps are stored here, subroutine call instructions and jump instructions can be used as 2-byte instructions, reducing the number of program steps.
In memory expansion mode and microprocessor mode, a part of the spaces are reserved and cannot be
used. For example, in the M30800MC-XXXFP, the following spaces cannot be used.
• The space between 002C0016 and 00800016 (Memory expansion and microprocessor modes)
• The space between F0000016 and FDFFFF16 (Memory expansion mode)
_______
<100-pin version>
Type No.
M30800MC/FC
M30803MG/FG
<144-pin version>
Type No.
M30802MC/FC
M30805MG/FG
M30802S
M30805S
Address
XXXXX
002BFF
0053FF
Address
XXXXX
002BFF
0053FF
002BFF
0063FF
Figure 1.2.1. Memory map
12
000000
16
000400
16
XXXXXX
Address
YYYYY
FE0000
FC0000
Address
YYYYY
FE0000
FC0000
16
16
16
16
16
16
16
16
16
008000
16
16
16
F00000
16
YYYYYY
16
16
16
FFFFFF
Note 1: During memory expansion and microprocessor modes, can not be used.
Note 2: In memory expansion mode, can not be used.
SFR area
For details, see
Figures 1.5.1 to
Internal RAM
16
Internal reserved
area (Note 1)
AAA
External area
AAA
Internal reserved
area (Note 2)
16
Internal ROM
16
1.5.4
area
area
FFFE00
FFFFDC
FFFFFF
16
Special page
vector table
16
Undefined instruction
Overflow
BRK instruction
Address match
Watchdog timer
16
Reset
NMI
Under
development
CPU
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Central Processing Unit (CPU)
The CPU has a total of 28 registers shown in Figure 1.3.1. Eight of these registers (R0, R1, R2, R3, A0, A1,
SB and FB) come in two sets; therefore, these have two register banks.
General register
b31
R2
R3
b23
High-speed interrupt register
b23
b15b0
FLG
R0H
R1H
A0
A1
SB
FB
USP
ISP
INTB
PC
b15b0
SVP
R0L
R1L
R2
R3
SVF
Flag register
Data register (Note)
Address register (Note)
Static base register (Note)
Frame base register (Note)
User stack pointer
Interrupt stack pointer
Interrupt table register
Program counter
Flag save register
PC save register
VCT
DMAC related register
b15
b23
DMA0
DMA1
DSA0
DSA1
DRA0
DRA1
Note: These registers have two register banks.
Figure 1.3.1. Central processing unit register
b7b0
DMD0
DMD1
DCT0
DCT1
DRC0
DRC1
Vector register
DMA mode register
DMA transfer count register
DMA transfer count reload register
DMA memory address register
DMA SFR address register
DMA memory address reload register
13
Under
development
CPU
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(1) Data registers (R0, R0H, R0L, R1, R1H, R1L, R2, R3, R2R0 and R3R1)
Data registers (R0, R1, R2, and R3) are configured with 16 bits, and are used primarily for transfer and
arithmetic/logic operations.
Registers R0 and R1 each can be used as separate 8-bit data registers, high-order bits as (R0H/R1H),
and low-order bits as (R0L/R1L). Registers R2 and R0, as well as R3 and R1 can use as 32-bit data
registers (R2R0/R3R1).
(2) Address registers (A0 and A1)
Address registers (A0 and A1) are configured with 24 bits, and have functions equivalent to those of data
registers. These registers can also be used for address register indirect addressing and address register
relative addressing.
(3) Static base register (SB)
Static base register (SB) is configured with 24 bits, and is used for SB relative addressing.
(4) Frame base register (FB)
Frame base register (FB) is configured with 24 bits, and is used for FB relative addressing.
(5) Program counter (PC)
Program counter (PC) is configured with 24 bits, indicating the address of an instruction to be executed.
(6) Interrupt table register (INTB)
Interrupt table register (INTB) is configured with 24 bits, indicating the start address of an interrupt vector
table.
(7) User stack pointer (USP), interrupt stack pointer (ISP)
Stack pointer comes in two types: user stack pointer (USP) and interrupt stack pointer (ISP), each configured with 24 bits.
Your desired type of stack pointer (USP or ISP) can be selected by a stack pointer select flag (U flag).
This flag is located at the position of bit 7 in the flag register (FLG).
Set USP and ISP to an even number so that execution efficiency is increased.
(8) Save flag register (SVF)
This register consists of 16 bits and is used to save the flag register when a high-speed interrupt is
generated.
14
Under
development
CPU
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(9) Save PC register (SVP)
This register consists of 24 bits and is used to save the program counter when a high-speed interrupt is
generated.
(10) Vector register (VCT)
This register consists of 24 bits and is used to indicate the jump address when a high-speed interrupt is
generated.
(11) DMA mode registers (DMD0/DMD1)
These registers consist of 8 bits and are used to set the transfer mode, etc. for DMA.
(12) DMA transfer count registers (DCT0/DCT1)
These registers consist of 16 bits and are used to set the number of DMA transfers performed.
(13) DMA transfer count reload registers (DRC0/DRC1)
These registers consist of 16 bits and are used to reload the DMA transfer count registers.
(14) DMA memory address registers (DMA0/DMA1)
These registers consist of 24 bits and are used to set a memory address at the source or destination of
DMA transfer.
(15) DMA SFR address registers (DSA0/DSA1)
These registers consist of 24 bits and are used to set a fixed address at the source or destination of DMA
transfer.
These registers consist of 24 bits and are used to reload the DMA memory address registers.
15
Under
development
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
CPU
(17) Flag register (FLG)
Flag register (FLG) is configured with 11 bits, each bit is used as a flag. Figure 1.3.2 shows the flag
register (FLG). The following explains the function of each flag:
• Bit 0: Carry flag (C flag)
This flag retains a carry, borrow, or shift-out bit that has occurred in the arithmetic/logic unit.
• Bit 1: Debug flag (D flag)
This flag enables a single-step interrupt.
When this flag is “1”, a single-step interrupt is generated after instruction execution. This flag is
cleared to “0” when the interrupt is acknowledged.
• Bit 2: Zero flag (Z flag)
This flag is set to “1” when an arithmetic operation resulted in 0; otherwise, cleared to “0”.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
• Bit 3: Sign flag (S flag)
This flag is set to “1” when an arithmetic operation resulted in a negative value; otherwise, cleared
to “0”.
• Bit 4: Register bank select flag (B flag)
This flag chooses a register bank. Register bank 0 is selected when this flag is “0” ; register bank
1 is selected when this flag is “1”.
• Bit 5: Overflow flag (O flag)
This flag is set to “1” when an arithmetic operation resulted in overflow; otherwise, cleared to “0”.
• Bit 6: Interrupt enable flag (I flag)
This flag enables a maskable interrupt.
An interrupt is disabled when this flag is “0”, and is enabled when this flag is “1”. This flag is
cleared to “0” when the interrupt is acknowledged.
• Bit 7: Stack pointer select flag (U flag)
Interrupt stack pointer (ISP) is selected when this flag is “0” ; user stack pointer (USP) is selected
when this flag is “1”.
This flag is cleared to “0” when a hardware interrupt is acknowledged or an INT instruction of
software interrupt Nos. 0 to 31 is executed.
16
• Bits 8 to 11: Reserved area
Under
development
CPU
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
• Bits 12 to 14: Processor interrupt priority level (IPL)
Processor interrupt priority level (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 the processor interrupt priority level (IPL), the interrupt
is enabled.
• Bit 15: Reserved area
b0b15
IPL
Flag register (FLG)
CDZSBOIU
Carry flag
Figure 1.3.2. Flag register (FLG)
Debug flag
Zero flag
Sign flag
Register bank select flag
Overflow flag
Interrupt enable flag
Stack pointer select flag
Reserved area
Processor interrupt priority level
Reserved area
17
Under
development
Reset
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Reset
There are two kinds of resets; hardware and software. In both cases, operation is the same after the reset.
(See “Software Reset” for details of software resets.) This section explains on hardware resets.
When the supply voltage is in the range where operation is guaranteed, a reset is effected by holding the
reset pin level “L” (0.2VCC max.) for at least 20 cycles. When the reset pin level is then returned to the “H”
level while main clock is stable, the reset status is cancelled and program execution resumes from the
address in the reset vector table.
Figure 1.4.1 shows the example reset circuit. Figure 1.4.2 shows the reset sequence.
RESET
Example when f(XIN) = 10MHz and V
V
Figure 1.4.1. Example reset circuit
X
IN
More than 20 cycles are needed
Microprocessor
mode BYTE = “H”
RESET
BCLK
Address
RD
BCLK 24cycles
CC
5V
V
CC
0V
5V
RESET
0V
FFFFC
CC
= 5V
16
4.2V
0.8V
.
Content of reset vector
FFFFD
16
FFFFE
16
WR
CS0
Microprocessor
mode BYTE = “L”
Address
RD
WR
CS0
Single chip
mode
Address
Figure 1.4.2. Reset sequence
18
FFFFC
FFFFC
16
16
FFFFE
FFFFE
16
Content of reset vector
16
Content of reset vector
Under
development
Reset
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Table 1.4.1 shows the statuses of the other pins while the RESET pin level is “L”. Figures 1.4.3 and 1.4.4
____________
show the internal status of the microcomputer immediately after the reset is cancelled.
Table 1.4.1. Pin status when RESET pin level is “L”
____________
Status
Pin name
P0
P1
P2, P3, P4
P5
0
P5
1
P5
2
P5
3
P5
4
CNVSS = V
Input port (floating)
Input port (floating)
Input port (floating)
Input port (floating)
Input port (floating)
Input port (floating)
Input port (floating)
Input port (floating)
SS
CNVSS = V
BYTE = V
SS
Data input (floating)
Data input (floating)
Address output (undefined)
WR output (“H” level is output)
BHE output (undefined)
RD output (“H” level is output)
BCLK output
HLDA output (The output value
depends on the input to the
HOLD pin)
CC
BYTE = V
CC
Data input (floating)
Input port (floating)
Address output (undefined)
WR output (“H” level is output)
BHE output (undefined)
RD output (“H” level is output)
BCLK output
HLDA output (The output value
depends on the input to the
HOLD pin)
P5
5
P5
6
P5
7
P6, P7, P80 to P84,
P8
6
, P87, P9, P10,
P11, P12, P13,
P14, P15 (Note)
Input port (floating)
Input port (floating)
Input port (floating)
Input port (floating)
Input port (floating)Input port (floating)Input port (floating)
Note :Port P11 to P15 exist in 144-pin vrsion.
HOLD input (floating)
RAS output
RDY input (floating)
HOLD input (floating)
RAS output
RDY input (floating)
Input port (floating)Input port (floating)
19
Under
development
Reset
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
(The blank area is reserved and cannot be used by user.)
Note 1: Addresses 03C916, 03CB16 to 03D316 area is for future plan.
Must set "FF
Note 2: Address 03DC
16
" to address 03CB16, 03CE16, 03CF16, 03D216, 03D316 at initial setting.
16
area is for future plan. Must set "0016" to address 03DC16 at initial setting.
Figure 1.5.4. Location of peripheral unit control registers (4)
25
Under
development
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Software Reset
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Software Reset
Writing “1” to bit 3 of the processor mode register 0 (address 000416) applies a (software) reset to the
microcomputer. A software reset has the same effect as a hardware reset. The contents of internal RAM
are preserved.
Processor Mode
(1) Types of Processor Mode
One of three processor modes can be selected: single-chip mode, memory expansion mode, and microprocessor mode. The functions of some pins, the memory map, and the access space differ according to
the selected processor mode.
• Single-chip mode
In single-chip mode, only internal memory space (SFR, internal RAM, and internal ROM) can be
accessed. Ports P0 to P10 can be used as programmable I/O ports or as I/O ports for the internal
peripheral functions.
• Memory expansion mode
In memory expansion mode, external memory can be accessed in addition to the internal memory
space (SFR, internal RAM, and internal ROM).
In this mode, some of the pins function as the address bus, the data bus, and as control signals. The
number of pins assigned to these functions depends on the bus and register settings. (See “Bus
Settings” for details.)
• Microprocessor mode
In microprocessor mode, the SFR, internal RAM, and external memory space can be accessed. The
internal ROM area cannot be accessed.
In this mode, some of the pins function as the address bus, the data bus, and as control signals. The
number of pins assigned to these functions depends on the bus and register settings. (See “Bus
Settings” for details.)
(2) Setting Processor Modes
26
The processor mode is set using the CNVSS pin and the processor mode bits (bits 1 and 0 at address
000416). Do not set the processor mode bits to “102”.
Regardless of the level of the CNVSS pin, changing the processor mode bits selects the mode. Therefore,
never change the processor mode bits when changing the contents of other bits. Also do not attempt to
shift to or from the microprocessor mode within the program stored in the internal ROM area.
• Applying VSS to CNVSS pin
The microcomputer begins operation in single-chip mode after being reset. Memory expansion mode
is selected by writing “012” to the processor mode is selected bits.
• Applying VCC to CNVSS pin
The microcomputer starts to operate in microprocessor mode after being reset.
Figure 1.6.1 and 1.6.2 show the processor mode register 0 and 1.
Figure 1.6.3 shows the memory maps applicable for each processor modes.
Under
development
Processor Mode
Specifications in this manual are tentative and subject to change.
The device is reset when this bit is set to “1”.
The value of this bit is “0” when read.
b5 b4
0 0 : Multiplexed bus is not used
0 1 : Allocated to CS2 space
1 0 : Allocated to CS1 space
1 1 : Allocated to entire space (Note4)
Must always be set to “0”
0 : BCLK is output (Note 6)
1 : Function set by bit 0,1 of system
clock control register 0
Note 1: Set bit 1 of the protect register (address 000A
Note 2: If the V
CC
voltage is applied to the CNVSS, the value of this register when reset is 0316. (PM00 is set
16
) to “1” when writing new values to this register.
to “1” and PM07 is set to “0”.)
Note 3: Valid in microprocessor and memory expansion modes 1, 2 and 3. Do not use multiplex bus when
mode 0 is selected. Do not set to allocated to CS2 space when mode 2 is selected.
Note 4: After the reset has been released, the M16C/80 group MCU operates using the separate bus. As a
result, in microprocessor mode, you cannot select the full CS space multiplex bus.
When you select the full CS space multiplex bus in memory expansion mode, the address bus
operates with 64 Kbytes boundaries for each chip select.
Mode 0: Multiplexed bus cannot be used.
Mode 1: CS0 to CS2 when you select full CS space.
Mode 2: CS0 to CS1 when you select full CS space.
Mode 3: CS0 to CS3 when you select full CS space.
Note 5: No BCLK is output in single chip mode even when "0" is set in PM07. When stopping clock output in
microprocessor or memory expansion mode, make the following settings: PM07="1", bit 0 (CM00) and
bit 1 (CM01) of system clock control register 0 (address 0006
16
) = "0". "L" is now output from P53.
Note 6: When selecting BCLK, set bits 0 and 1 of system clock control register 0 (CM00, CM01) to "0".
Note 7: When using 16-bit bus width in DRAM controller, set this bit to "1".
Note 8: Do not set the processor mode bits and other bits simultaneously when setting the processor mode
bits to “01
2
” or “112”. Set the other bits first, and then change the processor mode bits.
Figure 1.6.1. Processor mode register 0
27
Under
development
Processor Mode
Specifications in this manual are tentative and subject to change.
Processor mode register 1 (Note 1) :Mask ROM version
b7 b6 b5 b4 b3 b2 b1 b0
Preliminary Specifications REV.D
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
ROMless version (144-pin version)
SymbolAddressWhen reset
0
PM10005
16
00
16
Bit nameFunctionBit symbol
PM10
External memory area
mode bit (Note 3)
b1 b0
0 0 : Mode 0 (P4
0 1 : Mode 1 (P4
P4
PM11
1 0 : Mode 2 (P4
P4
1 1 : Mode 3 (Note 2)
(P4
4
to P47 : CS3 to CS0)
PM12
Internal memory wait bit0 : No wait state
1 : Wait state inserted
Reserved bit
PM14
PM15
ALE pin select bit (Note 3)
Must always be set to “0”
b5 b4
0 0 : No ALE
0 1 : P5
3
1 0 : P5
1 1 : P5
/BCLK (Note 4)
6
/RAS
4
/HLDA
Nothing is assinged. When read, the content is indeterminate.
Note 1: Set bit 1 of the protect register (address 000A16) to “1” when writing new values to this register.
Note 2: When mode 3 is selected, DRAMC is not used.
Note 3: Valid in memory expansion mode or in microprocessor mode.
Note 4: When selecting P5
3
/BCLK, set bits 0 and 1 of system clock control register 0 (CM00, CM01) to "0".
Processor mode register 1 (Note 1) :Flash memory version
b7 b6 b5 b4 b3 b2 b1 b0
0
SymbolAddressWhen reset
PM10005
16
00
16
4
to P47 : A20 to A23)
4
: A20,
5
to P47 : CS2 to CS0)
4
, P45 : A20, A21,
6
, P47 : CS1, CS0)
WR
PM10
External memory area
mode bit (Note 3)
PM11
PM12
Internal memory wait bit0 : No wait state
Reserved bit
PM14
PM15
ALE pin select bit (Note 3)
Reserved bit
Note 1: Set bit 1 of the protect register (address 000A16) to “1” when writing new values to this register.
Note 2: When mode 3 is selected, DRAMC is not used.
Note 3: Valid in memory expansion mode or in microprocessor mode.
Note 4: When selecting P5
3
/BCLK, set bits 0 and 1 of system clock control register 0 (CM00, CM01) to "0".
Note 5: Rewrite this bit when the main clock is in division by 8 mode.
Figure 1.6.2. Processor mode register 1
Bit nameFunctionBit symbol
b1 b0
0 0 : Mode 0 (P4
0 1 : Mode 1 (P4
P4
1 0 : Mode 2 (P4
P4
4
to P47 : A20 to A23)
4
: A20,
5
to P47 : CS2 to CS0)
4
, P45 : A20, A21,
6
, P47 : CS1, CS0)
WR
1 1 : Mode 3 (Note 2)
(P4
4
to P47 : CS3 to CS0)
1 : Wait state inserted
Must always be set to “0”
b5 b4
0 0 : No ALE
0 1 : P5
3
1 0 : P5
1 1 : P5
/BCLK (Note 4)
6
/RAS
4
/HLDA
Must always be set to “1” (Note 5)
28
Under
Single chip
mode
Memory expanded mode
Microprocessor mode
SFR area
Internal RAM area
Internal reserved area
Internal ROM area
No use
External area 0
CS2
2Mbytes
External area 1
CS0
2Mbytes
External area 3
No use
Internal ROM area
Internal reserved area
Internal ROM area
Internal reserved area
Internal ROM area
Internal reserved area
CS0
3Mbytes
External area 3
CS1
4Mbytes
(Note2)
External area 0
External area 3
No use
CS0
2Mbytes
External area 3
CS0
4Mbytes
External area 3
000000
16
000400
16
000800
16
200000
16
400000
16
C00000
16
E00000
16
F00000
16
FFFFFF
16
Each CS0 to CS3 can set 0 to 3 WAIT.
Mode 0
Mode 1Mode 2Mode 0
Mode 1
Mode 2
SFR area
Internal RAM area
Internal reserved area
SFR area
Internal RAM area
Internal reserved area
SFR area
Internal RAM area
Internal reserved area
SFR area
Internal RAM area
Internal reserved area
SFR area
Internal RAM area
Internal reserved area
SFR area
Internal RAM area
Mode 3
Internal reserved area
SFR area
Internal RAM area
Internal ROM area
Internal reserved area
CS1, 1Mbytes
External area 0
Mode 3
Internal reserved area
SFR area
Internal RAM area
No use
CS2, 1Mbytes
External area 1
No use
Connect with
DRAM
0, 0.5 to 8MB
(When not
connect with
DRAM, use as
external area.)
Connect with
DRAM
0, 0.5 to 8MB
(When open area
is under 8MB,
cannot use the
rest of this area.)
Connect with
DRAM
0, 0.5 to 8MB
(When open area
is under 8MB,
cannot use the
rest of this area.)
Connect with
DRAM
0, 0.5 to 8MB
(When open area
is under 8MB,
cannot use the
rest of this area.)
No use
(Cannot use as
DRAM area or
external area.)
Connect with
DRAM
0, 0.5 to 8MB
(When not
connect with
DRAM, use as
external area.)
Connect with
DRAM
0, 0.5 to 8MB
(When open area
is under 8MB,
cannot use the
rest of this area.)
No use
(Cannot use as
DRAM area or
external area.)
No use
No use
No use
CS1
2Mbytes
(Note1)
External area 0
No use
Note 1: 200000
16
–008000
16
=2016 Kbytes. 32 K less than 2 MB.
Note 2: 400000
16
–008000
16
=4064 Kbytes. 32 K less than 4 MB.
External area 1
External area 0
CS2
2Mbytes
External area 1
CS1
4Mbytes
(Note2)
External area 0
CS1, 1Mbytes
External area 0
CS2, 1Mbytes
External area 1
CS1
2Mbytes
(Note1)
External area 0
External area 1
(External area 2)(External area 2)(External area 2)
(External area 2)(External area 2)(External area 2)
External area 3
CS3, 1Mbytes
External area 2
CS0, 1Mbytes
External area 3
CS3, 1Mbytes
External area 2
CS0, 1Mbytes
External area 3
Preliminary Specifications REV.D
development
Processor Mode
Processor Mode
Specifications in this manual are tentative and subject to change.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Figure 1.6.3. Memory maps in each processor mode
29
Under
development
Bus Settings
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Bus Settings
The BYTE pin, bit 0 to 3 of the external data bus width control register (address 000B16), bits 4 and 5 of the
processor mode register 0 (address 000416) and bit 0 and 1 of the processor mode register 1 (address
000516) are used to change the bus settings.
Table 1.7.1 shows the factors used to change the bus settings, figure 1.7.1 shows external data bus width
control register and table 1.7.2 shows external area 0 to 3 and external area mode.
Table 1.7.1. Factors for switching bus settings
Bus settingSwitching factor
Switching external address bus widthExternal data bus width control register
Switching external data bus widthBYTE pin (external area 3 only)
Switching between separate and multiplex busBits 4 and 5 of processor mode register 0
(1) Selecting external address bus width
You can select the width of the address bus output externally from the 16 Mbytes address space, the
number of chip select signals, and the address area of the chip select signals. (Note, however, that when
you select “Full CS space multiplex bus”, addresses A0 to A15 are output.) The combination of bits 0 and
1 of the processor mode register 1 allow you to set the external area mode.
When using DRAM controller, the DRAM area is output by multiplexing of the time splitting of the row and
column addresses.
____
(2) Selecting external data bus width
You can select 8-bit or 16-bit for the width of the external data bus for external areas 0, 1, 2, and 3. When
the data bus width bit of the external data bus width control register is “0”, the data bus width is 8 bits;
when “1”, it is 16 bits. The width can be set for each of the external areas. The default bus width for
external area 3 is 16 bits when the BYTE pin is “L” after a reset, or 8 bits when the BYTE pin is “H” after
a reset. The bus width selection is valid only for the external bus (the internal bus width is always 16 bits).
During operation, fix the level of the BYTE pin to “H” or “L”.
(3) Selecting separate/multiplex bus
The bus format can be set to multiplex or separate bus using bits 4 and 5 of the processor mode register 0.
• Separate bus
In this bus configuration, input and output is performed on separate data and address buses. The data
bus width can be set to 8 bits or 16 bits using the external data bus width control register. For all
programmable external areas, P0 is the data bus when the external data bus is set to 8 bits, and P1 is
a programmable IO port. When the external data bus width is set to 16 bits for any of the external
areas, P0 and P1 (although P1 is undefined for any 8-bit bus areas) are the data bus.
When accessing memory using the separate bus configuration, you can select a software wait using
the wait control register.
• Multiplex bus
In this bus configuration, data and addresses are input and output on a time-sharing basis. For areas
for which 8-bit has been selected using the external data bus width control register, the 8 bits D0 to D7
are multiplexed with the 8 bits A0 to A7. For areas for which 16-bit has been selected using the external
data bus width control register, the 16 bits D0 to D15 are multiplexed with the 16 bits A0 to A15. When
accessing memory using the multiplex bus configuration, two waits are inserted regardless of whether
you select “No wait” or “1 wait’ in the appropriate bit of the wait control register.
30
Under
development
Specifications in this manual are tentative and subject to change.
Bus Settings
Preliminary Specifications REV.D
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
The default after a reset is the separate bus configuration, and the full CS space multiplex bus configu-
____
____
ration cannot be selected in microprocessor mode. If you select “Full CS space multiplex bus”, the 16
bits from A0 to A15 are output for the address
External data bus width control register
b7 b6 b5 b4 b3 b2 b1 b0
SymbolAddressWhen reset
DS000B
16
XXXXX000
2
Bit nameFunctionBit symbol
DS0
DS1
DS2
DS3
Nothing is assigned.
When write, set "0". When read, their contents are indeterminate.
Note: The value after a reset is determined by the input via the BYTE pin.
External area 0 data bus
width bit
External area 1 data bus
width bit
External area 2 data bus
width bit
External area 3 data bus
width bit (Note)
0 : 8 bits data bus width
1 : 16 bits data bus width
0 : 8 bits data bus width
1 : 16 bits data bus width
0 : 8 bits data bus width
1 : 16 bits data bus width
0 : 8 bits data bus width
1 : 16 bits data bus width
WR
Figure 1.7.1. External data bus width control register
Table 1.7.2. External area 0 to 3 and external area mode
External area mode
Memory expansion mode
Microprocessor mode
area 0
External
Memory expansion mode
Microprocessor mode
area 1
External
Memory expansion mode
Microprocessor mode
area 2
External
Memory expansion mode
area 3
External
Microprocessor mode
(Note 2)
,
,
,
Mode 0Mode 1Mode 2Mode 3
00800016 to
1FFFFF
16
20000016 to
3FFFFF
16
40000016 to
BFFFFF
16
(Note 1)
C0000016 to
EFFFFF
16
C0000016 to
FFFFFF
16
<CS1 area>
008000
1FFFFF
16
to
16
<CS2 area>
200000
3FFFFF
16
to
16
<DRAMC area>
400000
BFFFFF
16
to
16
<CS0 area>
C00000
EFFFFF
16
to
16
<CS0 area>
E00000
FFFFFF
16
to
16
<CS1 area>
008000
1FFFFF
16
to
16
No area is
selected.
<DRAMC area>
400000
BFFFFF
16
to
16
<CS0 area>
C00000
EFFFFF
16
to
16
<CS0 area>
C00000
FFFFFF
16
to
16
<CS1 area>
100000
1FFFFF
<CS2 area>
200000
2FFFFF
<CS3 area>
C00000
CFFFFF
<CS0 area>
E00000
EFFFFF
<CS0 area>
F00000
FFFFFF
16
16
16
16
16
to
16
to
16
to
16
to
16
to
16
Note 1: DRAMC area when using DRAMC.
Note 2:Set the external area mode (modes 0, 1, 2, and 3) using bits 0 and 1 of the processor mode register
1 (address 000516).
31
Under
development
Bus Settings
Specifications in this manual are tentative and subject to change.
Table 1.7.3. Each processor mode and port function
Preliminary Specifications REV.D
Processor
mode
Single-chip
mode
Memory expansion mode/microprocessor modes
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Memory
expansion mode
Multiplexed
bus space
select bit
Data bus width
BYTE pin level
“01”, “10”
CS1 or CS2 : multiplexed
bus, and the other :
separate bus
All external
area is 8 bits
Some external
area is 16 bits
Separate bus
All external
area is 8 bits
“00”
Some external
area is 16 bits
area is 8 bits
“11” (Note 1)
All space multiplexed
bus
All external
Some external
area is 16 bits
P00 to P07I/O portData busData busData busData busI/O port I/O port
P10 to P17I/O portI/O portData busI/O portData busI/O portI/O port
P2
0
to P2
7
P30 to P3
P4
0
to P4
P4
4
to P4
I/O port
7
I/O port
3
I/O portAddress busAddress busAddress busAddress busI/O port I/O port
6
I/O portCS (chip select) or address bus (A20 to A22)
Address busAddress bus
/data bus/data bus
(Note 2)
Address busAddress bus
(Note 2)
/data bus
(Note 2)
Address busAddress busAddress busAddress bus
/data bus/data bus
Address busAddress busAddress busAddress bus
/data bus
(For details, refer to “Bus control”) (Note 5)
P4
7
I/O port
CS (chip select) or address bus (A23)
(For details, refer to “Bus control”) (Note 5)
P5
0
to P5
3
I/O port
Outputs RD, WRL, WRH and BCLK, or RD, BHE, WR and BCLK
Note 1:The default after a reset is the separate bus configuration, and "Full CS space multiplex bus" cannot be selected in
microprocessor mode. When you select "Full CS space multiplex bus" in extended memory mode, the address bus
operates with 64 Kbytes boundaries for each chip select.
Note 2: Address bus in separate bus configuration.
Note 3: The ALE output pin is selected using bits 4 and 5 of the processor mode register 1.
Note 4: When you have selected use of the DRAM controller and you access the DRAM area, these are CASL, CASH, DW, and
BCLK outputs.
Note 5: The CS signal and address bus selection are set by the external area mode.
32
Under
Preliminary Specifications REV.D
development
Bus Control
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Bus Control
The following explains the signals required for accessing external devices and software waits. The signals
required for accessing the external devices are valid when the processor mode is set to memory expansion
mode and microprocessor mode.
(1) Address bus/data bus
There are 24 pins, A0 to A22 and A23 for the address bus for accessing the 16 Mbytes address space. A23
is an inverted output of the MSB of the address.
The data bus consists of pins for data IO. The external data bus control register (address 000B16) selects
the 8-bit data bus, D0 to D7 for each external area, or the 16-bit data bus, D0 to D15. After a reset, there is
by default an 8-bit data bus for the external area 3 when the BYTE pin is “H”, or a 16-bit data bus when the
BYTE pin is “L”.
When shifting from single-chip mode to extended memory mode, the value on the address bus is undefined until an external area is accessed.
When accessing a DRAM area with DRAM control in use, a multiplexed signal consisting of row address
and column address is output to A8 to A20.
(2) Chip select signals
The chip select signals share A0 to A22 and A23. You can use bits 0 and 1 of the processor mode register
1 (address 000516) to set the external area mode, then select the chip select area and number of address
outputs.
In microprocessor mode, external area mode 0 is selected after a reset. The external area can be split
into a maximum of four using the chip select signals. Table 1.7.4 shows the external areas specified by
the chip select signals.
________
____
Table 1.7.4. External areas specified by the chip select signals
Memory space
expansion
mode
Mode 0
Mode 1
Mode 2
Specified address range
Mode 3
Processor mode
Memory expansion mode
Microprocessor mode
Memory expansion mode
Microprocessor mode
Memory expansion mode
Microprocessor mode
CS0
(A23)
C0000016 to
DFFFFF
(2 Mbytes)
E0000016 to
FFFFFF
(2 Mbytes)
C00000
EFFFFF
(3 Mbytes)
C00000
FFFFFF
(4 Mbytes)
E00000
EFFFFF
(1 Mbytes)
F0000016 to
FFFFFF
(1 Mbytes)
16
16
16
to
16
16
to
16
16
to
16
16
CS1CS2CS3
(A22)(A21)(A20)
00800016 to
1FFFFF
(2016 Kbytes)
008000
3FFFFF
(4064 Kbytes)
100000
1FFFFF
(1 Mbytes)
Chip select signal
200000
16
16
to
16
16
to
16
3FFFFF
(2 Mbytes)
(A21)(A20)
200000
2FFFFF
(1 Mbytes)
16
to
16
16
to
16
(A20)
16
C00000
CFFFFF
(1 Mbytes)
to
16
33
Under
Preliminary Specifications REV.D
development
Bus Control
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
The chip select signal turns “L” (active) in synchronize with the address bus. However, its turning “H”
depends on the area accessed in the next cycle. Figure 1.7.2 shows the output examples of the address
bus and chip select signals.
(Example 1) After accessing the external area, the address bus and chip
(Example 3) After accessing the external area, only the address bus is
select signal both are changed in the next cycle.
The following example shows the other chip select signal accessing
area (j) in the cycle after having accessed external area (i). In this
case, the address bus and chip select signal both change between the
two cycles.
Access to
Access to
external
external
area (j)
area (i)
Data bus
Address bus
Chip select
(CSi)
Chip select
(CSj)
changed in the next cycle. (The chip select signal does not
change.)
The following example shows the same chip select signal
accessing area (i) in the cycle after having accessed
external area (i). In this case, the address bus changes
between the two cycles, but the chip select signal does not.
Address
Access to
external
area (i)
Data
Access to
external
area (i)
Data
(Example 2) After accessing the external area, only the chip select signal
(Example 4) After accessing the external area, the address bus and chip
is changed in the next cycle. (The address bus does not
change.)
The following example shows the CPU accesses the internal
ROM/RAM area in the cycle after having accessed external
area. In this case, the chip select signal changes between the
two cycles but the address bus does not.
Data bus
Address bus
Chip select
select signal both are not changed in the next cycle.
The following example shows CPU does not access any
area in the cycle after having accessed external area (no
instruction pre-fetch is occurred). In this case, the address
bus and the chip select signal do not change between the
two cycles.
Data
Address
Access to
external
area
No access
Data bus
Address bus
Chip select
(CSi)
Address
Note: These examples show the address bus and chip select signal for two consecutive cycles.
By combining these examples, chip select signal can be extended beyond two cycles.
Data
Data
Data bus
Address bus
Chip select
Data
Address
Figure 1.7.2. Example of address bus and chip select signal outputs (Separate bus)
34
Under
Preliminary Specifications REV.D
development
Bus Control
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(3) Read/write signals
With a 16-bit data bus, bit 2 of the processor mode register 0 (address 000416) select the combinations of
_____ ___________________ _________________
RD, BHE, and WR signals or RD, WRL, and WRH signals. With a 8-bit full space data bus, use the
combination of RD, WR, and BHE signals as read/write signals. (Set "0" to bit 2 of the processor mode
register 0 (address 000416).) When using both 8-bit and 16-bit data bus widths and you access an 8-bit
data bus area, the RD, WR and BHE signals combination is selected regardless of the value of bit 2 of the
processor mode register 0 (address 000416).
Tables 1.7.5 and 1.7.6 show the operation of these signals.
After a reset has been cancelled, the combination of RD, WR, and BHE signals is automatically selected.
When switching to the RD, WRL, and WRH combination, do not write to external memory until bit 2 of the
processor mode register 0 (address 000416) has been set (Note).
Note 1: Before attempting to change the contents of the processor mode register 0, set bit 1 of the protect
register (address 000A16) to “1”.
Note 2: When using 16-bit data bus width for DRAM controller, select RD, WRL, and WRH signals.
_____ ______________
_____ ______________
_____ ______________
_____ __________________
_____ _________________
Table 1.7.5. Operation of RD, WRL, and WRH signals
_____ _________________
Data bus width
16-bit
8-bit
______
L
H
H
H
H
L
H
L
H
L
L (Note)
H (Note)
WRHWRLRD
H
H
L
L
Not used
Not used
Note: It becomes WR signal.
Table 1.7.6. Operation of RD, WR, and BHE signals
_____ ______________
Data bus widthA0
16-bit
8-bit
RD
HLL
LHL
HLH
LHH
HLLL
LHLL
HLH / L
LHH / L
BHEWR
Not used
Not used
Status of external data bus
Read data
Write 1 byte of data to even address
Write 1 byte of data to odd address
Write data to both even and odd addresses
Write 1 byte of data
Read 1 byte of data
Status of external data bus
H
H
L
L
Write 1 byte of data to odd address
Read 1 byte of data from odd address
Write 1 byte of data to even address
Read 1 byte of data from 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
35
Under
Preliminary Specifications REV.D
development
Bus Control
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(4) ALE signal
The ALE signal latches the address when accessing the multiplex bus space. Latch the address when the
ALE signal falls. The ALE output pin is selected using bits 4 and 5 of the processor mode register 1
(address 000516).
The ALE signal is occurred regardless of internal area and external area.
When BYTE pin = “H”
ALE
D
0/A0
to D7/A
A8 to A
15
A16 to A
A20 to A22, A
19
ALE
7
23
AddressData (Note 1)
Address
Address (Note 2)
Address or CS
Note 1: Floating when reading.
Note 2: When full space multiplexed bus is selected, these are I/O ports.
D
A16 to A
A20 to A22, A
When BYTE pin = “L”
0/A0
to D15/A
19
23
15
AddressData (Note 1)
Address (Note 2)
Address or CS
Figure 1.7.3. ALE signal and address/data bus
(5) Ready signal
The ready signal facilitates access of external devices that require a long time for access. As shown in
Figure 1.7.2, inputting “L” to the RDY pin at the falling edge of BCLK causes the microcomputer to enter
the ready state. Inputting “H” to the RDY pin at the falling edge of BCLK cancels the ready state. Table
1.7.7 shows the microcomputer status in the ready state. Figure 1.7.4 shows the example of the RD
signal being extended using the RDY signal.
Ready is valid when accessing the external area during the bus cycle in which the software wait is applied. When no software wait is operating, the RDY signal is ignored, but even in this case, unused pins
must be pulled up.
________
________
________
________
_____
Table 1.7.7. Microcomputer status in ready state (Note)
ItemStatus
OscillationOn
_____ __________
RD/WR signal, address bus, data bus, CSMaintain status when ready signal received
__________
ALE signal, HLDA, programmable I/O ports
Internal peripheral circuitsOn
Note: The ready signal cannot be received immediately prior to a software wait.
36
Under
development
Bus Control
Separate bus (2 wait)
BCLK
RD
CS
(i=0 to 3)
RDY
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
1st cycle2nd cycle3rd cycle4th cycle
(Note)
i
tsu(RDY - BCLK)
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Multiplexed bus (2 wait)
1st cycle2nd cycle3rd cycle4th cycle
BCLK
RD
(Note)
CS
i
(i=0 to 3)
RDY
: Wait using RDY signal
: Wait using software
RDY received timing
tsu(RDY - BCLK)
RDY received timing
RDY signal received timing for i wait(s): i + 1 cycles
(i = 1 to 3)
Note: Chip select may get longer by a state of CPU such as an instruction queue buffer.
_____________
Figure 1.7.4. Example of RD signal extended by RDY signal
37
Under
Preliminary Specifications REV.D
development
Bus Control
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(6) Hold signal
The hold signal is used to transfer the bus privileges from the CPU to the external circuits. Inputting “L” to
__________
the HOLD pin places the microcomputer in the hold state at the end of the current bus access. This status
____________________
is maintained and “L” is output from the HLDA pin as long as “L” is input to the HOLD pin. Table 1.7.8
shows the microcomputer status in the hold state. The bus is used in the following descending order of
__________
priority: HOLD, DMAC, CPU.
__________
HOLD > DMAC > CPU
Figure 1.7.5. Example of RD signal extended by RDY signal
_____________
Table 1.7.8. Microcomputer status in hold state
ItemStatus
OscillationON
_____ __________ _______
RD/WR signal, address bus, data bus, CS, BHEFloating
Programmable I/O ports P0, P1, P2, P3, P4, P5Maintains status when hold signal is received
(7) External bus status when accessing to internal area
Table 1.7.9 shows external bus status when accessing to internal area
Table 1.7.9. External bus status when accessing to internal area
ItemSFR accessing statusInternal ROM/RAM accessing status
Address busRemain address of external area accessed immediately before
Data bus When readFloating
When writeFloating
_____ ______ ________ _________
RD, WR, WRL, WRHOutput "H"
________
BHERemain external area status accessed immediately before
____
CSOutput "H"
ALEALE output
(8) BCLK output
BCLK output can be selected by bit 7 of the processor mode register 0 (address 000416 :PM07) and bit 1
and bit 0 of the system clock select register 0 (address 000616 :CM01, CM00). Setting PM07 to “0” and
CM01 and CM00 to “00” outputs the BCLK signal from P53. However, in single chip mode, BCLK signal
is not output. When setting PM07 to “1”, the function is as set by CM01 and CM00.
38
Under
Preliminary Specifications REV.D
development
Bus Control
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
_______ __________ _______________
Mitsubishi Microcomputers
M16C/80 group
(9) DRAM controller signals (RAS, CASL, CASH, and DW)
Bits 1, 2, and 3 of the DRAM control register (address 000416) select the DRAM space and enable the
DRAM controller. The DRAM controller signals are then output when the DRAM area is accessed. Table
1.7.10 shows the operation of the respective signals.
Table 1.7.10. Operation of RAS, CASL, CASH, and DW signals
_______ __________ _______________
Data bus widthDW
16-bit
8-bit
RAS
LLL
LLL
LHH
LLL
LLHL
LHLL
LLH
LLL
CASHCASL
H
H
H
L
Not used
Not used
Read data from both even and odd addresses
Read 1 byte of data from even address
Read 1 byte of data from odd address
Write data to both even and odd addresses
Write 1 byte of data to even address
Write 1 byte of data to odd address
Read 1 byte of data
Write 1 byte of data
Status of external data bus
(10) Software wait
A software wait can be inserted by setting the wait control register (address 000816). Figure 1.7.6 shows
wait control register
You can use the external area I wait bits (where I = 0 to 3) of the wait control register to specify from “No
wait” to “3 waits” for the external memory area. When you select “No wait”, the read cycle is executed in
the BCLK1 cycle. The write cycle is executed in the BCLK2 cycle (which has 1 wait). When accessing
external memory using the multiplex bus, access has two waits regardless of whether you specify “No
wait” or “1 wait” in the appropriate external area i wait bits in the wait control register.
Software waits in the internal memory (internal RAM and internal ROM) can be set using the internal
memory wait bits of the processor mode register 1 (address 000516). Setting the internal memory wait bit
= “0” sets “No wait”. Setting the internal memory wait bit = “1” specifies a wait.
The SFR area is not affected by the setting of the internal memory wait bit and is always accessed in the
BCLK2 cycle.
Table 1.7.11 shows the software waits and bus cycles. Figures 1.7.7 and 1.7.8 show example bus timings
when using software waits.
39
Under
development
Bus Control
Wait control register
b7 b6 b5 b4 b3 b2 b1 b0
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SymbolAddressWhen reset
WCR0008
16
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
FF
16
WCR0
WCR1
WCR2
WCR
WCR4
WCR5
WCR6
WCR7
Note 1: When using the multiplex bus configuration, there are two waits regardless of whether
you have specified "No wait" or "1 wait". However, you can specify "2 wait" or "3 wait".
Note 2: When using the separate bus configuration, the read bus cycle is executed in the
BCLK1 cycle, and the write cycle is executed in the BCLK2 cycle (with 1 wait).
Figure 1.7.6. Wait control register
Bit nameFunctionBit symbol
External area 0 wait bit
External area 1 wait bit
External area 2 wait bit
External area 3 wait bit
WR
b1 b0
0 0: Without wait
0 1: With 1 wait
1 0: With 2 wait
1 1: With 3 wait
b3 b2
0 0: Without wait
0 1: With 1 wait
1 0: With 2 wait
1 1: With 3 wait
b5 b4
0 0: Without wait
0 1: With 1 wait
1 0: With 2 wait
1 1: With 3 wait
b7 b6
0 0: Without wait
0 1: With 1 wait
1 0: With 2 wait
1 1: With 3 wait
Table 1.7.11. Software waits and bus cycles
AreaBus status
Internal
memory wait bit
SFR
Internal
ROM/RAM
01 BCLK cycle
12 BCLK cycles
Separate bus
External
memory
area
Multiplex bus
External memory
area i wait bit
00
2
01
2
10
2
11
2
00
2
01
2
10
2
11
2
Bus cycle
2 BCLK cycles
Read :1 BCLK cycle
Write : 2 BCLK cycles
2 BCLK cycles
3 BCLK cycles
4 BCLK cycles
3 BCLK cycle
3 BCLK cycles
3 BCLK cycles
4 BCLK cycles
40
Under
Preliminary Specifications REV.D
development
Bus Control
Specifications in this manual are tentative and subject to change.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
< Separate bus (no wait) >
BCLK
Write signal
Read signal
Data bus
Address bus (Note 2)
Chip select (Note 2,3)
< Separate bus (with wait) >
BCLK
Write signal
Read signal
Bus cycle (Note)
Output
Address
Bus cycle (Note)
Bus cycle (Note)
Input
Address
Bus cycle (Note)
Data bus
Address bus (Note 2)
Chip select (Note 2,3)
< Separate bus with 2 wait >
BCLK
Write signal
Read signal
Data bus
Address bus (Note 2)
Chip select (Note 2,3)
Note 1: This timing example shows bus cycle length. Read cycle and write cycle may be continued after this
bus cycle.
Note 2: Address bus and chip select may get longer by a state of CPU such as an instruction queue buffer.
Note 3: When accessing same external area (same CS area) continuously, chip select may output
continuously.
Bus cycle (Note 1)
Data output
Address
Output
Address
Address
Bus cycle (Note 1)
Address
Input
Input
Figure 1.7.7. Typical bus timings using software wait
41
Under
Preliminary Specifications REV.D
development
Bus Control
Specifications in this manual are tentative and subject to change.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
< Separate bus (with 3 wait) >
BCLK
Write signal
Read signal
Data bus
Address
(Note 2)
Chip select
(Note 2,3)
< Multiplexed bus (with 2 wait) >
BCLK
Write signal
Read signal
ALE
Bus cycle (Note)
Data output
Address
Bus cycle (Note)
Bus cycle (Note)
Input
Address
Bus cycle (Note)
Address
Address bus/Data bus
(Note 2)
Chip select
(Note 2,3)
< Multiplexed bus (with 3 wait) >
BCLK
Write signal
Read signal
Address
Address bus
/Data bus
(Note 2)
ALE
Chip select
(Note 2,3)
AddressAddress
Address
Address
Bus cycle (Note)
Address
Data output
Data output
Address
Bus cycle (Note)
Address
Input
Address
Input
Note 1: This timing example shows bus cycle length. Read cycle and write cycle may be continued after this
bus cycle.
Note 2: Address bus and chip select may get longer by a state of CPU such as an instruction queue buffer.
Note 3: When accessing same external area (same CS area) continuously, chip select may output
continuously.
Figure 1.7.8. Typical bus timings using software wait
42
Under
development
Specifications in this manual are tentative and subject to change.
Clock Generating Circuit
Preliminary Specifications REV.D
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Clock Generating Circuit
The clock generating circuit contains two oscillator circuits that supply the operating clock sources to the
CPU and internal peripheral units.
Table 1.8.1. Main clock and sub clock generating circuits
Main clock generating circuitSub clock generating circuit
Use of clock• CPU’s operating clock source• CPU’s operating clock source
operating clock source source
Usable oscillatorCeramic or crystal oscillatorCrystal oscillator
Pins to connect oscillatorXIN, XOUTXCIN, XCOUT
Oscillation stop/restart functionAvailableAvailable
Oscillator status immediately after reset
OtherExternally derived clock can be input
OscillatingStopped
Example of oscillator circuit
Figure 1.8.1 shows some examples of the main clock circuit, one using an oscillator connected to the
circuit, and the other one using an externally derived clock for input. Figure 1.8.2 shows some examples
of sub clock circuits, one using an oscillator connected to the circuit, and the other one using an externally
derived clock for input. Circuit constants in Figures 1.8.1 and 1.8.2 vary with each oscillator used. Use
the values recommended by the manufacturer of your oscillator.
Microcomputer
(Built-in feedback resistance)
X
IN
C
IN
Note: Insert a damping resistance if required. The resistance will vary depending on the oscillator and the oscillation
drive capacity setting. Use the value recommended by the maker of the oscillator.
When the oscillation drive capacity is set to low, check that oscillation is stable.
Insert a feedback resistance between X
X
OUT
(Note)
R
d
C
OUT
Figure 1.8.1. Examples of main clock
IN
and X
OUT
when an oscillation manufacture required.
Microcomputer
(Built-in feedback resistance)
X
IN
Externally derived clock
Vcc
Vss
X
Open
OUT
Microcomputer
(Built-in feedback resistance)
X
CIN
C
CIN
Note: Insert a damping resistance if required. The resistance will vary depending on the oscillator and the oscillation
drive capacity setting. Use the value recommended by the maker of the oscillator.
When the oscillation drive capacity is set to low, check that oscillation is stable.
Insert a feedback resistance between X
X
COUT
(Note)
R
Cd
C
COUT
Figure 1.8.2. Examples of sub clock
CIN
and X
(Built-in feedback resistance)
Externally derived clock
Vcc
Vss
COUT
when an oscillation manufacture required.
Microcomputer
X
CIN
X
COUT
Open
43
Under
development
Specifications in this manual are tentative and subject to change.
Clock Generating Circuit
Clock Control
Figure 1.8.3 shows the block diagram of the clock generating circuit.
X
Preliminary Specifications REV.D
RESET
Software reset
NMI
Interrupt request
level judgment
output
CM10 “1”
Write signal
WAIT instruction
CIN
CM04
Q
S
R
CM05
QS
R
Sub clock
X
IN
Main clock
X
X
COUT
OUT
CM02
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
f
C32
1/32
f
C
a
d
f
1
f
AD
c
b
Divider 1
Divider 2
f
8
f
32
CM07=0
e
f
C
CM07=1
f1SIO2
f8SIO2
f32SIO2
BCLK
CM0i : Bit i at address 0006
CM1i : Bit i at address 0007
WDCi : Bit i at address 000F
16
16
16
Figure 1.8.3. Clock generating circuit
a
a
N is set by MCD4 to MCD0 as follow:
N = 1, 2, 3, 4, 6, 8, 10, 12, 14 and 16
1/21/21/21/2
1/N divider
b
Details of divider 1
Details of divider 2
c
1/2
e
44
Under
development
Clock Generating Circuit
The following paragraphs describes the clocks generated by the clock generating circuit.
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(1) Main clock
The main clock is generated by the main clock oscillation circuit. After a reset, the clock is divided by 8 to
the BCLK. The clock can be stopped using the main clock stop bit (bit 5 at address 000616). Switching to
the sub clock oscillation as CPU operating clock source before stopping the clock reduces the power
dissipation.
When the main clock is stoped (bit 5 at address 000616 =1) or the mode is shifted to stop mode (bit 0 at
address 000716 =1), the main clock division register (address 000C16) is set to the division by 8 ("0816").
After the oscillation of the main clock oscillation circuit has stabilized, the drive capacity of the main clock
oscillation circuit can be reduced using the XIN-XOUT drive capacity select bit (bit 5 at address 000716).
Reducing the drive capacity of the main clock oscillation circuit reduces the power dissipation. This bit
defaults to “1” when shifting from high-speed or middle-speed mode to stop mode and after a reset.
This bit remains in low-speed and low power dissipation mode.
(2) Sub clock
The sub clock is generated by the sub clock oscillation circuit. No sub clock is generated after a reset.
After oscillation is started using the port Xc select bit (bit 4 at address 000616), the sub clock can be
selected as the BCLK by using the system clock select bit (bit 7 at address 000616). However, be sure
that the sub clock oscillation has fully stabilized before switching.
After the oscillation of the sub clock oscillation circuit has stabilized, the drive capacity of the sub clock
oscillation circuit can be reduced using the XCIN-XCOUT drive capacity select bit (bit 3 at address 000616).
Reducing the drive capacity of the sub clock oscillation circuit reduces the power dissipation. This bit
changes to “1” when shifting to stop mode and at a reset.
When the sub clock is used, set ports P86 and P87 to no pull-up resistance with the input port.
(3) BCLK
The BCLK is the clock that drives the CPU, and is either fc or is derived by dividing the main clock by 1,
2, 3, 4, 6, 8, 10, 12, 14 or 16. The BCLK is derived by dividing the main clock by 8 after a reset.
This signal is output from BCLK pin using CM01, CM00 and PM07 in memory expansion mode and
microprocessor mode.
When main clock is stoped or shifting to stop mode, the main clock division register (address 000C16) is
set to the division by 8 ("0816").
(4) Peripheral function clock
• f1, f8, f32, f1SIO2, f8SIO2, f32SIO2
The clock for the peripheral devices is derived from the main clock or by dividing it by 8 or 32. The
peripheral function clock is stopped by stopping the main clock or by setting the WAIT peripheral function
clock stop bit (bit 2 at 000616) to “1” and then executing a WAIT instruction.
• fAD
This clock has the same frequency as the main clock and is used for A-D conversion.
(5) fC32
This clock is derived by dividing the sub clock by 32. It is used for the timer A and timer B counts.
(6) fC
This clock has the same frequency as the sub clock. It is used for BCLK and for the watchdog timer.
Figure 1.8.4 shows the system clock control registers 0 and 1 and figure 1.8.5 shows main clock division
register.
45
Under
development
Specifications in this manual are tentative and subject to change.
Clock Generating Circuit
System clock control register 0 (Note 1)
b7 b6 b5 b4 b3 b2 b1 b0
Preliminary Specifications REV.D
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
SymbolAddressWhen reset
CM00006
16
08
16
Mitsubishi Microcomputers
M16C/80 group
WR
CM00
CM01
CM02
CM03
CM04
CM05
CM06
CM07
Bit
Clock output function
select bit (Note 2)
WAIT peripheral function
clock stop bit
X
CIN-XCOUT
select bit (Note 4)
Port XC select bit0 : I/O port
Main clock (XIN-X
stop bit (Note 5, 6)
Watchdog timer function
select bit
System clock select bit
(Note 9)
name
drive capacity
OUT
b1 b0
0 0 : I/O port P5
0 1 : fC output (Note 3)
1 0 : f
8
output (Note 3)
1 1 : f
32
output (Note 3)
0 : Do not stop peripheral clock in wait
mode
1 : Stop peripheral clock in wait mode
(Note 10)
0 : LOW
1 : HIGH
1 : X
CIN-XCOUT
)
0 : On
1 : Off (Note 7)
0 : Watchdog timer interrupt
1 : Reset (Note 8)
0 : XIN, X
1 : X
CIN
OUT
, X
FunctionBit symbol
3
generation (Note 11)
COUT
Note 1: Set bit 0 of the protect register (address 000A16) to “1” before writing to this register.
Note 2: When outputting BCLK (bit 7 of processor mode register 0 is "0"), set these bits to "00". When
outputting ALE to P53 (bit 5 and 4 of processor mode register 0 is "01"), set these bits to "00". The
3
port P5
function is not selected even when you set "00" in microprocessor or memory expansion
mode and bit 7 of the processor mode register 0 is "1".
Note 3: When selecting fC, f8 or f32 in single chip mode, must use P57 as input port.
Note 4: Changes to “1” when shifting to stop mode or reset.
Note 5: When entering the power saving mode, the main clock is stopped using this bit. To stop the main
clock, set system clock stop bit (CM07) to "1" while an oscillation of sub clock is stable. Then set this
bit to "1".
Note 6: When this bit is "1", X
OUT
up to X
("H" level) via the feedback resistance.
Note 7: When the main clock is stopped, the main clock division register (address 000C
OUT
is "H". Also, the internal feedback resistance remains ON, so XIN is pulled
16
) is set to the
division by 8 mode.
Note 8: When "1" has been set once, "0" cannot be written by software.
Note 9: To set CM07 "1" from "0", first set CM04 to "1", and an oscillation of sub clock is stable. Then set
CM07. Do not set CM04 and CM07 simultaneously. Also, to set CM07 "0" from "1", first set CM05
to "1", and an oscillation of main clock is stable. Then set CM07.
32
Note 10: fc
Note 11: When Xc
is not included.
IN
-Xc
OUT
is used, set port P86 and P87 to no pull-up resistance with the input port.
System clock control register 1 (Note 1)
b7 b6 b5 b4 b3 b2 b1 b0
00
0000
SymbolAddressWhen reset
CM10007
16
20
16
CM10
Reserved bit
CM15
Reserved bit
All clock stop control bit
(Note 3)
X
IN-XOUT
select bit (Note 2)
drive capacity
Note 1: Set bit 0 of the protect register (address 000A16) to “1” before writing to this register.
Note 2: Changes to
“1” when shifting from high-speed or middle-speed mode to stop mode or reset.
This bit is remained in low speed or low power dissipation mode.
Note 3: When this bit is "1", X
COUT
are high-inpedance.
X
OUT
is "H", and the internal feedback resistance is disabled. X
Note 4: When the main clock is stopped, the main clock division register (address 000C
division by 8 mode.
Figure 1.8.4. System clock control registers 0 and 1
46
Bit
name
FunctionBit symbol
0 : Clock on
1 : All clocks off (stop mode) (Note 4)
Always set to
0 : LOW
1 : HIGH
Always set to
“0”
“0”
CIN
and
16
) is set to the
WR
Under
development
Specifications in this manual are tentative and subject to change.
Clock Generating Circuit
Main clock division register (Note 1)
b7 b6 b5 b4 b3 b2 b1 b0
Preliminary Specifications REV.D
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
SymbolAddressWhen reset
MCD000C
16
XXX01000
Mitsubishi Microcomputers
M16C/80 group
2
Bit nameFunctionBit symbol
MCD0
MCD1
MCD2
MCD3
MCD4
Nothing is assigned.
When write, set "0". When read, their contents are indeterminate.
Note 1: Set bit 0 of the protect register (address 000A16) to “1” before writing to
Note 2: These bits are "01000
Note 3: Do not attempt to set combinations of values other than those shown in
Main clock division select
bit (Note 2)
this register.
or you shift to stop mode.
this figure.
2
" (8-division mode) when main clock is stopped
b4 b3 b2 b1 b0
1 0 0 1 0 : No division mode
0 0 0 1 0 : Division by 2 mode
0 0 0 1 1 : Division by 3 mode
0 0 1 0 0 : Division by 4 mode
0 0 1 1 0 : Division by 6 mode
0 1 0 0 0 : Division by 8 mode
0 1 0 1 0 : Division by 10 mode
0 1 1 0 0 : Division by 12 mode
0 1 1 1 0 : Division by 14 mode
0 0 0 0 0 : Division by 16 mode
Figure 1.8.5. Main clock division register
Clock Output
In single chip mode, when the BCLK output function select bit (bit 7 at address 000416 :PM07) is “1”, you
can output f8, f32, or fc from the P53/BCLK/ALE/CLKOUT pins by setting the clock output function select
bits (bits 1 and 0 at address 000616 :CM01, CM00).(Note)
Even when you set PM07 to “0” and CM01 and CM00 to “002”, no BCLK is output.
In memory expansion mode or microprocessor mode, when the ALE pin select bits (bits 5 and 4 at address 000516 :PM15, PM14) are other than “012(P53/BCLK)” and PM07 is “1”, you can output f8, f32, or fc
from the P53/BCLK/ALE/CLKOUT pins by setting CM01 and CM00.
In memory expansion mode or microprocessor mode, when PM15 and PM14 are other than “012(P53/
BCLK)” and PM07 is “0” and CM01 and CM00 to “002”, BCLK is output from the P53/BCLK/ALE/CLKOUT
pins.
When stopping clock output in memory expansion mode or microprocessor mode, set PM07 to “1” and
CM01 and CM00 to “002” (IO port P53). The P53 function is not selected. When PM15 and PM14 are “012
(P53/BCLK)” and CM01 and CM00 are “002”, PM07 is ignored and the P53 pin is set for ALE output.
When the WAIT peripheral function clock stop bit (bit 2 at address 000616) is set to “1”, f8 or f32 clock
output is stopped when a WAIT command is executed.
Table 1.8.2 shows clock output setting (single chip mode) and Table 1.8.3 shows clock output setting
(memory expansion/microprocessor mode).
Note :When outputting the f8, f32 or fc from port P53/BCLK/ALE/CLKOUT pin in single chip mode, use port
_______
P57/RDY as an input only port.
WR
47
Under
development
Specifications in this manual are tentative and subject to change.
Writing “1” to the all-clock stop control bit (bit 0 at address 000716) stops all oscillation and the microcomputer enters stop mode. In stop mode, the content of the internal RAM is retained provided that VCC remains above 2V.
Because the oscillation of BCLK, f1 to f32, f1SIO2 to f32SIO2, fc, fc32, and fAD stops in stop mode, peripheral
functions such as the A-D converter and watchdog timer do not function. However, timer A and timer B
operate provided that the event counter mode is set to an external pulse, and UARTi(i = 0 to 2) functions
provided an external clock is selected. Table 1.8.4 shows the status of the ports in stop mode.
Stop mode is cancelled by a hardware reset or interrupt.
When using an interrupt to exit stop mode, the relevant interrupt must have been enabled and set to a
priority level above the level set by the interrupt priority set bits (bits 2, 1, and 0 at address 009F16) for
exiting a stop/wait state. Set the interrupt priority set bits for the exit from a stop/wait state to the same level
as the flag register (FLG) processor interrupt level (IPL). Figure 1.8.6 shows the exit priority register.
When exiting stop mode using an interrupt, the relevant interrupt routine is executed.
Although stop mode is cancelled by hardware reset only, the interrupt enable flag (I flag) must be set to "1".
When shifting to stop mode and reset, the main clock division register (000C16) is set to “0816”.
48
Under
development
Clock Generating Circuit
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Table 1.8.4. Port status during stop mode
PinMemory expansion modeSingle-chip mode
Microprocessor mode
Preliminary Specifications REV.D
Address bus, data bus, CS0 to CS3, BHE
_____ ______ ________ _________ ______ _________
______________ _______
Retains status before stop mode
RD, WR, WRL, WRH, DW, CASL,“H” (Note)
________
CASH
________
RAS“H” (Note)
__________
HLDA, BCLK“H”
ALE“H”
Port
Retains status before stop mode
Retains status before stop mode
CLKOUTWhen fc selected“H”“H”
When f8, f32 selected
Retains status before stop modeRetains status before stop mode
________________
Note :When self-refresh is done in operating DRAM control, CAS and RAS becomes “L”.
Mitsubishi Microcomputers
M16C/80 group
Exit priority register
b7 b6 b5 b4 b3 b2 b1 b0
SymbolAddressWhen reset
RLVL009F
RLVL0
RLVL1
RLVL2
FSIT
Nothing is assigned.
When write, set "0". When read, their contents are indeterminate.
Interrupt priority set bit for
exiting Stop/Wait state
(Note 1,2)
Note 1: Exits the Stop or Wait mode when the requested interrupt priority level is
higher than that set in the exit priority register.
Note 2: Set to the same value as the processor interrupt priority level (IPL) set in
the flag register (FLG).
Note 3: The high-speed interrupt can only be specified for interrupts with
interrupt priority level 7. Specify interrupt priority level 7 for only one
interrupt.
Figure 1.8.6. Exit priority register
49
Under
development
Wait Mode
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Wait Mode
When a WAIT instruction is executed, the BCLK stops and the microcomputer enters the wait mode. In this
mode, oscillation continues but the BCLK and watchdog timer stop. Writing “1” to the WAIT peripheral
function clock stop bit and executing a WAIT instruction stops the clock being supplied to the internal
peripheral functions, allowing power dissipation to be reduced. Table 1.8.5 shows the status of the ports in
wait mode.
Wait mode is cancelled by a hardware reset or interrupt. If an interrupt is used to cancel wait mode, the
microcomputer restarts using as BCLK the clock that had been selected when the WAIT instruction was
executed.
When using an interrupt to exit Wait mode, the relevant interrupt must have been enabled and set to a
priority level above the level set by the interrupt priority set bits for exiting a stop/wait state (bits 2, 1, and 0
at address 009F16). Set the interrupt priority set bits for the exit from a stop/wait state to the same level as
the flag register (FLG) processor interrupt level (IPL).
When using an interrupt to exit Wait mode, the microcomputer resumes operating the clock that was operating when the WAIT command was executed as BCLK from the interrupt routine.
Table 1.8.5. Port status during wait mode
PinMemory expansion modeSingle-chip mode
Microprocessor mode
Address bus, data bus, CS0 to CS3,
________
______________
Retains status before wait mode
BHE
_____ ______ ________ _________ ______ _________
RD, WR, WRL, WRH, DW, CASL,“H” (Note)
________
CASH
________
RAS“H” (Note)
__________
HLDA,BCLK“H”
ALE“L”
Port
Retains status before wait modeRetains status before wait mode
CLKOUTWhen fC selectedDoes not stop
When f8, f32 selected Does not stop when the WAIT peripheral function clock stop bit
is “0”. When the WAIT peripheral function clock stop bit is “1”,
the status immediately prior to entering wait mode is maintained.
________________
Note :When self-refresh is done in operating DRAM control, CAS and RAS becomes “L”.
50
Under
development
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
BCLK Status
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Status Transition of BCLK
Power dissipation can be reduced and low-voltage operation achieved by changing the count source for
BCLK. Table 1.8.6 shows the operating modes corresponding to the settings of system clock control
registers 0 and main clock division register.
After a reset, operation defaults to division by 8 mode. When shifting to stop mode, reset or stopping main
clock, the main clock division register (address 000C16) is set to “0816”.
(1) Division by 2 mode
The main clock is divided by 2 to obtain the BCLK.
(2) Division by 3 mode
The main clock is divided by 3 to obtain the BCLK.
(3) Division by 4 mode
The main clock is divided by 4 to obtain the BCLK.
(4) Division by 6 mode
The main clock is divided by 6 to obtain the BCLK.
(5) Division by 8 mode
The main clock is divided by 8 to obtain the BCLK. After reset, this mode is executed. Note that oscillation
of the main clock must have stabilized before transferring from this mode to no-division, division by 2, 6,
10, 12, 14 and 16 mode.
Oscillation of the sub clock must have stabilized before transferring to low-speed and low power dissipation mode.
(6) Division by 10 mode
The main clock is divided by 10 to obtain the BCLK.
(7) Division by 12 mode
The main clock is divided by 12 to obtain the BCLK.
(8) Division by 14 mode
The main clock is divided by 14 to obtain the BCLK.
(9) Division by 16 mode
The main clock is divided by 16 to obtain the BCLK.
(10) No-division mode
The main clock is divided by 1 to obtain the BCLK.
(11) Low-speed mode
fC is used as BCLK. Note that oscillation of both the main and sub clocks must have stabilized before
transferring from this mode to another or vice versa. At least 2 to 3 seconds are required after the sub
clock starts. Therefore, the program must be written to wait until this clock has stabilized immediately
after powering up and after stop mode is cancelled.
(12) Low power dissipation mode
fC is the BCLK and the main clock is stopped.
When the main clock is stoped, the main clock division register (address 000C16) is set to the division by
8 mode.
51
Under
development
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
BCLK Status
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Note: When count source of BCLK is changed from clock A to clock B (XIN to XCIN or XCIN to XIN), clock B
needs to be stable before changing. Please wait to change modes until after oscillation has stabilized.
Table 1.8.6. Operating modes dictated by settings of system clock control register 0 and main clock division register
CM07CM05CM04MCD4MCD3MCD2MCD1MCD0
Operating mode of BCLK
00Invalid10010No division
00Invalid00010Division by 2 mode
00Invalid00011Division by 3 mode
00Invalid00100Division by 4 mode
00Invalid00110Division by 6 mode
00Invalid01000Division by 8 mode
00Invalid01010Division by 10 mode
00Invalid01100Division by 12 mode
00Invalid01110Division by 14 mode
00Invalid00000Division by 16 mode
101InvalidInvalidInvalidInvalidInvalidLow-speed mode
111InvalidInvalidInvalidInvalidInvalidLow power dissipation mode
CM0i: Clock control register 0 (address 000616) bit i
MCDi: Main clock division register (address 000C16) bit i
52
Under
development
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Power Saving
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Power Saving
In Power Save modes, the CPU and oscillator stop and the operating clock is slowed to minimize power
dissipation by the CPU. The following outlines the Power Save modes.
There are three power save modes.
(1) Normal operating mode
• High-speed mode
In this mode, one main clock cycle forms BCLK. The CPU operates on the selected internal clock. The
peripheral functions operate on the clocks specified for each respective function.
• Medium-speed mode
In this mode, the main clock is divided into 2, 3, 4, 6, 8, 10, 12, 14, or 16 to form BCLK. The CPU
operates on the selected internal clock. The peripheral functions operated on the clocks specified for
each respective function.
• Low-speed mode
In this mode, fc forms BCLK. The CPU operates on the fc clock. fc is the clock supplied by the
subclock. The peripheral functions operate on the clocks specified for each respective function.
• Low power-dissipation mode
This mode is selected when the main clock is stopped from low-speed mode. The CPU operates on
the fc clock. fc is the clock supplied by the subclock. Only the peripheral functions for which the
subclock was selected as the count source continue to run.
(2) Wait mode
CPU operation is halted in this mode. The oscillator continues to run.
(3) Stop mode
All oscillators stop in this mode. The CPU and internal peripheral functions all stop. Of all 3 power saving
modes, power savings are greatest in this mode.
Figure 1.8.7 shows the clock transition between each of the three modes, (1), (2), and (3).
53
Under
development
Specifications in this manual are tentative and subject to change.
Power Saving
Transition of stop mode, wait mode
Preliminary Specifications REV.D
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Reset
All oscillators stopped
Stop mode
CM10=“1”
Interrupt
Medium-speed mode
(Divided-by-8 mode)
Note 1
Interrupt
CM10=“1”
All oscillators stopped
CM10=“1”
Stop mode
Interrupt
Note 3
Note 1: Switch clocks after oscillation of main clock is fully stable. After stop mode or when main clock oscillation is stopped,
transferred to the middle speed mode.
Note 2: Switch clocks after oscillation of sub clock is fully stable.
Note 3: The main ckock devision register is set to the division by 8 mode (MCD="08
Note 4: When shifting to low power dissipation mode, the main ckock devision register is set to the division by 8 mode (MCD="08
High-speed/medium-
speed mode
Note 1
Low-speed/low power
dissipation mode
Note 2
Note 4
Normal mode
(Please see the following as transition of normal mode.)
Transition of normal mode
Please change according to a direction of an arrow.
Note 1: Switch clocks after oscillation of main clock is fully stable.
Note 2: Switch clocks after oscillation of sub clock is fully stable.
Note 3: Set the desired division to the main clock division register (MCD).
Note 4: When shifting to division by 8 mode, MCD is set to "08
BCLK :f(X
CM07=“1”
CM07=“1”
CM05=“1”
CIN)
Note 2
CM05=“1”
CM05=“0”
Note 4
16".
16”
CM04=“1”
MCD=“XX
Note 1, 3
16”
Main clock is oscillating
Sub clock is oscillating
Main clock is oscillating
Sub clock is oscillating
Note 1
Note 3
Low-speed mode
BCLK :f(XCIN)
CM07=“1”
CM07=“1”
Note 2
Figure 1.8.7. Clock transition
54
Under
y
development
Protection
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Protection
The protection function is provided so that the values in important registers cannot be changed in the event
that the program runs out of control. Figure 1.8.8 shows the protect register. The values in the processor
mode register 0 (address 000416), processor mode register 1 (address 000516), system clock control register 0 (address 000616), system clock control register 1 (address 000716), main clock division register
(address 000C16), port P9 direction register (address 03C716) and function select register A3 (address
03B516) can only be changed when the respective bit in the protect register is set to “1”. Therefore, important outputs can be allocated to port P9.
If, after “1” (write-enabled) has been written to the PRC2 (bit 2 at address 000A16), a value is written to any
address, the bit automatically reverts to “0” (write-inhibited). Change port P9 input/output and function
select register A3 immediately after setting "1" to PRC2. Interrupt and DMA transfer should not be inserted
between instructions. However, the PRC0 (bit 0 at address 000A16) and PRC1 (bit 1 at address 000A16) do
not automatically return to “0” after a value has been written to an address. The program must therefore be
written to return these bits to “0”.
Protect register
b7 b6 b5 b4 b3 b2 b1 b0
Note: Writing a value to an address after “1” is written to this bit returns the bit
Figure 1.8.8. Protect register
SymbolAddressWhen reset
PRCR000A
PRC0
PRC1
PRC2
Nothing is assigned.
When write, set "0". When read, their contents are indeterminate.
Enables writing to system clock
control registers 0 and 1 (addresses
0006
16 and 000716) and main clock
division register (address 000C
Enables writing to processor mode
registers 0 and 1 (addresses 0004
and 0005
Enables writing to port P9 direction
register (address 03C7
function select register A3 (address
03B5
to “0”. Other bits do not automatically return to “0” and they must therefore
be reset b
16)
16) (Note)
the program.
16XXXXX0002
Bit nameBit symbol
16) and
Function
0 : Write-inhibited
1 : Write-enabled
16)
0 : Write-inhibited
16
1 : Write-enabled
0 : Write-inhibited
1 : Write-enabled
WR
55
Under
development
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Interrupts
Interrupt Outline
Types of Interrupts
Figure 1.9.1 lists the types of interrupts.
Software
Interrupt
Hardware
Special
Peripheral I/O
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Undefined instruction (UND instruction)
Overflow (INTO instruction)
BRK instruction
BRK2 instruction
INT instruction
Reset
_______
NMI
Watchdog timer
Single step
Address matched
*1
Mitsubishi Microcomputers
M16C/80 group
*1 Peripheral I/O interrupts are generated by the peripheral functions built into the microcomputer
system. High-speed interrupt can be used as highest priority in peripheral I/O interrupts.
Figure 1.9.1. Classification of interrupts
• Maskable interrupt: An interrupt which can be enabled (disabled) by the interrupt enable flag (I
flag) or whose interrupt priority can be changed by priority level.
• Non-maskable interrupt: An interrupt which cannot be enabled (disabled) by the interrupt enable flag
(I flag) or whose interrupt priority cannot be changed by priority level.
56
Under
development
Interrupts
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Software Interrupts
Software interrupts are generated by some instruction that generates an interrupt request when executed. Software interrupts are nonmaskable interrupts.
(1) Undefined-instruction interrupt
This interrupt occurs when the UND instruction is executed.
(2) Overflow interrupt
This interrupt occurs if the INTO instruction is executed when the O flag is 1.
The following lists the instructions that cause the O flag to change:
ABS, ADC, ADCF, ADD, ADDX, CMP, CMPX, DIV, DIVU, DIVX, NEG, RMPA, SBB, SCMPU, SHA,
SUB, SUBX
(3) BRK interrupt
This interrupt occurs when the BRK instruction is executed.
(4) BRK2 interrupt
This interrupt occurs when the BRK2 instruction is executed. This interrupt is used exclusively for
debugger purposes. You normally do not need to use this interrupt.
(5) INT instruction interrupt
This interrupt occurs when the INT instruction is executed after specifying a software interrupt number
from 0 to 63. Note that software interrupt numbers 0 to 43 are assigned to peripheral I/O interrupts.
This means that by executing the INT instruction, you can execute the same interrupt routine as used
in peripheral I/O interrupts.
The stack pointer used in INT instruction interrupt varies depending on the software interrupt number.
For software interrupt numbers 0 to 31, the U flag is saved when an interrupt occurs and the U flag is
cleared to 0 to choose the interrupt stack pointer (ISP) before executing the interrupt sequence. The
previous U flag before the interrupt occurred is restored when control returns from the interrupt routine. For software interrupt numbers 32 to 63, such stack pointer switchover does not occur.
However, in peripheral I/O interrupts, the U flag is saved when an interrupt occurs and the U flag is
cleared to 0 to choose ISP.
Therefore movement of U flag is different by peripheral I/O interrupt or INT instruction in software
interrupt number 32 to 43.
57
Under
development
Interrupts
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Hardware Interrupts
There are Two types in hardware Interrupts; special interrupts and Peripheral I/O interrupts.
(1) Special interrupts
Special interrupts are nonmaskable interrupts.
Preliminary Specifications REV.D
• Reset
A reset occurs when the RESET pin is pulled low.
______
• NMI interrupt
This interrupt occurs when the NMI pin is pulled low.
• Watchdog timer interrupt
This interrupt is caused by the watchdog timer.
• Address-match interrupt
This interrupt occurs immediately before the instruction at the address indicated by the address match
interrupt register is executed while the address match interrupt enable bit is set to “1”.
This interrupt does not occur if any address other than the start address of an instruction is set in the
address match register.
• Single-step interrupt
This interrupt is used exclusively for debugger purposes, do not use it in other circumstances. A singlestep interrupt occurs when the D flag is set (= 1); in this case, an interrupt is generated after one
instruction is executed.
____________
______
Mitsubishi Microcomputers
M16C/80 group
(2) Peripheral I/O interrupts
A peripheral I/O interrupt is generated by one of built-in peripheral functions. Built-in peripheral functions are dependent on classes of products, so the interrupt factors too are dependent on classes of
products. The interrupt vector table is the same as the one for software interrupt numbers 0 through
43 the INT instruction uses. Peripheral I/O interrupts are maskable interrupts.
This is an interrupt that the serial I/O bus collision detection generates. When I2C mode is selected,
_____
start, stop condition interrupt is selected. When SS pin is selected, fault error interrupt is selected.
• DMA0 through DMA3 interrupts
These are interrupts that DMA generates.
• Key-input interrupt
___
A key-input interrupt occurs if an “L” is input to the KI pin.
• A-D conversion interrupt
This is an interrupt that the A-D converter generates.
• UART0, UART1, UART2/NACK, UART3/NACK and UART4/NACK transmission interrupt
These are interrupts that the serial I/O transmission generates.
• UART0, UART1, UART2/ACK, UART3/ACK and UART4/ACK reception interrupt
These are interrupts that the serial I/O reception generates.
• Timer A0 interrupt through timer A4 interrupt
These are interrupts that timer A generates
• Timer B0 interrupt through timer B5 interrupt
These are interrupts that timer B generates.
_______________
• INT0 interrupt through INT5 interrupt
__________
An INT interrupt selects a edge sense or a level sense. In edge sense, an INT interrupt occurs if either
a rising edge or a falling edge or a both edge is input to the INT pin. In level sense, an INT interrupt
__________
_____
occurs if either an "H" level or an "L" level is input to the INT pin.
58
Under
development
Interrupts
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
High-speed interrupts
High-speed interrupts are interrupts in which the response is executed at 5 cycles and the return is 3
cycles.
When a high-speed interrupt is received, the flag register (FLG) and program counter (PC) are saved to
the save flag register (SVF) and save PC register (SVP) and the program is executed from the address
shown in the vector register (VCT).
Execute a FREIT instruction to return from the high-speed interrupt routine.
High-speed interrupts can be set by setting “1” in the high-speed interrupt specification bit allocated to bit
3 of the exit priority register. Setting “1” in the high-speed interrupt specification bit makes the interrupt set
to level 7 in the interrupt control register into a high-speed interrupt.
You can only set one interrupt as a high-speed interrupt. When using a high-speed interrupt, do not set
multiple interrupts as level 7 interrupts.
The interrupt vector for a high-speed interrupt must be set in the vector register (VCT).
When using a high-speed interrupt, you can use a maximum of two DMAC channels.
The execution speed is improved when register bank 1 is used with high speed interrupt register selected
by not saving registers to the stack but to the switching register bank. In this case, switch register bank
mode for high-speed interrupt routine.
Interrupts and Interrupt Vector Tables
If an interrupt request is accepted, a program branches to the interrupt routine set in the interrupt vector
table. Set the first address of the interrupt routine in each vector table. Figure 1.9.2 shows the format for
specifying the address.
Two types of interrupt vector tables are available — fixed vector table in which addresses are fixed and
variable vector table in which addresses can be varied by the setting.
Figure 1.9.2. Format for specifying interrupt vector addresses
Low address
Mid address
High address
0 0 0 00 0 0 0
LSB
59
Under
development
Interrupts
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
• Fixed vector tables
The fixed vector table is a table in which addresses are fixed. The vector tables are located in an area
extending from FFFFDC16 to FFFFFF16. One vector table comprises four bytes. Set the first address
of interrupt routine in each vector table. Table 1.9.1 shows the interrupts assigned to the fixed vector
tables and addresses of vector tables.
Address (L) to address (H)
Undefined instructionFFFFDC16 to FFFFDF16Interrupt on UND instruction
OverflowFFFFE016 to FFFFE316Interrupt on INTO instruction
BRK instructionFFFFE416 to FFFFE716If content of FFFFE716 is filled with FF16, program
executionstarts from the address shown by the vector in the
variable vector table
Address matchFFFFE816 to FFFFEB16There is an address-matching interrupt enable bit
Watchdog timerFFFFF016 to FFFFF316
_______
NMIFFFFF816 to FFFFFB16
External interrupt by input to NMI pin
_______
ResetFFFFFC16 to FFFFFF16
• Vector table dedicated for emulator
Table 1.9.2 shows interrupt vector address which is vector table register dedicated for emulator (address 00002016 to 00002216). These instructions are not effected with interrupt enable flag (I flag)
(non maskable interrupt).
This interrupt is used exclusively for debugger purposes. You normally do not need to use this interrupt. Do not access to the interrupt vector table register dedicated for emulator (address 00002016 to
00002216).
Table 1.9.2. Interrupt vector table register for emulator
Interrupt source Vector table addresses Remarks
Address (L) to address (H)
BRK2 instructionInterrupt vector table register for emulatorInterrupt for debugger
00002016 to 00002216
Single stepInterrupt vector table register for emulatorInterrupt for debugger
00002016 to 00002216
• Variable vector tables
The addresses in the variable vector table can be modified, according to the user’s settings. Indicate
the first address using the interrupt table register (INTB). The 256-byte area subsequent to the address the INTB indicates becomes the area for the variable vector tables. One vector table comprises
four bytes. Set the first address of the interrupt routine in each vector table. Table 1.9.3 shows the
interrupts assigned to the variable vector tables and addresses of vector tables.
Set an even address to the start address of vector table setting in INTB so that operating efficiency is
increased.
60
Under
development
Specifications in this manual are tentative and subject to change.
Note 1: Address relative to address in interrupt table register (INTB).
Note 2: When I C mode is selected, NACK/ACK, start/stop condition detection interrupts are selected.
Note 3: The fault error interrupt is selected when SS pin is selected.
2
Vector table address
Address (L) to address (H)
+32 to +35 (Note 1)Software interrupt number 8
+36 to +39 (Note 1)Software interrupt number 9
+40 to +43 (Note 1)Software interrupt number 10
+44 to +47 (Note 1) Software interrupt number 11
+48 to +51 (Note 1)Software interrupt number 12
+52 to +55 (Note 1)Software interrupt number 13
+56 to +59 (Note 1)Software interrupt number 14
+60 to +63 (Note 1)Software interrupt number 15
+64 to +67 (Note 1)Software interrupt number 16
+68 to +71 (Note 1)Software interrupt number 17
+72 to +75 (Note 1)Software interrupt number 18
+76 to +79 (Note 1)Software interrupt number 19
+80 to +83 (Note 1)Software interrupt number 20
+84 to +87 (Note 1)Software interrupt number 21
+88 to +91 (Note 1)Software interrupt number 22
+92 to +95 (Note 1)Software interrupt number 23
+96 to +99 (Note 1)Software interrupt number 24
+100 to +103 (Note 1)Software interrupt number 25
+104 to +107 (Note 1)Software interrupt number 26
+108 to +111 (Note 1)Software interrupt number 27
+112 to +115 (Note 1)Software interrupt number 28
+116 to +119 (Note 1)Software interrupt number 29
+120 to +123 (Note 1)Software interrupt number 30
+124 to +127 (Note 1)Software interrupt number 31
+128 to +131 (Note 1)Software interrupt number 32
+132 to +135 (Note 1)Software interrupt number 33
+136 to +139 (Note 1)Software interrupt number 34
+140 to +143 (Note 1)Software interrupt number 35
+144 to +147 (Note 1)Software interrupt number 36
+148 to +151 (Note 1)Software interrupt number 37
+152 to +155 (Note 1)Software interrupt number 38
+156 to +159 (Note 1)Software interrupt number 39
+160 to +163 (Note 1)Software interrupt number 40
+164 to +167 (Note 1)Software interrupt number 41
+168 to +171 (Note 1)Software interrupt number 42
+172 to +175 (Note 1)Software interrupt number 43
Cannot be masked I flag+0 to +3 (Note 1)BRK instructionSoftware interrupt number 0
Cannot be masked I flag
61
Under
development
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Interrupts
Interrupt control registers
Peripheral I/O interrupts have their own interrupt control registers. Figure 1.9.3 shows the interrupt control registers.
When using an interrupt to exit Stop mode or Wait mode, the relevant interrupt must have been enabled
and set to a priority level above the level set by the interrupt priority set bits for exit a stop/wait state (bits
2, 1, and 0 at address 009F16). Set the interrupt priority set bits for the exit from a stop/wait state to the
same level as the flag register (FLG) processor interrupt level (IPL).
Figure 1.9.4 shows the exit priority register.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
62
Under
development
Interrupts
Interrupt control register
b7 b6 b5 b4 b3 b2 b1 b0
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SymbolAddressWhen reset
ADIC0073
BCNiIC(i=2 to 4)008F16, 007116, 0091
DMiIC(i=0 to 3)006816, 008816, 006A16, 008A
KUPIC0093
TAiIC(i=0 to 4)006C16, 008C16, 006E16, 008E
TBiIC(i=0 to 5) 009416, 007616, 009616, 007816, 009816, 006916 XXXXX000
SiTIC(i=0 to 4)009016, 009216, 008916, 008B16, 008D
SiRIC(i=0 to 4)007216, 007416, 006B16, 006D16, 006F
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
16
XXXXX000
16
XXXXX000
16
XXXXX000
16
16
16
XXXXX000
XXXXX000
XXXXX000
16,
007016 XXXXX000
2
2
2
2
2
2
2
2
b7 b6 b5 b4 b3 b2 b1 b0
Bit nameFunctionBit symbol
ILVL0
ILVL1
ILVL2
IR
Nothing is assigned.
When write, set "0". When read, their contents are indeterminate.
Note: This bit can only be accessed for reset (= 0), but cannot be accessed for set (= 1).
Nothing is assigned.
When write, set "0". When read, their contents are indeterminate.
Note 1: This bit can only be accessed for reset (= 0), but cannot be accessed for set (= 1).
Note 2: When INT3 to INT5 are used for data bus in microprocessor mode or memory
expansion mode, set the interrupt disabled to INT3IC, INT4IC and INT5IC.
Note 3: When level sense is selected, set related bit of interrupt cause select register (
address 031F
Figure 1.9.3. Interrupt control register
Polarity select bit
Level sense/edge
sense select bit
16
) to one edge.
0: Interrupt not requested
1: Interrupt requested
0 : Selects falling edge or L level
1 : Selects rising edge or H level
0 : Edge sense
1 : Level sense
(Note 3)
(Note 1)
63
Under
development
Interrupts
Exit priority register
b7 b6 b5 b4 b3 b2 b1 b0
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SymbolAddressWhen reset
RLVL009F
16
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
XXXX0000
2
RLVL0
RLVL1
RLVL2
FSIT
Nothing is assigned.
When write, set "0". When read, their contents are indeterminate.
Note 1: Exits the Stop or Wait mode when the requested interrupt priority level is
Note 2: Set to the same value as the processor interrupt priority level (IPL) set in
Note 3: The high-speed interrupt can only be specified for interrupts with
Figure 1.9.4. Exit priority register
Bit
Interrupt priority set bit for
exiting Stop/Wait state
(Note 1,2)
higher than that set in the exit priority register.
the flag register (FLG).
interrupt priority level 7. Specify interrupt priority level 7 for only one
interrupt.
WR
Interrupt Enable Flag (I Flag)
The interrupt enable flag (I flag) is used to disable/enable maskable interrupts. When this flag is set
(= 1), all maskable interrupts are enabled; when the flag is cleared to 0, they are disabled. This flag
is automatically cleared to 0 after a reset is cleared.
Interrupt Request Bit
This bit is set (= 1) by hardware when an interrupt request is generated. The bit is cleared to 0 by
hardware when the interrupt request is acknowledged and jump to the interrupt vector.
This bit can be cleared to 0 (but cannot be set to 1) in software.
Interrupt Priority Level Select Bit and Processor Interrupt Priority Level (IPL)
Interrupt priority levels are set by the interrupt priority select bit in an interrupt control register. When
an interrupt request is generated, the interrupt priority level of this interrupt is compared with the
processor interrupt priority level (IPL). This interrupt is enabled only when its interrupt priority level is
greater than the processor interrupt priority level (IPL). This means that you can disable any particular interrupt by setting its interrupt priority level to 0.
64
Under
development
Interrupts
Table 1.9.4 shows how interrupt priority levels are set. Table 1.9.5 shows interrupt enable levels in
relation to the processor interrupt priority level (IPL).
The following lists the conditions under which an interrupt request is acknowledged:
The interrupt enable flag (I flag), interrupt request bit, interrupt priority level select bit, and the processor interrupt priority level (IPL) all are independent of each other, so they do not affect any other bit.
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Table 1.9.4 Interrupt Priority Levels
Interrupt priority
level select bit
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Interrupt priority level
b0b1b2
Level 0 (interrupt disabled)
Level 1
Level 2
Level 3
Level 4
Level 5
Level 6
Level 7
Priority
order
Low
High
Table 1.9.5 IPL and Interrupt Enable Levels
Processor interrupt
priority level (IPL)
IPL
IPL
2
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
IPL
1
0
Enabled interrupt priority
levels
I
nterrupt levels 1 and above are enabled.
Interrupt levels 2 and above are enabled.
Interrupt levels 3 and above are enabled.
Interrupt levels 4 and above are enabled.
Interrupt levels 5 and above are enabled.
Interrupt levels 6 and above are enabled.
Interrupt levels 7 and above are enabled.
All maskable interrupts are disabled.
Rewrite the interrupt control register
When a instruction to rewrite the interrupt control register is executed but the interrupt is disabled, the
interrupt request bit is not set sometimes even if the interrupt request for that register has been generated. This will depend on the instruction. If this creates problems, use the below instructions to change
the register.
Instructions : AND, OR, BCLR, BSET
65
Under
development
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Interrupts
Interrupt Sequence
An interrupt sequence — what are performed over a period from the instant an interrupt is accepted to the
instant the interrupt routine is executed — is described here.
If an interrupt occurs during execution of an instruction, the processor determines its priority when the
execution of the instruction is completed, and transfers control to the interrupt sequence from the next
cycle. If an interrupt occurs during execution of either the SCMPU, SIN, SMOVB, SMOVF, SMOVU,
SSTR, SOUT or RMPA instruction, the processor temporarily suspends the instruction being executed,
and transfers control to the interrupt sequence.
In the interrupt sequence, the processor carries out the following in sequence given:
(1) CPU gets the interrupt information (the interrupt number and interrupt request level) by reading
address 00000016 (address 00000216 when high-speed interrupt). After this, the related interrupt
request bit is "0".
(2) Saves the content of the flag register (FLG) as it was immediately before the start of interrupt se-
quence in the temporary register (Note) within the CPU.
(3) Sets the interrupt enable flag (I flag), the debug flag (D flag), and the stack pointer select flag (U flag)
to “0” (the U flag, however does not change if the INT instruction, in software interrupt numbers 32
through 63, is executed)
(4) Saves the content of the temporary register (Note 1) within the CPU in the stack area. Saves in the
flag save register (SVF) in high-speed interrupt.
(5) Saves the content of the program counter (PC) in the stack area. Saves in the PC save register
(SVP) in high-speed interrupt.
(6) Sets the interrupt priority level of the accepted instruction in the IPL.
After the interrupt sequence is completed, the processor resumes executing instructions from the first
address of the interrupt routine.
Note: This register cannot be utilized by the user.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Interrupt Response Time
'Interrupt response time' is the period between the instant an interrupt occurs and the instant the first
instruction within the interrupt routine has been executed. This time comprises the period from the
occurrence of an interrupt to the completion of the instruction under execution at that moment (a) and the
time required for executing the interrupt sequence (b). Figure 1.9.5 shows the interrupt response time.
Interrupt request generated
Instruction
(a) The period from the occurrence of an interrupt to the completion of the instruction under execution.
(b) The time required for executing the interrupt sequence.
Figure 1.9.5 Interrupt response time
Interrupt request acknowledged
Interrupt sequence
(a)
(b)
Interrupt response time
Time
Instruction in interrupt
routine
66
Under
development
Interrupts
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Time (a) varies with each instruction being executed. The DIVX instruction requires a maximum time that
consists of 24* cycles.
Time (b) is shown in table 1.9.6.
* It is when the divisor is immediate or register. When the divisor is memory, the following value is
added.
• Normal addressing: 2 + X
• Index addressing: 3 + X
• Indirect addressing: 5 + X + 2Y
• Indirect index addressing: 6 + X + 2Y
X is number of wait of the divisor area. Y is number of wait of the indirect address stored area.
When X and Y are in odd address or in 8 bits bus area, double the value of X and Y.
Table 1.9.6 Interrupt Sequence Execution Time
Interrupt
Interrupt vector address
Peripheral I/O
Odd address (Note 1)
INT instruction
_______
NMI
Odd address (Note 1)
Even address (Note 2)
Watchdog timer
Undefined instruction
Address match
Overflow
Even address (Note 2)
BRK instruction (Variable vector table)
Note 1: Allocate interrupt vector addresses in even addresses, if possible.
Note 2: The vector table is fixed to even address.
Note 3: The high-speed interrupt is independent of these conditions.
67
Under
development
Interrupts
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Changes of IPL When Interrupt Request Acknowledged
When an interrupt request is acknowledged, the interrupt priority level of the acknowledged interrupt is
set to the processor interrupt priority level (IPL).
If an interrupt request is acknowledged that does not have an interrupt priority level, the value shown in
Table 1.9.7 is set to the IPL.
Table 1.9.7 Relationship between Interrupts without Interrupt Priority Levels and IPL
Interrupt sources without interrupt priority levels
_______
Watchdog timer, NMI
Value that is set to IPL
7
Reset
Other
0
Not changed
Saving Registers
In an interrupt sequence, only the contents of the flag register (FLG) and program counter (PC) are
saved to the stack area.
The order in which these contents are saved is as follows: First, the FLG register is saved to the stack
area. Next, the 16 high-order bits and 16 low-order bits of the program counter expanded to 32-bit are
saved. Figure 1.9.6 shows the stack status before an interrupt request is acknowledged and the stack
status after an interrupt request is acknowledged.
In a high-speed interrupt sequence, the contents of the flag register (FLG) is saved to the flag save
register (SVF) and program counter (PC) is saved to PC save register (SVP).
If there are any other registers you want to be saved, save them in software at the beginning of the
interrupt routine. The PUSHM instruction allows you to save all registers except the stack pointer (SP)
by a single instruction.
The execution speed is improved when register bank 1 is used with high speed interrupt register selected
by not saving registers to the stack but to the switching register bank. In this case, switch register bank
mode for high-speed interrupt routine.
Address
Stack area
LSBMSB
Address
Stack area
LSBMSB
Program counter
m-6
m-5
m–4
m–3
m–2
m–1
m
m+1
Stack status before interrupt request is acknowledged
Content of
previous stack
Content of
previous stack
[SP]
Stack pointer
value before
interrupt occurs
m-6
m-5
m–4
m–3
m–2
m–1
m
m+1
Stack status after interrupt request is acknowledged
(PCL)
Program counter
(PCM)
Program counter
(PCH)
0 0
Flag register
(FLGL)
Flag register
(FLGH)
Content of
previous stack
Content of
previous stack
Figure 1.9.6 Stack status before and after an interrupt request is acknowledged
68
[SP]
New stack
pointer value
Under
development
Interrupts
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Return from Interrupt Routine
As you execute the REIT instruction at the end of the interrupt routine, the contents of the flag register
(FLG) and program counter (PC) that have been saved to the stack area immediately preceding the
interrupt sequence are automatically restored. In high-speed interrupt, as you execute the FREIT instruction at the end of the interrupt routine, the contents of the flag register (FLG) and program counter (PC)
that have been saved to the save registers immediately preceding the interrupt sequence are automatically restored.
Then control returns to the routine that was under execution before the interrupt request was acknowledged, and processing is resumed from where control left off.
If there are any registers you saved via software in the interrupt routine, be sure to restore them using an
instruction (e.g., POPM instruction) before executing the REIT or FREIT instruction.
When switching the register bank before executing REIT and FREIT instruction, switched to the register
bank immediately before the interrupt sequence.
Interrupt Priority
If two or more interrupt requests are sampled active at the same time, whichever interrupt request is
acknowledged that has the highest priority.
Maskable interrupts (Peripheral I/O interrupts) can be assigned any desired priority by setting the interrupt priority level select bit accordingly. If some maskable interrupts are assigned the same priority level,
the priority between these interrupts is resolved by the priority that is set in hardware.
Certain nonmaskable interrupts such as a reset (reset is given the highest priority) and watchdog timer
interrupt have their priority levels set in hardware. Figure 1.9.7 lists the hardware priority levels of these
interrupts.
Software interrupts are not subjected to interrupt priority. They always cause control to branch to an
interrupt routine whenever the relevant instruction is executed.
Interrupt Resolution Circuit
Interrupt resolution circuit selects the highest priority interrupt when two or more interrupt requests are
sampled active at the same time.
Figure 1.9.8 shows the interrupt resolution circuit.
_______
Reset > NMI > Watchdog > Peripheral I/O > Single step > Address match
Figure 1.9.7. Interrupt priority that is set in hardware
69
Under
development
Interrupts
High
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Priority level of each interrupt
Level 0 (initial value)
DMA0
DMA1
DMA2
DMA3
Timer A0
Timer A1
Timer A2
Timer A3
Timer A4
UART0 transmission
UART0 reception
UART1 transmission
UART1 reception
Timer B0
Timer B1
Timer B2
UART2 transmission/NACK
UART3 transmission/NACK
UART4 transmission/NACK
condition/fault error (UART3)
condition/fault error (UART4)
INT1
INT0
Timer B5
UART2 reception/ACK
UART3 reception/ACK
UART4 reception/ACK
Bus collision/start, stop
condition(UART2)
Bus collision/start, stop
Bus collision/start, stop
A-D conversion
Key input interrupt
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Timer B3
Timer B4
INT5
INT4
INT3
INT2
Low
Priority of peripheral I/O interrupts
(if priority levels are same)
Figure 1.9.8. Interrupt resolution circuit
Stop/wait return interrupt level
Processor interrupt priority level
(RLVL)
(IPL)
Interrupt enable flag (I flag)
Instruction fetch
Address match
Watchdog timer
DBC
NMI
Reset
Interrupt
request
accepted.
To CLK
Interrupt
request
accepted.
To CPU
70
Under
development
Specifications in this manual are tentative and subject to change.
Interrupts
______
INT Interrupts
________________
Preliminary Specifications REV.D
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
INT0 to INT5 are external input interrupts. The level sense/edge sense switching bits of the interrupt control
register select the input signal level and edge at which the interrupt can be set to occur on input signal level
and input signal edge. The polarity bit selects the polarity.
With the external interrupt input edge sense, the interrupt can be set to occur on both rising and falling
edges by setting the INTi interrupt polarity switch bit of the interrupt request select register (address
031F16) to “1”. When you select both edges, set the polarity switch bit of the corresponding interrupt control
register to the falling edge (“0”).
When you select level sense, the INTi interrupt polarity switch bit of the interrupt request select register
(address 031F16) to “0”.
Figure 1.9.9 shows the interrupt request select register.
Interrupt request cause select register
b7 b6 b5 b4 b3 b2 b1 b0
SymbolAddressWhen reset
IFSR 031F
Bit symbol
IFSR0
IFSR1
IFSR2
IFSR3
IFSR4
IFSR5
Nothing is assigned.
When write, set "0". When read, their contents are indeterminate.
Note :When level sense is selected, set this bit to "0".
INT0 interrupt polarity
swiching bit (Note)
INT1 interrupt polarity
swiching bit (Note)
INT2 interrupt polarity
swiching bit (Note)
INT3 interrupt polarity
swiching bit (Note)
INT4 interrupt polarity
swiching bit (Note)
INT5 interrupt polarity
swiching bit (Note)
16
Bit nameFumction
XX000000
0 : One edge
1 : Two edges
0 : One edge
1 : Two edges
0 : One edge
1 : Two edges
0 : One edge
1 : Two edges
0 : One edge
1 : Two edges
0 : One edge
1 : Two edges
2
WR
Figure 1.9.9 Interrupt request cause select register
71
Under
development
Specifications in this manual are tentative and subject to change.
Interrupts
______
NMI Interrupt
__________________
Preliminary Specifications REV.D
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
An NMI interrupt is generated when the input to the P85/NMI pin changes from “H” to “L”. The NMI interrupt
is a non-maskable external interrupt. The pin level can be checked in the port P85 register (bit 5 at address
03C416).
This pin cannot be used as a normal port input.
Notes:
__________________
When not intending to use the NMI function, be sure to connect the NMI pin to VCC (pulled-up). The NMI
interrupt is non-maskable. Because it cannot be disabled, the pin must be pulled up.
Key Input Interrupt
If the direction register of any of P104 to P107 is set for input and a falling edge is input to that port, a key
input interrupt is generated. A key input interrupt can also be used as a key-on wakeup function for cancelling the wait mode or stop mode. However, if you intend to use the key input interrupt, do not use P104 to
P107 as A-D input ports. Figure 1.9.10 shows the block diagram of the key input interrupt. Note that if an “L”
level is input to any pin that has not been disabled for input, inputs to the other pins are not detected as an
interrupt.
Setting the key input interrupt disable bit (bit 7 at address 03AF16) to “1” disables key input interrupts from
occurring regardless of the setting in the interrupt control register. When “1” is set in the key input interrupt
disable register, there is no input via the port pin even when the direction register is set to input.
Port P104-P107 pull-up
Pull-up
transistor
P107/KI3
P106/KI2
P105/KI1
P104/KI0
Pull-up
transistor
Pull-up
transistor
Pull-up
transistor
Port P107 direction register
Port P106 direction
register
Port P10
register
Port P10
register
select bit
Port P107 direction
register
5 direction
4 direction
Figure 1.9.10. Block diagram of key input interrupt
Key input interrupt control
register
Interrupt control
circuit
(address 009316)
Key input interrupt
request
72
Under
A
A
development
Interrupts
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Address Match Interrupt
An address match interrupt is generated when the address match interrupt address register contents match
the program counter value. Four address match interrupts can be set, each of which can be enabled and
disabled by an address match interrupt enable bit. Address match interrupts are not affected by the interrupt enable flag (I flag) and processor interrupt priority level (IPL).
Figure 1.9.11 shows the address match interrupt-related registers.
Set the start address of an instruction to the address match interrupt register.
Address match interrupt is not generated when address such as the middle of instruction or table data is
set.
Address match interrupt enable register
b7 b6 b5 b4 b3 b2 b1 b0
SymbolAddress When reset
AIER0009
AIER0
Address match interrupt 0
AAAAAAAAAAAA
AIER1
Address match interrupt 1
AAAAAAAAAAAA
AIER2
AIER3
Nothing is assigned.
When write, set "0". When read, their contents are indeterminate.
Address match interrupt register i (i = 0 ot 3)
(b16)
(b23)
b7
(b15)(b8)
b0 b7b0
Address match interrupt 2
Address match interrupt 3
b7b0
16XXXX00002
Bit nameBit symbol
enable bit
enable bit
enable bit
enable bit
SymbolAddress When reset
RMAD00012
RMAD1001616 to 00141600000016
RMAD2001A16 to 00181600000016
RMAD3001E16 to 001C1600000016
0 : Interrupt disabled
1 : Interrupt enabled
0 : Interrupt disabled
1 : Interrupt enabled
0 : Interrupt disabled
1 : Interrupt enabled
0 : Interrupt disabled
1 : Interrupt enabled
Function
16 to 00101600000016
WR
FunctionValues that can be set
Address setting register for address match
interrupt
Figure 1.9.11. Address match interrupt-related registers
WR
00000016 to FFFFFF16
73
Under
development
Interrupts
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Precautions for Interrupts
(1) Reading addresses 00000016 and 00000216
• When maskable interrupt is occurred, CPU read the interrupt information (the interrupt number and
interrupt request level) in the interrupt sequence from address 00000016. When high-speed interrupt
is occurred, CPU read from address 00000216.
The interrupt request bit of the certain interrupt will then be set to “0”.
However, reading addresses 00000016 and 00000216 by software does not set request bit to “0”.
(2) Setting the stack pointer
• The value of the stack pointer immediately after reset is initialized to 00000016. Accepting an interrupt
before setting a value in the stack pointer may become a factor of runaway. Be sure to set a value in
the stack pointer before accepting an interrupt. When using the NMI interrupt, initialize the stack point
at the beginning of a program. Any interrupt including the NMI interrupt is generated immediately after
executing the first instruction after reset. Set an even address to the stack pointer so that the operating
efficiency of accessign memory is increased.
_______
_______
_______
(3) The NMI interrupt
• As for the NMI interrupt pin, an interrupt cannot be disabled. Connect it to the Vcc pin via a resistance
(pull-up) if unused. Be sure to work on it.
• The NMI pin also serves as P85, which is exclusively input. Reading the contents of the P8 register
allows reading the pin value. Use the reading of this pin only for establishing the pin level at the time
when the NMI interrupt is input.
• Signal of "L" level width more than 1 clock of CPU operation clock (BCLK) is necessary for NMI pin.
_______
_______
_______
_______
(4) External interrupt
• Edge sense
Either an “L” level or an “H” level of at least 250 ns width is necessary for the signal input to pins INT0
to INT5 regardless of the CPU operation clock.
• Level sense
Either an “L” level or an “H” level of 1 cycle of BCLK + at least 200 ns width is necessary for the signal
input to pins INT0 to INT5 regardless of the CPU operation clock. (When XIN=20MHz and no division
mode, at least 250 ns width is necessary.)
• When the polarity of the INT0 to INT5 pins is changed, the interrupt request bit is sometimes set to "1".
After changing the polarity, set the interrupt request bit to "0". Figure 1.9.12 shows the procedure for
changing the INT interrupt generate factor.
______
(5) Rewrite the interrupt control register
• When a instruction to rewrite the interrupt control register is executed but the interrupt is disabled, the
interrupt request bit is not set sometimes even if the interrupt request for that register has been generated. This will depend on the instruction. If this creates problems, use the below instructions to change
the register.
Instructions : AND, OR, BCLR, BSET
74
Under
development
Interrupts
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Set the interrupt priority level to level 0
(Disable
Set the polarity select bit
Clear the interrupt request bit to “0”
Set the interrupt priority level to level 1 to 7
(Enable the accepting of INT interrupt request)
______
INT
interrupt)
Figure 1.9.12. Switching condition of INT interrupt request
(6) Address match interrupt
• Do not set the following addresses to the address match interrupt register.
1. The address of the starting instruction in an interrupt routine.
2. Any of the next 7 instructions addresses immediately after an instruction to clear an interrupt request
bit of an interrupt control register or an instruction to rewrite an interrupt priority level to a smaller value.
3. Any of the next 3 instructions addresses immediately after an instruction to set the interrupt enable
flag (I flag).
4. Any of the next 3 instructions addresses immediately after an instruction to rewrite a processor interrupt priority level (IPL) to a smaller value.
Example 1)
Interrupt_A:; Interrupt A routine
pushm R0,R1,R2,R3,A0,A1 ; <----
••••;
Do not set address match interrupt to the
start address of an interrupt instruction
Example 2)
mov.b #0,TA0IC;Change TA0 interrupt priority level to a smaller value
nop; 1st instruction
nop; 2nd instruction
nop; 3rd instruction
nop; 4th instruction
Do not set address match interrupt
during this period
nop; 5th instruction
nop; 6th instruction
nop; 7th instruction
75
Under
development
Interrupts
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Example 3)
fsetI; Set I flag ( interrupt enabled)
nop; 1st instruction
nop; 2nd instruction
Do not set address match interrupt
during this period
nop; 3rd instruction
Example 4)
ldipl#0; Rewrite IPL to a smaller value
nop; 1st instruction
nop; 2nd instruction
Do not set address match interrupt
during this period
nop; 3rd instruction
• To return from an interrupt to the address set in an address match interrupt register using return
instruction (reit or freit)
To rewrite the interrupt control register within the interrupt routine, add the below processing to the
end of the routine (immediately before the reit or freit instruction). Also, if multiple interrupts are
enabled with other interrupts, add the below processing to the end of the interrupt that enables the
multiple interrupts.
If the interrupt control register is being rewritten within the non-maskable interrupt routine, add the
below processing to the end of all interrupts.
Additional process
; Execute after the register reset instruction (popm instruction)
fclrU; Select ISP (Unnecessary if the ISP has been selected)
pushm R0; Store R0 register
mov.w 6[SP],R0; Read FLG on stack (use "stc SVF,R0" when high-speed
; interrupt)
ldcR0,FLG; Set in FLG
popm R0; Restore R0 register
nop; Dummy
reit; Interrupt completed (use freit when high-speed interrupt)
Example 5)
If rewriting the interrupt control register for interrupt B with the interrupt A routine and enabling multiple
interrupts with interrupt C, the above processing is required at the end of the interrupt A and interrupt
C routines.
76
Under
development
Interrupts
Interrupt_A:
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Interrupt A routine
pushm R0,R1,R2,R3,A0,A1; Store registers
••••
bclr3,TA0IC; Rewrite interrupt control register of interrupt B
••••
popm R0,R1,R2,R3,A0,A1; Restore registers
fclrU; Select ISP (Unnecessary if the ISP has been selected)
pushm R0; Store R0 register
mov.w 6[SP],R0; Read FLG on stack
ldcR0,FLG; Set in FLG
popm R0; Restore R0 register
nop; Dummy
reit; Interrupt completed
Interrupt C routine
Interrupt_C:
pushm R0,R1,R2,R3,A0,A1; Store registers
fsetI; Multiple interrupt enabled
••••
••••
popm R0,R1,R2,R3,A0,A1;Restore registers
fclrU; Select ISP (Unnecessary if the ISP has been selected)
pushm R0; Store R0 register
mov.w 6[SP],R0; Read FLG on stack
ldcR0,FLG; Set in FLG
popm R0; Restore R0 register
nop; Dummy
reit; Interrupt completed
77
Under
development
Specifications in this manual are tentative and subject to change.
Watchdog Timer
Preliminary Specifications REV.D
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Watchdog Timer
The watchdog timer has the function of detecting when the program is out of control. The watchdog timer is
a 15-bit counter which down-counts the clock derived by dividing the BCLK using the prescaler. Whether a
watchdog timer interrupt is generated or reset is selected when an underflow occurs in the watchdog timer.
Watchdog timer interrupt is selected when bit 6 of the system control register 0 (address 000816 :CM06) is
"0" and reset is selected when CM06 is "1". No value other than "1" can be written in CM06. Once when
reset is selected (CM06="1"), watchdog timer interrupt cannot be selected by software.
When XIN is selected for the BCLK, bit 7 of the watchdog timer control register (address 000F16) selects the
prescaler division ratio (by 16 or by 128). When XCIN is selected as the BCLK, the prescaler is set for
division by 2 regardless of bit 7 of the watchdog timer control register (address 000F16). Therefore, the
watchdog timer cycle can be calculated as follows. However, errors can arise in the watchdog timer cycle
due to the prescaler.
When XIN is selected in BCLK
Watchdog timer cycle =
Prescaler division ratio (16 or 128) x watchdog timer count (32768)
BCLK
When XCIN is selected in BCLK
Watchdog timer cycle =
Prescaler division ratio (2) x watchdog timer count (32768)
BCLK
For example, when BCLK is 20MHz and the prescaler division ratio is set to 16, the monitor timer cycle is
approximately 26.2 ms.
The watchdog timer is initialized by writing to the watchdog timer start register (address 000E16) and when
a watchdog timer interrupt request is generated. The prescaler is initialized only when the microcomputer is
reset. After a reset is cancelled, the watchdog timer and prescaler are both stopped. The count is started by
writing to the watchdog timer start register (address 000E16). CM06 is initialized only at reset. After reset,
watchdog timer interrupt is selected.
The watchdog timer and the prescaler stop in stop mode, wait mode and hold status. After exiting these
modes and status, counting starts from the value remained before.
In the stop mode, wait mode and hold state, the watchdog timer and prescaler are stopped. Counting is
resumed from the held value when the modes or state are released. Figure 1.10.1 shows the block diagram
of the watchdog timer. Figure 1.10.2 shows the watchdog timer-related registers.
Prescaler
BCLK
HOLD
Write to the watchdog timer
start register
(address 000E16)
RESET
Figure 1.10.1. Block diagram of watchdog timer
78
1/16
1/128
1/2
“CM07 = 0”
“WDC7 = 0”
“CM07 = 0”
“WDC7 = 1”
“CM07 = 1”
Watchdog timer
Set to
“7FFF16”
"CM06=0"
Watchdog timer
interrupt request
"CM06=1"
Reset
Under
development
Specifications in this manual are tentative and subject to change.
Watchdog Timer
Watchdog timer control register
b7 b6 b5 b4 b3 b2 b1 b0
00
Preliminary Specifications REV.D
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
SymbolAddressWhen reset
WDC 000F
16
000XXXXX
Mitsubishi Microcomputers
M16C/80 group
2
Bit name
High-order bit of watchdog timer
Reserved bit
WDC7
Prescaler select bit0 : Divided by 16
Watchdog timer start register
b7b0
SymbolAddressWhen reset
WDTS 000E
16
Indeterminate
Function
The watchdog timer is initialized and starts counting after a write instruction to
this register. The watchdog timer value is always initialized to “7FFF
regardless of whatever value is written.
System clock control register 0 (Note 1)
b7 b6 b5 b4 b3 b2 b1 b0
Note 1: Set bit 0 of the protect register (address 000A
Note 2: When outputting BCLK (bit 7 of processor mode register 0 is "0"), set these bits to "00". When
outputting ALE to P5
3
port P5
function is not selected even when you set "00" in microprocessor or memory expansion
mode and bit 7 of the processor mode register 0 is "1".
Note 3: When selecting f
Note 4: Changes to “1” when shifting to stop mode or reset.
Note 5: When entering the power saving mode, the main clock is stopped using this bit. To stop the main
clock, set system clock stop bit (CM07) to "1" while an oscillation of sub clock is stable. Then set this
bit to "1".
Note 6: When this bit is "1", X
OUT
up to X
("H" level) via the feedback resistance.
Note 7: When the main clock is stopped, the main clock division register (address 000C
division by 8 mode.
Note 8: When "1" has been set once, "0" cannot be written by software.
Note 9: To set CM07 "1" from "0", first set CM04 to "1", and an oscillation of sub clock is stable. Then set
CM07. Do not set CM04 and CM07 simultaneously. Also, to set CM07 "0" from "1", first set CM05
to "1", and an oscillation of main clock is stable. Then set CM07.
32
Note 10: fc
Note 11: When Xc
is not included.
IN
-Xc
SymbolAddressWhen reset
CM00006
CM00
CM01
CM02
CM03
CM04
CM05
CM06
CM07
3
C
, f8 or f32 in single chip mode, must use P57 as input port.
OUT
OUT
is used, set port P86 and P87 to no pull-up resistance with the input port.
Clock output function
select bit (Note 2)
WAIT peripheral function
clock stop bit
X
CIN-XCOUT
select bit (Note 4)
Port XC select bit0 : I/O port
Main clock (XIN-X
stop bit (Note 5, 6)
Watchdog timer function
select bit
System clock select bit
(Note 9)
(bit 5 and 4 of processor mode register 0 is "01"), set these bits to "00". The
is "H". Also, the internal feedback resistance remains ON, so X
name
16
Bit
drive capacity
OUT
)
16
) to “1” before writing to this register.
Figure 1.10.2. Watchdog timer control and start registers
FunctionBit symbolWR
Must always be set to “0”
1 : Divided by 128
16
”
08
16
b1 b0
0 0 : I/O port P5
0 1 : fC output (Note 3)
1 0 : f
8
1 1 : f
32
0 : Do not stop peripheral clock in wait
mode
1 : Stop peripheral clock in wait mode
(Note 10)
0 : LOW
1 : HIGH
1 : X
CIN-XCOUT
0 : On
1 : Off (Note 7)
0 : Watchdog timer interrupt
1 : Reset (Note 8)
0 : XIN, X
1 : X
CIN
FunctionBit symbol
3
output (Note 3)
output (Note 3)
generation (Note 11)
OUT
, X
COUT
16
) is set to the
WR
WR
IN
is pulled
79
Under
development
DMAC
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
DMAC
This microcomputer has four DMAC (direct memory access controller) channels that allow data to be sent
to memory without using the CPU. DMAC is a function that to transmit 1 data of a source address (8 bits /
16 bits) to a destination address when transmission request occurs. When using three or more DMAC
channels, the register bank 1 register and high-speed interrupt register are used as DMAC registers. If you
are using three or more DMAC channels, you cannot, therefore, use high-speed interrupts. The CPU and
DMAC use the same data bus, but the DMAC has a higher bus access privilege than the CPU, and because
of the use of cycle-steeling, operations are performed at high-speed from the occurrence of a transfer
request until one word (16 bits) or 1 byte (8 bits) of data have been sent. Figure 1.11.1 shows the mapping
of registers used by the DMAC.
structures of the registers used.
As the registers shown in Figure 1.11.1 is allocated in CPU, use LDC instruction when writing. When writing
to DCT2, DCT3, DRC2, DRC3, DMA2 and DMA3, set register bank select flag (B flag) to "1" and use MOV
instruction to set R0 to R3, A0 and A1 registers. When writing to DSA2 and DSA3, set register bank select
flag (B flag) to "1" and use LDC instruction to set SB and FB registers.
Table 1.11.1 shows DMAC specifications. Figures 1.11.2 to 1.11.5 show the
DMAC related register
DMD0
DMD1
DCT0
DCT1
DRC0
DRC1
DMA0
DMA1
DSA0
DSA1
DRA0
DRA1
When using three or more DMAC channels
The register bank 1 is used as a DMAC register
DCT2 (R0)
DCT3 (R1)
DRC2 (R2)
DRC3 (R3)
DMA2 (A0)
DMA3 (A1)
DSA2 (SB)
DSA3 (FB)
DMA mode register 0, 1
DMA0, 1 transfer count register
DMA0,1 transfer count reload register
DMA0, 1 memory address register
DMA0, 1 SFR address register
DMA0, 1 memory address reload register
DMA2 transfer count register
DMA3 transfer count register
DMA2 transfer count reload register
DMA3 transfer count reload register
DMA2 memory address register
DMA3 memory address register
DMA2 SFR address register
DMA3 SFR address register
When using three or more DMAC channels
The high-speed interrupt register is used as a DMAC
register
SVF
DRA2 (SVP)
DRA1 (VCT)
When using DMA2 and DMA3, use the CPU
registers shown in parentheses.
Flag save register
DMA2 memory address reload register
DMA3 memory address reload register
Figure 1.11.1. Register map using DMAC
In addition to writing to the software DMA request bit to start DMAC transfer, the interrupt request signals
output from the functions specified in the DMA request factor select bits are also used. However, in contrast
to the interrupt requests, repeated DMA requests can be received, regardless of the interrupt flag.
(Note, however, that the number of actual transfers may not match the number of transfer requests if the
DMA request cycle is shorter than the DMR transfer cycle. For details, see the description of the DMAC
request bit.)
80
Under
development
DMAC
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Table 1.11.1. DMAC specifications
ItemSpecification
No. of channels4 (cycle steal method)
Transfer memory space• From any address in the 16 Mbytes space to a fixed address (16
Mbytes space)
• From a fixed address (16 Mbytes space) to any address in the 16 M
bytes space
Maximum No. of bytes transferred
DMA request factors (Note)
Falling edge of INT0 to INT3 or both edge
Timer A0 to timer A4 interrupt requests
Timer B0 to timer B5 interrupt requests
UART0 to UART4 transmission and reception interrupt requests
A-D conversion interrupt requests
Software triggers
Channel priorityDMA0 > DMA1 > DMA2 > DMA3 (DMA0 is the first priority)
Transfer unit8 bits or 16 bits
Transfer address directionforward/fixed (forward direction cannot be specified for both source and
destination simultaneously)
Transfer mode• Single transfer
Transfer ends when the transfer count register is "000016".
• Repeat transfer
When the transfer counter is "000016", the value in the transfer
counter reload register is reloaded into the transfer counter and the
DMA transfer is continued
DMA interrupt request generation timing
When the transfer counter register changes from "000116" to "000016".
DMA startup• Single transfer
Transfer starts when DMA transfer count register is more than
"000116" and the DMA is requested after “012” is written to the
channel i transfer mode select bits
• Repeat transfer
Transfer starts when the DMA is requested after “112” is written to the
channel i transfer mode select bits
DMA shutdown• Single transfer
When “002” is written to the channel i transfer mode select bits and
DMA transfer count register becomes "000016" by DMA transfer or
write
• Repeat transfer
When “002” is written to the channel i transfer mode select bits
Reload timingWhen the transfer counter register changes from "000116" to "000016" in
repeat transfer mode.
Reading / writing the registerRegisters are always read/write enabled.
Number of DMA transfer cyclesBetween SFR and internal RAM : 3 cycles
Between external I/O and external memory : minimum 3 cycles
Note: DMA transfer is not effective to any interrupt.
81
Under
development
DMAC
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
DMAi request cause select register (i = 0 to 3)(Note 1)
If software trigger is selected, a
DMA request is generated by
setting this bit to “1” (When read,
the value of this bit is always “0”)
RW
Nothing is assigned.
When write, set "0". When read, its content is indeterminate.
DRQ
Note 1: Please refer to DMAC precautions.
Note 2: Set DMA inhibit before changing the DMA request cause. Set DRQ to "1"
simultaneously.
Note 3: DMA0-INT0, DMA1-INT1, DMA2-INT2, and DMA3-INT3 correspond to DMAi and
INTi. However, when INT3 pin becomes data bus in microprocessor mode, DMA3INT3 cannot be used.
Note 4: UARTi reception and ACK switching are effected using the UARTi special mode
register and UARTi special mode register 2.
Note 5: When setting DSR to "1", set DRQ to "1" using OR instruction etc. simultaneously.
Note 6: Do not write "0" to this bit. There is no need to clear the DMA request bit.
Figure 1.11.2. DMAC register (1)
DMA request bit
(Note 5,6)
0 : Not requested
1 : Requested
e.g.) MOV.B #083h, DMiSL; Set timer A0
e.g.) OR.B #0A0h, DMiSL
82
Under
development
DMAC
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
DMA mode register 0
(CPU internal register)
b7 b6 b5 b4 b3 b2 b1 b0
SymbolWhen reset
DMD000
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
16
DMA mode register 1
(CPU internal register)
b7 b6 b5 b4 b3 b2 b1 b0
Bit symbol
MD00
MD01
BW0
RW0
MD10
MD11
BW1
RW1
SymbolWhen reset
DMD100
Bit name
Channel 0 transfer
mode select bit
Channel 0 transfer
unit select bit
Channel 0 transfer
direction select bit
Channel 1 transfer
mode select bit
Channel 1 transfer
unit select bit
Channel 1 transfer
direction select bit
Function
b1 b0
0 0 : DMA inhibit
0 1 : Single transfer
1 0 : Reserved
1 1 : Repeat transfer
0 : 8 bits
1 : 16 bits
0 : Fixed address to memory (forward direction)
1 : Memory (forward direction) to fixed address
b5 b4
0 0 : DMA inhibit
0 1 : Single transfer
1 0 : Reserved
1 1 : Repeat transfer
0 : 8 bits
1 : 16 bits
0 : Fixed address to memory (forward direction)
1 : Memory (forward direction) to fixed address
16
RW
Bit symbol
MD20
MD21
BW2
RW2
MD30
MD31
BW3
RW3
Figure 1.11.3. DMAC register (2)
Bit name
Channel 2 transfer
mode select bit
Channel 2 transfer
unit select bit
Channel 2 transfer
direction select bit
Channel 3 transfer
mode select bit
Channel 3 transfer
unit select bit
Channel 3 transfer
direction select bit
Function
b1 b0
0 0 : DMA inhibit
0 1 : Single transfer
1 0 : Reserved
1 1 : Repeat transfer
0 : 8 bits
1 : 16 bits
0 : Fixed address to memory (forward direction)
1 : Memory (forward direction) to fixed address
b5 b4
0 0 : DMA inhibit
0 1 : Single transfer
1 0 : Reserved
1 1 : Repeat transfer
0 : 8 bits
1 : 16 bits
0 : Fixed address to memory (forward direction)
1 : Memory (forward direction) to fixed address
RW
83
Under
development
DMAC
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
DMAi transfer count register (i = 0 to 3)
(CPU internal register)
b15b0
Function
• Transfer counter
Set transfer number
Note 1: When setting DCT2 and DCT3, set "1" to the register bank select
flag (B flag) of flag register (FLG), and then set desired value to R0
and R1 of register bank 1.
Note 2: When "0" is set to this register, data transfer is not done even if DMA
is requested.
DMAi transfer count reload register (i = 0 to 3)
(CPU internal register)
Note 1: When setting DSA2, set "1" to the register bank select flag (B flag) of flag register
(FLG), and set desired value to SB of register bank 1.
When setting DSA3, set "1" to the register bank select flag (B flag) of flag register
(FLG), and set desired value to FB of register bank 1.
Note 2: When the transfer direction select bit is "0" (fixed address to memory), this register
is source fixed address.
When the transfer direction select bit is "1" (memory to fixed address), this register
is destination fixed address.
DMAi memory address reload register (i = 0 to 3)
(CPU internal register)
b23
• Memory address register reload value
Set source or destination memory address
Note: When setting DRA2, set desired value to save PC register (SVP).
When setting DRA3, set desired value to vector register (VCT).
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(1) Transfer cycle
The transfer cycle consists of the bus cycle in which data is read from memory or from the SFR area
(source read) and the bus cycle in which the data is written to memory or to the SFR area (destination
write). The number of read and write bus cycles depends on the source and destination addresses. In
memory expansion mode and microprocessor mode, the number of read and write bus cycles also depends on the level of the BYTE pin. Also, the bus cycle itself is longer when software waits are inserted.
(a) Effect of source and destination addresses
When 16-bit data is transferred on a 16-bit data bus, and the source and destination both start at odd
addresses, there are one more source read cycle and destination write cycle than when the source
and destination both start at even addresses.
(b) Effect of external data bus width control register
When in memory expansion mode or microprocessor mode, the transfer cycle changes according to
the data bus width at the source and destination.
1. When transferring 16 bits of data and the data bus width at the source and at the destination is 8
bits (data bus width bit = “0”), there are two 8-bit data transfers. Therefore, two bus cycles are
required for reading and two cycles for writing.
2. When transferring 16 bits of data and the data bus width at the source is 8 bits (data bus width bit
= “0”) and the data bus width at the destination is 16 bits (data bus width bit = “1”), the data is read
in two 8-bit blocks and written as 16-bit data. Therefore, two bus cycles are required for reading
and one cycle for writing.
3. When transferring 16 bits of data and the data bus width at the source is 16 bits (data bus width bit
= “1”) and the data bus width at the destination is 8 bits (data bus width bit = “0”), 16 bits of data are
read and written as two 8-bit blocks. Therefore, one bus cycle is required for reading and two
cycles for writing.
(c) Effect of software wait
When the SFR area or a memory area with a software wait is accessed, the number of cycles is
increased for the wait by 1 bus cycle. The length of the cycle is determined by BCLK.
Figure 1.11.6 shows the example of the transfer cycles for a source read. Figure 1.11.6 shows the destination is external area, the destination write cycle is shown as two cycle (one bus cycle) and the source
read cycles for the different conditions. In reality, the destination write cycle is subject to the same conditions as the source read cycle, with the transfer cycle changing accordingly. When calculating the transfer
cycle, remember to apply the respective conditions to both the destination write cycle and the source read
cycle. For example (2) in Figure 1.11.6, if data is being transferred in 16-bit units on an 8-bit bus, two bus
cycles are required for both the source read cycle and the destination write cycle.
86
Under
Preliminary Specifications REV.D
development
DMAC
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
(1) •When 8-bit data is transferred
•When 16-bit data is transferred on a 16-bit data bus and the source address is even
BCLK
Mitsubishi Microcomputers
M16C/80 group
Address
bus
RD signal
WR signal
Data
bus
CPU use
CPU useCPU use
Source
Destination
Destination
CPU useSource
(2) •When 16-bit data is transferred and the source address is odd
•When 16-bit data is transferred and the width of data bus at the source is 8-bit
(When the width of data bus at the destination is 8-bit, there are also two destination write cycles).
BCLK
Address
bus
RD signal
WR signal
Data
bus
CPU use
CPU use
Source
Source + 1
Source + 1
Destination
Destination
CPU useSource
CPU use
(3) •When one wait is inserted into the source read under the conditions in (1)
BCLK
Address
bus
RD signal
WR signal
Data
bus
CPU use
CPU useCPU use
Source
Source
Destination
Destination
CPU use
(4) •When one wait is inserted into the source read under the conditions in (2)
(When 16-bit data is transferred and the width of data but at the destination is 8-bit, there are
two destination write cycles).
BCLK
Address
bus
RD signal
WR signal
Data
bus
CPU use
CPU use CPU use
Source
Source + 1
Source + 1
Destination
Destination
CPU useSource
Note: The same timing changes occur with the respective conditions at the destination as at the source.
Figure 1.11.6. Example of the transfer cycles for a source read
87
Under
development
DMAC
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(2) DMAC transfer cycles
Any combination of even or odd transfer read and write addresses is possible. Table 1.11.2 shows the
number of DMAC transfer cycles.
The number of DMAC transfer cycles can be calculated as follows:
No. of transfer cycles per transfer unit = No. of read cycles x j + No. of write cycles x k
The DMAC can issue DMA requests using preselected DMA request factors for each channel as triggers.
The DMA transfer request factors include the reception of DMA request signals from the internal peripheral functions, software DMA factors generated by the program, and external factors using input from
external interrupt signals.
See the description of the DMAi factor selection register for details of how to select DMA request factors.
DMA requests are received as DMA requests when the DMAi request bit is set to “1” and the channel i
transfer mode select bits are “01” or “11”. Therefore, even if the DMAi request bit is “1”, no DMA request
is received if the channel i transfer mode select bit is “00”. In this case, DMAi request bit is cleared.
Because the channel i transfer mode select bits default to “00” after a reset, remember to set the channel
i transfer mode select bit for the channel to be activated after setting the DMAC related registers. This
enables receipt of the DMA requests for that channel, and DMA transfers are then performed when the
DMAi request bit is set.
The following describes when the DMAi request bit is set and cleared.
88
Under
development
DMAC
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(1) Internal factors
The DMAi request flag is set to “1” in response to internal factors at the same time as the interrupt
request bit of the interrupt control register for each factor is set. This is because, except for software
trigger DMA factors, they use the interrupt request signals output by each function.
The DMAi request bit is cleared to "0" when the DMA transfer starts or the DMA transfer is in disable
state (channel i transfer mode select bits are "00" and the DMAi transfer count register is "0").
(2) External factors
These are DMA request factors that are generated by the input edge from the INTi pin (where i indi-
______
______
cates the DMAC channel). When the INTi pin is selected by the DMAi request factor select bit as an
external factor, the inputs from these pins become the DMA request signals.
When an external factor is selected, the DMAi request bit is set, according to the function specified in the
______
DMA request factor select bit, on either the falling edge of the signal input via the INTi pins, or both edges.
When an external factor is selected, the DMAi request bit is cleared, in the same way as the DMAi
request bit is cleared for internal factors, when the DMA transfer starts or the DMA transfer is in
disable state.
(3) Relationship between external factor request input and DMAi request flag, and DMA transfer timing
When the request inputs to DMAi occur in the same sampling cycle (between the falling edge of BCLK
and the next falling edge), the DMAi request bits are set simultaneously, but if the DMAi enable bits
are all set, DMA0 takes priority and the transfer starts. When one transfer unit is complete, the bus
privilege is returned to the CPU. When the CPU has completed one bus access, DMA1 transfer starts,
and, when one transfer unit is complete, the privilege is again returned to the CPU.
The priority is as follows: DMA0 > DMA1 > DMA2 > DMA3.
Figure 1.11.7. DMA transfer example by external factors shows what happens when DMA0 and DMA1
requests occur in the same sampling cycle.
In this example, DMA transfer request signals are input simultaneously from
external factors and the DMA transfers are executed in the minimum cycles.
BCLK
DMA0
DMA1
CPU
INT0
DMA0
request bit
INT1
DMA1
request bit
Figure 1.11.7. DMA transfer example by external factors
Bus
priviledge
acquired
89
Under
development
DMAC
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Precautions for DMAC
(1) Do not clear the DMA request bit of the DMAi request cause select register.
In M16C/80, when a DMA request is generated while the channel is disabled (Note), the DMA transfer is
not executed and the DMA request bit is cleared automatically.
Note :The DMA is disabled or the transfer count register is "0".
(2) When DMA transfer is done by a software trigger, set DSR and DRQ of the DMAi request cause select
register to "1" simultaneously using the OR instruction.
e.g.) OR.B #0A0h, DMiSL; DMiSL is DMAi request cause select register
(3) When changing the DMAi request cause select bit of the DMAi request cause select register, set "1" to
the DMA request bit, simultaneously. In this case, set the corresponding DMA channel to disabled
before changing the DMAi request cause select bit. At least 2 instructions are needed from the instruction to write to the DMAi request cause select register to enable DMA.
Example) When DMA request cause is changed to timer A0 and using DMA0 in single transfer after
DMA initial setting
push.wR0; Store R0 register
stcDMD0, R0; Read DMA mode register 0
and.b#11111100b, R0L; Clear DMA0 transfer mode select bit to "00"
ldcR0, DMD0; DMA0 disabled
mov.b#10000011b, DM0SL ; Select timer A0
; (Write "1" to DMA request bit simultaneously)
mov.bR0L, R0L; Dummy cycle
or.b#00000001b, R0L; Set DMA0 single transfer
ldcR0, DMD0; DMA0 enabled
pop.wR0; Restore R0 register
At least 2 instructions are
needed until DMA enabled.
90
Under
development
Timer
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Timer
There are eleven 16-bit timers. These timers can be classified by function into timers A (five) and timers B
(six). All these timers function independently. Figures 1.12.1 and 1.12.2 show the block diagram of timers.
Clock prescaler
f
TA0
X
IN
1/8
1/4
f
1 f8 f32 fC32
IN
Noise
filter
1
f
8
f
32
X
CIN
Clock prescaler reset flag (bit 7
at address 0341
• Timer mode
• One-shot mode
• PWM mode
• Event counter mode
16
1/32
Reset
) set to “1”
Timer A0
f
C32
Timer A0 interrupt
TA1
TA2
TA3
TA4
• Timer mode
• One-shot mode
• PWM mode
IN
Noise
filter
• Event counter mode
• Timer mode
• One-shot mode
• PWM mode
Timer A1
Timer A1 interrupt
Timer A2 interrupt
IN
IN
Noise
filter
Noise
filter
• Event counter mode
• Timer mode
• One-shot mode
• PWM mode
• Event counter mode
• Timer mode
• One-shot mode
• PWM mode
Timer A2
Timer A3 interrupt
Timer A3
Timer A4 interrupt
IN
Noise
filter
• Event counter mode
Timer A4
Timer B2 overflow
Figure 1.12.1. Timer A block diagram
91
Under
development
Timer
TB0IN
TB1IN
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
XIN
f
1 f8 f32 fC32
1/8
1/4
Timer B2 overflow (to timer A count source)
Noise
filter
Noise
filter
f1
f8
f32
XCIN
Clock prescaler reset flag (bit 7
at address 0341
• Timer mode
• Pulse width measuring mode
• Event counter mode
• Timer mode
• Pulse width measuring mode
• Event counter mode
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
16) set to “1”
Timer B0
Timer B1
Clock prescaler
1/32
Reset
Mitsubishi Microcomputers
M16C/80 group
f
C32
Timer B0 interrupt
Timer B1 interrupt
TB2IN
TB3IN
TB4IN
TB5IN
Noise
filter
Noise
filter
Noise
filter
Noise
filter
Figure 1.12.2. Timer B block diagram
• Timer mode
• Pulse width measuring mode
Timer B2
• Event counter mode
• Timer mode
• Pulse width measuring mode
Timer B3
• Event counter mode
• Timer mode
• Pulse width measuring mode
Timer B4
• Event counter mode
• Timer mode
• Pulse width measuring mode
Timer B5
• Event counter mode
Timer B2 interrupt
Timer B3 interrupt
Timer B4 interrupt
Timer B5 interrupt
92
Under
development
Timer A
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Timer A
Figure 1.13.1 shows the block diagram of timer A. Figures 1.13.2 to 1.13.4 show the timer A-related registers.
Except in event counter mode, timers A0 through A4 all have the same function. Use the timer Ai mode
register (i = 0 to 4) bits 0 and 1 to choose the desired mode.
Timer A has the four operation modes listed as follows:
• Timer mode: The timer counts an internal count source.
• Event counter mode: The timer counts pulses from an external source or a timer over flow.
• One-shot timer mode: The timer stops counting when the count reaches “000016”.
• Pulse width modulation (PWM) mode: The timer outputs pulses of a given width.
Specifications in this manual are tentative and subject to change.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Timer Ai register (Note 1)
(b15)(b8)
b7b0b7b0
• Timer mode000016 to FFFF
Counts an internal count source
• Event counter mode000016 to FFFF16
Counts pulses from an external source or timer overflow
• One-shot timer mode (Note 2, 3)000016 to FFFF
Counts a one shot width
• Pulse width modulation mode (16-bit PWM) (Note 2, 4)
Functions as a 16-bit pulse width modulator
• Pulse width modulation mode (8-bit PWM) (Note 2, 4)
Timer low-order address functions as an 8-bit
prescaler and high-order address functions as an 8-bit
pulse width modulator
Note 1: Read and write data in 16-bit units.
Note 2: Use MOV instruction to write to this register.
Note 3: When the timer Ai register is set to "0000
operate and the timer Ai interrupt request is not generated. When
the pulse is set to output, the pulse does not output from the TAi
pin.
Note 4: When the timer Ai register is set to "0000
modulator does not operate and the output level of the TAi
remains "L" level, therefore the timer Ai interrupt request is not
generated. This also occurs in the 8-bit pulse width modulator mode
when the significant 8 high-order bits in the timer Ai register are set
to "00
Timer A1 count start flag
Timer A2 count start flag
Timer A3 count start flag
Timer A4 count start flag
Timer B0 count start flag
Timer B1 count start flag
Timer B2 count start flag
16
Bit nameFunctionBit symbol
Timer A0 up/down flag
Timer A1 up/down flag
Timer A2 up/down flag
Timer A3 up/down flag
Timer A4 up/down flag
Timer A2 two-phase pulse
signal processing select bit
Timer A3 two-phase pulse
signal processing select bit
Timer A4 two-phase pulse
signal processing select bit
0 : Down count
1 : Up count
This specification becomes valid
when the up/down flag content is
selected for up/down switching
cause
0 : two-phase pulse signal
1 : two-phase pulse signal
When not using the two-phase
pulse signal processing function,
set the select bit to “0”
Note: Use MOV instruction to write to this register.
0 : Stops counting
1 : Starts counting
00
16
processing disabled
processing enabled
WR
WR
Figure 1.13.3. Timer A-related registers (2)
94
Under
development
Timer A
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
One-shot start flag
b7 b6 b5 b4 b3 b2 b1 b0
Trigger select register
b7 b6 b5 b4 b3 b2 b1 b0
SymbolAddressWhen reset
ONSF0342
16
00
16
Bit nameFunctionBit symbol
TA0OS
TA1OS
TA2OS
TA3OS
TA4OS
TAZIE
TA0TGL
TA0TGH
Timer A0 one-shot start flag
Timer A1 one-shot start flag
Timer A2 one-shot start flag
Timer A3 one-shot start flag
Timer A4 one-shot start flag
Z phase input enable bit
Timer A0 event/trigger
select bit
1 : Timer start
When read, the value is “0”
0 : Invalid
1 : Valid
b7 b6
0 0 :
Input on TA0IN is selected (Note)
0 1 : TB2 overflow is selected
1 0 : TA4 overflow is selected
1 1 : TA1 overflow is selected
Note: Set the corresponding function select register A to I/O port, and port
direction register to “0”.
SymbolAddressWhen reset
TRGSR0343
16
00
16
Bit nameFunctionBit symbol
TA1TGL
TA1TGH
TA2TGL
TA2TGH
TA3TGL
TA3TGH
Timer A1 event/trigger
select bit
Timer A2 event/trigger
select bit
Timer A3 event/trigger
select bit
b1 b0
0 0 :
Input on TA1IN is selected (Note)
0 1 : TB2 overflow is selected
1 0 : TA0 overflow is selected
1 1 : TA2 overflow is selected
b3 b2
0 0 :
Input on TA2IN is selected (Note)
0 1 : TB2 overflow is selected
1 0 : TA1 overflow is selected
1 1 : TA3 overflow is selected
b5 b4
0 0 :
Input on TA3IN is selected (Note)
0 1 : TB2 overflow is selected
1 0 : TA2 overflow is selected
1 1 : TA4 overflow is selected
TA4TGL
TA4TGH
Timer A4 event/trigger
select bit
b7 b6
0 0 :
Input on TA4IN is selected (Note)
0 1 : TB2 overflow is selected
1 0 : TA3 overflow is selected
1 1 : TA0 overflow is selected
Note: Set the corresponding function select register A to I/O port, and port
direction register to “0”.
WR
WR
Clock prescaler reset flag
b7 b6 b5 b4 b3 b2 b1 b0
SymbolAddressWhen reset
CPSRF0341
Nothing is assigned.
When write, set "0". When read, their contents are indeterminate.
CPSR
Clock prescaler reset flag
Figure 1.13.4. Timer A-related registers (3)
16
Bit nameFunctionBit symbol
0XXXXXXX
2
WR
0 : No effect
1 : Prescaler is reset
(When read, the value is “0”)
95
Under
development
Timer A
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(1) Timer mode
In this mode, the timer counts an internally generated count source. (See Table 1.13.1.) Figure 1.13.5
shows the timer Ai mode register in timer mode.
Table 1.13.1. Specifications of timer mode
ItemSpecification
Count sourcef1, f8, f32, fc32
Count operation• Down count
• When the timer underflows, it reloads the reload register contents before
continuing counting
Divide ratio1/(n+1)n : Set value
Count start conditionCount start flag is set (= 1)
Count stop conditionCount start flag is reset (= 0)
Interrupt request generation timing
TAiIN pin functionProgrammable I/O port or gate input
TAiOUT pin functionProgrammable I/O port or pulse output (Setting by the corresponding function
Read from timerCount value can be read out by reading timer Ai register
Write to timer• When counting stopped
Select function• Gate function
When the timer underflows
select registers A and B)
When a value is written to timer Ai register, it is written to both reload register
and counter
• When counting in progress
When a value is written to timer Ai register, it is written to only reload register
(Transferred to counter at next reload time)
Counting can be started and stopped by the TAiIN pin’s input signal
• Pulse output function
Each time the timer underflows, the TAiOUT pin’s polarity is reversed
Timer Ai mode register
b7 b6 b5 b4 b3 b2 b1 b0
0
00
Figure 1.13.5. Timer Ai mode register in timer mode
SymbolAddressWhen reset
TAiMR(i=0 to 4)0356
TMOD0
TMOD1
MR0
MR1
MR2
MR3
TCK0
TCK1
Operation mode
select bit
This bit is invalid in M16C/80 series.
Port output control is set by the function select registers A and B.
Gate function select bit
0 (Set to “0” in timer mode)
Count source select bit
16 to 035A16 00000X002
Bit nameFunctionBit symbolWR
Note 1: The bit can be “0” or “1”.
Note 2: Set the corresponding port function select register to I/O port, and port
direction register to “0”.
b1 b0
0 0 : Timer mode
b4 b3
0 X
(Note 1): Gate function not available
1 0 : Timer counts only when TAiIN pin is
1 1 : Timer counts only when TA
b7 b6
0 0 : f
0 1 : f8
1 0 : f
1 1 : f
(TAiIN pin is a normal port pin)
held “L” (Note 2)
iIN pin is
held “H” (Note 2)
1
32
C32
– –
96
Under
development
Timer A
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
(2) Event counter mode
In this mode, the timer counts an external signal or an internal timer’s overflow. Timers A0 and A1 can count a singlephase external signal. Timers A2, A3, and A4 can count a single-phase and a two-phase external signal. Table
1.13.2 lists timer specifications when counting a single-phase external signal. Figure 1.13.6 shows the timer Ai
mode register in event counter mode. Table 1.13.3 lists timer specifications when counting a two-phase
external signal. Figure 1.13.7 shows the timer Ai mode register in event counter mode.
Table 1.13.2. Timer specifications in event counter mode (when not processing two-phase pulse signal)
ItemSpecification
Count source
Count operation•Up count or down count can be selected by external signal or software
Divide ratio• 1/ (FFFF16 - n + 1) for up count
Count start conditionCount start flag is set (= 1)
Count stop conditionCount start flag is reset (= 0)
Interrupt request generation timing
TAiIN pin functionProgrammable I/O port or count source input
TAiOUT pin function
Read from timerCount value can be read out by reading timer Ai register
Write to timer• When counting stopped
Select function• Free-run count function
Note: This does not apply when the free-run function is selected.
• External signals input to TAiIN pin (effective edge can be selected by software)
• TB2 overflows or underflows, TAj overflows or underflows
• When the timer overflows or underflows, it reloads the reload register con
tents before continuing counting (Note)
• 1/ (n + 1) for down countn : Set value
The timer overflows or underflows
Programmable I/O port, pulse output, or up/down count select input (
the corresponding function select registers A and B
)
Setting by
When a value is written to timer Ai register, it is written to both reload register and counter
• When counting in progress
When a value is written to timer Ai register, it is written to only reload register
(Transferred to counter at next reload time)
Even when the timer overflows or underflows, the reload register content is
not reloaded to it
• Pulse output function
Each time the timer overflows or underflows, the TAi
OUT
pin’s polarity is reversed
Timer Ai mode register
(When not using two-phase pulse signal processing)
b7 b6 b5 b4 b3 b2 b1 b0
010
SymbolAddressWhen reset
TAiMR(i=0 to 4) 0356
Bit symbolBit nameFunction
TMOD0
TMOD1
MR0
MR1
MR2
MR3
TCK0
TCK1
Note 1: This bit is valid when only counting an external signal.
Note 2: Set the corresponding function select register A to I/O port, and port direction
Operation mode select bit
This bit is invalid in M16C/80 series.
Port output control is set by the function select registers A and B.
Count polarity
select bit (Note 1)
Up/down switching
cause select bit
0 : (Set to “0” in event counter mode)
Count operation type
select bit
Two-phase pulse signal
processing operation
select bit
When not using two-phase pulse signal
processing, set this bit to “0”
Figure 1.13.6. Timer Ai mode register in event counter mode
2
iOUT
pin's input signal (Note 2)
WR
– –
97
Under
development
Timer A
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi Microcomputers
M16C/80 group
Table 1.13.3. Timer specifications in event counter mode
ItemSpecification
Count source•Two-phase pulse signals input to TAiIN or TAiOUT pin
Count operation•Up count or down count can be selected by two-phase pulse signal
•When the timer overflows or underflows, the reload register content is
reloaded and the timer starts over again (Note)
Divide ratio•1/ (FFFF16 - n + 1) for up count
• 1/ (n + 1) for down countn : Set value
Count start conditionCount start flag is set (= 1)
Count stop conditionCount start flag is reset (= 0)
Interrupt request generation timing
Timer overflows or underflows
TAiIN pin functionTwo-phase pulse input
TAiOUT pin functionTwo-phase pulse input (Set the corresponding function select registers A to I/
O port)
Read from timerCount value can be read out by reading timer A2, A3, or A4 register
Write to timer•When counting stopped
When a value is written to timer A2, A3, or A4 register, it is written to both
reload register and counter
• When counting in progress
When a value is written to timer A2, A3, or A4 register, it is written to only
reload register. (Transferred to counter at next reload time.)
Select function (Note 2)• Normal processing operation (TimerA2 and timer A3)
The timer counts up rising edges or counts down falling edges on the TAiIN
pin when input signal on the TAiOUT pin is “H”
TAi
OUT
TAi
IN
(i=2,3)
Up
count
Up
count
Up
count
Down
count
Down
count
Down
count
• Multiply-by-4 processing operation (TimerA3 and timer A4)
If the phase relationship is such that the TAiIN pin goes “H” when the input
signal on the TAiOUT pin is “H”, the timer counts up rising and falling edges
on the TAiOUT and TAiIN pins. If the phase relationship is such that the
TAiIN pin goes “L” when the input signal on the TAiOUT pin is “H”, the timer
counts down rising and falling edges on the TAiOUT and TAiIN pins.
TAi
OUT
Count down all edges
TAi
Count up all edges
IN
(i=3,4)
Count up all edges
(when processing two-phase pulse signal with timers A2, A3, and A4)
Note 1: This does not apply when the free-run function is selected.
Note 2: Timer A3 is selectable. Timer A2 is fixed to normal processing operation and timer A4 is fixed to
multiply-by-4 operation.
Count down all edges
98
Under
development
Timer A
Preliminary Specifications REV.D
Specifications in this manual are tentative and subject to change.
Timer Ai mode register
(When using two-phase pulse signal processing)
Mitsubishi Microcomputers
M16C/80 group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
b6 b5 b4 b3 b2 b1 b0
b7
01
SymbolAddressWhen reset
010
TAiMR(i=2 to 4)0358
Bit symbolBit nameFunction
TMOD0
TMOD1
MR0
MR1
MR2
MR3
TCK0
TCK1
Note 1: Set the corresponding function select register A to I/O port.
Note 2: This bit is valid for timer A3 mode register.
processing operation.
Note 3: When performing two-phase pulse signal processing, make sure the two-phase pulse
Operation mode select bit
This bit is invalid in M16C/80 series.
Port output control is set by the function select registers A and B.
0 (Set to “0” when using two-phase pulse signal processing)
1 (Set to “1” when using two-phase pulse signal processing)
0 (Set to “0” when using two-phase pulse signal processing)
Count operation type
select bit
Two-phase pulse
processing operation
select bit (Note 2)(Note 3)
Timer A2 is fixed to normal processing operation and timer A4 is fixed to multiply-by-4
signal processing operation select bit (address 0344
sure to set the event/trigger select bit (addresses 0343
16
to 035A1600000X00
b1 b0
0 1 : Event counter mode
0 : Reload type
1 : Free-run type
0 : Normal processing operation
1 : Multiply-by-4 processing operation
2
WR
(Note 1)
16
) is set to “1”. Also, always be
16
) to “00”.
– –
Figure 1.13.7. Timer Ai mode register in event counter mode
99
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.