Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
Description
Description
The M16C/6NT 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 100-pin plastic molded QFP. These singlechip microcomputers operate using sophisticated instructions featuring a high level of instruction efficiency.
With 1M 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.
Being equipped with two CAN (Controller Area Network) modules, the microcomputer is suited to drive
automotive and industrial control systems. The CAN modules comply with the 2.0B specification.
Specifications written in this
manual are believed to be accurate, but are not guaranteed
to be entirely free of error.
Specifications in this manual
may be changed for functional
or performance improvements.
Please make sure your manual
is the latest edition.
• Memory expansion .............................. Available (to a maximum of 1M bytes)
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
Description
Performance Outline
Table 1-1 is a performance outline of the M16C/6N group.
Table 1-1. Performance outline of M16C/6N group
ItemPerformance
Number of basic instructions91 instructions
Shortest instruction execution time
Memory ROM128K to 256K byte
capacityRAM5K to 10K byte
I/O portsP0 to P10 (except P85)8 bit x 10, 7 bit x 1
Input portP851 bit x 1
MultifunctionTA0, TA1, TA2, TA3, TA416 bit x 5
timerTB0, TB1, TB2, TB3, TB4, TB516 bit x 6
Serial I/OUART0, UART1, UART2(UART or clock synchronous) x 3
SI/O3Clock synchronous
A-D converter10 bits x (8 + 8 + 8 + 2) inputs
D-A converter8 bits x 2 channels
CRC calculation circuitCRC-CCITT
DMAC2 channels (trigger: 23 sources)
CAN module2 channels, 2.0B active
Watchdog timer15 bits x 1 (with prescaler)
Interrupt29 internal and 9 external sources, 4 software sources,
Memory type:
M : Mask ROM version
F : Flash ROM version
Shows RAM capacity, pin count, etc
(The value itself has no specific meaning)
M16C/6N Group
M16C Family
6
Preliminary Specifications REV.B
Under
development
Pin Description
Description
Specifications in this manual are tentative and subject to change.
Table 1-3. Pin Description of M16C/6N group (1)
Pin name
Signal name
I/O type
Mitsubishi microcomputers
M16C / 6N Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Function
VCC, V
SS
CNV
SS
RESET
X
IN
X
OUT
BYTE
CC
AV
AV
SS
V
REF
P00 to P0
D0 to D
7
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
Input
Input
Input
Output
Input
Input
Input/output
Supply 4.0 to 5.5 V to the V
CC
pin. Supply 0 V to the VSS pin.
This pin switches between processor modes. Connect it to the
SS
pin to operate in single-chip or memory expansion mode.
V
Connect it to the V
CC
pin to operate in microprocessor mode.
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
X
OUT
pin open.
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
operating in single-chip mode,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, the user can specify in units of four
bits via software whether or not they are tied to a pull-up resistor.
Pins in this port also function as A-D converter input pins.
7
Input/output
When set as a separate bus, these pins input and output data (D
0–D7
).
P10 to P1
D8 to D
15
P20 to P2
A0 to A
7
A0/D0 to
7/D7
A
A0, A1/D
to A7/D
P30 to P3
A8 to A
15
A8/D7,
9
to A
A
P40 to P4
0
to CS3,
CS
A
16
to A
7
7
0
7
15
7
6
19
I/O port P1
I/O port P2
I/O port P3
I/O port P4
Input/output
Input/output
Input/output
Output
Input/output
Output
Input/output
Input/output
Output
Input/output
Output
Input/output
Output
Output
This is an 8-bit I/O port equivalent to P0. Pins in this port also function
as 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. Pins in this port also function
as A-D converter input pins.
These pins output 8 low-order address bits (A0–A7).
If the external bus is set as an 8-bit wide multiplexed bus, these pins
0–D7
input and output data (D
0–A7
) separated in time by multiplexing.
(A
) and output 8 low-order address bits
If the external bus is set as a 16-bit wide multiplexed bus, these pins
0–D6
input and output data (D
in time by multiplexing. They also output address (A
) and output address (A1–A7) separated
0
).
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
7
input and output data (D
by multiplexing. They also output address (A
) and output address (A8) separated in time
9–A15
).
This is an 8-bit I/O port equivalent to P0.
These pins output CS0–CS3 signals and A16–A19. CS0–CS3 are chip
16–A19
select signals used to specify an access space. A
are 4 high-
order address bits.
7
Preliminary Specifications REV.B
Under
development
Pin Description
Description
Specifications in this manual are tentative and subject to change.
Table 1-4. Pin Description of M16C/6N group (2)
Signal nameFunctionPin nameI/O type
Mitsubishi microcomputers
M16C / 6N Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
0
to P5
P5
WRL / WR,
WRH / BHE,
RD,
BCLK,
HLDA,
HOLD,
ALE,
RDY
P60 to P6
7
P70 to P77
0
to P84,
P8
P86,
P87,
P8
5
I/O port P5Input/output
7
I/O port P6
I/O port P7
I/O port P8
Input port P8
5
Output
Output
Output
Output
Output
Input
Output
Input
Input/output
Input/output
Input/output
Input/output
Input/output
Input
This is an 8-bit I/O port equivalent to P0. In single-chip mode, P57 in
this port outputs a divide-by-8 or divide-by-32 clock of XIN or a clock of
the same frequency as X
CIN
as selected by software.
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. BCLK outputs
a clock with the same cycle as the internal clock φ.
This is an 8-bit I/O port equivalent to P0. Pins in this port also function
as UART0 and UART1 I/O pins as selected by software.
This is an 8-bit I/O port equivalent to P0. Pins in this port also function
as timer A
0
- A3, timer B5, UART2 I/O or CAN1 transmit/receive data
pins as selected by software.
P80 to P84, P86 and P87 are I/O ports with the same functions as P0.
Using software, they can be made to function as the I/O pins for timer
A4 and the input pins for external interrupts. P8
6
and P87 can be set
using software to function as the I/O pins for a sub clock generation
circuit. In this case, connect a quartz oscillator between P86 (X
pin) and P8
7
(X
CIN
pin). P85 is an input-only port that also functions
COUT
for NMI. The NMI interrupt is generated when the input at this pin
changes from H to L . The NMI function cannot be cancelled using
software. The pull-up cannot be set for this pin.
P90 to P9
7
P100 to P10
I/O port P9
I/O port P10
7
Input/output
Input/output
This is an 8-bit I/O port equivalent to P0. Pins in this port also function
transmit/receive data pins as selected by software.
This is an 8-bit I/O port equivalent to P0. Pins in this port also function
as A-D converter input pins. Furthermore, P10
4
- P107 also function as
input pins for the key input interrupt function.
8
Under
development
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
Memory
Operation of Functional Blocks
The M16C/6N group accommodates several 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 CAN module, timers, serial I/O, D-A converter, DMAC, CRC calculation
circuit, A-D converter, and I/O ports.
Each unit is explained in the following.
Memory
Figure 2-1 depicts the memory map of the M16C/6N group. The address space extends the 1M bytes from
address 0000016 to FFFFF16. ROM is located from FFFFF16 down. For example, in the M306N0MCTXXXFP, there is 128K byte of internal ROM from E000016 to FFFFF16. The vector table for fixed interrupts
such as the reset and NMI are mapped to FFFDC16 to FFFFF16. The starting addresses of the interrupt
routines are 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.
RAM is located from 0040016 up. For example, in the M306N0MCT-XXXFP, 5K bytes of internal RAM are
mapped to the space from 0040016 to 017FF16. 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 0000016 to 003FF16. This area accommodates the control registers for peripheral devices such as I/O ports, A-D converter, serial I/O, CAN controller and timers, etc. Figure 2-2 to 2-9 are
locations 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 FFE0016 to FFFDB16. If the starting addresses of subroutines or
the destination addresses of jumps are stored here, subroutine call instructions and jump instructions can be
implemented as 2-byte instructions, reducing the number of program steps.
In memory expansion mode and microprocessor mode, a part of the space is reserved and cannot be used.
For example, in the M306N0MCT-XXXFP, the following space cannot be used.
• The space between 0180016 and 03FFF16 (Memory expansion and microprocessor modes)
• The space between D000016 and DFFFF16 (Memory expansion mode)
Type No. Address XXXXX16 Address YYYYY
M306N0MC 017FF16 E0000
M306N0FG
Figure 2-1. Memory map
02BFF
00000
16
SFR area
FFE00
16
00400
16
Internal RAM area
XXXXX
16
Internal reserved
16
area (Note 1)
04000
External area
Internal reserved
D0000
16
YYYYY
FFFFF
16
Note 1: During memory expansion and microprocessor modes, can not be used.
16
C0000
16
16
Note 2: In memory expansion mode, can not be used.
area (Note 2)
16
Internal ROM area
16
Special page
vector table
FFFDC
16
Undefined instruction
Overflow
BRK instruction
Address match
Single step
Watchdog timer
FFFFF
DBC
NMI
Reset
16
9
ent
nder
U
developm
Memory
0000
16
0001
16
0002
16
0003
16
0004
16
0005
16
0006
16
0007
16
0008
16
0009
16
000A
16
000B
16
000C
16
000D
16
000E
16
000F
16
0010
16
0011
16
0012
16
0013
16
0014
16
0015
16
0016
16
0017
16
0018
16
0019
16
001A
16
001B
16
001C
16
001D
16
001E
16
001F
16
0020
16
0021
16
0022
16
0023
16
0024
16
0025
16
0026
16
0027
16
0028
16
0029
16
002A
16
002B
16
002C
16
002D
16
002E
16
002F
16
0030
16
0031
16
0032
16
0033
16
0034
16
0035
16
0036
16
0037
16
0038
16
0039
16
003A
16
003B
16
003C
16
003D
16
003E
16
003F
16
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
0040
16
0041
16
0042
16
0043
Processor mode register 0 (PM0)
Processor mode register 1(PM1)
System clock control register 0 (CM0)
System clock control register 1 (CM1)
Chip select control register (CSR)
Address match interrupt enable register (AIER)
Protect register (PRCR)
Oscillation stop detection register (CM2)
Watchdog timer start register (WDTS)
Watchdog timer control register (WDC)
Specifications in this manual are tentative and subject to change.
16
16
16
CAN1 Slot 14: Message Identifier / DLC
16
16
16
16
16
16
16
CAN1 Slot 14: Data Field
16
16
16
16
16
CAN1 Slot 14: Time Stamp
16
16
16
16
CAN1 Slot 15: Message Identifier / DLC
16
16
16
16
16
16
16
CAN1 Slot 15: Data Field
16
16
16
16
16
CAN1 Slot 15: Time Stamp
16
16
CAN1 global mask (C1GMR)
16
16
16
16
16
16
CAN1 local mask A (C1LMAR)
16
16
16
16
16
16
CAN1 local mask B (C1LMBR)
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
M16C / 6N Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Count start flag (TABSR)
0380
16
Clock prescaler reset flag (CPSRF)
0381
16
One-shot start flag (ONSF)
0382
16
Trigger select register (TRGSR)
0383
16
Up-down flag (UDF)
0384
16
0385
16
Timer A0 (TA0)
0386
16
0387
16
Timer A1 (TA1)
0388
16
0389
16
Timer A2 (TA2)
038A
16
038B
16
Timer A3 (TA3)
038C
16
038D
16
Timer A4 (TA4)
038E
16
038F
16
Timer B0 (TB0)
0390
16
0391
16
Timer B1 (TB1)
0392
16
0393
16
Timer B2 (TB2)
0394
16
0395
16
Timer A0 mode register (TA0MR)
0396
16
Timer A1 mode register (TA1MR)
0397
16
Timer A2 mode register (TA2MR)
0398
16
Timer A3 mode register (TA3MR)
0399
16
Timer A4 mode register (TA4MR)
039A
16
Timer B0 mode register (TB0MR)
039B
16
Timer B1 mode register (TB1MR)
039C
16
Timer B2 mode register (TB2MR)
039D
16
039E
16
039F
16
UART0 transmit/receive mode register (U0MR)
03A0
16
UART0 bit rate generator (U0BRG)
03A1
16
UART0 transmit buffer register (U0TB)
03A2
16
03A3
16
UART0 transmit/receive control register 0 (U0C0)
03A4
16
UART0 transmit/receive control register 1 (U0C1)
03A5
16
UART0 receive buffer register (U0RB)
03A6
16
03A7
16
UART1 transmit/receive mode register (U1MR)
03A8
16
UART1 bit rate generator (U1BRG)
03A9
16
UART1 transmit buffer register (U1TB)
03AA
16
03AB
16
UART1 transmit/receive control register 0 (U1C0)
03AC
16
UART1 transmit/receive control register 1 (U1C1)
03AD
16
UART1 receive buffer register (U1RB)
03AE
16
03AF
16
UART transmit/receive control register 2 (UCON)
03B0
16
03B1
16
03B2
16
03B3
16
03B4
16
03B5
16
Flash memory control register 2 (FMCR2)
03B6
16
Flash memory control register (FMCR)
03B7
16
DMA0 cause select register (DM0SL)
03B8
16
03B9
16
DMA1 cause select register (DM1SL)
03BA
16
03BB
16
CRC data register (CRCD)
03BC
16
03BD
16
CRC input register (CRCIN)
03BE
16
03BF
16
Mitsubishi microcomputers
Figure 2-8. Location of peripheral unit control registers (7)
16
Under
development
Memory
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
03C0
16
A-D register 0 (AD0)
03C1
16
03C2
16
A-D register 1 (AD1)
03C3
16
03C4
16
A-D register 2 (AD2)
03C5
16
03C6
16
A-D register 3 (AD3)
03C7
16
03C8
16
A-D register 4 (AD4)
03C9
16
03CA
16
A-D register 5 (AD5)
03CB
16
03CC
16
A-D register 6 (AD6)
03CD
16
03CE
16
A-D register 7 (AD7)
03CF
16
03D0
16
03D1
16
03D2
16
03D3
16
03D4
16
A-D control register 2 (ADCON2)
03D5
16
03D6
16
A-D control register 0 (ADCON0)
03D7
16
A-D control register 1 (ADCON1)
03D8
16
D-A register 0 (DA0)
03D9
16
03DA
16
D-A register 1 (DA1)
03DB
16
03DC
16
D-A control register (DACON)
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
Port P6 (P6)
03ED
16
Port P7 (P7)
03EE
16
Port P6 direction register (PD6)
03EF
16
Port P7 direction register (PD7)
03F0
16
Port P8 (P8)
03F1
16
Port P9 (P9)
03F2
16
Port P8 direction register (PD8)
03F3
16
Port P9 direction register (PD9)
03F4
16
Port P10 (P10)
03F5
16
03F6
16
Port P10 direction register (PD10)
03F7
16
03F8
16
03F9
16
03FA
16
03FB
16
03FC
16
Pull-up control register 0 (PUR0)
03FD
16
Pull-up control register 1 (PUR1)
03FE
16
Pull-up control register 2 (PUR2)
03FF
16
Port control register (PCR)
Mitsubishi microcomputers
M16C / 6N Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Figure 2-9. Location of peripheral unit control registers (8)
17
ent
Preliminary Specifications REV.B
Under
developm
CPU
Bus Control
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
Central Processing Unit (CPU)
The CPU has a total of 13 registers shown in Figure 3-1. Seven of these registers (R0, R1, R2, R3, A0, A1,
and FB) come in two sets; therefore, these registers have two register banks.
R0
R1
R2
R3
A0
A1
FB
(Note)
(Note)
(Note)
(Note)
(Note)
(Note)
(Note)
b15
b15
b15
b15
b15
b15
b15
b8 b7 b0
H
b8 b7 b0
H
L
b19
L
PC
b0
Program counter
Data
b0
registers
INTB
b19
H
b0
L
Interrupt table
register
b0
b0
b15
USP
b15
ISP
b0
User stack pointer
b0
Interrupt stack
pointer
Address
b0
b0
registers
Frame base
registers
SB
FLG
b15
b15
b0
Static base
register
b0
Flag register
IPL
CDZSBOIU
Note: These registers consist of two register banks.
Figure 3-1. Central processing unit register
(1) Data registers (R0, R0H, R0L, R1, R1H, R1L, R2, and R3)
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). In some instructions, registers R2 and R0, as well as R3 and R1 can be
used as 32-bit data registers (R2R0/R3R1).
(2) Address rgisters (A0 and A1)
Address registers (A0 and A1) are configured with 16 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.
In some instructions, registers A1 and A0 can be combined for use as a 32-bit address register (A1A0).
18
Preliminary Specifications REV.B
Under
development
Bus Control
CPU
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
(3) Frame base register (FB)
The frame base register (FB) is configured with 16 bits, and is used for FB relative addressing.
(4) Program counter (PC)
The program counter (PC) is configured with 20 bits, indicating the address of an instruction to be executed.
(5) Interrupt table register (INTB)
The interrupt table register (INTB) is configured with 20 bits, indicating the start address of an interrupt
vector table.
(6) Stack pointer (USP/ISP)
Stack pointers come in two types: the user stack pointer (USP) and the interrupt stack pointer (ISP), each
configured with 16 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).
(7) Static base register (SB)
The static base register (SB) is configured with 16 bits, and is used for SB relative addressing.
(8) Flag register (FLG)
The flag register (FLG) is configured with 11 bits, each bit is used as a flag. Figure 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 results in 0; otherwise, cleared to “0”.
• Bit 3: Sign flag (S flag)
This flag is set to “1” when an arithmetic operation results 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 results 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.
19
ent
Preliminary Specifications REV.B
Under
developm
CPU
Bus Control
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
• Bit 7: Stack pointer select flag (U flag)
The 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.
• Bits 8 to 11: Reserved area
• 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 a priority greater than the processor interrupt priority level (IPL), the interrupt
is enabled.
• Bit 15: Reserved area
The C, Z, S, and O flags are changed when instructions are executed. See the software manual for details.
IPL
b0b15
Flag register (FLG)
CDZSBOIU
Carry flag
Debug flag
Zero flag
Sign flag
Register bank select flag
Overflow flag
Interrupt enable flag
Stack pointer select flag
Reserved area
Processor interrupt priority level
Figure 3-2. Flag register (FLG)
Reserved area
20
Preliminary Specifications REV.B
Under
development
Bus Control
Processor Mode
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
Processor Mode
(1) Processor Mode Types
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
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 3-3 shows the processor mode register 0 and 1.
Figure 3-4 shows the memory maps applicable for each of the modes when memory area dose not be
expanded (normal mode).
21
ent
Preliminary Specifications REV.B
Under
developm
Processor Mode
Bus Control
Specifications in this manual are tentative and subject to change.
Processor mode register 0 (Note 1)
b7 b6 b5 b4 b3 b2 b1 b0
SymbolAddressWhen reset
PM00004
16
00
16
(Note 2)
Mitsubishi microcomputers
M16C / 6N Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
PM00
PM01
PM02
PM03
PM04
PM05
PM06
PM07
Note 1: Set bit 1 of the protect register (address 000A
values to this register.
Note 2: If the V
reset is 03
Note 3: Valid in microprocessor and memory expansion modes.
Note 4: If the entire space is of multiplexed bus in memory expansion mode, choose an 8-
bit width.The processor operates using the separate bus after reset is revoked, so the entire
space multiplexed bus cannot be chosen in microprocessor mode.
The higher-order address becomes a port if the entire space multiplexed bus is chosen, so
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)
0 : Address output
1 : Port function
(Address is not output)
0 : BCLK is output
1 : BCLK is not output
(Pin is left floating)
16
) to “1” when writing new
SS
, the value of this register when
00000XX0
2
WR
Bit nameFunctionBit symbol
Reserved bit
Nothing is assigned.
In an attempt to write to these bits, write “0”. The value, if read, turns
out to be
Note 1: Set bit 1 of the protect register (address 000A
Note 2: Be sure to set this bit to 0 except products whose RAM size and ROM size exceed 15K bytes
Note 3: With the processor running in memory expansion mode or in microprocessor mode, setting this
indeterminate.
PM13
PM14
PM15
Reserved bit
PM17Wait bit
Internal reserved area
expansion bit (Note 2)
Memory area
expansion bit (Note 3)
and 192K bytes respectively.
Set this bit to "1" for M306N0FG.
Specify E0000
to “0” at the time reset is revoked, for the reset vector table of user program.
bit provides the means of expanding the external memory area. (Normal mode: up to 1M byte,
expansion mode 1: up to 1.2 M bytes, expansion mode 2: up to 4M bytes)
For details, see “Memory space expansion functions”.
16
or a subsequent address, which becomes an internal ROM area if PM13 is set
Must always be set to “0”
0: The same internal reserved
area as that of M16C/60 and
M16C/61 group
1: Expands the internal RAM area
and internal ROM area to 23 K
bytes and to 256K bytes
respectively. (Note 2)
b5 b4
0 0 : Normal mode
(Do not expand)
0 1 : Inhibited
1 0 : Memory area expansion
mode 1
1 1 : Memory area expansion
mode 2
Must always be set to “0”
0 : No wait state
1 : Wait state inserted
16
) to “1” when writing new values to this register.
WR
Figure 3-3. Processor mode register 0 and 1
22
Preliminary Specifications REV.B
Under
development
Bus Control
Processor Mode
Specifications in this manual are tentative and subject to change.
Mitsubishi microcomputers
M16C / 6N Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Type No. Address XXXXX16 Address YYYYY16
M306N0MC 017FF16 E000016
M306N0FG
Figure 3-4.
Memory maps in each processor mode
02BFF16 C000016
Single-chip mode
16
00000
0040016
XXXXX16
0400016
D000016
YYYYY16
FFFFF16
SFR area
Internal
RAM area
Inhibited
Internal
ROM area
Memory expansion mode
SFR area
Internal
RAM area
Internally
reserved area
External
area
Internally
reserved area
Internal
ROM area
External area : Accessing this area allows the user to
access a device connected externally
to the microcomputer.
Microprocessor mode
SFR area
Internal
RAM area
Internally
reserved area
External
area
23
ent
Preliminary Specifications REV.B
Under
developm
Bus Control
Bus Settings
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
Bus Settings
The BYTE pin and bits 4 to 6 of the processor mode register 0 (address 000416) are used to change the bus
settings.
Table 3-1 shows the factors used to change the bus settings.
Table 3-1. Factors for switching bus settings
Bus settingSwitching factor
Switching external address bus widthBit 6 of processor mode register 0
Switching external data bus widthBYTE pin
Switching between separate and multiplex busBits 4 and 5 of processor mode register 0
(1) Selecting external address bus width
The address bus width for external output in the 1M bytes of address space can be set to 16 bits (64K bytes
address space) or 20 bits (1M bytes address space). When bit 6 of the processor mode register 0 is set to
“1”, the external address bus width is set to 16 bits, and P2 and P3 become part of the address bus. P40 to
P43 can be used as programmable I/O ports. When bit 6 of processor mode register 0 is set to “0”, the
external address bus width is set to 20 bits, and P2, P3, and P40 to P43 become part of the address bus.
(2) Selecting external data bus width
The external data bus width can be set to 8 or 16 bits. (Note, however, that only the separate bus can be
set.) When the BYTE pin is “L”, the bus width is set to 16 bits; when “H”, it is set to 8 bits. (The internal bus
width is permanently set to 16 bits.)
(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 mode, the data and address are input and output separately. The data bus can be set using the
BYTE pin to be 8 or 16 bits. When the BYTE pin is “H”, the data bus is set to 8 bits and P0 functions as
the data bus and P1 as a programmable I/O port. When the BYTE pin is “L”, the data bus is set to 16 bits
and P0 and P1 are both used for the data bus.
When the separate bus is used for access, a software wait can be selected.
• Multiplex bus
In this mode, data and address I/O are time multiplexed. With an 8-bit data bus selected (BYTE pin =
“H”), the 8 bits from D0 to D7 are multiplexed with A0 to A7.
With a 16-bit data bus selected (BYTE pin = “L”), the 8 bits from D0 to D7 are multiplexed with A1 to A8.
D8 to D15 are not multiplexed. In this case, the external devices connected to the multiplexed bus are
mapped to the microcomputer’s even addresses (every 2nd address). To access these external devices, access the even addresses as bytes.
The ALE signal latches the address. It is output from P56.
Before accessing the multiplex bus, always set the CSi wait bit of the chip select control register to “0”.
In microprocessor mode, multiplexed bus for the entire space cannot be selected.
In memory expansion mode, when multiplexed bus for the entire space is selected, address bus range
is 256 bytes in each chip select.
24
Preliminary Specifications REV.B
Under
development
Bus Control
Bus Settings
Specifications in this manual are tentative and subject to change.
Table 3-2. Pin functions for each processor mode
Mitsubishi microcomputers
M16C / 6N Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Processor mode
External bus type
Multiplexed bus
space select bit
Data bus width
BYTE pin level
P00 to P0
P1
P2
P2
P3
P31 to P3
P4
Port P40 to P4
function select bit = 1
P4
Port P40 to P4
function select bit = 0
P4
P5
0
to P1
0
1
to P2
0
0
to P4
0
to P4
4
to P4
0
to P5
7
7
7
7
3
3
3
3
7
3
Single-chip
mode
Memory expansion mode/microprocessor modes
Multiplexed bus and
separate bus
separate bus
Memory
expansion mode
Multiplexed
bus (Note 1)
01 , 100011 (Note 2)
8 bits
= H
16 bits
= L
8 bits
= H
16 bits
= L
I/O portData busData busData busData busI/O port
I/O portI/O portData busI/O portData busI/O port
I/O port
I/O port
I/O portAddress bus
Address bus
/data bus
Address busAddress bus
/data bus
(Note 3)
(Note 3)
Address busAddress busAddress busAddress bus
/data bus
Address bus
/data bus
(Note 3)
(Note 3)
/data bus
Address busAddress busAddress bus
/data bus
Address busAddress busI/O port
I/O portAddress busAddress busAddress busAddress busI/O port
I/O portI/O portI/O port/O portI/O portI/O port
I/O portAddress busAddress busAddress busAddress busI/O port
I/O port
CS (chip select) or programmable I/O port
(For details, refer to Bus control )
I/O port
Outputs RD, WRL, WRH, and BCLK or RD, BHE, WR, and BCLK
(For details, refer to Bus control )
8 bita
= H
P5
P5
P5
P5
4
5
6
7
I/O portHLDAHLDAHLDAHLDAHLDA
I/O portHOLDHOLDHOLDHOLDHOLD
I/O portALEALEALEALEALE
I/O portRDYRDYRDYRDYRDY
Note 1: In memory expansion mode, do not select a 16-bit multiplex bus.
Note 2: In microprocessor mode, multiplexed bus for the entire space cannot be selected.
In memory expansion mode, when multiplexed bus for the entire space is selected, address bus range is 256 bytes
in each chip select.
Note 3: Address bus when in separate bus mode.
25
ent
Under
developm
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
Bus Control
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. The software waits are valid in all processor modes.
(1) Address bus/data bus
The address bus consists of the 20 pins A0 to A19 for accessing the 1M bytes of address space.
The data bus consists of the pins for data I/O. When the BYTE pin is “H”, the 8 ports D0 to D7 function
as the data bus. When BYTE is “L”, the 16 ports D0 to D15 function as the data bus.
Both the address and data bus retain their previous states when internal ROM or RAM is accessed.
Also, when a change is made from single-chip mode to memory expansion mode, the value of the
address bus is undefined until external memory is accessed.
(2) Chip select signal
The chip select signal is output using the same pins as P44 to P47. Bits 0 to 3 of the chip select control
register (address 000816) set each pin to function as a port or to output the chip select signal. The chip
select control register is valid in memory expansion mode and microprocessor mode. In single-chip
mode, P44 to P47 function as programmable I/O ports regardless of the value in the chip select control
register.
In microprocessor mode, only CS0 outputs the chip select signal after the reset state has been cancelled. CS1 to CS3 function as input ports. Figure 3-5 shows the chip select control register.
The chip select signal can be used to split the external area into as many as four blocks. Table 3-3
shows the external memory areas specified using the chip select signal.
Table 3-3. External areas specified by the chip select signals
Chip select
Special address range
Memory expansion mode
16
CS0
CS1
CS2
CS3
30000
28000
08000
04000
to CFFFF16 (640K)
16
to 2FFFF16 (32K)
16
to 27FFF16 (128K)
16
to 07FFF16 (16K)
Microprocessor mode
30000
16
to FFFFF16 (832K)
28000
16
to 2FFFF16 (32K)
16
08000
04000
to 27FFF16 (128K)
16
to 07FFF16 (16K)
26
Preliminary Specifications REV.B
Under
development
Specifications in this manual are tentative and subject to change.
Bus Control
Chip select control register
b7 b6 b5 b4 b3 b2 b1 b0
Figure 3-5. Chip select control register
SymbolAddress When reset
CSR0008
Bit symbol
CS0
CS1
CS2
CS3
CS0W
CS1W
CS2W
CS3W
Bit name
CS0 output enable bit
CS1 output enable bit
CS2 output enable bit
CS3 output enable bit
CS0 wait bit
CS1 wait bit
CS2 wait bit
CS3 wait bit
Mitsubishi microcomputers
M16C / 6N Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
16
01
16
Function
0 : Chip select output disabled
(Normal port pin)
1 : Chip select output enabled
0 : Wait state inserted
1 : No wait state
W
R
(3) Read/write signals
With a 16-bit data bus (BYTE pin =“L”), 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 an 8-bit data bus (BYTE pin
= “H”), use the combination of RD, WR, and BHE signals. (Set bit 2 of the processor mode register 0
(address 000416) to “0”.) Tables 3-4 and 3-5 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: Before attempting to change the contents of the processor mode register 0, set bit 1 of the protect
register (address 000A16) to “1”.
Table 3-4. Operation of RD, WRL, and WRH signals
Data bus width
16-bit
(BYTE = L )
WRHWRLRD
L
H
H
H
H
L
H
L
H
H
L
L
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
Status of external data bus
Table 3-5. Operation of RD, WR, and BHE signals
Data bus widthA0
RDBHEWR
HLL
LHL
16-bit
(BYTE = L )
HLH
LHH
HLLL
LHLL
8-bit
(BYTE = H )
HLH / L
LHH / L
Not used
Not used
27
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
ent
Under
developm
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
Bus Control
(4) ALE signal
The ALE signal latches the address when accessing the multiplex bus space. Latch the address when the
ALE signal falls.
When BYTE pin = “H”
D
0/A0 to D7/A7
A8 to A19
ALE
AddressData (Note 1)
Address (Note 2)
Note 1: Floating when reading.
Note 2: When multiplexed bus for the entire space is selected, these are I/O ports.
When BYTE pin = “L”
ALE
A
D
0/A1 to D7/A8
A9 to A19
0
AddressData (Note 1)
Address
Address
Figure 3-6. ALE sigal 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 3-7, 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 3-6
shows the microcomputer status in the ready state. Figure 3-7 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.
Table 3-6. Microcomputer status in ready state (Note)
ItemStatus
OscillationOn
R/W 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.
BCLK
RD
CSi
(i = 0 to 3)
: Wait using ready function
: Wait using software
RDY
tsu
(RDY – BCLK)
Figure 3-7. Example of RD signal extended by RDY signal
28
Under
development
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
Bus Control
(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 3-7 shows
the microcomputer status in the hold state.
Table 3-7. Microcomputer status in hold state
ItemStatus
OscillationO N
R/W signal, address bus, data bus, CS, BHEFloating
The output of the internal clock φ can be selected using bit 7 of the processor mode register 0 (address
000416) (Note). The output is floating when bit 7 is set to “1”.
Note: Before attempting to change the contents of the processor mode register 0, set bit 1 of the protect
register (address 000A16) to “1”.
29
ent
Under
developm
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Mitsubishi microcomputers
M16C / 6N Group
Bus Control
(8) 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 chip select control register (address 000816).
A software wait is inserted in the internal ROM/RAM area and in the external memory area by setting the
wait bit of the processor mode register 1. When set to “0”, each bus cycle is executed in one BCLK cycle.
When set to “1”, each bus cycle is executed in two or three BCLK cycles. After the microcomputer has been
reset, this bit defaults to “0”. When set to “1”, bits 4 to 7 of the chip select control register are invalid and a
wait is applied to all external memory areas (two or three BCLK cycles). However, this is not necessary if the
oscillation frequency is less than 3MHz.
When the wait bit of the processor mode register 1 is “0”, software waits can be set independently for each
of the 4 areas selected using the chip select signal. Bits 4 to 7 of the chip select control register correspond
to chip selects CS0 to CS3. When one of these bits is set to “1”, the bus cycle is executed in one BCLK
cycle. When set to “0”, the bus cycle is executed in two or three BCLK cycles. These bits default to “0”
after the microcomputer has been reset.
The SFR area is always accessed in two BCLK cycles regardless of the setting of these control bits. Also,
the corresponding bits of the chip select control register must be set to “0” if using the multiplex bus to
access the external memory area.
Table 3-8 shows the software wait and bus cycles. Figure 3-8 shows example bus timing when using
software waits.
Note: Before attempting to change the contents of the processor mode register 1, set bit 1 of the protect