Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
Description
The M16C/80 (144-pin version) group of single-chip microcomputers are built using the high-performance
silicon gate CMOS process using a M16C/60 Series CPU core and are packaged in a 144-pin plastic
molded QFP. 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.
The M16C/80 (144-pin version) group includes a wide range of products with different internal memory
types and sizes and various package types.
Features
• Memory capacity..................................ROM (See ROM expansion figure.)
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
Performance Outline
Table 1.1.1 is a performance outline of M16C/80 (144-pin version) group.
Table 1.1.1. Performance outline of M16C/80 (144-pin version) 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 port8 bits x 13, 7 bits x 2, 5 bits 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
(built-in feedback resistance, and external ceramic or
quartz oscillator)
memory version
2.7 to 5.5V (f(XIN)=10MHz) Mask ROM and flash
memory version
Mask ROM 128 Kbytes version
4
Under
development
Description
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi plans to release the following products in the M16C/80 (144-pin version) group:
(1) Support for mask ROM version, external ROM version and flash memory version
(2) ROM capacity
(3) Package
144P6Q: Plastic molded QFP (mask ROM version and flash memory version)
ROM Size
(Byte)
Preliminary Specifications REV.B
External
ROM
256K
M30805MG-XXXGP
M30805FGGP
M30805SGP
M30802SGP
Mitsubishi microcomputers
128K
96K
80K
64K
32K
M30802MC-XXXGP
Mask ROM version
M30802FCGP
Flash memory
version
External ROM version
Figure 1.1.3. ROM expansion
The M16C/80 (144-pin version) group products currently supported are listed in Table 1.1.2.
Table 1.1.2. M16C/80 (144-pin version) group
RAM capacityROM capacityPackage typeRemarksType No
M30802MC-XXXGP128K byte s
10K bytesMask ROM version
144P6Q-A
20K bytesM30805MG-XXXGP256K bytes
M30802FCGP
**
10K bytes128K byte s
Flash memo ry version
As of June, 2000
M30805FGGP
M30802SGP
M30805SGP
**
:Under development
**
256K byte s
20K bytes
10K bytes
24K bytes
External ROM version
5
Under
development
Description
Type No. M 3 0 8 0 2 M C – X X X G P
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Package type:
GP : Package144P6Q-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 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Figure 1.1.4. Type No., memory size, and package
Shows RAM capacity, pin count, etc
(The value itself has no specific meaning)
M16C/80 Group
M16C Family
6
Under
development
Specifications in this manual are tentative and subject to change.
Pin Description
Pin Description
Preliminary Specifications REV.B
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Pin name
VCC, V
SS
CNV
SS
RESET
X
IN
X
OUT
BYTE
CC
AV
AV
SS
V
REF
P00 to P0
7
Signal name
Power supply
input
SS
CNV
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 port P0
I/O type
Input
Input
Input
Output
Input
Input
Input/output
Function
Supply 4.2 to 5.5 V to the V
This pin switches between processor modes. Connect it to the V
CC
pin. Supply 0 V to the VSS pin.
SS
when operating in single-chip or memory expansion mode after reset.
CC
Connect it to the V
when in microprocessor mode after reset.
A “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
OUT
pin open.
X
and the X
IN
pin and leave the
OUT
pins. To
IN
This pin selects the width of an external data bus. 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
SS
not using the external bus,connect this pin to V
.
This pin is a power supply input for the A-D converter. Connect this
CC
pin to V
.
This pin is a power supply input for the A-D converter. Connect this
SS
pin to V
.
This pin is a reference voltage input for the A-D converter.
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.
D0 to D
7
P10 to P1
D8 to D
P20 to P2
A0 to A
7
15
7
7
A0/D0 to
A
P30 to P3
A8 to A
7/D7
7
15
A8/D8 to
15/D15
A
MA0 to MA7
I/O port P1
I/O port P2
I/O port P3
Input/output
Input/output
Input/output
Input/output
Output
Input/output
Input/output
Output
Input/output
Output
When set as a separate bus, these pins input and output data (D
5
This is an 8-bit I/O port equivalent to P0. P1
to P17 also function as
0–D7
external interrupt pins as selected by software.
When set as a separate bus, these pins input and output data
(D8–D15).
This is an 8-bit I/O port equivalent to P0.
0–A7
These pins output 8 low-order address bits (A
If a multiplexed bus is set, these pins input and output data (D
0–A7
output 8 low-order address bits (A
) separated in time by
).
0–D7
) and
multiplexing.
This is an 8-bit I/O port equivalent to P0.
8–A15
These pins output 8 middle-order address bits (A
).
If the external bus is set as a 16-bit wide multiplexed bus, these pins
8–D15
input and output data (D
8–A15
(A
) separated in time by multiplexing.
) and output 8 middle-order address bits
If accessing to DRAM area, these pins output row address and column
address separated in time by multiplexing.
).
7
Under
development
Specifications in this manual are tentative and subject to change.
Pin Description
Pin Description
Preliminary Specifications REV.B
P40 to P4
A16 to A22,
A
23
CS
MA8 to MA12
P5
0
to CS
0
to P5
7
3
7
Signal nameFunctionPin nameI/O type
I/O port P4This is an 8-bit I/O port equivalent to P0.Input/output
Output
Output
Output
I/O port P5Input/output
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
These pins output 8 high-order address bits (A
23
address bit (A
) outputs inversely.
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 data separated in time by
multiplexing.
This is an 8-bit I/O port equivalent to P0. P53 in this port outputs a
divide-by-8 or divide-by-32 clock of X
frequency as X
CIN
as selected by software.
IN
16–A22
, A23). Highest
or a clock of the same
WRL / WR,
WRH / BHE,
RD,
BCLK,
HLDA,
HOLD,
ALE,
RDY
DW,
CASL,
CASH,
RAS
P60 to P6
7
P70 to P77
I/O port P6
I/O port P7
Output
Output
Output
Output
Output
Input
Output
Input
Output
Output
Output
Output
Input/output
Input/output
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
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 a “L”
level. ALE is used to latch the address. While the input level of the
RDY pin is “L”, the microcomputer is in the ready state.
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, 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. Pins in this port also function as UART0 and UART1 I/
O pins as selected by software.
0
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.
8
0
to P84,
P8
P8
6
,
7
,
P8
5
P8
P90 to P9
7
P100 to P10
I/O port P8
I/O port P8
I/O port P9
7
I/O port P10
5
Input/output
Input/output
Input/output
Input
Input/output
Input/output
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
6
(X
COUT
circuit. In this case, connect a quartz oscillator between P8
7
(X
CIN
pin) and P8
pin). P85 is an input-only port that also functions
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.
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.
This is an 8-bit I/O port equivalent to P6. Pins in this port also function
4
as A-D converter input pins. Furthermore, P10
–P107 also function as
input pins for the key input interrupt function.
Under
development
Specifications in this manual are tentative and subject to change.
Pin Description
Pin Description
Preliminary Specifications REV.B
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Signal nameFunctionPin nameI/O type
Input/outputI/O port P11P110 to P114 This is an 5-bit I/O port equivalent to P6.
Input/outputI/O port P12P120 to P127 This is an 8-bit I/O port equivalent to P6.
Input/outputI/O port P13P130 to P137 This is an 8-bit I/O port equivalent to P6.
Input/outputI/O port P14P140 to P146 This is an 7-bit I/O port equivalent to P6.
Input/outputI/O port P15P150 to P157 This is an 8-bit I/O port equivalent to P6.
9
Under
A
A
development
Memory
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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 M30802MC-XXXGP,
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 M30802MC-XXXGP, 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 M30802MC-XXXGP, 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)
_______
Type No.
M30802MC/FC
M30805MG/FG
M30802S
M30805S
Address
XXXXX
002BFF
0053FF
002BFF
0063FF
Figure 1.2.1. Memory map
10
000000
16
000400
16
XXXXXX
008000
16
F00000
YYYYYY
FFFFFF
16
16
Address
16
YYYYY
16
FE0000
FC0000
16
16
16
16
16
16
SFR area
For details, see
Figures 1.5.1 to
Internal RAM
16
Internal reserved
area (Note 1)
External area
AAAAAA
Internal reserved
area (Note 2)
16
Internal ROM
1.5.4
area
area
FFFE00
FFFFDC
FFFFFF
16
Special page
vector table
16
Undefined instruction
Overflow
BRK instruction
Address match
Watchdog timer
NMI
16
Reset
Note 1: During memory expansion and microprocessor modes, can not be used.
Note 2: In memory expansion mode, can not be used.
Under
development
CPU
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
Central Processing Unit (CPU)
The CPU has a total of 28 registers shown in Figure 1.3.1. Seven 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
11
Under
development
CPU
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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.
12
Under
development
CPU
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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.
13
Under
development
CPU
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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”.
• 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.
14
• Bits 8 to 11: Reserved area
Under
development
CPU
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
• 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
15
Under
development
Reset
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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
16
FFFFC
FFFFC
16
16
FFFFE
FFFFE
16
Content of reset vector
16
Content of reset vector
Under
development
Reset
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Mitsubishi microcomputers
M16C/80 (144-pin version) 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
0
P5
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,
6
, P87, P9, P10,
P8
P11, P12, P13,
P14, P15
Input port (floating)
Input port (floating)
Input port (floating)
Input port (floating)
HOLD input (floating)
RAS output
RDY input (floating)
HOLD input (floating)
RAS output
RDY input (floating)
Input port (floating)Input port (floating)
17
Under
development
Reset
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
(The blank area is reserved and cannot be used by user.)
Figure 1.5.3. Location of peripheral unit control registers (3)
22
Under
development
SFR
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
03C0
16
Port P6 (P6)
03C1
16
Port P7 (P7)
03C2
16
Port P6 direction register (PD6)
03C3
16
Port P7 direction register (PD7)
03C4
16
Port P8 (P8)
03C5
16
Port P9 (P9)
03C6
16
Port P8 direction register (PD8)
03C7
16
Port P9 direction register (PD9)
03C8
16
Port P10 (P10)
03C9
16
Port P11 (P11)
03CA
16
Port P10 direction register (PD10)
03CB
16
Port P11 direction register (PD11)
03CC
16
Port P12 (P12)
03CD
16
Port P13 (P13)
03CE
16
Port P12 direction register (PD12)
03CF
16
Port P13 direction register (PD13)
03D0
16
Port P14 (P14)
03D1
16
Port P15 (P15)
03D2
16
Port P14 direction register (PD14)
03D3
16
Port P15 direction register (PD15)
03D4
16
03D5
16
03D6
16
03D7
16
03D8
16
03D9
16
03DA
16
Pull-up control register 2 (PUR2)
03DB
16
Pull-up control register 3 (PUR3)
03DC
16
Pull-up control register 4 (PUR4)
03DD
16
03DE
16
03DF
16
03E0
16
Port P0 (P0)
03E1
16
Port P1 (P1)
03E2
16
Port P0 direction register (PD0)
03E3
16
Port P1 direction register (PD1)
03E4
16
Port P2 (P2)
03E5
16
Port P3 (P3)
03E6
16
Port P2 direction register (PD2)
03E7
16
Port P3 direction register (PD3)
03E8
16
Port P4 (P4)
03E9
16
Port P5 (P5)
03EA
16
Port P4 direction register (PD4)
03EB
16
Port P5 direction register (PD5)
03EC
16
03ED
16
03EE
16
03EF
16
03F0
16
Pull-up control register 0 (PUR0)
03F1
16
Pull-up control register 1 (PUR1)
03F2
16
03F3
16
03F4
16
03F5
16
03F6
16
03F7
16
03F8
16
03F9
16
03FA
16
03FB
16
03FC
16
03FD
16
03FE
16
03FF
16
Port control register (PCR)
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
(The blank area is reserved and cannot be used by user.)
Figure 1.5.4. Location of peripheral unit control registers (4)
23
Under
development
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Software Reset
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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
24
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.
Processor mode register 0 (Note 1)
b7 b6 b5 b4 b3 b2 b1 b0
0
Preliminary Specifications REV.B
SymbolAddressWhen reset
PM00004
16
80
16
(Note 2)
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Bit nameFunctionBit symbol
PM00
PM01
PM02
Processor mode bit
R/W mode select bit
(Note 7)
PM03
PM04
Software reset bit
Multiplexed bus space
select bit (Note 3)
PM05
Reserved bit
PM07
BCLK output disable bit
(Note 5)
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
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
) 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
16
bit 1 (CM01) of system clock control register 0 (address 0006
) = "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 controler, set this bit to "1".
WR
Figure 1.6.1. Processor mode register 0
25
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.B
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
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)
4
to P47 : CS3 to CS0)
(P4
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
3
0 1 : P5
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.
3
Note 4: When selecting P5
/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.
3
Note 4: When selecting P5
/BCLK, set bits 0 and 1 of system clock control register 0 (CM00, CM01) to "0".
Figure 1.6.2. Processor mode register 1
Bit nameFunctionBit symbol
b1 b0
4
0 0 : Mode 0 (P4
0 1 : Mode 1 (P4
P4
1 0 : Mode 2 (P4
P4
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)
4
to P47 : CS3 to CS0)
(P4
1 : Wait state inserted
Must always be set to “0”
b5 b4
0 0 : No ALE
3
0 1 : P5
1 0 : P5
1 1 : P5
/BCLK (Note 4)
6
/RAS
4
/HLDA
Must always be set to “1”
26
Under
Singl chip
mode
Memory expanded mode
Microprocesser mode
SFR area
Internal RAM area
Internal reserved area
Internal ROM area
No use
External area
CS2
2Mbytes
CS0
2Mbytes
No use
Internal ROM area
Internal reserved area
Internal ROM area
Internal reserved area
Internal ROM area
Internal reserved area
CS0
3Mbytes
CS1
4Mbytes
(Note2)
CS1
2Mbytes
(Note1)
External area
CS2
2Mbytes
No use
CS0
2Mbytes
CS0
4Mbytes
CS1
4Mbytes
(Note2)
000000
16
000400
16
000800
16
200000
16
400000
16
C00000
16
E00000
16
F00000
16
FFFFFF
16
Each CS0, CS1 and CS can set 0 to 3 WAIT.
Mode 0
Mode 1Mode 2Mode 0
MOde 1Mode 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
Mode 3
Internal reserved area
SFR area
Internal RAM area
No use
CS2
1Mbytes
No use
Connect with
DRAM
0.05 to 8MB
(When not
connect with
DRAM, use as
external area.)
External area
Connect with
DRAM
0.05 to 8MB
(When open area
is under 8MB,
cannot use the
rest of this area.)
Connect with
DRAM
0.05 to 8MB
(When open area
is under 8MB,
cannot use the
rest of this area.)
Connect with
DRAM
0.05 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.05 to 8MB
(When not
connect with
DRAM, use as
external area.)
Connect with
DRAM
0.05 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.)
External area
No use
CS3
1Mbytes
CS0
1Mbytes
CS1
1Mbytes
No use
CS2
1Mbytes
No use
CS1
2Mbytes
(Note1)
No use
CS3
1Mbytes
CS0
1Mbytes
development
Processor Mode
Processor Mode
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Figure 1.6.3. Memory maps in each processor mode (without memory area expansion, normal mode)
27
Under
development
Bus Settings
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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.
28
Under
development
Specifications in this manual are tentative and subject to change.
Bus Settings
Preliminary Specifications REV.B
Mitsubishi microcomputers
M16C/80 (144-pin version) 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>
16
008000
1FFFFF
to
16
<CS2 area>
16
200000
3FFFFF
to
16
<DRAMC area>
16
400000
BFFFFF
to
16
<CS0 area>
16
C00000
EFFFFF
to
16
<CS0 area>
16
E00000
FFFFFF
to
16
<CS1 area>
16
008000
1FFFFF
to
16
No area is
selected.
<DRAMC area>
16
400000
BFFFFF
to
16
<CS0 area>
16
C00000
EFFFFF
to
16
<CS0 area>
16
C00000
FFFFFF
to
16
<CS1 area>
16
100000
1FFFFF
to
16
<CS2 area>
16
200000
2FFFFF
to
16
<CS3 area>
16
C00000
CFFFFF
to
16
<CS0 area>
16
E00000
EFFFFF
to
16
<CS0 area>
16
F00000
FFFFFF
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).
29
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.B
Processor
mode
Single-chip
mode
Memory expansion mode/microprocessor modes
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Memory
expansion mode
Multiplexed
bus space
select bit
Data bus width
BYTE pin level
P00 to P0
P10 to P1
7
7
port
P2
0
to P2
7
P30 to P3
P4
P4
P4
P5
0
to P4
4
to P4
7
0
to P5
7
3
6
3
“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
“11” (Note 1)
All space multiplexed
bus
I/O portData busData busData busData busI/O port I/O port
I/O portI/O portData busI/O portData bus I/O port I/O
I/O port
I/O port
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
I/O portAddress busAddress busAddress busAddress busI/O port I/O port
I/O portCS (chip select) or address bus (A23)
(For details, refer to “Bus control”) (Note 5)
I/O port
CS (chip select) or address bus (A23)
(For details, refer to “Bus control”) (Note 5)
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.
30
Under
development
Bus Control
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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)
200000
2FFFFF
(1 Mbytes)
16 to
16
(A21)(A20)
16 to
16
(A20)
C00000
CFFFFF
(1 Mbytes)
16 to
16
31
Under
development
Bus Control
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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
32
Under
development
Bus Control
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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/A7
A8 to A15
A16 to A19
A20 to A22, A23
ALE
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 A19
A20 to A22, A23
When BYTE pin = “L”
0/A0 to D15/A15
AddressData (Note 1)
Address (Note 2)
Address or CS
Figure 1.7.2. 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.3 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.
33
Under
development
Bus Control
Separate bus (2 wait)
BCLK
RD
CS
(i=0 to 3)
RDY
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
1st cycle2nd cycle3rd cycle4th cycle
(Note)
i
tsu(RDY - BCLK)
Mitsubishi microcomputers
M16C/80 (144-pin version) 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
Input RDY signal at i + 1 cycles for i wait.
(i = 1 to 3)
Note: Chip select may get longer by a state of CPU such as an instruction queue buffer.
Figure 1.7.3. Example of RD signal extended by RDY signal
_____________
34
Under
development
Bus Control
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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.4. 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 portsP0, 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 “002” 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.
35
Under
development
Bus Control
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
_______ __________ _______________
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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 bit (bit 7) of the processor mode register 1 (address
000516) (Note) and bits 4 to 7 of the wait control register (address 000816). Figure 1.7.5 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.6 and 1.7.7 show example bus
timings when using software waits.
36
Under
development
Bus Control
Wait control register
b7 b6 b5 b4 b3 b2 b1 b0
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
SymbolAddressWhen reset
WCR0008
16
Mitsubishi microcomputers
M16C/80 (144-pin version) 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.5. 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
Specifications in this manual are tentative and subject to change.
Mitsubishi microcomputers
M16C/80 (144-pin version) 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.6. Typical bus timings using software wait
38
Under
development
Bus Control
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Mitsubishi microcomputers
M16C/80 (144-pin version) 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.7. Typical bus timings using software wait
39
Under
Preliminary Specifications REV.B
development
Clock Generating Circuit
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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
Figure 1.8.2. Examples of sub clock
40
(Note)
R
Cd
C
COUT
CIN
and X
(Built-in feedback resistance)
Externally derived clock
Vcc
Vss
COUT
when an oscillation manufacture required.
Microcomputer
X
CIN
X
COUT
Open
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.B
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 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
C32
f
1/32
f
C
a
d
f
1
f
AD
b
Divider 1
Divider 2
f1SIO2
f
8
f
32
c
CM07=0
e
f
C
CM07=1
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
c
1/2
Details of divider 1
e
Details of divider 2
41
Under
development
Clock Generating Circuit
The following paragraphs describes the clocks generated by the clock generating circuit.
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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.
(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.
42
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.B
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
SymbolAddressWhen reset
CM00006
16
08
16
Mitsubishi microcomputers
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
1 1 : f
32
0 : Do not stop f1, f8, f32 in wait mode
1 : Stop f
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)
1
, f8, f32 in wait mode
generation
OUT
, X
COUT
WR
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 P5
port P5
3
function is not selected even when you set "00" in microprocessor or memory expansion
3
(bit 5 and 4 of processor mode register 0 is "01"), set these bits to "00". The
mode and bit 7 of the processor mode register 0 is "1".
Note 3: When selecting f
C
, 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 power saving mode, main clock stops using this bit. When returning from stop
mode and operating with X
Note 6: When this bit is "1", X
up to X
OUT
("H" level) via the feedback resistance.
Note 7: When the main clock is stopped, the main clock division register (address 000C
IN
, set this bit to “0”.
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.
System clock control register 1 (Note 1)
b7 b6 b5 b4 b3 b2 b1 b0
00
0000
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
X
COUT
are high-inpedance.
Note 4: When the main clock is stopped, the main clock division register (address 000C
division by 8 mode.
Figure 1.8.4. Clock control registers 0 and 1
SymbolAddressWhen reset
CM10007
CM10
Reserved bit
CM15
Reserved bit
OUT
All clock stop control bit
(Note 3)
IN-XOUT
X
select bit (Note 2)
is "H", and the internal feedback resistance is disabled. X
16
Bit
name
drive capacity
20
16
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
43
Under
development
Clock Generating Circuit
Specifications in this manual are tentative and subject to change.
Main clock division register (Note 1)
b7 b6 b5 b4 b3 b2 b1 b0
Preliminary Specifications REV.B
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
SymbolAddressWhen reset
MCD000C
16
XXX01000
Mitsubishi microcomputers
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.
2
or you shift to stop mode.
this figure.
" (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
44
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.
When shifting to stop mode and reset, the main clock division register (000C16) is set to “0816”.
45
Under
development
Clock Generating Circuit
Specifications in this manual are tentative and subject to change.
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
46
Under
development
Wait Mode
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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”.
47
Under
development
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
BCLK Status
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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.
48
Under
development
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
BCLK Status
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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
49
Under
development
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Power Saving
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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).
50
Under
development
Specifications in this manual are tentative and subject to change.
Power Saving
Transition of stop mode, wait mode
Preliminary Specifications REV.B
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Reset
All oscillators stopped
Stop mode
CM10=“1”
Interrupt
Interrupt
CM10=“1”
WAIT
instruction
Medium-speed mode
(Divided-by-8 mode)
Interrupt
Note 1
WAIT
instruction
High-speed/medium-
speed mode
CPU operation stopped
Wait mode
CPU operation stopped
Wait mode
Interrupt
All oscillators stopped
CM10=“1”
Stop mode
Note 1
Low-speed/low power
dissipation 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
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(X
CM07=“1”
CIN
)
CM07=“1”
Note 2
Figure 1.8.7. Clock transition
51
Under
y
development
Protection
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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 0007
division register (address 0008
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
16
) (Note
16
16
XXXXX000
Bit nameBit symbol
16
)
and main clock
)
16
) and
0 : Write-inhibited
1 : Write-enabled
16
)
0 : Write-inhibited
16
1 : Write-enabled
0 : Write-inhibited
1 : Write-enabled
2
Function
)
to “0”. Other bits do not automatically return to “0” and they must therefore
be reset b
the program.
WR
52
Under
development
Preliminary Specifications REV.B
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
M16C/80 (144-pin version) group
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
*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.
53
Under
development
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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.
54
Under
development
Interrupts
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
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.B
• 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 when the program's execution address matches the content of the address match
register while the address match interrupt enable bit is set (= 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. You normally do not need to use this interrupt. A single-step interrupt occurs when the D flag is set (= 1); in this case, an interrupt is generated
each time an instruction is executed.
____________
______
Mitsubishi microcomputers
(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 a "H" level or a "L" level is input to the INT pin.
55
Under
development
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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
56
Under
development
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
• 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 00002316). 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
00002316).
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 00002316
Single stepInterrupt vector table register for emulatorInterrupt for debugger
00002016 to 00002316
• 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.
57
Under
development
Interrupts
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
58
Under
development
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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.
59
Under
development
Interrupts
Interrupt control register
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
b7 b6 b5 b4 b3 b2 b1 b0
SymbolAddressWhen reset
16
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
16,
007016 XXXXX000
16
16
16
XXXXX000
XXXXX000
XXXXX000
XXXXX000
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
16
16
XXXXX000
XXXXX000
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 (
16
address 031F
) to one edge.
2
Figure 1.9.3. Interrupt control register
60
Under
development
Interrupts
Exit priority register
b7 b6 b5 b4 b3 b2 b1 b0
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
SymbolAddressWhen reset
RLVL009F
16
Mitsubishi microcomputers
M16C/80 (144-pin version) 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
61
Under
development
Interrupts
Interrupt Enable Flag (I Flag)
Interrupt Request Bit
Interrupt Priority Level Select Bit and Processor Interrupt Priority Level (IPL)
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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.
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 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.
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.
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.
62
Under
development
Interrupts
Rewrite the interrupt control register
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
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
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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.
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.
63
Under
development
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Interrupt request generated
Instruction
Interrupt request acknowledged
Interrupt sequence
(a)
(b)
Time
Instruction in interrupt
routine
Interrupt response time
(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
Time (a) varies with each instruction being executed. The DIVX instruction requires a maximum time that
consists of 29* 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: 5 + 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.
64
Under
development
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Interrupts
Table 1.9.6 Interrupt Sequence Execution Time
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
16 bits data bus
14 cycles
16 cycles
12 cycles
14 cycles
13 cycles
Peripheral I/O
INT instruction
_______
NMI
Interrupt
Interrupt vector address
Even address
Odd address (Note 1)
Even address
Odd address (Note 1)
Even address (Note 2)
Watchdog timer
Undefined instruction
Address match
Overflow
BRK instruction (Variable vector table)
Note 1: Allocate interrupt vector addresses in even addresses as must as possible.
Note 2: The vector table is fixed to even address.
Note 3: The high-speed interrupt is independent of these conditions.
8 bits data bus
16 cycles
16 cycles
14 cycles
14 cycles
15 cycles
16 cycles
19 cycles
19 cycles
21 cycles
5 cycles
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
Reset
Other
Value that is set to IPL
7
0
Not changed
65
Under
development
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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
m-6
m-5
m–4
m–3
m–2
m–1
m
m+1
Stack status before interrupt request is acknowledged
Stack area
Content of
previous stack
Content of
previous stack
LSBMSB
[SP]
Stack pointer
value before
interrupt occurs
Address
m-6
m-5
m–4
m–3
m–2
m–1
m
m+1
Stack status after interrupt request is acknowledged
Stack area
Program counter
(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
LSBMSB
[SP]
New stack
pointer value
66
Under
development
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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 interrupt that a request came to most in the first place is accepted at first, and then, 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
67
Under
development
Interrupts
High
Preliminary Specifications REV.B
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 (144-pin version) 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
68
Under
development
Specifications in this manual are tentative and subject to change.
Interrupts
______
INT Interrupts
________________
Preliminary Specifications REV.B
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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
69
Under
Preliminary Specifications REV.B
development
Interrupts
______
NMI Interrupt
Specifications in this manual are tentative and subject to change.
__________________
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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/KI
P106/KI
P105/KI
P104/KI
3
2
1
0
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
70
Under
A
A
development
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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, 1)
(b16)
(b23)
b7
(b15)(b8)
b0 b7b0
Address match interrupt 2
Address match interrupt 3
b7b0
Bit nameBit symbol
16
XXXXXX00
enable bit
enable bit
enable bit
enable bit
SymbolAddress When reset
RMAD00012
RMAD10016
RMAD2001A16 to 0018
RMAD3001E
0 : Interrupt disabled
1 : Interrupt enabled
0 : Interrupt disabled
1 : Interrupt enabled
2
Function
0 : Interrupt disabled
1 : Interrupt enabled
0 : Interrupt disabled
1 : Interrupt enabled
16
to 0010
16
to 0014
16
to 001C
16
16
16
16
000000
000000
000000
000000
WR
16
16
16
16
FunctionValues that can be set
Address setting register for address match
interrupt
Figure 1.9.11. Address match interrupt-related registers
00000016 to FFFFFF
WR
16
71
Under
development
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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 number to the stack pointer. When an even
number is set, execution efficiency is increased.
Set an even address to the stack pointer so that operating efficiency 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
72
Under
development
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
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 INTi interrupt request)
INTi
interrupt)
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
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 start address of an interrupt instruction.
2. Address of an instruction to clear an interrupt request bit of an interrupt control register or any of the
next 7 instructions addresses immediately after 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.
Do not set address match interrupt to the
start address of an interrupt instruction
Do not set address match interrupt
during this period
73
Under
development
Interrupts
Example 3)
Example 4)
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
fsetI; Set I flag ( interrupt enabled)
nop; 1st instruction
nop; 2nd instruction
Do not set address match interrupt
during this period
nop; 3rd instruction
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
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
74
Under
development
Specifications in this manual are tentative and subject to change.
Watchdog Timer
Preliminary Specifications REV.B
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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.
Figure 1.10.1 shows the block diagram of the watchdog timer. Figure 1.10.2 shows the watchdog timerrelated registers.
Prescaler
“CM07 = 0”
BCLK
HOLD
1/16
1/128
1/2
“WDC7 = 0”
“CM07 = 0”
“WDC7 = 1”
“CM07 = 1”
Watchdog timer
"CM06=0"
Watchdog timer
interrupt request
"CM06=1"
Reset
Write to the watchdog timer
start register
(address 000E
RESET
16
)
Figure 1.10.1. Block diagram of watchdog timer
Set to
“7FFF
16
”
75
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.B
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
SymbolAddressWhen reset
WDC 000F
16
000XXXXX
Mitsubishi microcomputers
M16C/80 (144-pin version) group
2
Bit name
High-order bit of watchdog timer
Reserved bit
WDC7
Prescaler select bit0 : Divided by 16
Must always be set to “0”
1 : Divided by 128
FunctionBit symbolWR
Watchdog timer start register
b7b0
SymbolAddressWhen reset
WDTS 000E
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.
16
Function
Indeterminate
16
”
WR
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 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 P5
port P5
3
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 power saving mode, main clock stops using this bit. When returning from stop
mode and operating with X
Note 6: When this bit is "1", X
up to X
OUT
("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.
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.
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
IN
, set this bit to “0”.
OUT
is "H". Also, the internal feedback resistance remains ON, so XIN is pulled
name
16
Bit
drive capacity
OUT
)
08
16
FunctionBit symbol
b1 b0
0 0 : I/O port P5
0 1 : fC output (Note 3)
8
output (Note 3)
1 0 : f
1 1 : f
32
0 : Do not stop f1, f8, f32 in wait mode
1 : Stop f
0 : LOW
1 : HIGH
CIN-XCOUT
1 : X
0 : On
1 : Off (Note 7)
0 : Watchdog timer interrupt
1 : Reset (Note 8)
0 : XIN, X
1 : X
CIN
3
output (Note 3)
1
, f8, f32 in wait mode
generation
OUT
, X
COUT
16
) is set to the
WR
Figure 1.10.2. Watchdog timer control and start registers
76
Under
development
DMAC
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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 register channels
The high-speed interrupt register 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
DMA transfer count register
DMA transfer count reload register
DMA memory address register
DMA SFR address register
DMA memory address reload register
DMA2 transfer count register
DMA3 transfer count register
DMA2 transfer count reload register
DMA3 transfer count reload register
When using three or more DMAC channels
The register bank 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.) see the description of the DMAC request bit.
77
Under
development
DMAC
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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 1 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.
78
Under
development
DMAC
Preliminary Specifications REV.B
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, the value of these bits 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
79
Under
development
DMAC
Preliminary Specifications REV.B
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 (144-pin version) 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
80
Under
development
DMAC
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Mitsubishi microcomputers
M16C/80 (144-pin version) 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 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 destination fixed address.
When the transfer direction select bit is "1" (memory to fixed address), this register
is source fixed address.
• Memory address register reload value
Set source or destination memory address
Transfer count
specification
16
000000
to FFFFFF
(16 Mbytes area)
16
16
16
16
RW
16
82
Under
development
DMAC
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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.
83
Under
development
DMAC
(1) 8-bit transfers
BCLK
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
16-bit transfers from even address and the source address is even.
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Address
bus
RD signal
WR signal
Data
bus
CPU use
CPU useCPU use
Source
Destination
Destination
CPU useSource
(2) 16-bit transfers and the source address is odd
Transferring 16-bit data on an 8-bit data bus (In this case, 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) 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
Destination
Destination
CPU useSource
(4) One wait is inserted into the source read under the conditions in (2)
(When 16-bit data is transferred on an 8-bit data bus, 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
84
Under
development
DMAC
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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
Internal ROM/RAMNo wait11
Internal ROM/RAMWith wait22
SFR area22
Separate busNo wait12
Separate busOne wait22
Separate busTwo wait33
Separate busThree wait44
Multiplex bus33
Single-chip mode
No. of read No. of write No. of read No. of write
cyclescyclescyclescycles
Memory expansion mode
Microprocessor mode
DMA Request Bit
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.
85
Under
development
DMAC
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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
86
Under
development
DMAC
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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, the corresponding DMA channel is set to disabled. At
least 2 instructions are needed from the instruction to write to the DMAi request cause select bit 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.
87
Under
development
Timer A
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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
1 f8 f32 fC32
f
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
C32
f
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
88
Under
development
Timer A
TB0
TB1
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
f
X
IN
1/8
1/4
f
1 f8 f32 fC32
Timer B2 overflow (to timer A count source)
IN
IN
Noise
filter
Noise
filter
1
f
8
f
32
X
CIN
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
16
) set to “1”
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Clock prescaler
f
1/32
Reset
Timer B0
Timer B1
C32
Timer B0 interrupt
Timer B1 interrupt
TB2
TB3
TB4
TB5
• Timer mode
• Pulse width measuring mode
IN
IN
IN
IN
Noise
filter
Noise
filter
Noise
filter
Noise
filter
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
Figure 1.12.2. Timer B block diagram
89
Under
development
Timer A
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
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.
Timer Ai register (Note)
(b15)(b8)
b7b0 b7b0
• 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 mode000016 to FFFF
Counts a one shot width
SymbolAddressWhen reset
TA00347
TA10349
TA2034B
TA3034D
TA4034F
Function
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
16
,0346
16
16
16
16
16
,0348
,034A
,034C
,034E
Indeterminate
16
Indeterminate
16
Indeterminate
16
Indeterminate
16
Values that can be set
Indeterminate
WR
16
16
Count start flag
b7 b6 b5 b4 b3 b2 b1 b0
Up/down flag
b7 b6 b5 b4 b3 b2 b1 b0
• Pulse width modulation mode (16-bit PWM)
Functions as a 16-bit pulse width modulator
• Pulse width modulation mode (8-bit PWM)
Timer low-order address functions as an 8-bit
prescaler and high-order address functions as an 8-bit
pulse width modulator
Note: Read and write data in 16-bit units.
SymbolAddressWhen reset
TABSR0340
TA0S
TA1S
TA2S
TA3S
TA4S
TB0S
TB1S
TB2S
Timer A0 count start flag
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
SymbolAddressWhen reset
UDF0344
16
00
16
Bit nameFunctionBit symbol
0 : Stops counting
1 : Starts counting
16
00
16
16
to FFFE
0000
00
16
to FE
16
(Both high-order
and low-order
addresses)
16
WR
TA0UD
TA1UD
TA2UD
TA3UD
TA4UD
TA2P
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
TA3P
Timer A3 two-phase pulse
signal processing select bit
TA4P
Timer A4 two-phase pulse
signal processing select bit
Figure 1.13.3. Timer A-related registers (2)
Bit nameFunctionBit symbol
WR
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
processing disabled
1 : two-phase pulse signal
processing enabled
When not using the two-phase
pulse signal processing function,
set the select bit to “0”
91
Under
development
Timer A
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Mitsubishi microcomputers
M16C/80 (144-pin version) 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 pin output function select register 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 port function select register 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
Figure 1.13.4. Timer A-related registers (3)
92
16
Bit nameFunctionBit symbol
Clock prescaler reset flag
0XXXXXXX
2
0 : No effect
1 : Prescaler is reset
(When read, the value is “0”)
WR
Under
development
Timer A
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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 corresponding port 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 register and peripheral function select register)
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 (Must always be fixed to “0” in timer mode)
Count source select bit
16
to 035A1600000X00
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”.
2
b1 b0
0 0 : Timer mode
b4 b3
(Note 2)
0 X
1 0 : Timer counts only when TA
1 1 : Timer counts only when TA
b7 b6
0 0 : f
0 1 : f8
1 0 : f
1 1 : f
: Gate function not available
(TAiIN pin is a normal port pin)
held “L” (Note 2)
held “H” (Note 2)
1
32
C32
iIN
iIN
pin is
pin is
93
Under
development
Timer A
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(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 (Setting by
corresponding port function select register and peripheral function select register)
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
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: In event counter mode, the count source is selected by the event / trigger
Note 2: Valid only when counting an external signal.
Note 3: When an “L” signal is input to the TAi
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 2)
Up/down switching
cause select bit
0 (Must always be fixed to “0” in event counter mode)
Count operation type
select bit
Invalid in event counter mode
Can be “0” or “1”
select bit (addresses 0342
When “H”, the upcount is activated. Set the corresponding port function
select register to I/O port, and port direction register to “0”.
16
to 035A1600000X00
b1 b0
0 1 : Event counter mode
16
and 034316).
Figure 1.13.6. Timer Ai mode register in event counter mode
Table 1.13.3. Timer specifications in event counter mode
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
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 functionTwo-phase pulse input
TAiOUT pin functionTwo-phase pulse input (Setting by corresponding port function select register
Read from timerCount value can be read out by reading timer A2, A3, or A4 register
Write to timer•When counting stopped
Select function• Normal processing operation
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
ItemSpecification
•When the timer overflows or underflows, the reload register content is
reloaded and the timer starts over again (Note)
• 1/ (n + 1) for down countn : Set value
Timer overflows or underflows
and peripheral function select register)
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.)
The timer counts up rising edges or counts down falling edges on the TAiIN
pin when input signal on the TAiOUT pin is “H”
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
• Multiply-by-4 processing operation
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.
(when processing two-phase pulse signal with timers A2, A3, and A4)
Note: This does not apply when the free-run function is selected.
95
Under
development
Timer A
Timer Ai mode register
(When not using two-phase pulse signal processing)
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
b7 b6 b5 b4 b3 b2 b1 b0
010
SymbolAddressWhen reset
TAiMR(i=2 to 4)0358
16
to 035A1600000X00
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
2
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
Note 3: This bit is valid for the timer A3 mode register.
Note 4: When performing two-phase pulse signal processing, make sure the two-phase
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 : (Must always be “0” in event counter mode)
Count operation type
select bit
Two-phase pulse signal
processing operation
select bit (Note 3,4)
register to “0”.
For timer A2 and A4 mode registers, this bit can be “0 ”or “1”.
pulse signal processing operation select bit (address 0344
always be set the event/trigger select bit (address 0343
Timer Ai mode register
(When using two-phase pulse signal processing)
0 : Normal processing operation
1 : Multiply-by-4 processing operation
16
) is set to “1”. Also,
16
) to “00”.
2
WR
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.
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 (Must always be “0” when using two-phase pulse signal
processing)
1 (Must always be “1” when using two-phase pulse signal
processing)
0 (Must always be “0” when using two-phase pulse signal
processing)
Count operation type
select bit
Two-phase pulse
processing operation
select bit (Note 2)(Note 3)
For timer A2 and A4 mode registers, this bit can be “0” or “1”.
signal processing operation select bit (address 0344
sure to set the event/trigger select bit (addresses 0342
b1 b0
0 1 : Event counter mode
0 : Reload type
1 : Free-run type
0 : Normal processing operation
1 : Multiply-by-4 processing operation
Figure 1.13.7. Timer Ai mode register in event counter mode
(Note 1)
16
) is set to “1”. Also, always be
16
and 034316) to “00”.
WR
96
Under
development
Timer A
• Counter Resetting by Two-Phase Pulse Signal Processing
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
This function resets the timer counter to “0” when the Z-phase (counter reset) is input during twophase pulse signal processing.
This function can only be used in timer A3 event counter mode, two-phase pulse signal processing,
free-run type, and multiply-by-4 processing. The Z phase is input to the INT2 pin.
When the Z-phase input enable bit (bit 5 at address 034216) is set to “1”, the counter can be reset by
Z-phase input. For the counter to be reset to “0” by Z-phase input, you must first write “000016” to the
timer A3 register (address 034D16 and 034C16).
The Z-phase is input when the INT2 input edge is detected. The edge polarity is selected by the INT2
polarity switch bit (bit 5 at address 009C16). The Z-phase must have a pulse width greater than 1 cycle
of the timer A3 count source. Figure 1.13.8 shows the relationship between the two-phase pulse (A
phase and B phase) and the Z phase.
The counter is reset at the count source following Z-phase input. Figure 1.13.9 shows the timing at
which the counter is reset to “0”.
TA3OUT
(A phase)
TA3IN
(B phase)
Count source
INT2
(Z phase)
The pulse must be wider than this width.
Note: Select rising edge.
Figure 1.13.8. The relationship between the two-phase pulse (A phase and B phase) and the Z phase
97
Under
development
Timer A
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
TA3
OUT
(A phase)
TA3
IN
(B phase)
Count source
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
INT2
(Note)
(Z phase)
Count value
mm+11 2 3 4 5
Becoming "0" at this timing.
Note: Select rising edge.
Figure 1.13.9. The counter reset timing
Note that two timer A3 interrupt requests occur successively two times when timer A3 underflow
and INT2 input reload are happened at the same timing.
Do not use timer A3 interrupt request when this function is used.
98
Under
g
development
Timer A
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(3) One-shot timer mode
In this mode, the timer operates only once. (See Table 1.13.4.) When a trigger occurs, the timer starts up and
continues operating for a given period. Figure 1.13.10 shows the timer Ai mode register in one-shot timer mode.
Table 1.13.4. Timer specifications in one-shot timer mode
• When the count reaches 000016, the timer stops counting after reloading a
new count
• If a trigger occurs when counting, the timer reloads a new count and restarts counting
Divide ratio1/n n : Set value
Count start condition• An external trigger is input
• The timer overflows
• The one-shot start flag is set (= 1)
Count stop condition• A new count is reloaded after the count has reached 000016
• The count start flag is reset (= 0)
Interrupt request generation timing
TAiIN pin functionProgrammable I/O port or trigger input
TAiOUT pin functionProgrammable I/O port or pulse output (Setting by corresponding port function
Read from timerWhen timer Ai register is read, it indicates an indeterminate value
Write to timer•When counting stopped
The count reaches 000016
select register and peripheral function select register)
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)
Timer Ai mode register
b7 b6 b5 b4 b3 b2 b1 b0
100
SymbolAddressWhen reset
TAiMR(i=0 to 4)0356
Bit symbol
TMOD0
TMOD1
MR0
MR1
MR2
MR3
TCK0
TCK1
Note 1: Valid only when the TA
Note 2: Set the corresponding port function select register 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.
External trigger select
bit (Note 1)
Trigger select bit
0 (Must always be “0” in one-shot timer mode)
Count source select bit
(addresses 0342
ister to “0”.
re
16
to 035A1600000X00
Bit name
b1 b0
1 0 : One-shot timer mode
0 : Falling edge of TAiIN pin's input signal (Note 2)
1 : Rising edge of TAi
0 : One-shot start flag is valid
1 : Selected by event/trigger select
register
b7 b6
0 0 : f
1
0 1 : f
8
1 0 : f
32
1 1 : f
C32
iIN
pin is selected by the event/trigger select bit
16
and 034316). If timer overflow is selected, this bit can be “1” or “0”.
Figure 1.13.10. Timer Ai mode register in one-shot timer mode
2
Function
IN
pin's input signal (Note 2)
WR
99
Under
development
Timer A
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
(4) Pulse width modulation (PWM) mode
In this mode, the timer outputs pulses of a given width in succession. (See Table 1.13.5.) In this mode, the counter
functions as either a 16-bit pulse width modulator or an 8-bit pulse width modulator. Figure 1.13.11 shows the
timer Ai mode register in pulse width modulation mode. Figure 1.13.12 shows the example of how a 16-bit pulse
width modulator operates. Figure 1.13.13 shows the example of how an 8-bit pulse width modulator operates.
Table 1.13.5. Timer specifications in pulse width modulation mode
Count stop condition• The count start flag is reset (= 0)
Interrupt request generation timing
TAiIN pin functionProgrammable I/O port or trigger input
TAiOUT pin functionPulse output Two-phase pulse input (Setting by corresponding port function
Read from timerWhen timer Ai register is read, it indicates an indeterminate value
Write to timer•When counting stopped
• The timer counts down (operating as an 8-bit or a 16-bit pulse width modulator)
• The timer reloads a new count at a rising edge of PWM pulse and continues counting
• The timer is not affected by a trigger that occurs when counting
• Cycle time(216-1) / fi fixed
• High level width n (m+1) / fi n : values set to timer Ai register’s high-order address
• Cycle time (28-1) (m+1) / fi m:values set to timer Ai register’s low-order address
• The timer overflows
• The count start flag is set (= 1)
PWM pulse goes “L”
select register and peripheral function select register)
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)
Timer Ai mode register
b7 b6 b5 b4 b3 b2 b1 b0
111
SymbolAddressWhen reset
TAiMR(i=0 to 4) 0356
TMOD0
TMOD1
MR0
MR1
MR2
MR3
TCK0
TCK1
Note 1: Valid only when the TA
Note 2: Set the corresponding port function select register 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.
External trigger select
bit (Note 1)
Trigger select bit
16/8-bit PWM mode
select bit
Count source select bit
(addresses 0342
register to “0”.
16
to 035A1600000X00
Bit name
b1 b0
1 1 : PWM mode
0: Falling edge of TAiIN pin's input signal (Note 2)
1: Rising edge of TAi
0: Count start flag is valid
1: Selected by event/trigger select register
0: Functions as a 16-bit pulse width modulator
1: Functions as an 8-bit pulse width modulator
b7 b6
0 0 : f
0 1 : f
1 0 : f
1 1 : f
iIN
pin is selected by the event/trigger select bit
16
and 034316). If timer overflow is selected, this bit can be “1” or “0”.
1
8
32
C32
2
FunctionBit symbol
IN
pin's input signal (Note 2)
Figure 1.13.11. Timer Ai mode register in pulse width modulation mode
WR
100
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.