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/38024, H8/38024S,
8
H8/38024F-ZTAT, H8/38124
Hardware Manual
Renesas 8-Bit Single-Chip Microcomputer
H8 Family/H8/300L Super Low Power Series
Group
Rev. 6.00
Revision Date: Aug 27, 2004
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. 6.00, 08/04, page ii of xxx
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. Trea t ment 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 beca use 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. 6.00, 08/04, page iii of xxx
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. Contents
5. Overview
6. 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:
When designing an application system that includes this LSI, take notes into account. Each section
includes notes in relation to the descr i ptions given, and usage notes are give n, as required, as the
final part of each section.
7. List of Registers
8. Electrical Characteristics
9. Appendix
•Product Codes, Package Dimensions, etc.
Rev. 6.00, 08/04, page iv of xxx
Preface
The H8/38024 Group is a single-chip microcomputer built around the high-speed H8/300L CPU
and equipped with peripheral system functions on-chip. The H8/38024 Group incorporates
peripheral functions including ROM, RAM, timer, serial communications interface (SCI), 10-bit
PWM, A/D converter, LCD controller/driver, and I/O ports. It is a microcomputer allowing the
implementation of a sophisticated control system. Versions are available with types of internal
ROM: flash memory (F-ZTAT™
application products with a great deal of specification fluidity, and allows for rapid and flexible
response to contingencies arising between the initial stages of production and full-scale
production.
Below is a table listing the product specifications for each group.
Notes: 1. F-ZTAT is a trademark of Renesas Technology Corp.
2. ZTAT is a trademark of Renesas Technology Corp.
Target Readers: This manual is designed for use by people who design application systems using
the H8/38024 Group, H8/38024S Group, H8/38024F-ZTAT, and H8/38124 Group.
To use this manual, basic knowledge of electric circuits, logic circuits and microcomputers is
required.
Purpose:This manual provides the information of the hardware functions and electrical
characteristics of the H8/38024 Group, H8/38024S Group, H8/38024F-ZTAT, and H8/38124
Group. The H8/300L Series Programming Manual contains detailed information of executable
instructions. Please read the Programming Manual together with this manual.
How to Use the Book:
• To understa nd gene ra l fu nc tio n s
→ Read the manual from the beginning.
The manual explains the CPU, system control functions, peripheral functions and electrical
characteristics in that order.
• To understanding CPU functions
→ Refer to the separate H8/300L Series Programming Manual.
Explanatory Note: Bit sequence: upper bit at left, and lower bit at right
List of Related Documents: The latest documents are available on our Web site. Please make
sure that you have the late st version.
(http://www.renesas.com/)
• User manual for H8/38024 Group
Name of DocumentDocument No.
H8/38024 Group, H8/38024S Group, H8/38024F-ZTAT™,
H8/38124 Group Hardware Manual
Notes: The following limitations apply to H8/38024 and H8/38124 programming and debugging
when the on-chip emulator is used.
1. Pin 95 is not available because it is used exclusively by the on-chip emulator.
2. Pins 33, 34, and 35 are unavailable for use. In order to use these pins additional
hardware must be mounted on the user board.
3. The address range H'7000 to H'7FFF is used by the on-chip emulator and is unavailable
to the user.
4. The address range H'F780 to H'FB7F must not be accessed under any circumstances.
5. When the on-chip emulator is being used, pin 95 is I/O, pins 33 and 34 are input, and
pin 35 is output.
6. When using the on-chip emulator, pins OSC1 and OSC2 should be connected to an
oscillator, or an external clock should be supplied to pin OSC1, even if the on-chip
oscillator of the H8/38124 Group is selected.
Rev. 6.00, 08/04, page viii of xxx
List of Items Revised or Added for This Version
ItemPageRevisions (See Manual for Details)
1.1 Overview
Table 1.1 Features
6Table 1.1 amended
Product Code
Mask ROM Version ZTAT Version F-ZTAT Version Package
HD64338024HD64738024HD64F38024R
HD64338020——FP-80A
HD64F38024
FP-80A
FP-80B
TFP-80C
TLP-85V (HD64F38024R only)
Die (mask ROM/F-ZTAT version
only)
FP-80B
TFP-80C
Die
ROM/RAM Size
(Byte)
32K/1K
8K/512
3.4.2 Notes on
Rewriting Port Mode
Registers
Table 3.5 Conditions
under which Interrupt
Request Flag is Set
to 1
97Table 3.5 amended
Interrupt Request
Flags Set to 1Conditions
IWPRIWPF7
When PMR5 bit WKP7 is changed from 0 to 1 while pin
WKEGS7 = 0.
When PMR5 bit WK P 7 is changed fro m 1 to 0 while pin
WKEGS7 = 1.
IWPF6
When PMR5 bit WKP6 is changed from 0 to 1 while pin
WKEGS6 = 0.
When PMR5 bit WK P 6 is changed fro m 1 to 0 while pin
WKEGS6 = 1.
IWPF5
When PMR5 bit WKP5 is changed from 0 to 1 while pin
WKEGS5 = 0.
When PMR5 bit WK P 5 is changed fro m 1 to 0 while pin
WKEGS5 = 1.
IWPF4
When PMR5 bit WKP4 is changed from 0 to 1 while pin
WKEGS4 = 0.
When PMR5 bit WK P 4 is changed fro m 1 to 0 while pin
WKEGS4 = 1.
IWPF3
When PMR5 bit WKP3 is changed from 0 to 1 while pin
WKEGS3 = 0.
When PMR5 bit WK P 3 is changed fro m 1 to 0 while pin
WKEGS3 = 1.
IWPF2
When PMR5 bit WKP2 is changed from 0 to 1 while pin
WKEGS2 = 0.
When PMR5 bit WK P 2 is changed fro m 1 to 0 while pin
WKEGS2 = 1.
IWPF1
When PMR5 bit WKP1 is changed from 0 to 1 while pin
WKEGS1 = 0.
When PMR5 bit WK P 1 is changed fro m 1 to 0 while pin
WKEGS1 = 1.
IWPF0
When PMR5 bit WKP0 is changed from 0 to 1 while pin
WKEGS0 = 0.
When PMR5 bit WK P 0 is changed fro m 1 to 0 while pin
WKEGS0 = 1.
is low and WEGR bit
7
is low and WEGR bit
7
is low and WEGR bit
6
is low and WEGR bit
6
is low and WEGR bit
5
is low and WEGR bit
5
is low and WEGR bit
4
is low and WEGR bit
4
is low and WEGR bit
3
is low and WEGR bit
3
is low and WEGR bit
2
is low and WEGR bit
2
is low and WEGR bit
1
is low and WEGR bit
1
is low and WEGR bit
0
is low and WEGR bit
0
Rev. 6.00, 08/04, page ix of xxx
ItemPageRevisions (See Manual for Details)
4.1.1 Block Diagram
Figure 4.2 Block
Diagram of Clock Pulse
102Figure 4.2 amended
(Before) Internal reset signal → (After) Internal reset signal
(other than watchdog timer or low-voltage detect circuit reset)
Generators (H8/38124
Group)
4.2 System Clock
Generator
105Table 4.2
Frequency (MHz)44.193
Table 4.2 Crystal
Oscillator Parameters
On-Chip Oscillator
Selection Method
(H8/38124 Group Only)
108Note added
The on-chip oscillator is selected by setting the IRQAEC pin
input level during resets.*
* Other than watchdog timer or low-voltage detect circuit
reset.
4.4 Prescalers111Prescalers S (PPS)
Description amended
The output from prescaler S is shared by timer A,
timer G, SCI3, the A/D converter, the LCD controller,
F,
watchdog timer, and the 10-bit PWM. The divider ratio can be
set separately for each on-chip peripheral function.
4.5.1 Definition of
Oscillation Stabilization
Wait Time
5.1 Overview
Table 5.1 Operating
Modes
1152. Wait time
Description amended, notes *1, *2 added
Oscillation stabilization wait time = oscillation stabilization time + wait time
Notes: 1. H8/38024 Group
2. H8/38124 Group
117Table 5.1 amended
Operating ModeDescription
Watch modeThe CPU halts. The time-base function of timer A, timer F,
= t
+ (8 to 16,384 states)
rc
(to 131,072 states)
timer G, AEC and LCD controller/driver are operable on the
subclock
timer C, timer
1
*
................. (1)
2
*
Rev. 6.00, 08/04, page x of xxx
ItemPageRevisions (See Manual for Details)
8.1 Overview
Table 8.1 Port
Functions
187,
188
Table 8.1 amended
PortDescriptionPinsOther Functions
Port 3
• 8-bit I/O port
• MOS input pull-up
• Large-current
• MOS open drain
option
2
*
port
output selectable
(only P3
5
P3
/AEVL
7
P3
/AEVH
6
P3
to P3
5
3
P32, TMOFH
, TMOFL
P3
1
P3
/UDTimer C count up/down
0
)
(Before) Input terminal → (After) input pin
8.9.1 Overview
Figure 8.8 Port
9 Pin
222Figure 8.8 figure title amended
Configuration
9.2.1 Overview238Features
Description deleted
• Use of module standby mode enables this module to be
placed in standby mode independently when not used.
9.4.2 Register
Descriptions
258Timer Control Register F (TCRF)
Bits 2 to—Clock Select L (CKSL2 to CKSL0)
Note * amended
Note: * …. Note that the timer F counter may increment if the
setting of IRQ3 in port mode register 1 (PMR1) is changed
0 to 1 or from 1 to 0 while the TMIF pin is low order to changed
the TMIF pin function.
9.6.1 Overview290Feature
• On-chip the H8/38/124 Group, 10 internal clocks (φ/64, φ/128,φ/256, φ/512, φ/1024, φ/2048, φ/4096, φ/8192, φw/32, or
watchdog on-chip oscillator) are available for selection for use
by the counter.
Figure 9.17 (2) Block
Diagram of Watchdog
Timer (H8/38124
Group)
Bits 3 to 0—Clock Select (CKS3 to CKS0)
Bit table amended
Bit 3
CKS3
Bit 2
CKS2
Bit 1
CKS1
Bit 0
CKS0Description
0XXX
Watchdog on-chip oscillat or
9.7.2 Register
Configurations
309Event Counter Control/Status Register (ECCSR)
Description amended
• Bit 7—Control
• Bit 6—Counter
9.7.3 Operation
Figure 9.22 Event
Counter Operation
Waveform
316Event Counter PWM Operation
Figure 9.22 amended
Ndr: Value of ECPWDRH and ECPWDRL Fixed
= H’FFFF
14.1 Overview423Note * added
Note: * The voltage maintained in standby mode is the same as
the RAM data retaining voltage (VRAM). See section 16.8.2,
DC Characteristics, for information on retaining voltage.
14.2.1 Low-Voltage
Detection Control
Register (LVDCR)
428Note added
Note: Setting values marked with an asterisk (*) are invalid.
Table 14.3 LVDCR
Settings and Function
Register Selections
14.2.2 Low-Voltage
Detection Status
Register (LVDSR)
14.3.2 Low-Voltage
Detection Circuit
LVDR (Reset by Low
Voltage Detect) Circuit:
428Note amended
Note: * These bits
432Description amended
To operate the LVDR, set the LVDE bit in LVDCR to 1, wait for
150 µs (t
LVDON
detection power supply have stabilized, based on overflow of
LVDNT, etc., then set the LVDRE bit in LVDCR to 1.
LVDI (Interrupt by Low
Voltage Detect) Circuit:
433Description amended
To operate the LVDI, set the LVDE bit in LVDCR to 1, wait for
150 µs (t
LVDON
detection power supply have stabilized, based on overflow of
LVDNT, etc., then set the LVDDE and LVDUE bits in LVDCR to
1.
Overflow H (OVH)
Overflow L (OVL)
low when Ndr
initialized by resets trigged by LVDR.
) until the reference voltage and the low-voltage-
) until the reference voltage and the low-voltage-
Rev. 6.00, 08/04, page xii of xxx
ItemPageRevisions (See Manual for Details)
14.3.2 Low-Voltage
Detection Circuit
Operation and
Cancellation Setting
Procedure Using LVDR
437Description amended
2. After waiting for LVDCNT overflow, etc., to ensure that the
stabilization time (t
and low voltage detection power supply has elapsed, clear
bits LVDDF and LVDUF in LVDSR to 0.
= 150 µs) for the reference voltage
LVDON
and LVDI:
16.4.2 DC
Characteristics
Table 16.8 DC
Characteristics
16.8.1 Power Supply
462Table amended
ItemSym bol Applicable Pi ns MinTyp MaxUnit Test Condit i onNot es
output low
current
(per pin)
IOLOutput pins
except port 9
P9
P93 to P9
487Figure amended
to P9
0
Values
——0.5 mAAllowable
—— 25.0mA
2
—— 10.0
—— 10.0mA
5
Voltage and Operating
Ranges
Power Supply Voltage
and Oscillation
Frequency Range (OnChip Oscillator
Selected)
1
*
2
*
5
*
Rev. 6.00, 08/04, page xiii of xxx
ItemPageRevisions (See Manual for Details)
16.8.1 Power Supply
490Figure amended
Voltage and Operating
Ranges
1.0
Analog Power Supply
Voltage and A/D
Converter Operating
Range (On-Chip
Oscillator Selected)
16.8.2 DC
Characteristics
Table 16.21 DC
Characteristics
492Table 16.21 amended
φ (MHz)
0.35
2.75.5
AV
CC (V)
• Active (high-speed) mode
• Sleep (high-speed) mode
ItemSymbol Applicable Pins MinTyp MaxUnit Test ConditionNotes
ItemSymbol Applicable Pins MinTyp MaxUnit Test ConditionNotes
I
Watch
WATCHVCC
mode
current
consumption
I
Standby
STBYVCC
mode
current
consumption
V
RAM
RAM data
retaining
voltage
V
CC
Values
—TBD —µA
—1.8—
—1.86.0VCC = 2.7 V,
—TBD —µA
—0.5—
—0.05 —VCC = 2.7 V,
—0.6—VCC = 5.0 V,
—0.16 —
—1.05.0
2.0—— V
VCC = 2.7 V,
T
= 25°C,
a
32-kHz crystal
resonator used,
LCD not used
32-kHz crystal
resonator used,
LCD not used
V
= 2.7 V,
CC
T
= 25°C,
a
32-kHz crystal
resonator not used
= 2.7 V,
V
CC
T
= 25°C,
a
32-kHz crystal
resonator not used
T
= 25°C,
a
SUBSTP (subclock
oscillator control
register) setting = 1
T
= 25°C,
a
32-kHz crystal
resonator not used
= 5.0 V,
V
CC
T
= 25°C,
a
SUBSTP (subclock
oscillator control
register) setting = 1
32-kHz crystal
resonator not used
1 *3 *4
*
Reference
value
2 *3 *4
*
Reference
value
3 *4
*
1 *3 *4
*
Reference
value
2 *3 *4
*
Reference
value
2 *4
*
Reference
value
2 *3 *4
*
Reference
value
4
*2 *
Reference
value
3 *4
*
6
*
ItemSymbol
Allowable output low
current (per pin)
I
OL
Applicable
PinsMinTypMaxUnit
Output pins
except ports 3
and 9
Values
——2.0mA
Port 3——10.0
Output pins
except port 9
——0.5
Port 9——15.0
——10.0
——8.0
Note: 6. Voltage maintained in standby mode
Rev. 6.00, 08/04, page xv of xxx
Test
ConditionNotes
VCC = 4.0 V to
5.5 V
= 4.0 V to
V
CC
5.5 V
5
= 4.0 V to
*
V
CC
5.5 V
ItemPageRevisions (See Manual for Details)
16.8.3 AC
Characteristics
Table 16.22 Control
Signal Timing
500,
501
Table 16.22 amended, note *2 added
ItemSymbol
System clock
oscillation
frequency
OSC clock (φ
cycle time
System clock (φ)
cycle time
f
OSC
)
t
OSC
OSC
t
cyc
Applicable
PinsMin TypMax Unit Test Condition
OSC1, OSC
OSC1, OSC262.5 —500 nsF igure 16.1
Values
2.0 —16.0
2
0.7 —2.0On-chip oscillator
500 —1429On-chip oscillator
2—128 t
—— 182 µs
Note: 2. These characteristics are given as ranges between
minimum and maximum values in order to account for factors
such as temperature, power supply voltage, and variation
among production lots. When designing systems, make sure to
give due consideration to the SPEL range. Please see the Web
site for this product for actual performance data.
16.8.5 LCD
Characteristics
Table 16.25 LCD
Characteristics
503Table 16.25 amended
Applicable
ItemSymbol
Liquid crystal
display volt age
V
LCDV1
Pins
Values
MinTyp Max Unit Test Condition
2.7—5.5V
MHz
OSC
selected
selected
Reference
Figure
2
*
Reference
Figure
2
*
16.8.7 Power Supply
506Table 16.27
Voltage Detection
Circuit Characteristics
Table 16.27 Power
ItemSymbolMinTypMaxUnit Test Conditions
LVD stabilization timeT
150——µs
LVDON
Supply Voltage
Detection Circuit
Characteristics (1)
16.8.8 Power-On
509Title amended
Reset Circuit
Characteristics
B.2 Functions574PWCR1—PWM1 Control Register
Note 1 amended
Notes: 1. tφ: Period of
PWM1 input clock
589OSCCR—Clock Pulse Generator Control Register
Bit table amended
2
IRQAECF
R
1
OSCF
R
0
0
R/W
Rated Values
Rev. 6.00, 08/04, page xvi of xxx
ItemPageRevisions (See Manual for Details)
E. List of Product
Codes
Table E.1 H8/38024
Group Product Code
Lineup
618Table E.1 amended
Product TypeProduct CodeMark Code
H8/38124HD64F38124HF38124H80-pin QFP (FP-80A)
H8/38124
Group
F-ZTAT
versions
Mask ROM
versions
H8/38123HD64338123H38123(***)H80-pin QFP (FP-80A)Mask ROM
versions
H8/38122HD64338122H38122(***)H80-pin QFP (FP-80A)Mask ROM
versions
H8/38121HD64338121H38121(***)H80-pin QFP (FP-80A)
Mask ROM
versions
H8/38120HD64338120H38120(***)H80-pin QFP (FP-80A)Mask ROM
Appendix C I/O Port Block Diagrams........................................................................... 596
C.1Block Diagrams of Port 1 ................................................................................................. 596
C.2Block Diagrams of Port 3 ................................................................................................. 599
C.3Block Diagrams of Port 4 ................................................................................................. 604
C.4Block Diagram of Port 5................................................................................................... 608
C.5Block Diagram of Port 6................................................................................................... 609
C.6Block Diagram of Port 7................................................................................................... 610
C.7Block Diagram of Port 8................................................................................................... 611
C.8Block Diagrams of Port 9 ................................................................................................. 612
C.9Block Diagram of Port A.................................................................................................. 613
C.10 Block Diagram of Port B .................................................................................................. 614
Appendix D Port States in the Different Processing States ..................................... 615
Rev. 6.00, 08/04, page xxviii of xxx
Appendix E List of Product Codes................................................................................. 616
Appendix F Package Dimensions................................................................................... 619
Appendix G Specifications of Chip Form..................................................................... 623
Appendix H Form of Bonding Pads................................................................................ 625
Appendix ISpecifications of Chip Tray...................................................................... 626
Rev. 6.00, 08/04, page xxix of xxx
Rev. 6.00, 08/04, page xxx of xxx
Section 1 Overview
1.1Overview
The H8/300L Series is a series of single-chip microcomputers (MCU: microcomputer unit), built
around the high-speed H8/300L CPU and equipped with peripheral system functions on-chip.
Within the H8/300L Series, the H8/38024 Group, H8/38024S Group, and H8/38124 Group
comprise single-chip microcomputers equipped with a LCD (Liquid Crystal Display)
controller/driver. Other on-chip peripheral functions include six timers, a two-channel 10-bit
pulse width modulator (PWM), a serial communication interface, and an A/D converter.
Together, these functions make the H8/38024 Group, H8/38024S Group, and H8/38124 Group
ideally suited for embedded applications in systems requiring low power consumption and LCD
display. Models in the H8/38024 Group, H8/38024S Group, and H8/38124 Group are the
H8/38024, H8/38024S, and H8/38124 with on-chip 32-Kbyte ROM and 1-Kbyte RAM, the
H8/38023, H8/38023S, and H8/38123 with on-chip 24-Kbyte ROM and 1-Kbyte RAM, the
H8/38022, H8/38022S, and H8/38122 with on-chip 16-Kbyte ROM and 1-Kbyte RAM, the
H8/38021, H8/38021S, and H8/38121 with 12-Kbyte ROM and 512 byte RAM, and the
H8/38020, H8/38020S, and H8/38120 with 8-Kbyte ROM and 512 byte RAM.
1
*
The H8/38024 is also available in a ZTAT™
programmed as required by the user. The H8/38024 is also available in F-ZTAT™
on-chip flash memory which can be reprogrammed on board.
version with on-chip PROM which can be
2
*
versions with
The H8/38124 is also available in an F-ZTAT™ version with on-chip flash memory that can be
programmed on board.
Table 1.1 summarizes the features of the H8/38024 Group, H8/38024S Group, and H8/38124
Group.
Notes: 1. ZTAT (Zero Turn Around Time) is a trademark of Renesas Technology Corp.
2. F-ZTAT is a trademark of Renesas Technology Corp.
Rev. 6.00, 08/04, page 1 of 628
Table 1.1Features
ItemSpecification
CPUHigh-speed H8/300L CPU
• General-register architecture
General registers: Sixteen 8-bit registers (can be used as eight 16-bit
registers)
• Operating speed
Max. operating speed: 8 MHz (5 MHz for HD64F38024 and H8/38024S
Group)
Add/subtract: 0.25 µs (operating at 8 MHz), 0.4 µs (operating at φ =
5 MHz)
Multiply/divide: 1.75 µs (operating at 8 MHz), 2.8 µs (operating at φ =
5 MHz)
Can run on 32.768 kHz or 38.4 kHz subclock (32.768 kHz only for
H8/38124 Group)
• Instruction set compatible with H8/300 CPU
Instruction length of 2 bytes or 4 bytes
Basic arithmetic operations between registers
MOV instruction for data transfer between memory and registers
• Typical instructions
Multiply (8 bits × 8 bits)
Divide (16 bits ÷ 8 bits)
Bit accumulator
Register-indirect designation of bit position
Interrupts22 interrupt sources
• 13 external interrupt sources (IRQ
IRQAEC)
• 9 internal interrupt sources
, IRQ3, IRQ1, IRQ0, WKP7 to WKP0,
4
Rev. 6.00, 08/04, page 2 of 628
ItemSpecification
Clock pulse
generators
Power-down
modes
MemoryLarge on-chip me mory
I/O ports66 pins
Two on-chip clock pulse generators
• System clo ck pul se gener ator:
1.0 to 16 MHz: H8/38024 Group
1.0 to 10 MHz: HD64F38024, HD64F38024R, and H8/38024S Group
2.0 to 16 MHz: H8/38124 Group
• Subclock pulse generator: 32.768 kHz, 38.4 kHz
H8/38124 Group equipped with on-chip oscillator
Seven power-down modes
• Sleep (high-speed) mode
• Sleep (medium-speed) mode
• Standby mode
• Watch mode
• Subsleep mode
• Subactive mode
• Active (medium-speed) mode
• H8/38024, H8/38024S, and H8/38124: 32-Kbyte ROM, 1-Kbyte RAM
• H8/38023, H8/38023S, and H8/38123: 24-Kbyte ROM, 1-Kbyte RAM
• H8/38022, H8/38022S, and H8/38122: 16-Kbyte ROM, 1-Kbyte RAM
• H8/38021, H8/38021S, and H8/38121: 12-Kbyte ROM, 512 byte RAM
• H8/38020, H8/38020S, and H8/38120: 8-Kbyte ROM, 512 byte RAM
• 51 I/O pins (50 pins on H8/38124 Group)
• 9 input pins
• 6 output pins
Rev. 6.00, 08/04, page 3 of 628
ItemSpecification
TimersSix on-chip timers
• Timer A: 8-bit timer
Count-up timer with selection of eight internal clock signals divided from the
system clock (φ)* and four clock signals divided from the watch clock (φ
• Asynchronous event counter: 16-bit timer
Count-up timer able to count asynchronous external events
independently of the MCU's internal clocks
Asynchronous external events can be counted (both rising and falling edge
detection possible)
• Timer C: 8-bit timer
Count-up/down timer with selection of seven internal clock signals or
event input from external pin
Auto-reloading
• Timer F: 16-bit timer
Can be used as two independent 8-bit timers
Count-up timer with selection of four internal clock signals or event input
from external pin
Provision for toggle output by means of compare-match function
• Timer G: 8-bit timer
Count-up timer with selection of four internal clock signals
Incorporates input capture function (built-in noise canceler)
• Watchdog timer
Reset signal generated by overflow of 8-bit counter
*
)
w
Rev. 6.00, 08/04, page 4 of 628
ItemSpecification
Serial
communication
interface
10-bit PWMPulse-division PWM output for reduced ripple
A/D converterSuccessive approximations using a resistance ladder
LCD controller/
driver
Power-on reset
and low-voltage
detect circuits
(H8/38124 Group
only)
• SCI3: 8-bit synchronous/asynchronous serial interface
Incorporates multiproce ssor com muni cation function
• Can be used as a 10-bit D/A converter by connecting to an external lowpass filter.
• 8-channel analog input pins
• Conversion time: 31/φ or 62/φ per channel
LCD controller/driver equipped with a maximum of 32 segment pins and four
common pins
• Choice of four duty cycles (static, 1/2, 1/3, or 1/4)
• Segment pins can be switched to general-purpose port function in 4-bit units
Power-on reset circuit
• An internal reset signal can be issued at power-on by connecting an
external capacitor.
Low-voltage detect circuit
• Monitors the power supply voltage and issues an internal reset signal or
interrupt if the voltage goes below or above a specified range.
Rev. 6.00, 08/04, page 5 of 628
ItemSpecification
Product lineup
Mask ROM VersionZTAT VersionF-ZTAT Version Package
HD64338024HD64738024HD64F38024R
HD64338023——FP-80A
HD64338022——FP-80A
HD64338021——FP-80A
HD64338020——FP-80A
HD64338024S——FP-80A
HD64338023S——FP-80A
HD64338022S——FP-80A
HD64338021S——FP-80A
HD64338020S——FP-80A
HD64338124—HD64F38124FP-80A
HD64338123——FP-80A
HD64338122——FP-80A
HD64338121——FP-80A
HD64338120——FP-80A
Refer to appendix E for information on product model numbers.
Product Code
HD64F38024
FP-80A
FP-80B
TFP-80C
TLP-85V (HD64F38024R only)
Die (mask ROM/F-ZTAT version
only)
FP-80B
TFP-80C
Die
FP-80B
TFP-80C
Die
FP-80B
TFP-80C
Die
FP-80B
TFP-80C
Die
TFP-80C
TLP-85V
Die
TFP-80C
TLP-85V
Die
TFP-80C
TLP-85V
Die
TFP-80C
TLP-85V
Die
TFP-80C
TLP-85V
Die
TFP-80C
TFP-80C
TFP-80C
TFP-80C
TFP-80C
Note: * See section 4, Clock Pulse Generators, for the definition of φ and φw.
ROM/RAM Size
(Byte)
32K/1K
24K/1K
16K/1K
12K/512
8K/512
32K/1K
24K/1K
16K/1K
12K/512
8K/512
32K/1K
24K/1K
16K/1K
12K/512
8K/512
Rev. 6.00, 08/04, page 6 of 628
1.2Internal Block Diagram
Figure 1.1(1) shows a block diagram of the H8/38024 Group and H8/38024S Group.
Figure 1.1(2) shows a block diagram of the H8/38124 Group.
33, 34, and 35 are reserved for the
emulator and not available to the user.
P60/SEG
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
AV
Port 6Port 5Port 4Port 3Port 1
CC
Timer G
Asynchronous
ROM
Timer A
Timer C
counter
(16 bits)
A/D
(10 bits)
H8/300L
CPU
RAM
(512 bytes to 1 Kbyte)
10-bit PWM1
10-bit PWM2
Timer F
Serial
communication
interface
(SCI3)
WDT
LCD
controller
Large-current (15 mA/pin)
Port APort 9Port 8Port 7
supply
LCD power
Port B
CV
CC
V
SS
V
= AV
SS
SS
V
CC
RES
TEST
PA
/COM
3
PA2/COM
PA1/COM
PA0/COM
4
3
2
1
IRQAEC
P9
5
P9
4
P93/V
ref
P9
2
P91/PWM
P90/PWM
P87/SEG
P86/SEG
2
1
32
31
P85/SEG30
/SEG
P8
4
29
P83/SEG28
/SEG27
P8
2
/SEG
P8
1
26
P80/SEG
25
P77/SEG
24
P76/SEG
23
P75/SEG
22
P74/SEG
21
P73/SEG
20
P72/SEG
19
P71/SEG
18
P70/SEG
17
V
1
V
2
V
3
PB7/AN
7
PB6/AN
6
PB5/AN
5
PB4/AN
4
PB3/AN3/IRQ1/TMIC
/AN
PB
2
2
PB1/AN1/extU
/AN0/extD
PB
0
Figure 1.1(2) Block Diagram (H8/38124 Group)
Rev. 6.00, 08/04, page 8 of 628
1.3Pin Arrangement and Functions
1.3.1Pin Arrangement
The H8/38024 Group, H8/38024S Group, and H8/38124 Group pin arrangements are shown in
figures 1.2, 1.3, and 1.4. The bonding pad location diagram of the HCD64338024, HCD64338023,
HCD64338022, HCD64338021, and HCD64338020 is shown in figure 1.5. The bonding pad
coordinates of the HCD64338024, HCD64338023, HCD64338022, HCD64338021, and
HCD64338020 are given in table 1.2. The bonding pad location diagram of the HCD64F38024,
HCD64F38024R is shown in figure 1.6. The bonding pad coordinates of the HCD64F38024 are
given in table 1.3. The bonding pad location diagram of the HCD64338024S, HCD64338023S,
HCD64338022S, HCD64338021S, and HCD64338020S is shown in figure 1.7. The bonding pad
coordinates of the HCD64338024S, HCD64338023S, HCD64338022S, HCD64338021S, and
HCD64338020S are given in table 1.4.
Note: VSS Pads (No. 8 and 9) should be connected to power supply lines.
TEST Pad (No. 12) should be connected to V
If the pad of these aren’t connected to the power supply line, the LSI will not operate correctly. These values show the
coordinates of the centers of pads. The accuracy is ±5 µm. The home-point position is the chip’s center and the center
is located at half the distance between the upper and lower pads and left and right pads.
–1870154642P84/SEG291870–1571
–187030449PA0/COM11870–550
–187017350V31870–410
CC
SS
.
SS
187010
1870150
Rev. 6.00, 08/04, page 14 of 628
8179777573 7169 67 65
8078767472 70 68 6664
11
13
15
17
19
21
23
62
60
58
56
54
52
50
48
46
44
42
63
61
59
57
55
53
51
49
47
45
43
1
2
3
4
5
6
7
8
9
10
12
14
16
18
20
22
24262528 30 3234 36 3840
27 29 31 33 35 37 3941
(0, 0)
Y
X
Type code
Chip size: 3.84 mm × 4.24 mm
Voltage level on the back of the chip: GND
: NC pad
Figure 1.6 Bonding Pad Location Diagram of HCD64F38024, HCD64F38024R (Top View)
Rev. 6.00, 08/04, page 15 of 628
Table 1.3 Bonding Pad Coordinates of HCD64F38024, HCD64F38024R
CoordinatesCoordinates
Pad No. Pad NameX (µµµµm)Y (µµµµm)Pad No.Pad NameX (µµµµm)Y (µµµµm)
Note: VSS Pads (No. 9 and 10) should be connected to power supply lines.
TEST Pad (No. 13) should be connected to V
If the pad of these aren’t connected to the power supply line, the LSI will not operate correctly. These values show the
coordinates of the centers of pads. The accuracy is ±5 µm. The home-point position is the chip’s center and the center
is located at half the distance between the upper and lower pads and left and right pads.
–1802171743P84/SEG291802–1750
–180263850PA0/COM11802–840
–180247351V31802–726
CC
SS
.
SS
1802–267
1802–126
Rev. 6.00, 08/04, page 16 of 628
807978777675747372
7170696867666564636261
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
212223242526272829
Y
(0.0)
3031323334353637383940
X
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
Chip size: 2.91 mm × 2.91 mm
Voltage level on the back of the chip: GND
Figure 1.7 Bonding Pad Location Diagram of HCD64338024S, HCD64338023S,
HCD64338022S, HCD64338021S, and HCD64338020S (Top View)
Rev. 6.00, 08/04, page 17 of 628
Table 1.4Bonding Pad Coordinates of HCD64338024S, HCD64338023S, HCD64338022S,
HCD64338021S, and HCD64338020S
CoordinatesCoordinates
Pad No. Pad NameX (µµµµm)Y (µµµµm)Pad No.Pad NameX (µµµµm)Y (µµµµm)
Note: Pad No. 11 (TEST) should be connected to VSS.
If it is not connected, the LSI will not operate correctly.
These values show the coordinates of the centers of pads. The accuracy is ±5 µm.
The home-point position is the chip’s center and the center is located at halfway between the upper and lower pads and
the left and right pads.
–1338105341P84/SEG291338–1121
–133822948PA0/COM11338–277
CC
SS
1338156
1338362
Rev. 6.00, 08/04, page 18 of 628
1.3.2Pin Functions
*
*
*
Table 1.5 outlines the pin functions of the H8/38024 Group.
Table 1.5Pin Functions
Pin No.
Pad
Pad
1
No.
No.
9
541055853
898InputAnalog ground: This is
52
53
51
52
50
51
TypeSymbol
Power
V
CC
source
pins
V
SS
AV
CC
AV
SS
V
1
V
2
V
3
*
CV
CC
FP-80A
TFP-80C FP-80B TLP-85V
5254E8535452InputPower supply: All V
8
(= AV
53
SS
)
10
(= AVSS)
55
D8
E1
(= AV
)
SS
13B1121InputAnalog power supply:
8 (= VSS)10
(= V
)E1(= VSS)
SS
51
50
49
4
4—————InputPower supply: This is
53
52
51
F9
E9
F8
Pad
2
3
No.
I/OName and Functions
CC
pins should be connected
to the system power
supply.
InputGround: All V
SS
pins
should be connected to
the system power supply
(0 V).
This is the power supply
pin for the A/D converter.
When the A/D converter
is not used, connect this
pin to the system power
supply.
the A/D converter ground
pin. It should be
connected to the system
power supply (0V).
51
InputLCD power supply:
50
49
These are the power
supply pins for the LCD
controller/driver.
the internal step-down
power supply pin. To
ensure stability, a
capacitor with a rating of
about 0.1 µF should be
connected between this
pin and the V
These pins connect to a
crystal or ceramic
oscillator, or can be used
to input an external clock.
See section 4, Clock
Pulse Generators, for a
typical connection
diagram.
These pins connect to a
32.768-kHz or 38.4-kHz
crystal oscillator.
See section 4, Clock
Pulse Generators, for a
typical connection
diagram.
driven low, the chip is
reset
reserved and cannot be
used. It should be
connected to V
.
SS
1, 3, and 4: These are
input pins for edgesensitive external
interrupts, with a selection
of rising or falling edge
counter event signal:
This is an interrupt input
pin for enabling
asynchronous event
input.
On the H8/38124 Group,
this must be fixed at V
CC
or GND because the
oscillator is selected by
the input level during
resets. Refer to section 4,
Clock Pulse Generators,
for information on the
selection method.
request 7 to 0: These are
input pins for rising or
falling-edge-sensitive
external interrupts.
Rev. 6.00, 08/04, page 20 of 628
TypeSymbol
*
*
*
Timer
pins
AEVL
AEVH6867
TMIC7678B3777876InputTimer C event input:
UD6163A9626361InputTimer C up/down select:
TMIF57D1565InputTimer F event input:
TMOFL6264A8636462Output Timer FL output: This is
TMOFH 6365B9646563Output Timer FH output: This is
TMIG24C1232InputTimer G capture input:
10-bit
PWM pin
PWM1
PWM25455
Pin No.
FP-80A
TFP-80C FP-80B TLP-85V
70
69
56
57
A6
B7
E10
D9
Pad
No.
Pad
2
3
No.
I/OName and Functions
Pad
No.
1
696870696867InputAsynchronous event
counter event input:
This is an event input pin
for input to the
asynchronous event
counter.
This is an event input pin
for input to the timer C
counter.
This pin selects up- or
down-counting for the
timer C counter. The
counter operates as a
down-counter when this
pin is high, and as an upcounter when low.
This is an event input pin
for input to the timer F
counter.
an output pin for
waveforms generated by
the timer FL output
compare function.
an output pin for
waveforms generated by
the timer FH output
compare function.
This is an input pin for
timer G input capture.
555656575455Output 10-bit PWM output:
These are output pins for
waveforms generated by
the channel 1 and 2 10-bit
PWMs.
Rev. 6.00, 08/04, page 21 of 628
TypeSymbol
*
*
*
I/O ports P1
P1
P1
P1
7
6
4
3
P37 to
P3
0
P4
3
P42 to
P4
0
P57 to
P5
0
P67 to
P6
0
P77 to
P7
0
Pin No.
Pad
No.
6
5
4
3
Pad
2
3
No.
I/OName and Functions
5
I/OPort 1: This is a 4-bit I/O
4
3
2
port. Input or output can
be designated for each bit
by means of port control
FP-80A
TFP-80C FP-80B TLP-85V
5
4
3
2
7
6
5
4
D1
C2
B2
C1
Pad
No.
5
4
3
2
1
register 1 (PCR1).
Note that the H8/38124
Group is not equipped
with a pin 16.
68 to 6170 to 63 A6, B7
C7, A7
B8, B9
A8, A9
69 to6270 to6368 to61I/OPort 3: This is an 8-bit I/O
port. Input or output can
be designated for each bit
by means of port control
register 3 (PCR3).
If the on-chip emulator is
used, pins 33, 34, and 35
are reserved for the
emulator and not
available to the user.
7274C5737472InputPort 4 (bit 3): This is a 1-
bit input port.
71 to 6973 to 71 B6
B5
C6
72 to7073 to7171 to69I/OPort 4 (bits 2 to 0): This
is a 3-bit I/O port. Input or
output can be designated
for each bit by means of
port control register 4
(PCR4).
20 to 1322 to 15 H1, J1
H3, G1
H2, G2
F1, G3
21 to1422 to1520 to13I/OPort 5: This is an 8-bit I/O
port. Input or output can
be designated for each bit
by means of port control
register 5 (PCR5).
28 to 2130 to 23 K5, J4
H4, K4
J3, J2
K3, K2
29 to2230 to2328 to21I/OPort 6: This is an 8-bit I/O
port. Input or output can
be designated for each bit
by means of port control
register 6 (PCR6).
36 to 2938 to 41 J8, J7
K6, H7
H6, J7
H6, J5
J6, H5
37 to3038 to3136 to29I/OPort 7: This is an 8-bit I/O
port. Input or output can
be designated for each bit
by means of port control
register 7 (PCR7).
Rev. 6.00, 08/04, page 22 of 628
TypeSymbol
*
*
*
I/O ports P87 to
P8
0
P95 to
P9
0
PA3 to
PA
0
PB7 to
PB
0
Serial
RXD
32
communication
(SCI)
A/D
converter
TXD
SCK
AN7 to
AN
0
32
32
ADTRG 35B2343InputA/D converter trigger
Pin No.
Pad
No.
Pad
2
3
No.
I/OName and Functions
port. Input or output can
be designated for each bit
by means of port control
FP-80A
TFP-80C FP-80B TLP-85V
44 to 3746 to 39 H9, J9
H10, J10
K8, K9
H8, K7
Pad
1
No.
45 to3846 to3944 to37I/OPort 8: This is an 8-bit I/O
register 8 (PCR8).
59 to 5461 to 56 B10, C8
D10, C9
D9, E10
60 to5561 to5659 to54Output Port 9: This is a 6-bit
output port. If the on-chip
emulator is used, pin 95 is
reserved for the emulator
and not available to the
user. In the case of the
F-ZTAT version, pin 95
should not be left open in
the user mode, and
should instead be pulled
up to high level.
45 to 4847 to 50 G10
G8
G9
F10
46 to4947 to5045 to48I/OPort A: This is a 4-bit I/O
port. Input or output can
be designated for each bit
by means of port control
register A (PCRA).
80 to 732, 1,
80 to 75
A3, A2
C3, A4
B3, B4
81 to741,
80 to73InputPort B: This is an 8-bit
81 to
input port.
75
A5, C4
7072B5717270InputSCI3 receive data input:
This is the SCI3 data
input pin.
7173B6727371Output SCI3 transmit data
output: This is the SCI3
data output pin.
6971C6707169I/OSCI3 clock I/O: This is
the SCI3 clock I/O pin.
80 to 732, 1,
80 to 75
A3, A2
C3, A4
B3, B4
A5, C4
81 to741,
80 to73InputAnalog input channels 7
81 to
75
to 0: These are analog
data input channels to the
A/D converte.
input: This is the external
trigger input pin to the A/D
converter.
input: This is the LVD
reference voltage input
pin.
detect voltage input:
This is the LVD power
supply drop detect
voltage input pin.
extD74—————InputLVD power supply rise
detect voltage input:
This is the LVD power
supply rise detect voltage
input pin.
Notes: 1. Pad number for HCD64338024, HCD64338023, HCD64338022, HCD64338021, and
HCD64338020.
2. Pad number for HCD64F38024 and HCD64F38024R.
3. Pad number for HCD64338024S, HCD64338023S, HCD64338022S, HCD64338021S,
and HCD64338020S.
4. H8/38124 Group only
Rev. 6.00, 08/04, page 24 of 628
Section 2 CPU
2.1Overview
The H8/300L CPU has sixteen 8-bit general registers, which can also be pa i red as eight 16-bit
registers. Its concise instruction set is designed fo r high-speed operation.
2.1.1Features
Features of the H8/300L CPU are listed below.
• General-register architecture
Sixteen 8-bit general regi st ers, also usable as eight 16-bit general registers
• Instruction set with 55 basic instructions, including:
Multiply and divide instructions
Powerful bit-manipulation instructions
• Eight addressing modes
Register direct
Register indirect
Register indirect with displacement
Register indirect with post-increment or pre-decrement
Absolute address
Immediate
Program-counter relative
Memory indirect
• 64-Kbyte address space
• High-speed operation
All frequently used instructions are executed in two to four states
High-speed arithmetic and logic operations
8- or 16-bit register-register add or subtract: 0 .25 µs
8 × 8-bit multiply:1.75 µs
16 ÷ 8-bit divide:1.75 µs
*
*
*
Note: * These values are at φ = 8 MHz.
• Low-power operation modes
SLEEP instruction for transfer to low-power operation
Rev. 6.00, 08/04, page 25 of 628
2.1.2Address Spa ce
The H8/300L CPU supports an address space of up to 64 Kbytes for storing program code and
data.
See section 2.8, Memory Map, for details of the memory map.
2.1.3Register Configuration
Figure 2.1 shows the register structure of the H8/300L CPU. There are two groups of registers: the
general registers and control registers.
General registers (Rn)
7070
R0H
R1H
R2H
R3H
R4H
R5H
R6H
R7H
(SP)
R0L
R1L
R2L
R3L
R4L
R5L
R6L
R7L
Control registers (CR)
150
[Legend]
SP: Stack pointer
PC: Program counter
CCR: Condition code register
I: Interrupt mask bit
U: User bit
H: Half-carry flag
N: Negative flag
Z: Zero flag
V: Overflow flag
C: Carry flag
Rev. 6.00, 08/04, page 26 of 628
PC
76543210
CCR
I UHUNZ VC
Figure 2.1 CPU Registers
2.2Register Descriptions
2.2.1General Registers
All the general registers can be used as both data registers and address registers.
When used as data registers, they can be accessed as 16-bit registers (R0 to R7), or the high bytes
(R0H to R7H) and low bytes (R0L to R7L) can be accessed separately as 8-bit registers.
When used as address registers, the general registers are accessed as 16-bit registers (R0 to R7).
R7 also functions as the stack pointer (SP), used implicitly by hardware in exception processing
and subroutine calls. When it functions as the stack pointer, as indicated in figure 2.2, SP (R7)
points to the top of the stack.
Lower address side [H'0000]
Unused area
SP (R7)
Stack area
Upper address side [H'FFFF]
Figure 2.2 Stack Pointer
2.2.2Control Registers
The CPU control registers include a 16-bit pro gram counter (PC) and an 8-bit condition code
register (CCR).
Program Counter (PC)
This 16-bit register indicates the address of the next instruction the CPU will execute. All
instructions are fetched 16 bits (1 word) at a time, so the least significant bit of the PC is ignored
(always regarded as 0).
Rev. 6.00, 08/04, page 27 of 628
Condition Code Register (CCR)
This 8-bit register contains internal status information, including the interrupt mask bit (I) and
half-carry (H), negative (N), zero (Z), overflow (V), and carry (C) flags. These bits can be read
and written by so ftware (using the LDC, STC, ANDC, ORC, and XORC instructions). The N, Z,
V, and C flags are used as branching conditions for conditional branching (Bcc) instructions.
Bit 7—Interrupt Mask Bit (I): When this bit is set to 1, interrupts are masked. This bit is set to 1
automatically at the start of exception handling. The interrupt mask bit may be read and written
by software. For further details, see section 3.3, Interrupts.
Bit 6—User Bit (U): Can be used freely by the user.
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 is cleared to 0
otherwise.
The H flag is used implicitly by the DAA and DAS instructions.
When the ADD.W, SUB.W, or CMP.W instruction is executed, the H flag is set to 1 if there is a
carry or borrow at bit 11, and is cleared to 0 otherwise.
Bit 4—User Bit (U): Can be used freely by the user.
Bit 3—Negative Flag (N): Indicates the most significant bit (sign bit) of the result of an
instruction.
Bit 2—Zero Flag (Z): Set to 1 to indicate a zero result, and cleared to 0 to indicate a non-zero
result.
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 some or all of the flag bits unchanged.
Refer to the H8/300L Series Programming Manual for the action of each instruction on the flag
bits.
Rev. 6.00, 08/04, page 28 of 628
2.2.3Initial Register Values
When the CPU is reset, the program counter (PC) is initialized to the value stored at address
H'0000 in the vector table, and the I bit in the CCR is set to 1. The other CCR bits and the general
registers are not initialized. In particular, the stack pointer (R7) is not initialized. T he stack pointer
should be initialized by software, by the first instruction executed af ter a r e set.
2.3Data Formats
The H8/300L CPU can process 1-bit data, 4-bit (BCD) data, 8-bit (byte) data, and 16-bit (word)
data.
• Bit manipulation instructions operate on 1-bit data specified as bit n in a byte operand
(n = 0, 1, 2, ..., 7).
• All arithmetic and logic instructions except ADD S and SUBS can operate on byte data.
• The MOV.W, ADD.W, SUB.W, CMP.W, ADDS, SUBS, MULXU (8 bits × 8 bits), and
DIVXU (16 bits ÷ 8 bits) instructions operate on word data.
• The DAA and DAS instructions perform decimal arithmetic adjustments on byte data in
packed BCD form. Each nibble of the byte is treated as a decimal digit.
Rev. 6.00, 08/04, page 29 of 628
2.3.1Data Formats in General Registers
Data of all the sizes above can be stored in general registers as shown in figure 2.3.
Data TypeRegister No.Data Format
70
1-bit dataRnH
1-bit dataRnL
Byte dataRnH
Byte dataRnL
Word dataRn
76543210Don't care
70
76543210Don't care
70
MSBLSB
70
Don't care
150
MSBLSB
MSBLSB
Don't care
7034
4-bit BCD dataRnH
Upper digitLower digit
4-bit BCD dataRnL
[Legend]
Upper byte of general register
RnH:
Lower byte of general register
RnL:
Most significant bit
MSB:
Least significant bit
LSB:
Rev. 6.00, 08/04, page 30 of 628
70
Don't care
Figure 2.3 Register Data Formats
Don't care
34
Upper digitLower digit
2.3.2Memory Data Formats
Figure 2.4 indicates the data formats in memory. The H8/300L CPU can access word data stored
in memory (MOV.W instruction), but the word data must always begin at an even address. If word
data starting at an odd address is accessed, the least significant bit of the address is regarded as 0,
and the word data starting at the preceding address is accessed. The same applies to instruction
codes.
1-bit data
Byte data
Word data
Byte data (CCR) on stack
Word data on stack
Note: * Ignored on return
[Legend]
CCR: Condition code register
AddressData Type
Address n
Address n
Even address
Odd address
Even address
Odd address
Even address
Odd address
Data Format
70
76543210
MSBLSB
MSB
MSBLSBCCR
MSBLSB
MSB
Upper 8 bits
Lower 8 bits
*
CCR
LSB
LSB
Figure 2.4 Memory Data Formats
When the stack is accessed using R7 as an address register, word access should always be
performed. When the CCR is pushed on the stack, two identical copies of the CCR are pushed to
make a complete word. When they are restored, the lower byte is ignored.
Rev. 6.00, 08/04, page 31 of 628
2.4Addressing Modes
2.4.1Addressing Modes
The H8/300L CPU supports the eight addressing modes listed in table 2.1. Each instruction uses a
subset of these addressing modes.
Table 2.1Addressing Modes
No.Address ModesSymbol
1Register directRn
2Register indirect@Rn
3Register indirect with displacement@(d:16, Rn)
4Register indirect with post-increment
Register indirect with pre-decrement
5Absolute address@aa:8 or @aa:16
6Immediate#xx:8 or #xx:16
7Program-counter relative@(d:8, PC)
8Memory indirect@@aa:8
Register Direct—Rn: The register field of the instruction specifies an 8- or 16-bit general register
containing the operand.
@Rn+
@–Rn
Only the MOV.W, ADD.W, SUB.W, CMP.W, ADDS, SUBS, MULXU (8 bits × 8 bits), and
DIVXU (16 bits ÷ 8 bits) instructions have 16-bit operands.
Register Indirect—@Rn: The register field of the instruction specifies a 16-bit general register
containing the address of the operand in memory.
Register Indirect with Displacement—@(d:16, Rn): The instruction has a second word (bytes 3
and 4) containing a displacement which is added to the contents of the specified general register to
obtain the operand address in memory.
This mode is used only in MOV instructions. For the MOV.W instruction, the resulting address
must be even.
Rev. 6.00, 08/04, page 32 of 628
Register Indirect with Post-Increment or Pre-Decrement—@Rn+ or @–Rn:
• Register indirect with post-increment—@Rn+
The @Rn+ mode is used with MOV instructions t hat load registers from memory.
The register field of the instruction specifies a 16-bit general register containing the address of
the operand. After the operand is accessed, the register is incremented by 1 for MOV.B or 2 for
MOV.W. For MOV.W, the original contents of the 16-bit general register must be even.
• Register indirect with pre-decrement—@–Rn
The @–Rn mode is used with MOV instructions that store register contents to memory.
The register field of the instruction specifies a 16-bit general register which is decremented by
1 or 2 to obtain the address of the operand in memory. The register retains the decremented
value. The size of the decrement is 1 for MOV.B or 2 for MOV.W. For MOV.W, the original
contents of the register must be even.
Absolute Address—@aa:8 or @aa:16: The instruction specifies the absolute address of the
operand in memory.
The absolute address may be 8 bits long (@aa:8) or 16 bits long (@aa:16). The MOV.B and bit
manipulation instructions can use 8-bit absolute addresses. The MOV.B, MOV.W, JMP, and JSR
instructions can use 16-bit absolute addresses.
For an 8-bit absolute address, the upper 8 bits are assumed to be 1 (H'FF). The address range is
H'FF00 to H'FFFF (65280 to 65535).
Immediate—#xx:8 or #xx:16: The instruction contains an 8-bit operand (#xx:8) i n its second
byte, or a 16-bit operand (#xx:16) in its third and fourth bytes. Only MOV.W instructio ns ca n
contain 16-bit immediate values.
The ADDS and SUBS instructions implicitly contain the value 1 or 2 as immediate data. Some bit
manipulation instructions contain 3-bit immediate data in the second or fourth byte of the
instruction, specifying a bit number.
Program-Counter Relative—@(d:8, PC): This mode is used in the Bcc and BSR instructions.
An 8-bit displacement in byte 2 of the instruction code is sign-extended to 16 bits and added to the
program counter contents to generate a branch destination address. The possible branching range
is –126 to +128 bytes (–63 to +64 words) from the current address. The displacement should be an
even number.
Memory Indirect—@@aa:8: This mode can be used by the JMP and JSR instructions. The
second byte of the instruction code specifies an 8-bit absolute address. The word located at this
address contains the branch destination address.
Rev. 6.00, 08/04, page 33 of 628
The upper 8 bits of the absolute address are assumed to be 0 (H'00), so the address range is from
H'0000 to H'00FF (0 to 255). Note that with the H8/300L Series, the lower end of the address area
is also used as a vector area. See section 3.3, Interrupts, for details on the vector area.
If an odd address is specified as a branch destination or as the operand address of a MOV.W
instruction, the least significant bit is regarded as 0, causing word access to be performed at the
address preceding the specified address. See section 2.3.2, Memory Data Formats, for further
information.
2.4.2Effective Address Calculation
Table 2.2 shows how effective addresses are calculated in each of the addressing modes.
Arithmetic and logic instructions use register direct addressing (1). The ADD.B, ADDX, SUBX,
CMP.B, AND, OR, and XOR instructions can also use immediate addressing (6).
Data transfer instructions can use all addressing modes except program-counter relative (7) and
memory indirect (8).
Bit manipulation instructions can use register direct (1 ) , register indirect (2 ), or 8-bit absolute
addressing (5) to specify the operand. Register indirect (1) (BSET, BCLR, BNOT, and BTST
instructions) or 3-bit immediate addressing (6) can be used indepe ndently to specify a bit position
in the operand.
Rev. 6.00, 08/04, page 34 of 628
Table 2.2Effective Address Calculation
rn
30
rm
30
015
Operand is contents of registers indicated by rm/rn
, JMP, BSR, JSR, RTS5
System controlRTE, SLEEP, LDC, STC, ANDC, ORC, XORC, NOP8
Block data transferEEPMOV1
Notes: 1. PUSH Rn is equivalent to MOV.W Rn, @–SP.
POP Rn is equivalent to MOV.W @SP+, Rn. The same applies to the machine
language.
2. Bcc is a conditional branch instruction in which cc represents a condition code.
, POP
1
*
1
14
14
Total: 55
The following sections give a concise summary of the instructions in each category, and indicate
the bit patterns of their object code. The notation used is defined next.
Rev. 6.00, 08/04, page 38 of 628
Notation
RdGeneral register (destination)
RsGeneral register (source)
RnGeneral register
(EAd), <EAd>Destination operand
(EAs), <EAs>Source operand
CCRCondition code register
NN (negative) flag of CCR
ZZ (zero) flag of CCR
VV (overflow) flag of CCR
CC (carry) flag of CCR
PCProgram counter
SPStack pointer
#IMMImmediate data
dispDisplacement
+Addition
–Subtraction
×Multiplication
÷Division
∧AND logical
∨OR logical
⊕Exclusive OR logical
→Move
Table 2.4 describes the data transfer instructions. Figure 2.5 shows their object code formats.
Table 2.4Data Transfer Instructions
InstructionSize
MOVB/W(EAs) → Rd, Rs → (EAd)
POPW@SP+ → Rn
PUSHWRn → @–SP
Notes: * Size: Operand size
B:Byte
W:Word
*
Function
Moves data between two general registers or between a general
register and memory, or moves immediate data to a general
register.
The Rn, @Rn, @(d:16, Rn), @aa:16, #xx:16, @–Rn, and @Rn+
addressing modes are available for word data. The @aa:8
addressing mode is available for byte data only.
The @–R7 and @R7+ modes require word operands. Do not
specify byte size for these two modes.
Pops a 16-bit general register from the stack. Equivalent to
MOV.W @SP+, Rn.
Pushes a 16-bit general register onto the stack. Equivalent to
MOV.W Rn, @–SP.
Certain precautions are required in data access. See section 2.9.1, Notes on Data Access, for
details.
Figure 2.7 lists the format of the bit manipulation instructions.
Rev. 6.00, 08/04, page 40 of 628
15087
oprmrn
15087
oprmrn
15087
oprmrn
disp
MOV
Rm→Rn
@Rm←→Rn
@(d:16, Rm)←→Rn
15087
oprmrn
15087
oprnabs
15087
oprn
abs
15087
oprnIMM
15087
oprn
IMM
15087
oprn
[Legend]
op:
rm, rn:
disp:
abs:
IMM:
Operation field
Register field
Displacement
Absolute address
Immediate data
111
@Rm+→Rn, or
Rn →@−Rm
@aa:8←→Rn
@aa:16←→Rn
#xx:8→Rn
#xx:16→Rn
PUSH, POP
@SP+ Rn, or
→
Rn @−SP
→
Figure 2.5 Data Transfer Instruction Codes
Rev. 6.00, 08/04, page 41 of 628
2.5.2Arith metic Operations
Table 2.5 describes the arithmetic instructions.
Table 2.5Arithmetic Instructions
InstructionSize
ADD
SUB
ADDX
SUBX
INC
DEC
ADDS
SUBS
DAA
DAS
MULXUBRd × Rs → Rd
DIVXUBRd ÷ Rs → Rd
CMPB/WRd – Rs, Rd – #IMM
NEGB0 – Rd → Rd
Notes: * Size: Operand size
B:Byte
W:Word
*
B/WRd ± Rs → Rd, Rd + #IMM → Rd
BRd ± Rs ± C → Rd, Rd ± #IMM ± C → Rd
BRd ± 1 → Rd
WRd ± 1 → Rd, Rd ± 2 → Rd
BRd decimal adjust → Rd
Function
Performs addition or subtraction on data in two general registers,
or addition on immediate data and data in a general register.
Immediate data cannot be subtracted from data in a general
register. Word data can be added or subtracted only when both
words are in general registers.
Performs addition or subtraction with carry or borrow on byte data
in two general registers, or addition or subtraction on immediate
data and data in a general register.
Increments or decrements a general register by 1.
Adds or subtracts 1 or 2 to or from a general register
Decimal-adjusts (adjusts to 4-bit BCD) an addition or subtraction
result in a general register by referring to the CCR
Performs 8-bit × 8-bit unsigned multipl ic atio n on data in two
general registers, providing a 16-bit result
Performs 16-bit ÷ 8-bit unsigned division on data in two general
registers, providing an 8-bit quotient and 8-bit remainder
Compares data in a general register with data in another general
register or with immediate data, and indicates the result in the
CCR. Word data can be compared only between two general
registers.
Obtains the two’s complement (arithmetic complement) of data in a
general register
Rev. 6.00, 08/04, page 42 of 628
2.5.3Logic Operations
Table 2.6 describes the four instructions that perform logic operations.
Table 2.6Logic Operation Instructions
InstructionSize
ANDBRd ∧ Rs → Rd, Rd ∧ #IMM → Rd
ORBRd ∨ Rs → Rd, Rd ∨ #IMM → Rd
XORBRd ⊕ Rs → Rd, Rd ⊕ #IMM → Rd
NOTB~ Rd → Rd
Notes: * Size: Operand size
B:Byte
*
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
Obtains the one’s complement (logical complement) of general
register contents
2.5.4Shift Operations
Table 2.7 describes the eight shift instructions.
Table 2.7Shift Instr uctions
InstructionSize
SHAL
SHAR
SHLL
SHLR
ROTL
ROTR
ROTXL
ROTXR
Notes: * Size: Operand size
B:Byte
*
BRd shift → Rd
BRd shift → Rd
BRd rotate → Rd
BRd rotate through carry → Rd
Function
Performs an arithmetic shift operation on general register contents
Performs a logical shift operation on general register contents
Rotates general register contents
Rotates general register contents through the C (carry) bit
Rev. 6.00, 08/04, page 43 of 628
Figure 2.6 shows the instruction code format of arithmetic, logic, and shift instructions.
15087
oprmrn
15087
oprn
15087
oprn
15087
op
15087
rnIMM
oprn
15087
op
15087
rnIMM
op
[Legend]
op:
rm, rn:
IMM:
Operation field
Register field
Immediate data
rm
rm
rn
ADD, SUB, CMP,
ADDX, SUBX (Rm)
ADDS, SUBS, INC, DEC,
DAA, DAS, NEG, NOT
MULXU, DIVXU
ADD, ADDX, SUBX,
CMP (#XX:8)
AND, OR, XOR (Rm)
AND, OR, XOR (#xx:8)
SHAL, SHAR, SHLL, SHLR,
ROTL, ROTR, ROTXL, ROTXR
Figure 2.6 Arithmetic, Logic, and Shift Instruction Codes
Rev. 6.00, 08/04, page 44 of 628
2.5.5Bit Manipulations
Table 2.8 describes the bit-manipulation instructions. Figure 2.7 shows their object code formats.
Table 2.8Bit-Manipulation Instructions
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
BORBC ∨ (<bit-No.> of <EAd>) → C
BIORBC ∨ [~ (<bit-No.> of <EAd>)] → C
Notes: * Size: Operand size
B:Byte
*
Function
Sets a specified bit in a general register or memory to 1. The bit
number is specified by 3-bit immediate data or the lower three bits
of a general register.
Clears a specified bit in a general register or memory to 0. The bit
number is specified by 3-bit immediate data or the lower three bits
of a general register.
Inverts a specified bit in a general register or memory. The bit
number is specified by 3-bit immediate data or the lower three bits
of a general register.
Tests a specified bit in a general register or memory and sets or
clears the Z flag accordingly. The bit number is specified by 3-bit
immediate data or the lower three bits of a general register.
ANDs the C flag with a specified bit in a general register or
memory, and stores the result in the C flag.
ANDs the C flag with the inverse of a specified bit in a general
register or memory, and stores the result in the C flag.
The bit number is specified by 3-bit immediate data.
ORs the C flag with a specified bit in a general register or memory,
and stores the result in the C flag.
ORs the C flag with the inverse of a specified bit in a general
register or memory, and stores the result in the C flag.
The bit number is specified by 3-bit immediate data.
Rev. 6.00, 08/04, page 45 of 628
InstructionSize
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>)
BISTB~ C → (<bit-No.> of <EAd>)
Notes: * Size: Operand size
B:Byte
*
Function
XORs the C flag with a specified bit in a general register or
memory, and stores the result in the C flag.
XORs the C flag with the inverse of a specified bit in a general
register or memory, and stores the result in the C flag.
The bit number is specified by 3-bit immediate data.
Copies a specified bit in a general register or memory to the C flag.
Copies the inverse of a specified bit in a general register or
memory to the C flag.
The bit number is specified by 3-bit immediate data.
Copies the C flag to a specified bit in a general register or memory.
Copies the inverse of the C flag to a specified bit in a general
register or memory.
The bit number is specified by 3-bit immediate data.
Certain precautions are required in bit manipulation. See section 2.9.2, Notes on Bit
Manipulation, for details.
Figure 2.7 lists the format of the bit manipulation instructions.
Rev. 6.00, 08/04, page 46 of 628
15087
opIMMrn
BSET, BCLR, BNOT, BTST
Operand:
Bit No.:
register direct (Rn)
immediate (#xx:3)
15087
oprn
15087
op0
op
15087
op0
15087
op
op
15087
op
15087
opIMMrn
rm
rn
rn
abs
abs
Operand:
Bit No.:
Operand:
0000000IMM
Bit No.:
Operand:
0000000rmop
Bit No.:
Operand:
0000IMM
Bit No.:
Operand:
0000rmop
Bit No.:
register direct (Rn)
register direct (Rm)
register indirect (@Rn)
immediate (#xx:3)
register indirect (@Rn)
register direct (Rm)
absolute (@aa:8)
immediate (#xx:3)
absolute (@aa:8)
register direct (Rm)
BAND, BOR, BXOR, BLD, BST
Operand:
Bit No.:
register direct (Rn)
immediate (#xx:3)
15087
op0
15087
op
[Legend]
op:
rm, rn:
abs:
IMM:
Operation field
Register field
Absolute address
Immediate data
Figure 2.7 Bit Manipulation Instruction Codes
rn
0000000IMMop
abs
0000IMMop
Operand:
Bit No.:
Operand:
Bit No.:
register indirect (@Rn)
immediate (#xx:3)
absolute (@aa:8)
immediate (#xx:3)
Rev. 6.00, 08/04, page 47 of 628
15087
opIMMrn
15087
op0
15087
op
[Legend]
op:
rm, rn:
abs:
IMM:
Operation field
Register field
Absolute address
Immediate data
Figure 2.7 Bit Manipulation Instructio n Codes (cont)
BIAND, BIOR, BIXOR, BILD, BIST
Operand:
Bit No.:
rn
0000000IMMop
abs
0000IMMop
Operand:
Bit No.:
Operand:
Bit No.:
register direct (Rn)
immediate (#xx:3)
register indirect (@Rn)
immediate (#xx:3)
absolute (@aa:8)
immediate (#xx:3)
Rev. 6.00, 08/04, page 48 of 628
2.5.6Branching Instructions
Table 2.9 describes the branching instructions. Figure 2.8 shows their object code formats.
Table 2.9Branching Instructions
InstructionSizeFunction
Bcc—Branches to the designated address if condition cc is true. The
branching conditions are given 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. 6.00, 08/04, page 49 of 628
15087
opccdisp
15087
oprm0
15087
op
abs
15087
opabs
15087
opdisp
15087
oprm0
15087
op
abs
000
000
Bcc
JMP (@Rm)
JMP (@aa:16)
JMP (@@aa:8)
BSR
JSR (@Rm)
JSR (@aa:16)
15087
opabs
15087
[Legend]
op:
Operation field
cc:
Condition field
rm:
Register field
disp:
Displacement
abs:
Absolute address
Figure 2.8 Branching Instruction Codes
Rev. 6.00, 08/04, page 50 of 628
op
JSR (@@aa:8)
RTS
2.5.7System Control Instructions
Table 2.10 describes the system control instructions. Figure 2.9 shows their object code formats.
Table 2.10 System Control Instructions
InstructionSize
RTE—Returns from an exception-handling routine
SLEEP—Causes a transition from active mode to a power-down mode. See
LDCBRs → CCR, #IMM → CCR
STCBCCR → Rd
ANDCBCCR ∧ #IMM → CCR
ORCBCCR ∨ #IMM → CCR
XORCBCCR ⊕ #IMM → CCR
NOP—PC + 2 → PC
Notes: * Size: Operand size
B:Byte
*
Function
section 5, Power-Down Modes, for details.
Moves immediate data or general register contents to the condition
code register
Copies the condition code register to a specified general register
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. 6.00, 08/04, page 51 of 628
15087
op
15087
oprn
RTE, SLEEP, NOP
LDC, STC (Rn)
15087
opIMM
ANDC, ORC,
XORC, LDC (#xx:8)
[Legend]
op:
Operation field
rn:
Register field
IMM:
Immediate data
Figure 2.9 System Control Instruction Codes
2.5.8Block Data Transfer Instruction
Table 2.11 describes the block data transfer instruction. Figure 2.10 shows its object code format.
Table 2.11 Block Data Transfer Instruction
InstructionSizeFunction
EEPMOV—If R4L ≠ 0 then
repeat@R5+ → @R6+
R4L – 1 → R4L
untilR4L = 0
else next;
Block transfer instruction. Transfers the number of data bytes
specified by R4L from locations starting at the address indicated by
R5 to locations starting at the address indicated by R6. After the
transfer, the next instruction is executed.
Certain precautions are required in using the EEPMOV instruction. See section 2.9.3, Notes on
Use of the EEPMOV Instruction, for details.
Rev. 6.00, 08/04, page 52 of 628
15087
op
op
[Legend]
op:Operation field
Figure 2.10 Block Data Transfer Instruction Code
Rev. 6.00, 08/04, page 53 of 628
2.6Basic Operational Timing
CPU operation is synchronized by a system clock (φ) or a subclock (φ
clock signals see section 4, Clock Pulse Generators. The period from a rising edge of φ or φ
). For details on these
SUB
SUB
to
the next rising edge is called one state. A bus cycle consists of two states or three states. The
cycle differs depending on whether access is to on-chip memory or to on-chip peripheral modules.
2.6.1Access to On-Chip Memory (RAM, ROM)
Access to on-chip memory takes place in two states. The data bus width is 16 bits, allowing
access in byte or word size. Figure 2.11 shows the on-chip memory access cycle.
Bus cycle
φ or φ
SUB
Internal address bus
Internal read signal
Internal data bus
(read access)
T1 state
Address
T2 state
Read data
Internal write signal
Internal data bus
(write access)
Figure 2.11 On-Chip Memory Access Cycle
Rev. 6.00, 08/04, page 54 of 628
Write data
2.6.2Access to On-Chip Peripheral Modules
On-chip peripheral modules are accessed in two states or three states. The data bus width is 8 bits,
so access is by byte size only. This means that for accessing word data, two instructions must be
used. Figures 2.12 and 2.13 show the on-chip peripheral module access cycle.
There are four CPU states: the reset state, program execution state, program halt state, and
exception-handling state. The program execution state includes active (high-speed or mediumspeed) mode and subactive mode. In the program halt state there are a sleep (high-speed or
medium-speed) mode, standby mode, watch mode, and sub-sleep mode. These states are shown in
figure 2.14. Figure 2.15 shows the state transitions.
CPU stateReset state
The CPU is initialized
Program
execution state
Program halt state
A state in which some
or all of the chip
functions are stopped
to conserve power
The CPU executes successive program
instructions at high speed,
synchronized by the system clock
The CPU executes successive
program instructions at
reduced speed, synchronized
by the system clock
The CPU executes
successive program
instructions at reduced
speed, synchronized
by the subclock
Active
(high speed) mode
Active
(medium speed) mode
Subactive mode
Sleep (high-speed)
mode
Sleep (medium-speed)
mode
Standby mode
Low-power
modes
Watch mode
Subsleep mode
Exception-
handling state
A transient state in which the CPU changes
the processing flow due to a reset or an interrupt
Note: See section 5, Power-Down Modes, for details on the modes and their transitions.
Figure 2.14 CPU Operation States
Rev. 6.00, 08/04, page 57 of 628
Reset state
Reset cleared
Exception-handling state
Reset occurs
Reset
occurs
Program halt state
Reset
occurs
SLEEP instruction executed
Interrupt
source
occurs
Interrupt
source
occurs
Program execution state
Exceptionhandling
complete
Figure 2.15 State Transitions
2.7.2Program Execution State
In the program execution state the CPU executes program instructions in sequence.
There are three modes in this state, two active modes (high speed and medium speed) and one
subactive mode. Operation is synchronized with the system clock in active mode (high speed and
medium speed), and with the subclock in subactive mode. See section 5, Power-Down Modes for
details on these modes.
2.7.3Program Halt State
In the program halt state there are five modes: two sleep modes (high speed and medium speed),
standby mode, watch mode, and subsleep mode. See section 5, Power-Down Modes for details on
these modes.
2.7.4Exception-Handling State
The exception-handling state is a transient state occurring when exception handling is started by a
reset or interrupt and the CPU changes its normal processing flow. In exception handling caused
by an interrupt, SP (R7) is referenced and the PC and CCR values are saved on the stack.
For details on interrupt handling, see sectio n 3. 3, Interrupts.
Rev. 6.00, 08/04, page 58 of 628
2.8Memory Map
2.8.1Memory Map
The memory map of the H8/38024, H8/38024S, and H8/38124 are shown in figure 2.16(1), that of
the H8/38023, H8/38023S, and H8/38123 in figure 2.16(2), that of the H8/38022, H8/38022S, and
H8/38122 in figure 2.16(3), that of the H8/38021, H8/38021S, and H8/38121 in figure 2.16(4),
and that of the H8/38020, H8/38020S, and H8/38120 in figure 2.16(5).
HD64F38024, HD64F38024R, HD64F38124
H'0000
H'0029
H'002A
H'7000
H'7FFF
H'F020
H'F02B
H'F740
H'F74F
H'F780
H'FB7F
H'FB80
H'FF7F
H'FF80
H'FFFF
(flash memory version)
Interrupt vector area
On-chip ROM
Firmware
for on-chip emulator
Not used
Internal I/O register
Not used
LCD RAM (16 bytes)
Not used
(Workarea for reprogramming
flash memory: 1 Kbyte)
On-chip RAM
(2 Kbytes)
User area
(1 Kbyte)
Internal I/O register
(128 bytes)
1
*
2
*
32 Kbytes
(32768 bytes)
1024 bytes
HD64338024 (mask ROM version)
HD64338024S (mask ROM version)
HD64738024 (PROM version)
H'0000
H'0029
H'002A
H'7FFF
H'F740
H'F74F
H'FB80
H'FF7F
H'FF80
H'FFFF
Interrupt vector area
On-chip ROM
Not used
LCD RAM (16 bytes)
Not used
Internal I/O register
(128 bytes)
32 Kbytes
(32768 bytes)
1024 bytesOn-chip RAM
Notes: 1. Not available to the user if the on-chip emulator is used.
2. Used by the programming control program when programming flash memory. Also, not available to the user
if the on-chip emulator is used.
Figure 2.16(1) H8/38024, H8/38024S, and H8/38124 Memory Map
Rev. 6.00, 08/04, page 59 of 628
H'0000
H'0029
H'002A
H'5FFF
H'F740
H'F74F
Interrupt vector area
On-chip ROM
Not used
LCD RAM
(16 bytes)
24 Kbytes
(24576 bytes)
H'FB80
H'FF7F
H'FF80
H'FFFF
Figure 2.16(2) H8/38023, H8/38023S, and H8/38123 Memory Map
Rev. 6.00, 08/04, page 60 of 628
Not used
1024 bytesOn-chip RAM
Internal I/O registers
(128 bytes)
H'0000
H'0029
H'002A
H'3FFF
H'F740
H'F74F
Interrupt vector area
On-chip ROM
Not used
LCD RAM
(16 bytes)
16 Kbytes
(16384 bytes)
Not used
H'FB80
1024 bytesOn-chip RAM
H'FF7F
H'FF80
H'FFFF
Internal I/O registers
(128 bytes)
Figure 2.16(3) H8/38022, H8/38022S, and H8/38122 Memory Map
Rev. 6.00, 08/04, page 61 of 628
H'0000
H'0029
H'002A
H'2FFF
H'F740
H'F74F
Interrupt vector area
On-chip ROM
Not used
LCD RAM
(16 bytes)
12 Kbytes
(12288 bytes)
H'FD80
H'FF7F
H'FF80
H'FFFF
Figure 2.16(4) H8/38021, H8/38021S, and H8/38121 Memory Map
Rev. 6.00, 08/04, page 62 of 628
Not used
512 bytesOn-chip RAM
Internal I/O registers
(128 bytes)
H'0000
H'0029
H'002A
H'1FFF
H'F740
H'F74F
Interrupt vector area
On-chip ROM
Not used
LCD RAM
(16 bytes)
8 Kbytes
(8192 bytes)
Not used
H'FD80
512 bytesOn-chip RAM
H'FF7F
H'FF80
H'FFFF
Internal I/O registers
(128 bytes)
Figure 2.16(5) H8/38020, H8/38020S, and H8/38120 Memory Map
Rev. 6.00, 08/04, page 63 of 628
2.9Application Notes
2.9.1Notes on Data Access
1. Access to Empty Areas:
The address space of the H8/300L CPU includes empty areas in addition to the RAM,
registers, and ROM areas available to the user. If these empty areas are mistakenly accessed
by an application program, the following results will occur.
Data transfer from CPU to empty area:
The transferred data will be lost. This action may also cause the CPU to misoperate.
Data transfer from empty area to CPU:
Unpredictable data is transferred.
2. Access to Internal I/O Registers:
Internal data transfer to or from on-chip modules other than the ROM and R AM areas makes
use of an 8-bit data width. If word access is attempted to these areas, the following results will
occur.
Word access from CPU to I/O register area:
Upper byte: Will be written to I/O register.
Lower byte: Transferred data will be lost.
Word access from I/O register to CPU:
Upper byte: Will be written to upper part of CPU register.
Lower byte: Unpredictable data will be written to lower part of CPU r e gister.
Byte size instructions should therefore be used when transferring data to or from I/O registers
other than the on-chip ROM and RAM areas. Figure 2.17 shows the data size and number of
states in which on-chip peripheral modules can be accessed.
Rev. 6.00, 08/04, page 64 of 628
H'0000
H'0029
H'002A
Interrupt vector area
(42 bytes)
Access
WordByte
States
32 Kbytes
On-chip ROM
1
*
H'7FFF
Not used
H'F020
H'F02B
H'F740
H'F74F
H'F780
H'FB7F
2
*
H'FB80
H'FF7F
H'FF80
H'FFFF
Notes:
These examples apply to the H8/38024.
1. On the H8/38024, H8/38124, and H8/38024S, 32 Kbytes and the address is H'7FFF; on the
2. On the H8/38021, H8/38121, H8/38021S, H8/38020, H8/38120, and H8/38020S, 512 bytes
3. Only the HD64F38024, HD64F38024R, and HD64F38124 are equipped with internal I/O
Internal I/O registers
Not used
LCD RAM
(16 bytes)
Not used
(1-Kbyte work area for flash
memory programming)
Internal RAM
User Area
Internal I/O registers
(128 bytes)
H8/38023, H8/38123, and H8/38023S, 24 Kbytes and the address is H'5FFF; on the
H8/38022, H8/38122, and H8/38022S, 16 Kbytes and the address is H'3FFF; on the
H8/38021, H8/38121, and H8/38021S, 12 Kbytes and the address is H'2FFF; on the
H8/38020, H8/38120, and H8/38020S, 8 Kbytes and the address is H'1FFF.
and the address is H'FD80.
registers from H'F020 to H'F02B and on-chip RAM from H'F780 to H'FB7F. Attempting to
access these areas on products other than the HD64F38024, HD64F38024R, and
HD64F38124 will result in access to an empty area.
3
*
3
*
1024 bytes
H'FF98 to H'FF9F
H'FFA8 to H'FFAF
×
×
×
×
×
×
2
2
2
2
2
2
3
2
3
2
Figure 2.17 Data Size and Number of States for Access to and from
On-Chip Peripheral Modules
Rev. 6.00, 08/04, page 65 of 628
2.9.2Notes on Bit Manipulation
The BSET, BCLR, BNOT, BST, and BIST instructions read one byte of data, modify the data,
then write the data byte again. Special care is required when using these instructions in cases
where two registers are assigned to the same address, in the case of registers that include writeonly bits, and when the instruction accesses an I/O port.
Order of OperationOperation
1ReadRead byte data at the designated address
2ModifyModify a designated bit in the read data
3WriteWrite the altered byte data to the designated address
1. Bit manipulation in two registers assigned to the same address
Example 1: timer load register and timer counter
Figure 2.18 shows an example in which two timer registers share the same address. When a bit
manipulation instruction accesses the timer load register and timer counter of a reloadable timer,
since these two registers share the same address, the following operations take place.
Order of OperationOperation
1ReadTimer counter data is read (one byte)
2ModifyThe CPU modifies (sets or resets) the bit designated in the instruction
3WriteThe altered byte data is written to the timer load register
The timer counter is counting, so the value read is not necessarily the same as the value in the
timer load register. As a result, bits other than the intended bit in the timer load register may be
modified to the timer counter value.
Count clockTimer counter
Reload
Timer load register
Read
Write
Internal
data bus
Figure 2.18 Timer Configuration Example
Rev. 6.00, 08/04, page 66 of 628
Example 2: BSET instruction executed designating port 3
and P36 are designated as input pins, with a low-level signal input at P37 and a high-level
P3
7
signal at P3
example, the BSET instruction is used to change pin P3
. The remaining pins, P35 to P31, are output pins and output low-level signals. In this
When the BSET instruction is executed, first the CPU reads port 3.
Since P3
P3
and P36 are input pins, the CPU reads the pin states (low-level and high-level input).
7
to P30 are output pins, so the CPU reads the value in PDR3. In this example PDR3 has a value
5
of H'80, but the value read by the CPU is H'40.
Next, the CPU sets bit 0 of the read data to 1, changing the PDR3 data to H'41. Finally, the CPU
writes this value (H'41) to PDR3, completing execution of BSET.
As a result of this operation, bit 0 in PDR3 becomes 1, and P3
outputs a high-level signal.
0
However, bits 7 and 6 of PDR3 end up with different values.
To avoid this problem, store a copy of the PDR3 data in a work area in memory. Perform the bit
manipulation on the data in the work area, then write this data to PDR3.
Rev. 6.00, 08/04, page 67 of 628
[A: Prior to executing BSET]
MOV. B #80, R0LThe PDR3 value (H'80) is written to a work area in memory
MOV. B R0L, @RAM0(RAM0) as well as to PDR3
MOV. B R0L, @PDR3
When the BCLR instruction is executed, first the CPU reads PCR3. Since PCR3 is a write-only
register, the CPU reads a value of H'FF, even though the PCR3 value is actually H'3F.
Next, the CPU clears bit 0 in the read data to 0, changing the data to H'FE. Finally, this value
(H'FE) is written to PCR3 and BCLR instruction execution ends.
As a result of this operation, bit 0 in PCR3 b ecomes 0, making P3
and 6 in PCR3 change to 1, so that P3
and P36 change from input pins to output pins.
7
an input port. However, bits 7
0
To avoid this problem, store a copy of the PCR3 data in a work area in memory. Perform the bit
manipulation on the data in the work area, then write this data to PCR3.
Rev. 6.00, 08/04, page 69 of 628
[A: Prior to executing BCLR]
MOV. B #3F, R0LThe PCR3 value (H'3F) is written to a work area in memory
MOV. B R0L, @RAM0(RAM0) as well as to PCR3.
MOV. B R0L, @PCR3