The revision list can be viewed directly by
clicking the title page.
The revision list summarizes the locations of
revisions and additions. Details should always
be checked by referring to the relevant text.
H8/3052B F-ZTAT™
16
Hardware Manual
Renesas 16-Bit Single-Chip Microcomputer
H8 Family/H8/300H Series
H8/3052B HD64F3052BTE
HD64F3052BF
Rev. 3.00
Revision Date: Mar 21, 2006
Page 2
Keep safety first in your circuit designs!
1. Renesas Technology Corp. puts the maximum effort into making semiconductor products better and
more reliable, but there is always the possibility that trouble may occur with them. Trouble with
semiconductors may lead to personal injury, fire or property damage.
Remember to give due consideration to safety when making your circuit designs, with appropriate
measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or
(iii) prevention against any malfunction or mishap.
Notes regarding these materials
1. These materials are intended as a reference to assist our customers in the selection of the Renesas
Technology Corp. product best suited to the customer's application; they do not convey any license
under any intellectual property rights, or any other rights, belonging to Renesas Technology Corp. or
a third party.
2. Renesas Technology Corp. assumes no responsibility for any damage, or infringement of any thirdparty's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or
circuit application examples contained in these materials.
3. All information contained in these materials, including product data, diagrams, charts, programs and
algorithms represents information on products at the time of publication of these materials, and are
subject to change by Renesas Technology Corp. without notice due to product improvements or
other reasons. It is therefore recommended that customers contact Renesas Technology Corp. or
an authorized Renesas Technology Corp. product distributor for the latest product information
before purchasing a product listed herein.
The information described here may contain technical inaccuracies or typographical errors.
Renesas Technology Corp. assumes no responsibility for any damage, liability, or other loss rising
from these inaccuracies or errors.
Please also pay attention to information published by Renesas Technology Corp. by various means,
including the Renesas Technology Corp. Semiconductor home page (http://www.renesas.com).
4. When using any or all of the information contained in these materials, including product data,
diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total
system before making a final decision on the applicability of the information and products. Renesas
Technology Corp. assumes no responsibility for any damage, liability or other loss resulting from the
information contained herein.
5. Renesas Technology Corp. semiconductors are not designed or manufactured for use in a device or
system that is used under circumstances in which human life is potentially at stake. Please contact
Renesas Technology Corp. or an authorized Renesas Technology Corp. product distributor when
considering the use of a product contained herein for any specific purposes, such as apparatus or
systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use.
6. The prior written approval of Renesas Technology Corp. is necessary to reprint or reproduce in
whole or in part these materials.
7. If these products or technologies are subject to the Japanese export control restrictions, they must
be exported under a license from the Japanese government and cannot be imported into a country
other than the approved destination.
Any diversion or reexport contrary to the export control laws and regulations of Japan and/or the
country of destination is prohibited.
8. Please contact Renesas Technology Corp. for further details on these materials or the products
contained therein.
Rev. 3.00 Mar 21, 2006 page ii of xxviii
Page 3
General Precautions on Handling of Product
1. Treatment of NC Pins
Note: Do not connect anything to the NC pins.
The NC (not connected) pins are either not connected to any of the internal circuitry or are
used as test pins or to reduce noise. If something is connected to the NC pins, the
operation of the LSI is not guaranteed.
2. Treatment of Unused Input Pins
Note: Fix all unused input pins to high or low level.
Generally, the input pins of CMOS products are high-impedance input pins. If unused pins
are in their open states, intermediate levels are induced by noise in the vicinity, a passthrough current flows internally, and a malfunction may occur.
3. Processing before Initialization
Note: When power is first supplied, the product’s state is undefined.
The states of internal circuits are undefined until full power is supplied throughout the
chip and a low level is input on the reset pin. During the period where the states are
undefined, the register settings and the output state of each pin are also undefined. Design
your system so that it does not malfunction because of processing while it is in this
undefined state. For those products which have a reset function, reset the LSI immediately
after the power supply has been turned on.
4. Prohibition of Access to Undefined or Reserved Addresses
Note: Access to undefined or reserved addresses is prohibited.
The undefined or reserved addresses may be used to expand functions, or test registers
may have been be allocated to these addresses. Do not access these registers; the system’s
operation is not guaranteed if they are accessed.
Rev. 3.00 Mar 21, 2006 page iii of xxviii
Page 4
Configuration of This Manual
This manual comprises the following items:
1. General Precautions on Handling of Product
2. Configuration of This Manual
3. Preface
4. Main Revisions for This Edition
The list of revisions is a summary of points that have been revised or added to earlier versions.
This does not include all of the revised contents. For details, see the actual locations in this
manual.
5. Contents
6Overview
7. Description of Functional Modules
•CPU and System-Control Modules
•On-Chip Peripheral Modules
The configuration of the functional description of each module differs according to the
module. However, the generic style includes the following items:
i) Feature
ii) Input/Output Pin
iii) Register Description
iv) Operation
v) Usage Note
When designing an application system that includes this LSI, take notes into account. Each section
includes notes in relation to the descriptions given, and usage notes are given, as required, as the
final part of each section.
8. List of Registers
9. Electrical Characteristics
10. Appendix
Rev. 3.00 Mar 21, 2006 page iv of xxviii
Page 5
Preface
The H8/3052BF is a group of high-performance microcontrollers that integrate system supporting
functions together with an H8/300H CPU core.
The H8/300H CPU has a 32-bit internal architecture with sixteen 16-bit general registers, and a
concise, optimized instruction set designed for speed. It can address a 16-Mbyte linear address
space.
The on-chip supporting functions include ROM, RAM, a 16-bit integrated timer unit (ITU), a
programmable timing pattern controller (TPC), a watchdog timer (WDT), a serial communication
interface (SCI), an A/D converter, a D/A converter, I/O ports, a direct memory access controller
(DMAC), a refresh controller, and other facilities. Of the two SCI channels, one has been
expanded to support the ISO/IEC7816-3 smart card interface. Functions have also been added to
reduce power consumption in battery-powered applications: individual modules can be placed in
standby, and the frequency of the system clock supplied to the chip can be divided down under
software control.
The address space is divided into eight areas. The data bus width and access cycle length can be
selected independently in each area, simplifying the connection of different types of memory.
Seven operating modes (modes 1 to 7) are provided, offering a choice of data bus width and
address space size.
With these features, the H8/3052BF can be used to implement compact, high-performance
systems easily.
The H8/3052BF has an F-ZTAT* version with on-chip flash memory that can be programmed
on-board. These versions enable users to respond quickly and flexibly to changing application
specifications.
This manual describes the H8/3052BF hardware. For details of the instruction set, refer to the
H8/300H Series Software Manual.
Note: * F-ZTAT (Flexible–Zero Turn Around Time) is a trademark of Renesas Technology Corp.
Rev. 3.00 Mar 21, 2006 page v of xxviii
Page 6
Rev. 3.00 Mar 21, 2006 page vi of xxviii
Page 7
Main Revisions for this Edition
ItemPageRevisions (See Manual for Details)
AllNortification of change in company name amended
Notes: 1. An external capacitor must be connected when this pin functions as the VCL pin.
V
P8
IRQ
*
CL
/RFSH/
0
1
0
1
*
V
CL
P80/RFSH/
IRQ
0
V
CL
P80/RFSH/
IRQ
Rev. 3.00 Mar 21, 2006 page vii of xxviii
pin.
CL
Pin Name
1
*
0
1
*
V
CL
P80/RFSH/
IRQ
0
1
*
V
CL
P80/RFSH/
IRQ
0
1
*
V
CL
P80/RFSH/
IRQ
0
1
*
V
CL
P80/IRQ
0
Page 8
ItemPageRevisions (See Manual for Details)
1.3.3 Pin Functions
Table 1.3 Pin Functions
13, 17Table amended and note deleted
TypeSymbolPin No.
PowerV
CC
35, 68
V
SS
V
CL
6.3.6 Interconnections
138Figure amended
with Memory (Example)
A to A
Figure 6.18
19 1
Interconnections with
Memory (Example)
7.3.4 Interval Timer176Description amended
Timing of Setting of Compare Match Flag and Clearing by
Compare Match: The CMF flag in
compare match signal output when the RTCOR and
RTCNT values match.
E.2Timing of Recovery from Hardware Standby Mode......................................................... 807
Appendix F Product Code Lineup .................................................................................. 808
Appendix G Package Dimensions .................................................................................. 809
Appendix H Differences from H8/3048F-ZTAT ....................................................... 811
Rev. 3.00 Mar 21, 2006 page xxviii of xxviii
Page 29
Section 1 Overview
Section 1 Overview
1.1Overview
The H8/3052BF is a group of microcontrollers (MCUs) that integrate system supporting functions
together with an H8/300H CPU core having an original Renesas Technology architecture.
The H8/300H CPU has a 32-bit internal architecture with sixteen 16-bit general registers, and a
concise, optimized instruction set designed for speed. It can address a 16-Mbyte linear address
space. Its instruction set is upward-compatible at the object-code level with the H8/300 CPU,
enabling easy porting of software from the H8/300 Series.
The on-chip system supporting functions include ROM, RAM, a 16-bit integrated timer unit
(ITU), a programmable timing pattern controller (TPC), a watchdog timer (WDT), a serial
communication interface (SCI), an A/D converter, a D/A converter, I/O ports, a direct memory
access controller (DMAC), a refresh controller, and other facilities.
The H8/3052BF has 512 kbytes of ROM and 8 kbytes of RAM.
Seven MCU operating modes offer a choice of data bus width and address space size. The modes
(modes 1 to 7) include one single-chip mode and six expanded modes.
The H8/3052BF has an F-ZTAT™* version with on-chip flash memory that can be programmed
on-board.
Table 1.1 summarizes the features of the H8/3052BF.
Note: * F-ZTAT (Flexible–Zero Turn Around Time) is a trademark of Renesas Technology Corp.
Rev. 3.00 Mar 21, 2006 page 1 of 814
REJ09B0302-0300
Page 30
Section 1 Overview
Table 1.1Features
FeatureDescription
CPUUpward-compatible with the H8/300 CPU at the object-code level
• General-register machine
Sixteen 16-bit general registers
(also usable as + eight 16-bit registers or eight 32-bit registers)
• Short address mode
Maximum four channels available
Selection of I/O mode, idle mode, or repeat mode
Can be activated by compare match/input capture A interrupts from ITU
channels 0 to 3, transmit-data-empty and receive-data-full interrupts from
SCI channel 0, or external requests
• Full address mode
Maximum two channels available
Selection of normal mode or block transfer mode
Can be activated by compare match/input capture A interrupts from ITU
channels 0 to 3, external requests, or auto-request
Section 1 Overview
Rev. 3.00 Mar 21, 2006 page 3 of 814
REJ09B0302-0300
Page 32
Section 1 Overview
FeatureDescription
16-bit integrated
timer unit (ITU)
Programmable
timing pattern
controller (TPC)
Watchdog timer
(WDT),
1 channel
Serial
communication
interface (SCI),
2 channels
A/D converter
• Five 16-bit timer channels, capable of processing up to 12 pulse outputs or
10 pulse inputs
• 16-bit timer counter (channels 0 to 4)
• Two multiplexed output compare/input capture pins (channels 0 to 4)
• Operation can be synchronized (channels 0 to 4)
• PWM mode available (channels 0 to 4)
• Phase counting mode available (channel 2)
• Buffering available (channels 3 and 4)
• Reset-synchronized PWM mode available (channels 3 and 4)
• Complementary PWM mode available (channels 3 and 4)
• DMAC can be activated by compare match/input capture A interrupts
(channels 0 to 3)
• Maximum 16-bit pulse output, using ITU as time base
• Up to four 4-bit pulse output groups (or one 16-bit group, or two 8-bit groups)
• Non-overlap mode available
• Output data can be transferred by DMAC
• Reset signal can be generated by overflow
• Usable as an interval timer
• Selection of asynchronous or synchronous mode
• Full duplex: can transmit and receive simultaneously
Notes: 1. An external capacitor must be connected when this pin functions as the VCL pin.
2. In modes 1, 3, 5, and 6 the P40 to P47 functions of pins P40/D0 to P47/D7 are selected
after a reset, but they can be changed by software.
3. In modes 2 and 4 the D
to D7 functions of pins P40/D0 to P47/D7 are selected after a
0
reset, but they can be changed by software.
/TP3/
3
/
0
1
1
2
2
Rev. 3.00 Mar 21, 2006 page 12 of 814
REJ09B0302-0300
Page 41
Section 1 Overview
1.3.3Pin Functions
Table 1.3 summarizes the pin functions.
Table 1.3Pin Functions
TypeSymbolPin No.I/OName and Function
PowerV
CC
V
SS
V
CL
ClockXTAL67InputFor connection to a crystal resonator.
EXTAL66InputFor connection to a crystal resonator or
φ61OutputSystem clock: Supplies the system clock
Operating mode
MD2 to MD075 to 73InputMode 2 to mode 0: For setting the
control
35, 68InputPower: For connection to the power supply.
Connect all V
pins to the system power
CC
supply.
11, 22, 44,
57, 65, 92
InputGround: For connection to ground (0 V).
Connect all V
pins to the 0-V system
SS
power supply.
1InputConnect an external capacitor between this
pin and GND (0 V).
V
CL
0.1 µF
For examples of crystal resonator and
external clock input, see section 19, Clock
Pulse Generator.
input of an external clock signal. For
examples of crystal resonator and external
clock input, see section 19, Clock Pulse
Generator.
to external devices.
operating mode, as follows. Inputs at these
pins must not be changed during operation.
MD
MD
2
MD0Operating Mode
1
000—
001Mode 1
010Mode 2
011Mode 3
100Mode 4
101Mode 5
110Mode 6
111Mode 7
Rev. 3.00 Mar 21, 2006 page 13 of 814
REJ09B0302-0300
Page 42
Section 1 Overview
TypeSymbolPin No.I/OName and Function
System control RES63InputReset input: When driven low, this pin
resets the chip
FWE10InputFlash write enable: Allows program mode
setting.
STBY62InputStandby: When driven low, this pin forces a
transition to hardware standby mode
BREQ59InputBus request: Used by an external bus
master to request the bus right
BACK60OutputBus request acknowledge: Indicates that
the bus has been granted to an external bus
master
InterruptsNMI64InputNonmaskable interrupt: Requests a
nonmaskable interrupt
IRQ5 to IRQ017, 16,
Address busA23 to A
0
90 to 87
97 to 100,
InputInterrupt request 5 to 0: Maskable
interrupt request pins
OutputAddress bus: Outputs address signals
56 to 45,
43 to 36
Data busD15 to D
Bus controlCS7 to CS08, 97 to 99,
0
34 to 23,
21 to 18
Input/
Data bus: Bidirectional data bus
output
OutputChip select: Select signals for areas 7 to 0
88 to 91
AS69OutputAddress strobe: Goes low to indicate valid
address output on the address bus
RD70OutputRead: Goes low to indicate reading from
the external address space
HWR71OutputHigh write: Goes low to indicate writing to
the external address space; indicates valid
data on the upper data bus (D
to D8).
15
LWR72OutputLow write: Goes low to indicate writing to
the external address space; indicates valid
data on the lower data bus (D7 to D0).
WAIT58InputWait: Requests insertion of wait states in
bus cycles during access to the external
address space
Rev. 3.00 Mar 21, 2006 page 14 of 814
REJ09B0302-0300
Page 43
TypeSymbolPin No.I/OName and Function
Refresh
controller
RFSH87OutputRefresh: Indicates a refresh cycle
CS
3
88OutputRow address strobe RAS
strobe signal for DRAM connected to area 3
RD70OutputColumn address strobe CAS
address strobe signal for DRAM connected
to area 3; used with 2WE DRAM.
Write enable WE
WE: Write enable signal for
WEWE
DRAM connected to area 3; used with
2CAS DRAM.
HWR71OutputUpper write UW
UW: Write enable signal for
UWUW
DRAM connected to area 3; used with 2WE
DRAM.
Upper column address strobe UCAS
Column address strobe signal for DRAM
connected to area 3; used with 2CAS
DRAM.
LWR72OutputLower write LW
LW: Write enable signal for
LWLW
DRAM connected to area 3; used with 2WE
DRAM.
Lower column address strobe LCAS
Column address strobe signal for DRAM
connected to area 3; used with 2CAS
DRAM.
DMA controller
(DMAC)
DREQ1,
DREQ
TEND
TEND
1
0
9, 8InputDMA request 1 and 0: DMAC activation
0
,
94, 93OutputTransfer end 1 and 0: These signals
requests
indicate that the DMAC has ended a data
transfer
timer unit (ITU)
TCLKD to
TCLKA
TIOCA
TIOCA
96 to 93InputClock input D to A: External clock inputs16-bit integrated
to
4, 2, 99,
4
97, 95
0
Input/
output
Input capture/output compare A4 to A0:
GRA4 to GRA0 output compare or input
capture, or PWM output
TIOCB4 to
TIOCB
0
5, 3, 100,
98, 96
Input/
output
Input capture/output compare B4 to B0:
GRB4 to GRB0 output compare or input
capture, or PWM output
TOCXA
TOCXB
6OutputOutput compare XA4: PWM output
4
7OutputOutput compare XB4: PWM output
4
Section 1 Overview
RAS: Row address
RASRAS
CAS: Column
CASCAS
UCAS:
UCASUCAS
LCAS:
LCASLCAS
Rev. 3.00 Mar 21, 2006 page 15 of 814
REJ09B0302-0300
Page 44
Section 1 Overview
TypeSymbolPin No.I/OName and Function
Programmable
timing pattern
to TP09 to 2,
TP
15
100 to 93
OutputTPC output 15 to 0: Pulse output
controller (TPC)
Serial
communication
interface (SCI)
TxD1, TxD013, 12OutputTransmit data (channels 0 and 1):
SCI data output
, RxD015, 14InputReceive data (channels 0 and 1):
RxD
1
SCI data input
SCK1, SCK017, 16Input/
output
Serial clock (channels 0 and 1):
SCI clock input/output
A/D converterAN7 to AN085 to 78InputAnalog 7 to 0: Analog input pins
ADTRG9InputA/D trigger: External trigger input for
starting A/D conversion
D/A converterDA1, DA
85, 84OutputAnalog output: Analog output from the D/A
0
converter
A/D and D/A
converters
AV
CC
76InputPower supply pin for the A/D and D/A
converters. Connect to the system power
supply (+5 V) when not using the A/D and
D/A converters.
AV
SS
86InputGround pin for the A/D and D/A converters.
Connect to system ground (0 V).
V
REF
77InputReference voltage input pin for the A/D and
D/A converters. Connect to the system
power supply (+5 V) when not using the A/D
and D/A converters.
I/O portsP17 to P1043 to 36Input/
output
Port 1: Eight input/output pins.
The direction of each pin can be selected in
the port 1 data direction register (P1DDR).
P27 to P2052 to 45Input/
output
Port 2: Eight input/output pins.
The direction of each pin can be selected in
the port 2 data direction register (P2DDR).
P37 to P3034 to 27Input/
output
Port 3: Eight input/output pins.
The direction of each pin can be selected in
the port 3 data direction register (P3DDR).
P47 to P4026 to 23,
21 to 18
Input/
output
Port 4: Eight input/output pins.
The direction of each pin can be selected in
the port 4 data direction register (P4DDR).
Rev. 3.00 Mar 21, 2006 page 16 of 814
REJ09B0302-0300
Page 45
TypeSymbolPin No.I/OName and Function
I/O portsP5
to P5056 to 53Input/
3
output
Port 5: Four input/output pins. The direction
of each pin can be selected in the port 5
data direction register (P5DDR).
P66 to P6072 to 69,
60 to 58
Input/
output
Port 6: Seven input/output pins. The
direction of each pin can be selected in the
port 6 data direction register (P6DDR).
P77 to P7085 to 78InputPort 7: Eight input pins
P84 to P8091 to 87Input/
output
Port 8: Five input/output pins. The direction
of each pin can be selected in the port 8
data direction register (P8DDR).
P95 to P9017 to 12Input/
output
Port 9: Six input/output pins. The direction
of each pin can be selected in the port 9
data direction register (P9DDR).
PA7 to PA0100 to 93Input/
output
Port A: Eight input/output pins. The
direction of each pin can be selected in the
port A data direction register (PADDR).
PB7 to PB09 to 2Input/
output
Port B: Eight input/output pins. The
direction of each pin can be selected in the
port B data direction register (PBDDR).
Section 1 Overview
Rev. 3.00 Mar 21, 2006 page 17 of 814
REJ09B0302-0300
Page 46
Section 1 Overview
Rev. 3.00 Mar 21, 2006 page 18 of 814
REJ09B0302-0300
Page 47
Section 2 CPU
Section 2 CPU
2.1Overview
The H8/300H CPU is a high-speed central processing unit with an internal 32-bit architecture that
is upward-compatible with the H8/300 CPU. The H8/300H CPU has sixteen 16-bit general
registers, can address a 16-Mbyte linear address space, and is ideal for realtime control.
2.1.1Features
The H8/300H CPU has the following features.
• Upward compatibility with H8/300 CPU
Can execute H8/300 Series object programs
• General-register architecture
Sixteen 16-bit general registers (also usable as sixteen 8-bit registers or eight 32-bit registers)
• Sixty-two basic instructions
8/16/32-bit data transfer and arithmetic and logic instructions
Multiply and divide instructions
Powerful bit-manipulation instructions
• Eight addressing modes
Register direct [Rn]
Register indirect [@ERn]
Register indirect with displacement [@(d:16, ERn) or @(d:24, ERn)]
Register indirect with post-increment or pre-decrement [@ERn+ or @–ERn]
Absolute address [@aa:8, @aa:16, or @aa:24]
Immediate [#xx:8, #xx:16, or #xx:32]
Program-counter relative [@(d:8, PC) or @(d:16, PC)]
Memory indirect [@@aa:8]
• 16-Mbyte linear address space
• High-speed operation
All frequently-used instructions execute in two to four states
Maximum clock frequency:25 MHz
8/16/32-bit register-register add/subtract: 80 ns
8 × 8-bit register-register multiply:560 ns
16 ÷ 8-bit register-register divide:560 ns
• Two CPU operating modes
Normal mode (not available in the H8/3052BF)
Advanced mode
• Low-power mode
Transition to power-down state by SLEEP instruction
2.1.2Differences from H8/300 CPU
In comparison to the H8/300 CPU, the H8/300H has the following enhancements.
• More general registers
Eight 16-bit registers have been added.
• Expanded address space
Advanced mode supports a maximum 16-Mbyte address space.
Normal mode supports the same 64-kbyte address space as the H8/300 CPU.
(Normal mode is not available in the H8/3052BF.)
• Enhanced addressing
The addressing modes have been enhanced to make effective use of the 16-Mbyte address
space.
• Enhanced instructions
Data transfer, arithmetic, and logic instructions can operate on 32-bit data.
Signed multiply/divide instructions and other instructions have been added.
Rev. 3.00 Mar 21, 2006 page 20 of 814
REJ09B0302-0300
Page 49
Section 2 CPU
2.2CPU Operating Modes
The H8/300H CPU has two operating modes: normal and advanced. Normal mode supports a
maximum 64-kbyte address space. Advanced mode supports up to 16 Mbytes.
The H8/3052BF can be used only in advanced mode. (Information from this point on will apply to
advanced mode unless otherwise stated.)
CPU operating modes
Normal mode
Advanced mode
Maximum 64 kbytes, program
and data areas combined
Maximum 16 Mbytes, program
and data areas combined
Figure 2.1 CPU Operating Modes
Rev. 3.00 Mar 21, 2006 page 21 of 814
REJ09B0302-0300
Page 50
Section 2 CPU
2.3Address Space
The maximum address space of the H8/300H CPU is 16 Mbytes. The H8/3052BF has various
operating modes (MCU modes), some providing a 1-Mbyte address space, the others supporting
the full 16 Mbytes.
Figure 2.2 shows the address ranges of the H8/3052BF. For further details see section 3.6,
Memory Map in Each Operating Mode.
The 1-Mbyte operating modes use 20-bit addressing. The upper 4 bits of effective addresses are
ignored.
H'00000
H'FFFFF
H'000000
H'FFFFFF
a. 1-Mbyte modesb. 16-Mbyte modes
Figure 2.2 Memory Map
Rev. 3.00 Mar 21, 2006 page 22 of 814
REJ09B0302-0300
Page 51
Section 2 CPU
2.4Register Configuration
2.4.1Overview
The H8/300H CPU has the internal registers shown in figure 2.3. There are two types of registers:
general registers and control registers.
General Registers (ERn)
0707015
ER0
ER1
ER2
ER3
ER4
ER5
ER6
ER7
Control Registers (CR)
PC
E0
E1
E2
E3
E4
E5
E6
E7
230
(SP)
R0H
R1H
R2H
R3H
R4H
R5H
R6H
R7H
R0L
R1L
R2L
R3L
R4L
R5L
R6L
R7L
Legend:
Stack pointer
SP:
Program counter
PC:
Condition code register
CCR:
Interrupt mask bit
I:
User bit or interrupt mask bit
UI:
Half-carry flag
H:
User bit
U:
Negative flag
N:
Zero flag
Z:
Overflow flag
V:
Carry flag
C:
CCR
Figure 2.3 CPU Internal Registers
Rev. 3.00 Mar 21, 2006 page 23 of 814
7
6543210
IUIHUNZVC
REJ09B0302-0300
Page 52
Section 2 CPU
2.4.2General Registers
The H8/300H CPU has eight 32-bit general registers. These general registers are all functionally
alike and can be used without distinction between data registers and address registers. When a
general register is used as a data register, it can be accessed as a 32-bit, 16-bit, or 8-bit register.
When the general registers are used as 32-bit registers or as address registers, they are designated
by the letters ER (ER0 to ER7).
The ER registers divide into 16-bit general registers designated by the letters E (E0 to E7) and R
(R0 to R7). These registers are functionally equivalent, providing a maximum sixteen 16-bit
registers. The E registers (E0 to E7) are also referred to as extended registers.
The R registers divide into 8-bit general registers designated by the letters RH (R0H to R7H) and
RL (R0L to R7L). These registers are functionally equivalent, providing a maximum sixteen 8-bit
registers.
Figure 2.4 illustrates the usage of the general registers. The usage of each register can be selected
independently.
Rev. 3.00 Mar 21, 2006 page 24 of 814
REJ09B0302-0300
E registers
(extended registers)
E0 to E7
RH registers
R0H to R7H
R registers
R0 to R7
RL registers
R0L to R7L
Page 53
Section 2 CPU
General register ER7 has the function of stack pointer (SP) in addition to its general-register
function, and is used implicitly in exception handling and subroutine calls. Figure 2.5 shows the
stack.
Free area
SP (ER7)
Stack area
Figure 2.5 Stack
2.4.3Control Registers
The control registers are the 24-bit program counter (PC) and the 8-bit condition code register
(CCR).
Program Counter (PC): This 24-bit counter indicates the address of the next instruction the CPU
will execute. The length of all CPU instructions is 2 bytes (one word) or a multiple of 2 bytes, so
the least significant PC bit is ignored. When an instruction is fetched, the least significant PC bit is
regarded as 0.
Condition Code Register (CCR): This 8-bit register contains internal CPU status information,
including the interrupt mask bit (I) and half-carry (H), negative (N), zero (Z), overflow (V), and
carry (C) flags.
• Bit 7—Interrupt Mask Bit (I)
Masks interrupts other than NMI when set to 1. NMI is accepted regardless of the I bit setting.
The I bit is set to 1 at the start of an exception-handling sequence.
• Bit 6—User Bit or Interrupt Mask Bit (UI)
Can be written and read by software using the LDC, STC, ANDC, ORC, and XORC
instructions. This bit can also be used as an interrupt mask bit. For details see section 5,
Interrupt Controller.
• Bit 5—Half-Carry Flag (H)
When the ADD.B, ADDX.B, SUB.B, SUBX.B, CMP.B, or NEG.B instruction is executed,
this flag is set to 1 if there is a carry or borrow at bit 3, and cleared to 0 otherwise. When the
ADD.W, SUB.W, CMP.W, or NEG.W instruction is executed, the H flag is set to 1 if there is a
Rev. 3.00 Mar 21, 2006 page 25 of 814
REJ09B0302-0300
Page 54
Section 2 CPU
carry or borrow at bit 11, and cleared to 0 otherwise. When the ADD.L, SUB.L, CMP.L, or
NEG.L instruction is executed, the H flag is set to 1 if there is a carry or borrow at bit 27, and
cleared to 0 otherwise.
• Bit 4—User Bit (U)
Can be written and read by software using the LDC, STC, ANDC, ORC, and XORC
instructions.
• Bit 3—Negative Flag (N)
Indicates the most significant bit (sign bit) of data.
• Bit 2—Zero Flag (Z)
Set to 1 to indicate zero data, and cleared to 0 to indicate non-zero data.
• Bit 1—Overflow Flag (V)
Set to 1 when an arithmetic overflow occurs, and cleared to 0 at other times.
• Bit 0—Carry Flag (C)
Set to 1 when a carry occurs, and cleared to 0 otherwise. Used by:
Add instructions, to indicate a carry
Subtract instructions, to indicate a borrow
Shift and rotate instructions, to store the value shifted out of the end bit
The carry flag is also used as a bit accumulator by bit manipulation instructions.
Some instructions leave flag bits unchanged. Operations can be performed on CCR by the LDC,
STC, ANDC, ORC, and XORC instructions. The N, Z, V, and C flags are used by conditional
branch (Bcc) instructions.
For the action of each instruction on the flag bits, see appendix A.1, Instruction List. For the I and
UI bits, see section 5, Interrupt Controller.
2.4.4Initial CPU Register Values
In reset exception handling, PC is initialized to a value loaded from the vector table, and the I bit
in CCR is set to 1. The other CCR bits and the general registers are not initialized. The initial
value of the stack pointer (ER7) is undefined. The stack pointer must therefore be initialized by an
MOV.L instruction executed immediately after a reset.
Rev. 3.00 Mar 21, 2006 page 26 of 814
REJ09B0302-0300
Page 55
Section 2 CPU
2.5Data Formats
The H8/300H CPU can process 1-bit, 4-bit (BCD), 8-bit (byte), 16-bit (word), and 32-bit
(longword) data. Bit-manipulation instructions operate on 1-bit data by accessing bit n (n = 0, 1, 2,
…, 7) of byte operand data. The DAA and DAS decimal-adjust instructions treat byte data as two
digits of 4-bit BCD data.
2.5.1General Register Data Formats
Figure 2.6 shows the data formats in general registers.
Data TypeData Format
1-bit data
1-bit data
4-bit BCD data
4-bit BCD data
Byte data
Byte data
General
Register
RnH
RnL
RnH
RnL
RnH
RnL
70
6543210
7
Don’t care
43
70
Don’t care
70
MSBLSB
Don’t care
Figure 2.6 General Register Data Formats (1)
70
76543210
Lower digitUpper digit
7
70
MSBLSB
Don’t care
Don’t care
43
Lower digitUpper digit
Don’t care
0
Rev. 3.00 Mar 21, 2006 page 27 of 814
REJ09B0302-0300
Page 56
Section 2 CPU
Word data
Word data
Longword data
Legend:
ERn:
General register
En:
General register E
Rn:
General register R
RnH:
General register RH
RnL:
General register RL
MSB:
Most significant bit
LSB:
Least significant bit
General
RegisterData TypeData Format
Rn
150
En
MSBLSB
3116
ERn
MSB
Figure 2.6 General Register Data Formats (2)
150
MSBLSB
150
LSB
Rev. 3.00 Mar 21, 2006 page 28 of 814
REJ09B0302-0300
Page 57
Section 2 CPU
2.5.2Memory Data Formats
Figure 2.7 shows the data formats on memory. The H8/300H CPU can access word data and
longword data on memory, but word or longword data must begin at an even address. If an attempt
is made to access word or longword data at an odd address, no address error occurs but the least
significant bit of the address is regarded as 0, so the access starts at the preceding address. This
also applies to instruction fetches.
AddressData TypeData Format
70
1-bit data
76543210Address L
Byte data
Word data
Longword data
Address L
Address 2M
Address 2M + 1
Address 2N
Address 2N + 1
MSBLSB
MSB
LSB
MSB
Address 2N + 2
Address 2N + 3
LSB
Figure 2.7 Memory Data Formats
When ER7 (SP) is used as an address register to access the stack, the operand size should be word
size or longword size.
Rev. 3.00 Mar 21, 2006 page 29 of 814
REJ09B0302-0300
Page 58
Section 2 CPU
2.6Instruction Set
2.6.1Instruction Set Overview
The H8/300H CPU has 62 types of instructions, which are classified in table 2.1.
Note: * General registers include 8-bit registers (R0H to R7H, R0L to R7L), 16-bit registers (R0 to
R7, E0 to E7), and 32-bit data or address registers (ER0 to ER7).
*
*
*
Rev. 3.00 Mar 21, 2006 page 32 of 814
REJ09B0302-0300
Page 61
Table 2.3Data Transfer Instructions
Section 2 CPU
InstructionSize
MOVB/W/L(EAs) → Rd, Rs → (EAd)
MOVFPEB(EAs) → Rd
MOVTPEBRs → (EAs)
POPW/L@SP+ → Rn
PUSHW/LRn → @–SP
Note: * Size refers to the operand size.
B: Byte
W: Word
L: Longword
*
Function
Moves data between two general registers or between a general
register and memory, or moves immediate data to a general register.
Cannot be used in the H8/3052BF.
Cannot be used in the H8/3052BF.
Pops a general register from the stack. POP.W Rn is identical to
MOV.W @SP+, Rn. Similarly, POP.L ERn is identical to MOV.L
@SP+, ERn.
Pushes a general register onto the stack. PUSH.W Rn is identical to
MOV.W Rn, @–SP. Similarly, PUSH.L ERn is identical to MOV.L
ERn, @–SP.
Rev. 3.00 Mar 21, 2006 page 33 of 814
REJ09B0302-0300
Page 62
Section 2 CPU
Table 2.4Arithmetic Operation Instructions
InstructionSize
ADD, SUBB/W/LRd ± Rs → Rd, Rd ± #IMM → Rd
ADDX, SUBXBRd ± Rs ± C → Rd, Rd ± #IMM ± C → Rd
INC, DECB/W/LRd ± 1 → Rd, Rd ± 2 → Rd
ADDS, SUBSLRd ± 1 → Rd, Rd ± 2 → Rd, Rd ± 4 → Rd
DAA, DASBRd decimal adjust → Rd
MULXUB/WRd × Rs → Rd
MULXSB/WRd × Rs → Rd
*
Function
Performs addition or subtraction on data in two general registers, or
on immediate data and data in a general register. (Immediate byte
data cannot be subtracted from data in a general register. Use the
SUBX or ADD instruction.)
Performs addition or subtraction with carry or borrow on data in two
general registers, or on immediate data and data in a general
register.
Increments or decrements a general register by 1 or 2. (Byte
operands can be incremented or decremented by 1 only.)
Adds or subtracts the value 1, 2, or 4 to or from data in a 32-bit
register.
Decimal-adjusts an addition or subtraction result in a general register
by referring to CCR to produce 4-bit BCD data.
Performs unsigned multiplication on data in two general registers:
either 8 bits × 8 bits → 16 bits or 16 bits × 16 bits → 32 bits.
Performs signed multiplication on data in two general registers:
either 8 bits × 8 bits → 16 bits or 16 bits × 16 bits → 32 bits.
Rev. 3.00 Mar 21, 2006 page 34 of 814
REJ09B0302-0300
Page 63
Section 2 CPU
InstructionSize
DIVXUB/WRd ÷ Rs → Rd
DIVXSB/WRd ÷ Rs → Rd
CMPB/W/LRd – Rs, Rd – #IMM
NEGB/W/L0 – Rd → Rd
EXTSW/LRd (sign extension) → Rd
EXTUW/LRd (zero extension) → Rd
Note: * Size refers to the operand size.
B: Byte
W: Word
L: Longword
*
Function
Performs unsigned division on data in two general registers: either
16 bits ÷ 8 bits → 8-bit quotient and 8-bit remainder or 32 bits ÷ 16
bits → 16-bit quotient and 16-bit remainder.
Performs signed division on data in two general registers: either 16
bits ÷ 8 bits → 8-bit quotient and 8-bit remainder, or 32 bits ÷ 16 bits
→ 16-bit quotient and 16-bit remainder.
Compares data in a general register with data in another general
register or with immediate data, and sets CCR according to the
result.
Takes the two’s complement (arithmetic complement) of data in a
general register.
Extends byte data in the lower 8 bits of a 16-bit register to word data,
or extends word data in the lower 16 bits of a 32-bit register to
longword data, by extending the sign bit.
Extends byte data in the lower 8 bits of a 16-bit register to word data,
or extends word data in the lower 16 bits of a 32-bit register to
longword data, by padding with zeros.
Rev. 3.00 Mar 21, 2006 page 35 of 814
REJ09B0302-0300
Page 64
Section 2 CPU
Table 2.5Logic Operation Instructions
InstructionSize
ANDB/W/LRd ∧ Rs → Rd, Rd ∧ #IMM → Rd
ORB/W/LRd ∨ Rs → Rd, Rd ∨ #IMM → Rd
XORB/W/LRd ⊕ Rs → Rd, Rd ⊕ #IMM → Rd
NOTB/W/L¬ Rd → Rd
Note: * Size refers to the operand size.
B: Byte
W: Word
L: Longword
*
Function
Performs a logical AND operation on a general register and another
general register or immediate data.
Performs a logical OR operation on a general register and another
general register or immediate data.
Performs a logical exclusive OR operation on a general register and
another general register or immediate data.
Takes the one’s complement of general register contents.
Table 2.6Shift Instructions
InstructionSize
SHAL,
SHAR
SHLL,
SHLR
ROTL,
ROTR
ROTXL,
ROTXR
Note: * Size refers to the operand size.
B: Byte
W: Word
L: Longword
*
B/W/LRd (shift) → Rd
B/W/LRd (shift) → Rd
B/W/LRd (rotate) → Rd
B/W/LRd (rotate) → Rd
Function
Performs an arithmetic shift on general register contents.
Performs a logical shift on general register contents.
Rotates general register contents.
Rotates general register contents through the carry bit.
Rev. 3.00 Mar 21, 2006 page 36 of 814
REJ09B0302-0300
Page 65
Table 2.7Bit Manipulation Instructions
Section 2 CPU
InstructionSize
BSETB1 → (<bit-No.> of <EAd>)
BCLRB0 → (<bit-No.> of <EAd>)
BNOTB¬ (<bit-No.> of <EAd>) → (<bit-No.> of <EAd>)
BTSTB¬ (<bit-No.> of <EAd>) → Z
BANDBC ∧ (<bit-No.> of <EAd>) → C
BIANDBC ∧ [¬ (<bit-No.> of <EAd>)] → C
*
Function
Sets a specified bit in a general register or memory operand to 1.
The bit number is specified by 3-bit immediate data or the lower 3
bits of a general register.
Clears a specified bit in a general register or memory operand to 0.
The bit number is specified by 3-bit immediate data or the lower 3
bits of a general register.
Inverts a specified bit in a general register or memory operand. The
bit number is specified by 3-bit immediate data or the lower 3 bits of
a general register.
Tests a specified bit in a general register or memory operand and
sets or clears the Z flag accordingly. The bit number is specified by
3-bit immediate data or the lower 3 bits of a general register.
ANDs the carry flag with a specified bit in a general register or
memory operand and stores the result in the carry flag.
ANDs the carry flag with the inverse of a specified bit in a general
register or memory operand and stores the result in the carry flag.
The bit number is specified by 3-bit immediate data.
Rev. 3.00 Mar 21, 2006 page 37 of 814
REJ09B0302-0300
Page 66
Section 2 CPU
InstructionSize
BORBC ∨ (<bit-No.> of <EAd>) → C
BIORBC ∨ [¬ (<bit-No.> of <EAd>)] → C
BXORBC ⊕ (<bit-No.> of <EAd>) → C
BIXORBC ⊕ [¬ (<bit-No.> of <EAd>)] → C
BLDB(<bit-No.> of <EAd>) → C
BILDB¬ (<bit-No.> of <EAd>) → C
BSTBC → (<bit-No.> of <EAd>)
BISTBC → ¬ (<bit-No.> of <EAd>)
Note: * Size refers to the operand size.
B: Byte
*
Function
ORs the carry flag with a specified bit in a general register or
memory operand and stores the result in the carry flag.
ORs the carry flag with the inverse of a specified bit in a general
register or memory operand and stores the result in the carry flag.
The bit number is specified by 3-bit immediate data.
Exclusive-ORs the carry flag with a specified bit in a general register
or memory operand and stores the result in the carry flag.
Exclusive-ORs the carry flag with the inverse of a specified bit in a
general register or memory operand and stores the result in the carry
flag.
The bit number is specified by 3-bit immediate data.
Transfers a specified bit in a general register or memory operand to
the carry flag.
Transfers the inverse of a specified bit in a general register or
memory operand to the carry flag.
The bit number is specified by 3-bit immediate data.
Transfers the carry flag value to a specified bit in a general register
or memory operand.
Transfers the inverse of the carry flag value to a specified bit in a
general register or memory operand.
The bit number is specified by 3-bit immediate data.
Rev. 3.00 Mar 21, 2006 page 38 of 814
REJ09B0302-0300
Page 67
Section 2 CPU
Table 2.8Branching Instructions
InstructionSizeFunction
Bcc—Branches to a specified address if a specified condition is true. The
branching conditions are listed below.
MnemonicDescriptionCondition
BRA (BT)Always (true)Always
BRN (BF)Never (false)Never
BHIHighC ∨ Z = 0
BLSLow or sameC ∨ Z = 1
Bcc (BHS)Carry clear (high or same)C = 0
BCS (BLO)Carry set (low)C = 1
BNENot equalZ = 0
BEQEqualZ = 1
BVCOverflow clearV = 0
BVSOverflow setV = 1
BPLPlusN = 0
BMIMinusN = 1
BGEGreater or equalN ⊕ V = 0
BLTLess thanN ⊕ V = 1
BGTGreater thanZ ∨ (N ⊕ V) = 0
BLELess or equalZ ∨ (N ⊕ V) = 1
JMP—Branches unconditionally to a specified address
BSR—Branches to a subroutine at a specified address
JSR—Branches to a subroutine at a specified address
RTS—Returns from a subroutine
Rev. 3.00 Mar 21, 2006 page 39 of 814
REJ09B0302-0300
Page 68
Section 2 CPU
Table 2.9System Control Instructions
InstructionSize
TRAPA—Starts trap-instruction exception handling
RTE—Returns from an exception-handling routine
SLEEP—Causes a transition to the power-down state
LDCB/W(EAs) → CCR
STCB/WCCR → (EAd)
ANDCBCCR ∧ #IMM → CCR
ORCBCCR ∨ #IMM → CCR
XORCBCCR ⊕ #IMM → CCR
NOP—PC + 2 → PC
Note: * Size refers to the operand size.
B: Byte
W: Word
*
Function
Moves the source operand contents to the condition code register.
The condition code register size is one byte, but in transfer from
memory, data is read by word access.
Transfers the CCR contents to a destination location. The condition
code register size is one byte, but in transfer to memory, data is
written by word access.
Logically ANDs the condition code register with immediate data.
Logically ORs the condition code register with immediate data.
Logically exclusive-ORs the condition code register with immediate
data.
Only increments the program counter.
Rev. 3.00 Mar 21, 2006 page 40 of 814
REJ09B0302-0300
Page 69
Table 2.10 Block Transfer Instruction
InstructionSizeFunction
EEPMOV.B—if R4L ≠ 0 then
repeat @ER5+ → @ER6+, R4L – 1 → R4L
untilR4L = 0
else next;
EEPMOV.W—if R4 ≠ 0 then
repeat @ER5+ → @ER6+, R4 – 1 → R4
untilR4 = 0
else next;
Transfers a data block according to parameters set in general
registers R4L or R4, ER5, and ER6.
R4L or R4: Size of block (bytes)
ER5:Starting source address
ER6:Starting destination address
Execution of the next instruction begins as soon as the transfer is
completed.
Section 2 CPU
Rev. 3.00 Mar 21, 2006 page 41 of 814
REJ09B0302-0300
Page 70
Section 2 CPU
2.6.4Basic Instruction Formats
The H8/300H instructions consist of 2-byte (1-word) units. An instruction consists of an operation
field (OP field), a register field (r field), an effective address extension (EA field), and a condition
field (cc).
Operation Field: Indicates the function of the instruction, the addressing mode, and the operation
to be carried out on the operand. The operation field always includes the first 4 bits of the
instruction. Some instructions have two operation fields.
Register Field: Specifies a general register. Address registers are specified by 3 bits, data registers
by 3 bits or 4 bits. Some instructions have two register fields. Some have no register field.
Effective Address Extension: Eight, 16, or 32 bits specifying immediate data, an absolute
address, or a displacement. A 24-bit address or displacement is treated as 32-bit data in which the
first 8 bits are 0 (H'00).
Condition Field: Specifies the branching condition of Bcc instructions.
Figure 2.8 shows examples of instruction formats.
Operation field only
op
Operation field and register fields
oprnrm
Operation field, register fields, and effective address extension
oprnrm
EA (disp)
Operation field, effective address extension, and condition field
opccEA (disp)
Figure 2.8 Instruction Formats
Rev. 3.00 Mar 21, 2006 page 42 of 814
REJ09B0302-0300
NOP, RTS, etc.
ADD.B Rn, Rm, etc.
MOV.B @(d:16, Rn), Rm
BRA d:8
Page 71
Section 2 CPU
2.6.5Notes on Use of Bit Manipulation Instructions
The BSET, BCLR, BNOT, BST, and BIST instructions read a byte of data, modify a bit in the
byte, then write the byte back. Care is required when these instructions are used to access registers
with write-only bits, or to access ports.
The BCLR instruction can be used to clear flags in the on-chip registers. In an interrupt-handling
routine, for example, if it is known that the flag is set to 1, it is not necessary to read the flag ahead
of time.
StepDescription
1ReadRead data (byte unit) at the specified address
2Bit manipulationModify the specified bit in the read data
3WriteWrite the modified data (byte unit) to the specified address
In the following example, a BCLR instruction is executed on the data direction register (DDR) of
port 4.
and P46 are set as input pins, and are inputting low-level and high-level signals, respectively.
P4
7
P4
to P40 are set as output pins, and are in the low-level output state.
5
In this example, the BCLR instruction is used to make P4
To execute the BCLR instruction, the CPU begins by reading P4DDR. Since P4DDR is a writeonly register, it is read as H'FF, even though its true value is H'3F.
Next the CPU clears bit 0 of the read data, changing the value to H'FE.
Finally, the CPU writes this value (H'FE) back to DDR to complete the BCLR instruction.
As a result, P4
are set to 1, making P4
DDR is cleared to 0, making P40 an input pin. In addition, P47DDR and P46DDR
0
and P46 output pins.
7
The BCLR instruction can be used to clear flags in the internal I/O registers to 0. In an interrupthandling routine, for example, if it is known that the flag is set to 1, it is not necessary to read the
flag ahead of time.
2.7Addressing Modes and Effective Address Calculation
2.7.1Addressing Modes
The H8/300H CPU supports the eight addressing modes listed in table 2.11. Each instruction uses
a subset of these addressing modes. Arithmetic and logic instructions can use the register direct
and immediate modes. Data transfer instructions can use all addressing modes except programcounter relative and memory indirect. Bit manipulation instructions use register direct, register
indirect, or absolute (@aa:8) addressing mode to specify an operand, and register direct (BSET,
BCLR, BNOT, and BTST instructions) or immediate (3-bit) addressing mode to specify a bit
number in the operand.
Table 2.11 Addressing Modes
No.Addressing ModeSymbol
1Register directRn
2Register indirect@ERn
3Register indirect with displacement@(d:16, ERn)/@(d:24, ERn)
4Register indirect with post-increment
Register indirect with pre-decrement
5Absolute address@aa:8/@aa:16/@aa:24
6Immediate#xx:8/#xx:16/#xx:32
7Program-counter relative@(d:8, PC)/@(d:16, PC)
8Memory indirect@@aa:8
@ERn+
@–ERn
Rev. 3.00 Mar 21, 2006 page 44 of 814
REJ09B0302-0300
Page 73
Section 2 CPU
Register Direct—Rn: The register field of the instruction code specifies an 8-, 16-, or 32-bit
register containing the operand. R0H to R7H and R0L to R7L can be specified as 8-bit registers.
R0 to R7 and E0 to E7 can be specified as 16-bit registers. ER0 to ER7 can be specified as 32-bit
registers.
Register Indirect—@ERn: The register field of the instruction code specifies an address register
(ERn), the lower 24 bits of which contain the address of the operand.
Register Indirect with Displacement—@(d:16, ERn) or @(d:24, ERn): A 16-bit or 24-bit
displacement contained in the instruction code is added to the contents of an address register
(ERn) specified by the register field of the instruction, and the lower 24 bits of the sum specify the
address of a memory operand. A 16-bit displacement is sign-extended when added.
Register Indirect with Post-Increment or Pre-Decrement—@ERn+ or @–ERn:
• Register indirect with post-increment—@ERn+
The register field of the instruction code specifies an address register (ERn) the lower 24 bits
of which contain the address of a memory operand. After the operand is accessed, 1, 2, or 4 is
added to the address register contents (32 bits) and the sum is stored in the address register.
The value added is 1 for byte access, 2 for word access, or 4 for longword access. For word or
longword access, the register value should be even.
• Register indirect with pre-decrement—@–ERn
The value 1, 2, or 4 is subtracted from an address register (ERn) specified by the register field
in the instruction code, and the lower 24 bits of the result become the address of a memory
operand. The result is also stored in the address register. The value subtracted is 1 for byte
access, 2 for word access, or 4 for longword access. For word or longword access, the resulting
register value should be even.
Absolute Address—@aa:8, @aa:16, or @aa:24: The instruction code contains the absolute
address of a memory operand. The absolute address may be 8 bits long (@aa:8), 16 bits long
(@aa:16), or 24 bits long (@aa:24). For an 8-bit absolute address, the upper 16 bits are all
assumed to be 1 (H'FFFF). For a 16-bit absolute address the upper 8 bits are a sign extension. A
24-bit absolute address can access the entire address space. Table 2.12 indicates the accessible
address ranges.
Rev. 3.00 Mar 21, 2006 page 45 of 814
REJ09B0302-0300
Page 74
Section 2 CPU
Table 2.12 Absolute Address Access Ranges
Absolute Address1-Mbyte Modes16-Mbyte Modes
8 bits (@aa:8)H'FFF00 to H'FFFFF
(1048320 to 1048575)
16 bits (@aa:16)H'00000 to H'07FFF,
H'F8000 to H'FFFFF
(0 to 32767, 1015808 to 1048575)
24 bits (@aa:24)H'00000 to H'FFFFF
(0 to 1048575)
H'FFFF00 to H'FFFFFF
(16776960 to 16777215)
H'000000 to H'007FFF,
H'FF8000 to H'FFFFFF
(0 to 32767, 16744448 to 16777215)
H'000000 to H'FFFFFF
(0 to 16777215)
Immediate—#xx:8, #xx:16, or #xx:32: The instruction code contains 8-bit (#xx:8), 16-bit
(#xx:16), or 32-bit (#xx:32) immediate data as an operand.
The instruction codes of the ADDS, SUBS, INC, and DEC instructions contain immediate data
implicitly. The instruction codes of some bit manipulation instructions contain 3-bit immediate
data specifying a bit number. The TRAPA instruction code contains 2-bit immediate data
specifying a vector address.
Program-Counter Relative—@(d:8, PC) or @(d:16, PC): This mode is used in the Bcc and
BSR instructions. An 8-bit or 16-bit displacement contained in the instruction code is signextended to 24 bits and added to the 24-bit PC contents to generate a 24-bit branch address. The
PC value to which the displacement is added is the address of the first byte of the next instruction,
so the possible branching range is –126 to +128 bytes (–63 to +64 words) or –32766 to +32768
bytes (–16383 to +16384 words) from the branch instruction. The resulting value should be an
even number.
Memory Indirect—@@aa:8: This mode can be used by the JMP and JSR instructions. The
instruction code contains an 8-bit absolute address specifying a memory operand. This memory
operand contains a branch address. The memory operand is accessed by longword access. The first
byte of the memory operand is ignored, generating a 24-bit branch address. See figure 2.9. The
upper bits of the 8-bit absolute address are assumed to be 0 (H'0000), so the address range is 0 to
255 (H'000000 to H'0000FF). Note that the first part of this range is also the exception vector area.
For further details see section 5, Interrupt Controller.
Rev. 3.00 Mar 21, 2006 page 46 of 814
REJ09B0302-0300
When a word-size or longword-size memory operand is specified, or when a branch address is
specified, if the specified memory address is odd, the least significant bit is regarded as 0. The
accessed data or instruction code therefore begins at the preceding address. See section 2.5.2,
Memory Data Formats.
2.7.2Effective Address Calculation
Table 2.13 explains how an effective address is calculated in each addressing mode. In the
1-Mbyte operating modes the upper 4 bits of the calculated address are ignored in order to
generate a 20-bit effective address.
Rev. 3.00 Mar 21, 2006 page 47 of 814
REJ09B0302-0300
Page 76
Section 2 CPU
Table 2.13 Effective Address Calculation
No.
Addressing Mode and
Instruction Format
Effective Address
Calculation
1Register direct (Rn)
op rm rn
2Register indirect (@ERn)
310
rop
3Register indirect with displacement
@(d:16, ERn)/@(d:24, ERn)
310
opr
disp
Sign extensiondisp
4Register indirect with post-increment
or pre-decrement
Register indirect with post-increment
@ERn+
310
General register contents
General register contents
General register contents
Effective Address
Operand is general
register contents
23
230
23
0
0
op
r
Register indirect with pre-decrement
@–ERn
op
r
Rev. 3.00 Mar 21, 2006 page 48 of 814
REJ09B0302-0300
1, 2, or 4
310
General register contents
1, 2, or 4
1 for a byte operand, 2 for a word
operand, 4 for a longword operand
230
Page 77
Section 2 CPU
Addressing Mode and
Instruction Format
No.
5Absolute address
@aa:8
opabs
@aa:16
op
@aa:24
op
abs
6Immediate
#xx:8, #xx:16, or #xx:32
op
abs
IMM
Effective Address
Calculation
Effective Address
23
23
Sign
exten-
sion
23
H'FFFF
08 7
016 15
0
Operand is immediate
data
7Program-counter relative
@(d:8, PC) or @(d:16, PC)
opdisp
23
Sign
exten-
sion
PC contents
disp
0
23
0
Rev. 3.00 Mar 21, 2006 page 49 of 814
REJ09B0302-0300
Page 78
Section 2 CPU
Addressing Mode and
No.
Instruction Format
8Memory indirect @@aa:8
· Normal mode
op
abs
· Advanced mode
op
abs
Effective Address
Calculation
238 7
H'0000
15
Memory contents
238 7
H'0000
31
Memory contents
abs
abs
Effective Address
0
0
0
0
0
0
23
23
16 15
H'00
0
0
Legend:
r, rm, rn: Register field
op:Operation field
disp:Displacement
IMM:Immediate data
abs:Absolute address
Rev. 3.00 Mar 21, 2006 page 50 of 814
REJ09B0302-0300
Page 79
Section 2 CPU
2.8Processing States
2.8.1Overview
The H8/300H CPU has five processing states: the program execution state, exception-handling
state, power-down state, reset state, and bus-released state. The power-down state includes sleep
mode, software standby mode, and hardware standby mode. Figure 2.10 classifies the processing
states. Figure 2.12 indicates the state transitions.
Processing statesProgram execution state
The CPU executes program instructions in sequence
Exception-handling state
A transient state in which the CPU executes a hardware sequence
(saving PC and CCR, fetching a vector, etc.) in response to a reset,
interrupt, or other exception
Bus-released state
The external bus has been released in response to a bus request
signal from a bus master other than the CPU
Reset state
The CPU and all on-chip supporting modules are initialized and halted
Power-down state
The CPU is halted to conserve power
Sleep mode
Software standby mode
Hardware standby mode
Figure 2.10 Processing States
Rev. 3.00 Mar 21, 2006 page 51 of 814
REJ09B0302-0300
Page 80
Section 2 CPU
2.8.2Program Execution State
In this state the CPU executes program instructions in normal sequence.
2.8.3Exception-Handling State
The exception-handling state is a transient state that occurs when the CPU alters the normal
program flow due to a reset, interrupt, or trap instruction. The CPU fetches a starting address from
the exception vector table and branches to that address. In interrupt and trap exception handling
the CPU references the stack pointer (ER7) and saves the program counter and condition code
register.
Types of Exception Handling and Their Priority: Exception handling is performed for resets,
interrupts, and trap instructions. Table 2.14 indicates the types of exception handling and their
priority. Trap instruction exceptions are accepted at all times in the program execution state.
Table 2.14 Exception Handling Types and Priority
Type of
Priority
High
↑
Low
Note: * Interrupts are not detected at the end of the ANDC, ORC, XORC, and LDC instructions, or
ExceptionDetection TimingStart of Exception Handling
ResetSynchronized with clockException handling starts immediately
when RES changes from low to high
InterruptEnd of instruction
execution or end of
exception handling
Trap instructionWhen TRAPA instruction
is executed
immediately after reset exception handling.
*
When an interrupt is requested,
exception handling starts at the end of
the current instruction or current
exception-handling sequence
Exception handling starts when a trap
(TRAPA) instruction is executed
Figure 2.11 classifies the exception sources. For further details about exception sources, vector
numbers, and vector addresses, see section 4, Exception Handling, and section 5, Interrupt
Controller.
Rev. 3.00 Mar 21, 2006 page 52 of 814
REJ09B0302-0300
Notes: 1.2.From any state except hardware standby mode, a transition to the reset state occurs
whenever goes low.
From any state, a transition to hardware standby mode occurs when goes low.
*1
RES
Program execution state
Bus
request
Exception
Interrupt
NMI, IRQ , IRQ ,
or IRQ interrupt
STBY = High, = Low
01
2
RES
SLEEP
instruction
with SSBY = 0
Sleep mode
SLEEP instruction
with SSBY = 1
Software standby mode
Hardware standby mode
Power-down state
STBY
*2
Figure 2.12 State Transitions
Rev. 3.00 Mar 21, 2006 page 53 of 814
REJ09B0302-0300
Page 82
Section 2 CPU
2.8.4Exception-Handling Sequences
Reset Exception Handling: Reset exception handling has the highest priority. The reset state is
entered when the RES signal goes low. Reset exception handling starts after that, when RES
changes from low to high. When reset exception handling starts the CPU fetches a start address
from the exception vector table and starts program execution from that address. All interrupts,
including NMI, are disabled during the reset exception-handling sequence and immediately after it
ends.
Interrupt Exception Handling and Trap Instruction Exception Handling: When these
exception-handling sequences begin, the CPU references the stack pointer (ER7) and pushes the
program counter and condition code register on the stack. Next, if the UE bit in the system control
register (SYSCR) is set to 1, the CPU sets the I bit in the condition code register to 1. If the UE bit
is cleared to 0, the CPU sets both the I bit and the UI bit in the condition code register to 1. Then
the CPU fetches a start address from the exception vector table and execution branches to that
address.
Figure 2.13 shows the stack after the exception-handling sequence.
SP–4
SP–3
SP–2
SP–1
SP (ER7)
Legend:
CCR:
Condition code register
SP:
Stack pointer
Notes: 1.2.PC is the address of the first instruction executed after the return from the
exception-handling routine.
Registers must be saved and restored by word access or longword access,
starting at an even address.
Stack area
Before exception
handling starts
SP (ER7)
SP+1
SP+2
SP+3
SP+4
Pushed on stack
After exception
handling ends
Figure 2.13 Stack Structure after Exception Handling
Rev. 3.00 Mar 21, 2006 page 54 of 814
REJ09B0302-0300
CCR
PC
Even
address
Page 83
Section 2 CPU
2.8.5Bus-Released State
In this state the bus is released to a bus master other than the CPU, in response to a bus request.
The bus masters other than the CPU are the DMA controller, the refresh controller, and an external
bus master. While the bus is released, the CPU halts except for internal operations. Interrupt
requests are not accepted. For details see section 6.3.7, Bus Arbiter Operation.
2.8.6Reset State
When the RES input goes low all current processing stops and the CPU enters the reset state. The I
bit in the condition code register is set to 1 by a reset. All interrupts are masked in the reset state.
Reset exception handling starts when the RES signal changes from low to high.
The reset state can also be entered by a watchdog timer overflow. For details see section 12,
Watchdog Timer.
2.8.7Power-Down State
In the power-down state the CPU stops operating to conserve power. There are three modes: sleep
mode, software standby mode, and hardware standby mode.
Sleep Mode: A transition to sleep mode is made if the SLEEP instruction is executed while the
SSBY bit is cleared to 0 in the system control register (SYSCR). CPU operations stop
immediately after execution of the SLEEP instruction, but the contents of CPU registers are
retained.
Software Standby Mode: A transition to software standby mode is made if the SLEEP
instruction is executed while the SSBY bit is set to 1 in SYSCR. The CPU and clock halt and all
on-chip supporting modules stop operating. The on-chip supporting modules are reset, but as long
as a specified voltage is supplied the contents of CPU registers and on-chip RAM are retained.
The I/O ports also remain in their existing states.
Hardware Standby Mode: A transition to hardware standby mode is made when the STBY input
goes low. As in software standby mode, the CPU and all clocks halt and the on-chip supporting
modules are reset, but as long as a specified voltage is supplied, on-chip RAM contents are
retained.
For further information see section 20, Power-Down State.
Rev. 3.00 Mar 21, 2006 page 55 of 814
REJ09B0302-0300
Page 84
Section 2 CPU
2.9Basic Operational Timing
2.9.1Overview
The H8/300H CPU operates according to the system clock (φ). The interval from one rise of the
system clock to the next rise is referred to as a “state.” A memory cycle or bus cycle consists of
two or three states. The CPU uses different methods to access on-chip memory, the on-chip
supporting modules, and the external address space. Access to the external address space can be
controlled by the bus controller.
2.9.2On-Chip Memory Access Timing
On-chip memory is accessed in two states. The data bus is 16 bits wide, permitting both byte and
word access. Figure 2.14 shows the on-chip memory access cycle. Figure 2.15 indicates the pin
states.
Bus cycle
φ
Internal address bus
Internal read signal
Internal data bus
(read access)
Internal write signal
Internal data bus
(write access)
Figure 2.14 On-Chip Memory Access Cycle
T state
1
Address
Read data
Write data
T state
2
Rev. 3.00 Mar 21, 2006 page 56 of 814
REJ09B0302-0300
Page 85
Section 2 CPU
T
1
T
2
φ
Address bus
RD HWR LWR
, , ,AS
High
Address
High impedance
D to D
150
Figure 2.15 Pin States during On-Chip Memory Access
2.9.3On-Chip Supporting Module Access Timing
The on-chip supporting modules are accessed in three states. The data bus is 8 or 16 bits wide,
depending on the register being accessed. Figure 2.16 shows the on-chip supporting module access
timing. Figure 2.17 indicates the pin states.
Bus cycle
Read
access
Write
access
φ
Address bus
Internal read signal
Internal data bus
Internal write signal
Internal data bus
T state
1
T state
2
Address
Read data
Write data
Figure 2.16 Access Cycle for On-Chip Supporting Modules
Rev. 3.00 Mar 21, 2006 page 57 of 814
T state
3
REJ09B0302-0300
Page 86
Section 2 CPU
T
3
φ
Address bus
RD HWR LWR
, , ,AS
D to D
150
High
T
1
T
2
Address
High impedance
Figure 2.17 Pin States during Access to On-Chip Supporting Modules
2.9.4Access to External Address Space
The external address space is divided into eight areas (areas 0 to 7). Bus-controller settings
determine whether each area is accessed via an 8-bit or 16-bit bus, and whether it is accessed in
two or three states. For details see section 6, Bus Controller.
Rev. 3.00 Mar 21, 2006 page 58 of 814
REJ09B0302-0300
Page 87
Section 3 MCU Operating Modes
Section 3 MCU Operating Modes
3.1Overview
3.1.1Operating Mode Selection
The H8/3052BF has seven operating modes (modes 1 to 7) that are selected by the mode pins
(MD
to MD0) as indicated in table 3.1. The input at these pins determines the size of the address
2
space and the initial bus mode.
Table 3.1Operating Mode Selection
Mode PinsDescription
Operating
3
*
Mode
MD2MD1MD
Address Space
0
Initial Bus
*
Mode
—000————
Mode 1001Expanded mode8 bitsDisabledEnabled
Mode 2010Expanded mode16 bitsDisabledEnabled
Mode 3011Expanded mode8 bitsDisabledEnabled
Mode 4100Expanded mode16 bitsDisabledEnabled
Mode 5101Expanded mode8 bitsEnabledEnabled
Mode 6110Expanded mode8 bitsEnabledEnabled
Mode 7111Single-chip advanced
—EnabledEnabled
mode
Notes: 1. In modes 1 to 6, an 8-bit or 16-bit data bus can be selected on a per-area basis by
settings made in the area bus width control register (ABWCR). For details see section
6, Bus Controller.
2. If the RAME bit in SYSCR is cleared to 0, these addresses become external addresses.
3. These are the operating modes when the FWE pin is at 0. For the operating modes
when the FWE pin is at 1, see section 18, ROM.
1
On-Chip
ROM
On-Chip
RAM
2
*
2
*
2
*
2
*
2
*
2
*
For the address space size there are two choices: 1 Mbyte or 16 Mbytes. The external data bus is
either 8 or 16 bits wide depending on ABWCR settings. If 8-bit access is selected for all areas, the
external data bus is 8 bits wide. For details see section 6, Bus Controller.
Modes 1 to 4 are externally expanded modes that enable access to external memory and peripheral
devices and disable access to the on-chip ROM. Modes 1 and 2 support a maximum address space
of 1 Mbyte. Modes 3 and 4 support a maximum address space of 16 Mbytes.
Rev. 3.00 Mar 21, 2006 page 59 of 814
REJ09B0302-0300
Page 88
Section 3 MCU Operating Modes
Modes 5 and 6 are externally expanded modes that enable access to external memory and
peripheral devices and also enable access to the on-chip ROM. Mode 5 supports a maximum
address space of 1 Mbyte. Mode 6 supports a maximum address space of 16 Mbytes.
Mode 7 is a single-chip mode that operates using the on-chip ROM, RAM, and Internal I/O
registers, and makes all I/O ports available. Mode 7 supports a 1-Mbyte address space.
The H8/3052BF can be used only in modes 1 to 7. The inputs at the mode pins must select one of
these seven modes. The inputs at the mode pins must not be changed during operation.
3.1.2Register Configuration
The H8/3052BF has a mode control register (MDCR) that indicates the inputs at the mode pins
(MD
to MD0), and a system control register (SYSCR). Table 3.2 summarizes these registers.
2
Table 3.2Registers
Address
H'FFF1Mode control registerMDCRRUndetermined
H'FFF2System control registerSYSCRR/WH'0B
Note: * The lower 16 bits of the address are indicated.
*
NameAbbreviationR/WInitial Value
3.2Mode Control Register (MDCR)
MDCR is an 8-bit read-only register that indicates the current operating mode of the H8/3052BF.
Bit
Initial value
Read/Write
Note: Determined by pins MD to MD .*
Bits 7 and 6—Reserved: Read-only bits, always read as 1.
7
—
1
—
Reserved bitsMode select 2 to 0
6
—
1
—
20
5
—
0
—
4
—
0
—
Reserved bits
—
—
3
0
2
MDS2
*
—
R
Bits indicating the current
operating mode
1
MDS1
— R**
0
MDS0
—
R
Bits 5 to 3—Reserved: Read-only bits, always read as 0.
Rev. 3.00 Mar 21, 2006 page 60 of 814
REJ09B0302-0300
Page 89
Section 3 MCU Operating Modes
Bits 2 to 0—Mode Select 2 to 0 (MDS2 to MDS0): These bits indicate the logic levels at pins
MD
to MD0 (the current operating mode). MDS2 to MDS0 correspond to MD2 to MD0. MDS2 to
2
MDS0 are read-only bits. The mode pin (MD
to MD0) levels are latched into these bits when
2
MDCR is read.
3.3System Control Register (SYSCR)
SYSCR is an 8-bit register that controls the operation of the H8/3052BF.
Bit
Initial value
Read/Write
7
SSBY
0
R/W
Software standby
Enables transition to software standby mode
6
STS2
0
R/W
Standby timer select 2 to 0
These bits select the waiting time at
recovery from software standby mode
5
STS1
0
R/W
4
STS0
0
R/W
UE
R/W
User bit enable
Selects whether to use the UI bit in CCR
as a user bit or an interrupt mask bit
3
1
2
NMIEG
0
R/W
Reserved bit
NMI edge select
Selects the valid edge
of the NMI input
1
—
1
—
RAM enable
Enables or
disables
on-chip RAM
0
RAME
1
R/W
Bit 7—Software Standby (SSBY): Enables transition to software standby mode. (For further
information about software standby mode see section 20, Power-Down State.)
When software standby mode is exited by an external interrupt, this bit remains set to 1. To clear
this bit, write 0.
Bit 7: SSBYDescription
0SLEEP instruction causes transition to sleep mode(Initial value)
1SLEEP instruction causes transition to software standby mode
Rev. 3.00 Mar 21, 2006 page 61 of 814
REJ09B0302-0300
Page 90
Section 3 MCU Operating Modes
Bits 6 to 4—Standby Timer Select (STS2 to STS0): These bits select the length of time the CPU
and on-chip supporting modules wait for the internal clock oscillator to settle when software
standby mode is exited by an external interrupt. When using a crystal oscillator, set these bits so
that the waiting time will be at least 7 ms at the system clock rate. For further information about
waiting time selection, see section 20.4.3, Selection of Waiting Time for Exit from Software
Standby Mode.
Bit 6: STS2 Bit 5: STS1 Bit 4: STS0 Description
000Waiting time = 8,192 states(Initial value)
1Waiting time = 16,384 states
10Waiting time = 32,768 states
1Waiting time = 65,536 states
100Waiting time = 131,072 states
1Waiting time = 1,024 states
1—Illegal setting
Bit 3—User Bit Enable (UE): Selects whether to use the UI bit in the condition code register as a
user bit or an interrupt mask bit.
Bit 3: UEDescription
0UI bit in CCR is used as an interrupt mask bit
1UI bit in CCR is used as a user bit(Initial value)
Bit 2—NMI Edge Select (NMIEG): Selects the valid edge of the NMI input.
Bit 2: NMIEGDescription
0An interrupt is requested at the falling edge of NMI(Initial value)
1An interrupt is requested at the rising edge of NMI
Bit 1—Reserved: Read-only bit, always read as 1.
Bit 0—RAM Enable (RAME): Enables or disables the on-chip RAM. The RAME bit is
initialized by the rising edge of the RES signal. It is not initialized in software standby mode.
Bit 0: RAMEDescription
0On-chip RAM is disabled
1On-chip RAM is enabled(Initial value)
Rev. 3.00 Mar 21, 2006 page 62 of 814
REJ09B0302-0300
Page 91
3.4Operating Mode Descriptions
3.4.1Mode 1
Section 3 MCU Operating Modes
Ports 1, 2, and 5 function as address pins A
to A0, permitting access to a maximum 1-Mbyte
19
address space. The initial bus mode after a reset is 8 bits, with 8-bit access to all areas. If at least
one area is designated for 16-bit access in ABWCR, the bus mode switches to 16 bits.
3.4.2Mode 2
Ports 1, 2, and 5 function as address pins A
to A0, permitting access to a maximum 1-Mbyte
19
address space. The initial bus mode after a reset is 16 bits, with 16-bit access to all areas. If all
areas are designated for 8-bit access in ABWCR, the bus mode switches to 8 bits.
3.4.3Mode 3
Ports 1, 2, and 5 and part of port A function as address pins A
to A0, permitting access to a
23
maximum 16-Mbyte address space. The initial bus mode after a reset is 8 bits, with 8-bit access to
all areas. If at least one area is designated for 16-bit access in ABWCR, the bus mode switches to
16 bits. A
(BRCR). (In this mode A
to A21 are valid when 0 is written in bits 7 to 5 of the bus release control register
23
is always used for address output.)
20
3.4.4Mode 4
Ports 1, 2, and 5 and part of port A function as address pins A
to A0, permitting access to a
23
maximum 16-Mbyte address space. The initial bus mode after a reset is 16 bits, with 16-bit access
to all areas. If all areas are designated for 8-bit access in ABWCR, the bus mode switches to
8 bits. A
to A21 are valid when 0 is written in bits 7 to 5 of BRCR. (In this mode A20 is always
23
used for address output.)
3.4.5Mode 5
Ports 1, 2, and 5 can function as address pins A
to A0, permitting access to a maximum 1-Mbyte
19
address space, but following a reset they are input ports. To use ports 1, 2, and 5 as an address bus,
the corresponding bits in their data direction registers (P1DDR, P2DDR, and P5DDR) must be set
to 1. The initial bus mode after a reset is 8 bits, with 8-bit access to all areas. If at least one area is
designated for 16-bit access in ABWCR, the bus mode switches to 16 bits.
Rev. 3.00 Mar 21, 2006 page 63 of 814
REJ09B0302-0300
Page 92
Section 3 MCU Operating Modes
3.4.6Mode 6
Ports 1, 2, and 5 and part of port A function as address pins A
to A0, permitting access to a
23
maximum 16-Mbyte address space, but following a reset they are input ports. To use ports 1, 2,
and 5 as an address bus, the corresponding bits in their data direction registers (P1DDR, P2DDR,
and P5DDR) must be set to 1. For A
A
is always used for address output.)
20
to A21 output, clear bits 7 to 5 of BRCR to 0. (In this mode
23
The initial bus mode after a reset is 8 bits, with 8-bit access to all areas. If at least one area is
designated for 16-bit access in ABWCR, the bus mode switches to 16 bits.
3.4.7Mode 7
This mode operates using the on-chip ROM, RAM, and registers. All I/O ports are available.
Mode 7 supports a 1-Mbyte address space.
3.5Pin Functions in Each Operating Mode
The pin functions of ports 1 to 5 and port A vary depending on the operating mode. Table 3.3
indicates their functions in each operating mode.
Table 3.3Pin Functions in Each Mode
PortMode 1Mode 2Mode 3Mode 4Mode 5Mode 6Mode 7
2
8
*
0
2
*
0
1
*
0
2
*
0
P17 to P1
P27 to P2
D15 to D
P47 to P4
P53 to P5
A
20
Port 1A
Port 2A15 to A
Port 3D15 to D
Port 4P47 to P4
Port 5A19 to A
to A
7
A7 to A
0
A15 to A
8
D15 to D
8
1
*
D7 to D
0
A19 to A
16
A7 to A
0
8
8
1
*
0
16
0
A15 to A
D15 to D
P47 to P4
A19 to A
Port APA7 to PA4PA7 to PA4PA7 to PA
A
20
8
8
16
1
*
0
3
*
5
A7 to A
A15 to A
D15 to D
D7 to D
A19 to A
,
PA7 to PA
A
20
P17 to P1
0
P27 to P2
8
D15 to D
8
1
*
P47 to P4
0
P53 to P5
16
3
*
,
PA7 to PA4PA7 to PA5,
5
Notes: 1. Initial state. The bus mode can be switched by settings in ABWCR. These pins function
to P40 in 8-bit bus mode, and as D7 to D0 in 16-bit bus mode.
as P4
7
2. Initial state. These pins become address output pins when the corresponding bits in the
data direction registers (P1DDR, P2DDR, P5DDR) are set to 1.
3. Initial state. A
output by writing 0 in bits 7 to 5 of BRCR.
A
21
is always an address output pin. PA7 to PA5 are switched over to A23 to
20
2
*
P17 to P1
0
2
*
P27 to P2
0
P37 to P3
8
1
*
P47 to P4
0
2
*
P53 to P5
0
3
*
PA7 to PA
0
0
0
0
0
4
Rev. 3.00 Mar 21, 2006 page 64 of 814
REJ09B0302-0300
Page 93
Section 3 MCU Operating Modes
3.6Memory Map in Each Operating Mode
Figure 3.1 shows a memory map of the H8/3052BF. The address space is divided into eight areas.
The initial bus mode differs between modes 1 and 2, and also between modes 3 and 4.
The address locations of the on-chip RAM and on-chip registers differ between the 1-Mbyte
modes (modes 1, 2, 5, and 7) and 16-Mbyte modes (modes 3, 4, and 6). The address range
specifiable by the CPU in the 8- and 16-bit absolute addressing modes (@aa:8 and @aa:16) also
differs.
Area 0
Area 1
Area 2
Area 3
Area 4
Area 5
Area 6
Area 7
8-bit absolute addresses
H'007FFF
H'07FFFF
H'080000
H'1FFFFF
H'200000
H'3FFFFF
H'400000
H'5FFFFF
H'600000
H'7FFFFF
H'800000
H'9FFFFF
H'A00000
H'BFFFFF
H'C00000
H'DFFFFF
H'E00000
16-bit absolute addresses
H'FF8000
H'FFDF0F
H'FFDF10
H'FFFF00
H'FFFF0F
H'FFFF10
H'FFFF1B
H'FFFF1C
H'FFFFFF
(16-Mbyte expanded mode with
Mode 6
on-chip ROM enabled)
Vector area
On-chip ROM
Area 0
Area 1
Area 2
External
address
space
On-chip RAM *
External
address
space
Internal I/O
registers
Area 3
Area 4
Area 5
Area 6
Area 7
Memory-indirect
branch addresses
8-bit absolute addresses
(single-chip advanced mode)
H'00000
H'000FF
16-bit absolute
addresses
H'07FFF
H'7FFFF
H'F8000
H'FDF10
H'FFF00
H'FFF0F
H'FFF1C
H'FFFFF
16-bit absolute addresses
Mode 7
Vector area
On-chip ROM
On-chip RAM
Internal I/O
registers
16-bit absolute
addresses
Memory-indirect
branch addresses
16-bit absolute addresses
8-bit absolute addresses
Note: External addresses can be accessed by disabling on-chip RAM.*
Figure 3.1 H8/3052BF Memory Map in Each Operating Mode (cont)
Rev. 3.00 Mar 21, 2006 page 67 of 814
REJ09B0302-0300
Page 96
Section 3 MCU Operating Modes
Rev. 3.00 Mar 21, 2006 page 68 of 814
REJ09B0302-0300
Page 97
Section 4 Exception Handling
Section 4 Exception Handling
4.1Overview
4.1.1Exception Handling Types and Priority
As table 4.1 indicates, exception handling may be caused by a reset, trap instruction, or interrupt.
Exception handling is prioritized as shown in table 4.1. If two or more exceptions occur
simultaneously, they are accepted and processed in priority order. Trap instruction exceptions are
accepted at all times in the program execution state.
Table 4.1Exception Types and Priority
PriorityException TypeStart of Exception Handling
High
↑
Low
ResetStarts immediately after a low-to-high transition at the
RES pin
InterruptInterrupt requests are handled when execution of the
current instruction or handling of the current exception is
completed
Trap instruction (TRAPA)Started by execution of a trap instruction (TRAPA)
4.1.2Exception Handling Operation
Exceptions originate from various sources. Trap instructions and interrupts are handled as follows.
1. The program counter (PC) and condition code register (CCR) are pushed onto the stack.
2. The CCR interrupt mask bit is set to 1.
3. A vector address corresponding to the exception source is generated, and program execution
starts from the address indicated in that address.
For a reset exception, steps 2 and 3 above are carried out.
Rev. 3.00 Mar 21, 2006 page 69 of 814
REJ09B0302-0300
Page 98
Section 4 Exception Handling
4.1.3Exception Sources and Vector Table
The exception sources are classified as shown in figure 4.1. Different vectors are assigned to
different exception sources. Table 4.2 lists the exception sources and their vector addresses.
• Reset
Exception
sources
External interrupts:
• Interrupts
Internal interrupts:
• Trap instruction
NMI, IRQ to IRQ
30 interrupts from on-chip
supporting modules
0 5
Figure 4.1 Exception Sources
Rev. 3.00 Mar 21, 2006 page 70 of 814
REJ09B0302-0300
Page 99
Section 4 Exception Handling
Table 4.2Exception Vector Table
Exception SourceVector NumberVector Address
Reset0H'0000 to H'0003
Reserved for system use1H'0004 to H'0007
2H'0008 to H'000B
3H'000C to H'000F
4H'0010 to H'0013
5H'0014 to H'0017
6H'0018 to H'001B
External interrupt (NMI)7H'001C to H'001F
Trap instruction (4 sources)8H'0020 to H'0023
9H'0024 to H'0027
10H'0028 to H'002B
11H'002C to H'002F
External interrupt IRQ
External interrupt IRQ
External interrupt IRQ
External interrupt IRQ
External interrupt IRQ
External interrupt IRQ
0
1
2
3
4
5
Reserved for system use18H'0048 to H'004B
2
Internal interrupts
*
Notes: 1. Lower 16 bits of the address.
2. For the internal interrupt vectors, see section 5.3.3, Interrupt Exception Vector Table.
12H'0030 to H'0033
13H'0034 to H'0037
14H'0038 to H'003B
15H'003C to H'003F
16H'0040 to H'0043
17H'0044 to H'0047
19H'004C to H'004F
20
to
60
H'0050 to H'0053
to
H'00F0 to H'00F3
1
*
Rev. 3.00 Mar 21, 2006 page 71 of 814
REJ09B0302-0300
Page 100
Section 4 Exception Handling
4.2Reset
4.2.1Overview
A reset is the highest-priority exception. When the RES pin goes low, all processing halts and the
chip enters the reset state. A reset initializes the internal state of the CPU and the registers of the
on-chip supporting modules. Reset exception handling begins when the RES pin changes from low
to high.
The chip can also be reset by overflow of the watchdog timer. For details see section 12,
Watchdog Timer.
4.2.2Reset Sequence
The chip enters the reset state when the RES pin goes low.
To ensure that the chip is reset, hold the RES pin low for at least 20 ms at power-up. To reset the
chip during operation, hold the RES pin low for at least 20 system clock (φ) cycles. See appendix
D.2, Pin States at Reset, for the states of the pins in the reset state.
When the RES pin goes high after being held low for the necessary time, the chip starts reset
exception handling as follows.
• The internal state of the CPU and the registers of the on-chip supporting modules are
initialized, and the I bit is set to 1 in CCR.
• The contents of the reset vector address (H'0000 to H'0003) are read, and program execution
starts from the address indicated in the vector address.
Figure 4.2 shows the reset sequence in modes 1 and 3. Figure 4.3 shows the reset sequence in
modes 2 and 4. Figure 4.4 shows the reset sequence in modes 5 to 7.
Rev. 3.00 Mar 21, 2006 page 72 of 814
REJ09B0302-0300
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.