1. All information included in this document is current as of the date this document is issued. Such information, however, is
subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please
confirm the latest product information with a Renesas Electronics sales office. Also, please pay regular and careful attention to
additional and different inform ation to be disclosed by Renesas Electronics such as that disclosed through our website.
2. Renesas Electronics does not assume any liability for infringement of patents, copyrig hts, or other intellectual property rights
of third parties by or arising from the use of Renesa s Electronics products or technical information described in this document.
No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights
of Renesas Electronics or others.
3. You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, w hether in whole or in part.
4. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of
semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software,
and information in the design of your equipment. Renesas Electronics assumes no responsi bility for any losses incurred by
you or third parties arising from the use of these circuits, software, or information.
5. When exporting the products or technology described in this document, you should comply with the applicable export control
laws and regulations and follow the procedures required by such laws and regulations. You sho uld not use Renesas
Electronics products or the technolog y described in this document for any purpose relating to military applications or use by
the military, including but not limited to the development of weapons of mass destruction. Renesas Electronics products and
technology may not be used for or incorporate d into any products or systems whose manufac ture, use, or sale is prohibited
under any applicable domestic or foreign laws or regulations.
6. Renesas Electronics has used reasonable ca re in preparing the information included in this document, but Renesas Electronics
does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages
incurred by you resulting from errors in or omissions from the information included herein.
7. Renesas Electronics products are classified according to the following three quality grades: “Standard”, “High Quality”, and
“Specific”. The recommended applications for each Renesas Electronics product depends on the product’s quality grade, as
indicated below. You must check the quality grade of each Renesas Electronics product before using it in a particular
application. You may not use any Renesa s Electronics product for any application categorized as “Specific” without the prior
written consent of Renesas Electronic s. Further, you may not use any Renesas Electronics product for any application for
which it is not intended without the prior written consent of Renesas Electronics. Renesas Electronics shall not be in any way
liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an
application categorized as “Spec ific” or for which the product is not intended where you have failed t o obtain the prior written
consent of Renesas Electronics. The quality grade of each Renesas Electronics product is “Standard” unless otherwise
expressly specified in a Renesas Electronics data sheets or data books, etc.
“Standard”: Computers; office equipment; communications equipment; test and measurement equipment; audio and visual
“Specific”: Aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or
8. You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics,
especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation
characteristics, installation and othe r product characteristics. Renesas Elec tronics shall have no liability for malfunctions or
damages arising out of the use of Renesa s Electronics products beyond such specified ranges.
9. Although Renesas Electronics endeavors to improve the quality and reliability of its products, se miconductor products have
specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further,
Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measure s to
guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a
Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire
control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because
the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system
manufactured by you.
10. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental
compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable
laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS
Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with
applicable laws and regulations.
11. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of Renesas
Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this
document or Renesas Electronics products, or if you have any other inquiries.
(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its majority-
owned subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
equipment; home electronic applianc es; machine tools; personal electronic equipment; and industrial robots.
crime systems; safety equipment; and medical equipment not specifically designed for life support.
systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare
intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life.
Page 3
User’s Manual
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.
16
H8S/2158 Group,
TM
H8S/2158 F-ZTAT
Hardware Manual
Renesas 16-Bit Single-Chip
Microcomputer
H8S Family/H8S/2100 Series
H8S/2158 HD64F2158
Rev.3.00 2006.01
Page 4
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 Jan 25, 2006 page ii of lii
Page 5
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 Jan 25, 2006 page iii of lii
Page 6
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 in 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
11. Index
Rev. 3.00 Jan 25, 2006 page iv of lii
Page 7
Preface
The H8S/2158 is a microcomputer made up of the H8S/2000 CPU employing Renesas
Technology’s original architecture as its core, and the peripheral functions required to configure a
system, such as a notebook PC and portable information appliance products.
The H8S/2000 CPU has an internal 32-bit configuration, sixteen 16-bit general registers, and a
simple and optimized instruction set for high-speed operation. The H8S/2600 CPU can handle a
16-Mbyte linear address space. The instruction set of the H8S/2600 CPU maintains upward
compatibility at the object level with the H8/300 CPU and H8/300H CPU. This allows the H8/300,
H8/300L, or H8/300H user to easily utilize the H8S/2600 CPU.
This LSI is equipped with ROM, RAM, two PWM timers (PWM and PWMX), a 16-bit freerunning timer (FRT), an 8-bit timer (TMR), a watchdog timer (WDT), a serial communication
interface (SCI), an I
chip peripheral modules required for system configuration.
2
C bus interface (IIC), a D/A converter, an A/D converter, and I/O ports as on-
In particular, this LSI incorporates a universal serial bus interface (USB) and a multimedia card
1
*
(MultiMediaCard™
) interface (MCIF) for system configuration using a flash memory card as
the recording media. In addition, the serial communication interface (SCI) has a smart card
interface function. Auxiliary hardware for encryption operation (DES, GF) conforming to the
2
*
“Keitaide-Music
to the secure multimedia card (Secure-MultiMediaCard™
” standard is necessary to protect music copyright. Thus, it is easy to interface
1
*
).
Further, a data transfer controller (DTC), and a RAM-FIFO unit (RFU) that can operate FIFOs
such as the USB and MCIF together are incorporated as a bus master.
3
*
The on-chip ROM is flash memory (F-ZTAT™
) with a capacity of 256 kbytes. ROM is
connected to the CPU via a 16-bit data bus, enabling both byte and word data to be accessed in
one state. Instruction fetching has been speeded up, and processing speed increased.
Two operating modes, modes 2 and 3, are provided, and there is a choice of address spaces and
modes, single-chip mode and external extended mode. Other unique operating modes, such as
writing the boot program to the flash memory, on-chip emulation, and boundary scan, are also
available.
Notes: 1. MultiMediaCard™ is a trademark of Infineon Technologies AG.
Secure-MultiMediaCard™ is a multimedia card with a content protection function.
2. Technology standards for systems that deliver digital contents, such as music over
mobile phones. These standards were put together by five companies: SANYO Electric
Co., Ltd., Fujitsu Limited, Nippon Columbia Co., Ltd., PFU Limited, and Hitachi, Ltd.
These standards consist of a security guideline, a protocol standard, a secure
Rev. 3.00 Jan 25, 2006 page v of lii
Page 8
multimedia card standard, and a download and playback system standard.
URL: http://www.keitaide-music.org/
3. F-ZTAT™ is a trademark of Renesas Technology Corp.
Target Users: This manual was written for users who will be using the H8S/2158 in the design of
application systems. Target users are expected to understand the fundamentals of
electrical circuits, logical circuits, and microcomputers.
Objective:This manual was written to explain the hardware functions and electrical
characteristics of the H8S/2158 to the target users.
Refer to the H8S/2600 Series, H8S/2000 Series Programming Manual for a
detailed description of the instruction set.
Notes on reading this manual:
• In order to understand the overall functions of the chip
Read the manual according to the contents. This manual can be roughly categorized into parts
on the CPU, system control functions, peripheral functions and electrical characteristics.
• In order to understand the details of the CPU's functions
Read the H8S/2600 Series, H8S/2000 Series Programming Manual.
• In order to understand the details of a register when its name is known
Read the index that is the final part of the manual to find the page number of the entry on the
register. The addresses, bits, and initial values of the registers are summarized in section 28,
List of Registers.
Rules:Register name:The following notation is used for cases when the same or a
similar function, e.g. serial communication, is implemented
on more than one channel:
XXX_N (XXX is the register name and N is the channel
number)
Bit order:The MSB is on the left and the LSB is on the right.
Number notation:Binary is B'xxxx, hexadecimal is H'xxxx, decimal is xxxx.
Signal notation:An overbar is added to a low-active signal: xxxx
Related Manuals:The latest versions of all related manuals are available from our web site.
Please ensure you have the latest versions of all documents you require.
http://www.renesas.com/
Rev. 3.00 Jan 25, 2006 page vi of lii
Page 9
H8S/2158 manuals:
Document TitleDocument No.
H8S/2158 Hardware ManualThis manual
H8S/2600 Series, H8S/2000 Series Programming ManualREJ09B0139
All—All references to Hitachi, Hitachi, Ltd., Hitachi Semiconductors,
and other Hitachi brand names changed to Renesas
Technology Corp. Designation for categories changed from
“series” to “group”
Package
TQFP (TFP-100B) deleted
A)
Switching
5.3.4 IRQ Sense
Control Registers
(ISCR16H, ISCR16L,
ISCRH, ISCRL)
6.3.1 Bus Control
Register (BCR)
(Before) TFBGA (TBP-112) → (After) TFBGA (TBP-112
79Description added
The ISCR registers
between pins IRQ15 to IRQ2 and pins ExIRQ15 to ExIRQ2 is
performed by means of IRQ sense port select register 16
(ISSR16) and the IRQ sense port select register (ISSR).
107Bit table amended
BitBit NameInitial ValueR/WDescription
10IOS1
IOS0
1
1
...
or pins ExIRQ15 to ExIRQ2.
R/W
IOS Select 1, 0
R/W
Select the address range where the IOS signal is
output. For details, refer to table 6.8.
8.2.15 Data Transfer
ID Read/Write Select
Register B (DTIDSRB)
9.9.2 Port 9 Data
Register (P9DR)
179Bit table amended
RAM → Peripheral modules (write)
0:
Peripheral modules (read) → RAM
1:
251Table amended
(Before) R
/W → (After) R
13.1 Features315Description amended
• Cascading of two channels
— Cascading of TMR_0 and TMR_1
...
TMR_1 can be used to count TMR_0 compare-match
occurrences (compare-match count
• Multiple interrupt sources for each channel
mode).
...
Rev. 3.00 Jan 25, 2006 page ix of lii
Page 12
ItemPageRevision (See Manual for Details)
13.3.4 Time Control
Register (TCR)
Table 13.2 Clock
Input to TCNT and
Count Condition
322Table 13.2 amended
TMR_Y when (CKS2, CKS1, CKS0) = (1, 0, 0) (Before)
Increments at overflow signal from TCNT_X
prohibited
TMR_X when (CKS2, CKS1, CKS0) = (1, 0, 0) (Before)
*
→ (After) Setting
Increments at compare-match A from TCNT_Y → (After)
Setting prohibited
Note * amended
Note: * If the TMR_0 clock input is
generated. Simultaneous setting of this condition should
be
...
, a count-up clock cannot
therefore be avoided.
——Description of “TMR_Y and TMR_X Cascaded Connection”
deleted
13.7 Input Capture
Operation
13.9.6 Mode Setting
with Cascaded
Connection
15.3 Register
Descriptions
16.3.7 Serial Status
Register (SSR)
336Section number amended
344Description amended
If the 16-bit count mode
and TCNT_
1 are not generated,
378• TCSR_1
Notes amended
1
*
R/(W)
[Setting conditions] ...
• When TCSR is read when OVF = 1
OVF ...
402Description amended
Bit Functions in Smart card Interface Mode (when SMIF in
SCMR = 1)
Bit 6 [Clearing conditions] ...
• When RFU is activated by RDR
from RDR (only for SCI_0 and SCI_2)
...
, the input clock pulses for TCNT_0
2
*
, then 0 is written to
F = 1 allowing data to be read
Rev. 3.00 Jan 25, 2006 page x of lii
Page 13
ItemPageRevision (See Manual for Details)
16.3.9 Bit Rate
Register (BRR)
Table 16.2
Relationship between
405Table 16.2 amended
ModeBit RateError
Smart card
interface mode
B =
S × 2
φ × 10
2n+1
6
× (N + 1)
Error (%) =
N Setting in BRR and
Bit Rate B
16.3.10 Serial
Interface Control
Register (SCICR)
412Table amended
BitBit Name Initial Value R/WDescription
3, 2—All 0R/W
1, 0—All 0RReserved
Reserved
The initial value should not be changed.
These bits are always read as 0 and cannot be
modified.
B × S ×2
φ × 10
2n+1
6
× (N + 1)
– 1 × 100
16.7.8 Clock Output
Control
16.8 IrDA Operation
Figure 16.36 IrDA
Block Diagram
455Description amended
At Transition from Smart Card Interface Mode
Standby Mode:
1. Set the port data register (DR) ...
At Transition from
Software Standby Mode to Smart Card
Interface Mode:
1. Cancel software standby mode. ...
456Figure 16.36 amended
TxD1/IrTxD
RxD1/IrRxD
Description amended
Transmission: ... The high-level pulse can be selected using
the IrCKS2 to IrCKS0 bits in
457Description amended
Reception: ... IR frames are converted to UART frames using
the IrDA interface before inputting to
IrDA
Pulse encoder
Pulse decoder
SCICR
SCICR.
to Software
SCI_1
TxD1
RxD1
SCI_1. Data of level 0 is ...
Rev. 3.00 Jan 25, 2006 page xi of lii
Page 14
ItemPageRevision (See Manual for Details)
17.3.8 IIC Operation
Reservation Adapter
Status Register A
(ICSRA)
17.3.10 IIC
Operation Reservation
Adapter Status
Register C (ICSRC)
Figure 17.3 State
Transitions of TDRE,
SDRF, and RDRF Bits
17.5.3 Master
Receive Operation
498Bit table amended
ACKXE
(Before) R
/W → (After) R
506Description amended
Bit 0 [Clearing conditions]
• When ICDRX is read from with no receive data in the shift
register (SDRF =
0) in receive mode ...
507Figure 17.3 amended
(b) Receive mode
(Before)
(Before)
TDRE → (After) SDRE
SDRF → (After) RDRF
520Description amended
9. Clear the IRIC flag in ICCR to cancel wait state.
The master device outputs the 9th clock and drives SDA
9th receive clock pulse ...
17.7 Usage Notes
Table 17.12
Permissible SCL Rise
Time (t
) Values
sr
542Table 17.12 amended
IICX1,
t
cyc
Indication
IICX0
117.5 t
Standard mode10001000 1000 10001000875700
cyc
2
I
C Bus
Specification
(Max.)
φ =
5 MHz
Time Indication[ns]
φ =
φ =
8 MHz
10 MHz
φ =
16 MHz
φ =
20 MHz
low at
φ =
25 MHz
Rev. 3.00 Jan 25, 2006 page xii of lii
Page 15
ItemPageRevision (See Manual for Details)
17.7 Usage Notes549,
550
Description added
15. Notes on WAIT function
(a) Conditions to cause this phenomenon
When both of the following conditions are satisfied, the clock
pulse of the 9th clock could be outputted continuously in master
mode using the WAIT function due to the failure of the WAIT
insertion after the 8th clock fall.
(1) Setting the WAIT bit of the ICMR register to 1 and operating
WAIT, in master mode
(2) If the IRIC bit of interrupt flag is cleared from 1 to 0 between
the fall of the 7th clock and the fall of the 8th clock.
(b) Error phenomenon
Normally, WAIT State will be cancelled by clearing the IRIC flag
bit from 1 to 0 after the fall of the 8th clock in WAIT State. In this
case, if the IRIC flag bit is cleared between the 7th clock fall and
the 8th clock fall, the IRIC flag clear- data will be retained
internally. Therefore, the WAIT State will be cancelled right after
WAIT insertion on 8th clock fall.
(c) Restrictions
Please clear the IRIC flag before the rise of the 7th clock (the
counter value of BC2 through BC0 should be 2 or greater), after
the IRIC flag is set to 1 on the rise of the 9th clock.
If the IRIC flag-clear is delayed due to the interrupt or other
processes and the value of BC counter is turned to 1 or 0,
please confirm the SCL pins are in L’ state after the counter
value of BC2 through BC0 is turned to 0, and clear the IRIC
flag. (See figure 17.28.)
ASD
SCL
BC2 to BC0
IRIC
(operation
example)
A
9
0
Transmit/receive data
1 2 3 4 5 6 7 8 91 2 3
7 6 5 4 3 2 1 0 7 6 5
IRIC flag clear available
IRIC flag clear unavailable
SCL =
‘L’ confirm
IRIC flag clear available
A
IRIC clear
Transmit/receive
data
When BC2-0 ≥ 2
IRIC clear
Figure 17.28 IRIC Flag Clear Timing on WAIT Operation
Rev. 3.00 Jan 25, 2006 page xiii of lii
Page 16
ItemPageRevision (See Manual for Details)
17.7 Usage Notes550,
551
16. Notes on Arbitration Lost
The I2C bus interface recognizes the data in transmit/receive
frame as an address when arbitration is lost in master mode
and a transition to slave receive mode is automatically carried
out.
When arbitration is lost not in the first frame but in the second
frame or subsequent frame, transmit/receive data that is not an
address is compared with the value set in the SAR or SARX
register as an address. If the receive data matches with the
address in the SAR or SARX register, the I2C bus interface
erroneously recognizes that the address call has occurred. (See
figure 17.29.)
In multi-master mode, a bus conflict could happen. When The
I2C bus interface is operated in master mode, check the state of
the AL bit in the ICSR register every time after one frame of
data has been transmitted or received.
When arbitration is lost during transmitting the second frame or
subsequent frame, take avoidance measures.
• Arbitration is lost
2
C bus interface
I
(Master transmit mode)
Other device
(Master transmit mode)
2
C bus interface
I
(Slave receive mode)
SSLA
SSLA
SSLA
R/W
Transmit data match
Transmit timing match
R/WADATA2
R/WASLAR/W
• Receive address is ignored • Automatically transferred to slave
• The AL flag in ICSR is set to 1
A
A
A
receive mode
• Receive data is recognized as
an address
• When the receive data matches to
the address set in the SAR or SARX
register, the I
as a slave device
DATA1
Transmit data does not match
2
C bus interface operates
DATA3
DATA4
A
Data contention
A
Figure 17.29 Diagram of Erroneous Operation when
Arbitration is Lost
Though it is prohibited in the normal I2C protocol, the same
problem may occur when the MST bit is erroneously set to 1
and a transition to master mode is occurred during data
transmission or reception in slave mode. In multi-master mode,
pay attention to the setting of the MST bit when a bus conflict
may occur. In this case, the MST bit in the ICCR register should
be set to 1 according to the order below.
(a) Make sure that the BBSY flag in the ICCR register is 0 and
the bus is free before setting the MST bit.
Rev. 3.00 Jan 25, 2006 page xiv of lii
Page 17
ItemPageRevision (See Manual for Details)
17.7 Usage Notes551
(b) Set the MST bit to 1.
(c) To confirm that the bus was not entered to the busy state
while the MST bit is being set, check that the BBSY flag in the
ICCR register is 0 immediately after the MST bit has been set.
Note: Above restriction can be cleared by setting bits FNC1 and
FNC0 in the ICXR register.
18.3.1 USB Data
FIFO
Table 18.2 FIFO
Configuration
557Table 18.2 amended
EndpointTransfer Direction FIFO SizeConfiguration Description
VCCG8, G9InputPower supply pins. Connect all these
pins to the system power supply.
VCLE3InputPower supply pin. Connect this pin to
VCC.
VSSF4, G1
E8, D10
C11, B5
C5
XTALB1Input
EXTALC2Input
φG3OutputSupplies the system clock to external
EXCLG3Input32.768-kHz external clock for subclock
X1E1Input
X2E2Input
MD2
MD1
MD0
RESB2InputReset pin. When this pin is low, the chip
RESOC3OutputOutputs a reset signal to an external
STBYE4InputWhen this pin is low, a transition is made
FWEA2InputPin for use by flash memory.
C1
D3
D2
InputGround pins. Connect all these pins to
the system power supply (0 V).
For connection to a crystal resonator. An
external clock can be supplied from the
EXTAL pin. For an example of crystal
resonator connection, see section 26,
Clock Pulse Generator.
devices.
should be supplied.
For connection to a crystal resonator. An
external clock can be supplied from the
X2 pin. For an example of crystal
resonator connection, see section 26,
Clock Pulse Generator.
InputThese pins set the operating mode.
Inputs at these pins should not be
changed during operation.
is reset.
device.
to hardware standby mode.
Rev. 3.00 Jan 25, 2006 page 8 of 872
REJ09B0286-0300
reset input pins. Selectable to which pin
of TMIn or ExTMIn to insert external
event and counter reset.
input pins
output pins
Section 1 Overview
Rev. 3.00 Jan 25, 2006 page 11 of 872
REJ09B0286-0300
Page 66
Section 1 Overview
Pin No.
TypeSymbolTBP-112AI/OName and Function
Serial
communication
Interface
(SCI_0,
SCI_1,
SCI_2)
IrDA (SCI)
I2C bus
interface
(IIC)
Keyboard
control
A/D
converter
D/A
converter
TxD0 to TxD2F2, C4
L10
RxD0 to RxD2F1, B3
J9
SCK0 to SCK2A5, D6
C8
SSE0IK9InputInput pin to halt SCI_0
SSE2IJ8InputInput pin to halt SCI_2
IrTxDC4OutputEncoded data output pin for IrDASCI with
IrRxDB3InputEncoded data input pin for IrDA
SCL0
SCL1
SDA0
SDA1
KIN9 to KIN0J8, K9
WUE15 to
WUE8
AN7 to AN2H7, L8
CIN7 to CIN0J5, H5
ADTRGA9InputExternal trigger input pin to start A/D
DA1
DA0
A4
B4
D5
A3
J5, H5
L4, K4
K3, H4
L2, K2
B6, A6
C6, B7
A7, C7
D7, A8
J7, K7
L7, H6
L4, K4
K3, H4
L2, K2
H7
L8
OutputTransmit data output pins
InputReceive data input pins
Input/
Output
Input/
Output
Input/
Output
InputKeyboard matrix input pins. All pins have
InputWake-up event input pins. Same wake
InputAnalog input pins
InputExtended A/D conversion input pins
OutputAnalog output pins
Clock input/output pins. Output format is
NMOS push-pull output.
IIC clock input/output pins. These pins
can drive a bus directly with the NMOS
open drain output.
IIC data input/output pins. These pins
can drive a bus directly with the NMOS
open drain output.
a wake-up function. Normally, KIN9 to
KIN0 function as key scan inputs, and
P17 to P10 and P27 to P20 function as
key scan outputs. Thus, at a maximum
of 16 outputs x 8 inputs, 128-key matrix
can be configured.
up as key wake up can be performed
with various sources.
conversion
Rev. 3.00 Jan 25, 2006 page 12 of 872
REJ09B0286-0300
Page 67
Pin No.
TypeSymbolTBP-112AI/OName and Function
A/D
converter
D/A
converter
Universal
serial bus
(USB)
AVCCK5, J6InputAnalog power supply pins for the A/D
converter and D/A converter. When the
A/D converter and D/A converter are not
used, these pins should be connected to
the system power supply. These pins are
used with the USB internal
driver/receiver power supply, and should
therefore be connected to a power
supply of 3.3 V ± 0.3 V whenever the
USB is used.
AVrefL5InputReference voltage input pin for the A/D
converter and D/A converter. When the
A/D converter and D/A converter are not
used, this pin should be connected to the
system power supply.
AVSSK8, L9InputGround pins for the A/D converter and
D/A converter. These pins should be
connected to the system power supply
(0 V).
USDP
USDM
USEXCLA9InputUSB external clock input pin
DrVCCK5, J6InputThese pins should be connected to the
DrVSSK8, L9InputThese pins should be connected to the
SPEEDK2Output
SUSPENDL2Output
TXENLH4Output
TXDMNSK3Output
TXDPLSK4Output
XVERDATAL4Input
DMNSH5Input
DPLSJ5Input
L6
K6
Input/
Output
USB serial data I/O pins
internal driver/receiver power supply
(3.3 V ± 0.3 V).
internal driver/receiver power supply
(0 V).
External driver/receiver connection
signals.
These pins are for connection to a
driver/receiver compatible with
PDIUSBP11A manufactured by Philips
Electronics.
Section 1 Overview
Rev. 3.00 Jan 25, 2006 page 13 of 872
REJ09B0286-0300
Page 68
Section 1 Overview
Pin No.
TypeSymbolTBP-112AI/OName and Function
Multimedia
card
interface
(MCIF)
I/O portsP17 to P10D9, C10
ExMCCLK
MCCLK
ExMCTxD
MCTxD
ExMCRxD
MCRxD
ExMCCSA
ExMCCSB
MCCSA
MCCSB
ExMCCMD
MCCMD
ExMCDAT
MCDAT
ExMCDATDIR
ExMCCMDDIR
MCDATDIR
MCCMDDIR
P27 to P20G11, G10
P37 to P30B6, A6
P47 to P40H11, H10
P57 to P50J1, H2
K10
A8
K11
D7
H8
C7
J10
J11
A7
B7
K11
D7
H8
C7
J10
J11
A7
B7
B11, C9
B10, A10
D8, B9
F9, F11
F10, F8
E11, E10
C6, B7
A7, C7
D7, A8
H9, J11
J10, H8
K11, K10
J9, L10
B3, C4
F1, F2
OutputCommon clock output pins for MMC
mode*/SPI mode
OutputCommand/data output pins in SPI mode
InputResponse/data input pins in SPI mode
OutputChip select output pins to select
multimedia card in SPI mode
Input/
Output
Input/
Output
OutputOutput pins indicating I/O direction of
Input/
Output
Input/
Output
Input/
Output
Input/
Output
Input/
Output
Command output/response input pins in
MMC mode
Data I/O pins in MMC mode
MCCMD and MCDAT pins
Eight input/output pins
Eight input/output pins
Eight input/output pins
Eight input/output pins
Eight input/output pins
*
*
Rev. 3.00 Jan 25, 2006 page 14 of 872
REJ09B0286-0300
Page 69
Pin No.
TypeSymbolTBP-112AI/OName and Function
I/O portsP67 to P60J5, H5
L4, K4
K3, H4
L2, K2
P77 to P72H7, L8
J7, K7
L7, H6
P87 to P80A9, C8
D6, A5
A3, B4
D5, A4
P97 to P90G2, G3
H1, G4
H3, J2
K1, J3
PA1, PA0J8, K9Input/
Note: * MMC mode is MultiMediaCard mode.
Input/
Output
InputSix input pins
Input/
Output
Input/
Output
Output
Eight input/output pins
Eight input/output pins
Eight input/output pins. Note that pin P96
cannot be used as a general output port.
Two input/output pins
Section 1 Overview
Rev. 3.00 Jan 25, 2006 page 15 of 872
REJ09B0286-0300
Page 70
Section 1 Overview
Rev. 3.00 Jan 25, 2006 page 16 of 872
REJ09B0286-0300
Page 71
Section 2 CPU
Section 2 CPU
The H8S/2000 CPU is a high-speed central processing unit with an internal 32-bit architecture that
is upward-compatible with the H8/300 and H8/300H CPUs. The H8S/2000 CPU has sixteen 16-bit
general registers, can address a 16-Mbyte linear address space, and is ideal for realtime control.
This section describes the H8S/2000 CPU. The usable modes and address spaces differ depending
on the product. For details on each product, see section 3, MCU Operating Modes.
2.1Features
• Upward-compatibility with H8/300 and H8/300H CPUs
Can execute H8/300 CPU and H8/300H CPU object programs
• General-register architecture
Sixteen 16-bit general registers also usable as sixteen 8-bit registers or eight 32-bit registers
• Sixty-five basic instructions
8/16/32-bit 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:32,ERn)]
Register indirect with post-increment or pre-decrement [@ERn+ or @–ERn]
Absolute address [@aa:8, @aa:16, @aa:24, or @aa:32]
Immediate [#xx:8, #xx:16, or #xx:32]
Program-counter relative [@(d:8,PC) or @(d:16,PC)]
Memory indirect [@@aa:8]
• High-speed operation
All frequently-used instructions are executed in one or two states
8/16/32-bit register-register add/subtract: 1 state
8 × 8-bit register-register multiply: 12 states (MULXU.B), 13 states (MULXS.B)
16 ÷ 8-bit register-register divide: 12 states (DIVXU.B)
CPUS210A_000020020300
Rev. 3.00 Jan 25, 2006 page 17 of 872
REJ09B0286-0300
Page 72
Section 2 CPU
16 × 16-bit register-register multiply: 20 states (MULXU.W), 21 states (MULXS.W)
32 ÷ 16-bit register-register divide: 20 states (DIVXU.W)
• Two CPU operating modes
Normal mode
Advanced mode
• Power-down state
Transition to power-down state by SLEEP instruction
Selectable CPU clock speed
2.1.1Differences between H8S/2600 CPU and H8S/2000 CPU
The differences between the H8S/2600 CPU and the H8S/2000 CPU are as shown below.
• Register configuration
The MAC register is supported only by the H8S/2600 CPU.
• Basic instructions
The four instructions MAC, CLRMAC, LDMAC, and STMAC are supported only by the
H8S/2600 CPU.
• The number of execution states of the MULXU and MULXS instructions
Execution States
InstructionMnemonicH8S/2600H8S/2000
MULXUMULXU.B Rs, Rd312
MULXU.W Rs, ERd420
MULXSMULXS.B Rs, Rd413
MULXS.W Rs, ERd521
In addition, there are differences in address space, CCR and EXR register functions, power-down
modes, etc., depending on the model.
Rev. 3.00 Jan 25, 2006 page 18 of 872
REJ09B0286-0300
Page 73
Section 2 CPU
2.1.2Differences from H8/300 CPU
In comparison to the H8/300 CPU, the H8S/2000 CPU has the following enhancements.
• More general registers and control registers
Eight 16-bit extended registers and one 8-bit control register have been added.
• Extended address space
Normal mode supports the same 64-kbyte address space as the H8/300 CPU.
Advanced mode supports a maximum 16-Mbyte address space.
• Enhanced addressing
The addressing modes have been enhanced to make effective use of the 16-Mbyte address
space.
• Enhanced instructions
Addressing modes of bit-manipulation instructions have been enhanced.
Signed multiply and divide instructions have been added.
Two-bit shift and two-bit rotate instructions have been added.
Instructions for saving and restoring multiple registers have been added.
A test and set instruction has been added.
• Higher speed
Basic instructions are executed twice as fast.
2.1.3Differences from H8/300H CPU
In comparison to the H8/300H CPU, the H8S/2000 CPU has the following enhancements.
• Additional control register
One 8-bit control register has been added.
• Enhanced instructions
Addressing modes of bit-manipulation instructions have been enhanced.
Two-bit shift and two-bit rotate instructions have been added.
Instructions for saving and restoring multiple registers have been added.
A test and set instruction has been added.
• Higher speed
Basic instructions are executed twice as fast.
Rev. 3.00 Jan 25, 2006 page 19 of 872
REJ09B0286-0300
Page 74
Section 2 CPU
2.2CPU Operating Modes
The H8S/2000 CPU has two operating modes: normal and advanced. Normal mode supports a
maximum 64-kbyte address space. Advanced mode supports a maximum 16-Mbyte address space.
The mode is selected by the LSI's mode pins.
2.2.1Normal Mode
The exception vector table and stack have the same structure as in the H8/300 CPU in normal
mode.
• Address space
Linear access to a maximum address space of 64 kbytes is possible.
• Extended registers (En)
The extended registers (E0 to E7) can be used as 16-bit registers, or as the upper 16-bit
segments of 32-bit registers.
When extended register En is used as a 16-bit register it can contain any value, even when the
corresponding general register (Rn) is used as an address register. (If general register Rn is
referenced in the register indirect addressing mode with pre-decrement (@–Rn) or postincrement (@Rn+) and a carry or borrow occurs, the value in the corresponding extended
register (En) will be affected.)
• Instruction set
All instructions and addressing modes can be used. Only the lower 16 bits of effective
addresses (EA) are valid.
• Exception vector table and memory indirect branch addresses
In normal mode, the top area starting at H'0000 is allocated to the exception vector table. One
branch address is stored per 16 bits. The exception vector table in normal mode is shown in
figure 2.1. For details of the exception vector table, see section 4, Exception Handling.
The memory indirect addressing mode (@@aa:8) employed in the JMP and JSR instructions
uses an 8-bit absolute address included in the instruction code to specify a memory operand
that contains a branch address. In normal mode, the operand is a 16-bit (word) operand,
providing a 16-bit branch address. Branch addresses can be stored in the top area from H'0000
to H'00FF. Note that this area is also used for the exception vector table.
• Stack structure
In normal mode, when the program counter (PC) is pushed onto the stack in a subroutine call
in normal mode, and the PC and condition-code register (CCR) are pushed onto the stack in
exception handling, they are stored as shown in figure 2.2. The extended control register
(EXR) is not pushed onto the stack. For details, see section 4, Exception Handling.
Rev. 3.00 Jan 25, 2006 page 20 of 872
REJ09B0286-0300
Linear access to a maximum address space of 16 Mbytes is possible.
• Extended registers (En)
The extended registers (E0 to E7) can be used as 16-bit registers. They can also be used as the
upper 16-bit segments of 32-bit registers or address registers.
• Instruction set
All instructions and addressing modes can be used.
• Exception vector table and memory indirect branch addresses
In advanced mode, the top area starting at H'00000000 is allocated to the exception vector
table in 32-bit units. In each 32 bits, the upper 8 bits are ignored and a branch address is stored
in the lower 24 bits (see figure 2.3). For details of the exception vector table, see section 4,
Exception Handling.
H'00000000
H'00000003
H'00000004
H'00000007
H'00000008
H'0000000B
H'0000000C
H'00000010
Reserved
Reset exception vector
Reserved
(Reserved for system use)
Exception vector table
(Reserved for system use)
Reserved
Exception vector 1
Figure 2.3 Exception Vector Table (Advanced Mode)
Rev. 3.00 Jan 25, 2006 page 22 of 872
REJ09B0286-0300
Page 77
Section 2 CPU
The memory indirect addressing mode (@@aa:8) employed in the JMP and JSR instructions
uses an 8-bit absolute address included in the instruction code to specify a memory operand
that contains a branch address. In advanced mode, the operand is a 32-bit longword operand,
providing a 32-bit branch address. The upper 8 bits of these 32 bits are a reserved area that is
regarded as H'00. Branch addresses can be stored in the area from H'00000000 to H'000000FF.
Note that the top area of this range is also used for the exception vector table.
• Stack structure
In advanced mode, when the program counter (PC) is pushed onto the stack in a subroutine
call, and the PC and condition-code register (CCR) are pushed onto the stack in exception
handling, they are stored as shown in figure 2.4. The extended control register (EXR) is not
pushed onto the stack. For details, see section 4, Exception Handling.
SP
Reserved
PC
(24 bits)
(a) Subroutine Branch(b) Exception Handling
SP
CCR
PC
(24 bits)
Figure 2.4 Stack Structure in Advanced Mode
Rev. 3.00 Jan 25, 2006 page 23 of 872
REJ09B0286-0300
Page 78
Section 2 CPU
2.3Address Space
Figure 2.5 shows a memory map of the H8S/2000 CPU. The H8S/2000 CPU provides linear
access to a maximum 64-kbyte address space in normal mode, and a maximum 16-Mbyte
(architecturally 4-Gbyte) address space in advanced mode. The usable modes and address spaces
differ depending on the product. For details on each product, see section 3, MCU Operating
Modes.
H'0000
H'FFFF
H'00000000
64 kbytes16 Mbytes
H'00FFFFFF
Not available
in this LSI
H'FFFFFFFF
(b) Advanced Mode(a) Normal Mode
Figure 2.5 Memory Map
Program area
Data area
Rev. 3.00 Jan 25, 2006 page 24 of 872
REJ09B0286-0300
Page 79
Section 2 CPU
2.4Register Configuration
The H8S/2000 CPU has the internal registers shown in figure 2.6. There are two types of registers:
general registers and control registers. Control registers are a 24-bit program counter (PC), an 8-bit
extended control register (EXR), and an 8-bit condition code register (CCR).
General Registers (Rn) and Extended Registers (En)
150 70 70
ER0
ER1
ER2
ER3
ER4
ER5
ER6
ER7 (SP)
E0
E1
E2
E3
E4
E5
E6
E7
R0H
R1H
R2H
R3H
R4H
R5H
R6H
R7H
R0L
R1L
R2L
R3L
R4L
R5L
R6L
R7L
Control Registers
230
Legend:
SP
: Stack pointer
PC
: Program counter
EXR
: Extended control register
T
: Trace bit
I2 to I0
: Interrupt mask bits
CCR
: Condition-code register
: Interrupt mask bit
I
UI
: User bit or interrupt mask bit
H
U
N
Z
V
C
Note: * Does not affect operation in this LSI.
Figure 2.6 CPU Internal Registers
: Half-carry flag
: User bit
: Negative flag
: Zero flag
: Overflow flag
: Carry flag
PC
76543210
*
TI2I1I0
EXR
----
76543210
CCR
IUIHUNZVC
Rev. 3.00 Jan 25, 2006 page 25 of 872
REJ09B0286-0300
Page 80
Section 2 CPU
2.4.1General Registers
The H8S/2000 CPU has eight 32-bit general registers. These general registers are all functionally
alike and can be used as both address registers and data 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. Figure 2.7 illustrates the
usage of the general registers. When the general registers are used as 32-bit registers or address
registers, they are designated by the letters ER (ER0 to ER7).
When the general registers are used as 16-bit registers, the ER registers are divided 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.
When the general registers are used as 8-bit registers, the R registers are divided 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.
The usage of each register can be selected independently.
General register ER7 has the function of the stack pointer (SP) in addition to its general-register
function, and is used implicitly in exception handling and subroutine calls. Figure 2.8 shows the
stack.
• Address registers
• 32-bit registers
E registers (extended registers)
ER registers
(ER0 to ER7)
Figure 2.7 Usage of General Registers
Rev. 3.00 Jan 25, 2006 page 26 of 872
REJ09B0286-0300
• 16-bit registers• 8-bit registers
(E0 to E7)
RH registers
(R0H to R7H)
R registers
(R0 to R7)
RL registers
(R0L to R7L)
Page 81
Section 2 CPU
Free area
SP (ER7)
Stack area
Figure 2.8 Stack
2.4.2Program 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), so the least significant PC bit is ignored. (When an
instruction is fetched for read, the least significant PC bit is regarded as 0.)
2.4.3Extended Control Register (EXR)
EXR does not affect operation in this LSI.
BitBit NameInitial Value R/WDescription
7T0R/WTrace Bit
Does not affect operation in this LSI.
6 to 3—All 1RReserved
These bits are always read as 1.
2
1
0
I2
I1
I0
1
1
1
R/WInterrupt Mask Bits 2 to 0
Do not affect operation in this LSI.
Rev. 3.00 Jan 25, 2006 page 27 of 872
REJ09B0286-0300
Page 82
Section 2 CPU
2.4.4Condition-Code Register (CCR)
This 8-bit register contains internal CPU status information, including an interrupt mask bit (I) and
half-carry (H), negative (N), zero (Z), overflow (V), and carry (C) flags.
Operations can be performed on the CCR bits by the LDC, STC, ANDC, ORC, and XORC
instructions. The N, Z, V, and C flags are used as branching conditions for conditional branch
(Bcc) instructions.
BitBit NameInitial ValueR/WDescription
7I1R/WInterrupt Mask Bit
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. For
details, see section 5, Interrupt Controller.
6UIUndefinedR/WUser Bit or Interrupt Mask Bit
Can be written to and read from by software using the
LDC, STC, ANDC, ORC, and XORC instructions.
5HUndefinedR/WHalf-Carry Flag
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
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.
4UUndefinedR/WUser Bit
Can be written to and read from by software using the
LDC, STC, ANDC, ORC, and XORC instructions.
3NUndefinedR/WNegative Flag
Stores the value of the most significant bit of data as a
sign bit.
2ZUndefinedR/WZero Flag
Set to 1 to indicate zero data, and cleared to 0 to indicate
non-zero data.
Rev. 3.00 Jan 25, 2006 page 28 of 872
REJ09B0286-0300
Page 83
Section 2 CPU
BitBit NameInitial ValueR/WDescription
1VUndefinedR/WOverflow Flag
Set to 1 when an arithmetic overflow occurs, and cleared
to 0 otherwise.
0CUndefinedR/WCarry Flag
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 indicate a carry
The carry flag is also used as a bit accumulator by bit
manipulation instructions.
2.4.5Initial Register Values
Reset exception handling loads the CPU's program counter (PC) from the vector table, clears the
trace (T) bit in EXR to 0, and sets the interrupt mask (I) bits in CCR and EXR to 1. The other CCR
bits and the general registers are not initialized. Note that the stack pointer (ER7) is undefined.
The stack pointer should therefore be initialized by an MOV.L instruction executed immediately
after a reset.
Rev. 3.00 Jan 25, 2006 page 29 of 872
REJ09B0286-0300
Page 84
Section 2 CPU
2.5Data Formats
The H8S/2000 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.9 shows the data formats of general registers.
Data TypeRegister NumberData Image
70
1-bit data
1-bit data
4-bit BCD data
RnH
RnL
RnH
65432710
Don't care
7043
UpperLower
Don't care
70
65432710
Don't care
4-bit BCD data
Byte data
Byte data
RnL
RnH
RnL
Figure 2.9 General Register Data Formats (1)
Rev. 3.00 Jan 25, 2006 page 30 of 872
REJ09B0286-0300
7043
Don't care
70
MSBLSB
Don't care
UpperLower
Don't care
70
MSBLSB
Page 85
Data TypeData ImageRegister Number
Section 2 CPU
Word data
Word data
150
MSBLSB
Longword data
3116
MSB
Rn
En
ERn
EnRn
Legend:
: General register ER
ERn
: General register E
En
: General register R
Rn
: General register RH
RnH
: General register RL
RnL
: Most significant bit
MSB
: Least significant bit
LSB
Figure 2.9 General Register Data Formats (2)
150
MSBLSB
150
LSB
Rev. 3.00 Jan 25, 2006 page 31 of 872
REJ09B0286-0300
Page 86
Section 2 CPU
2.5.2Memory Data Formats
Figure 2.10 shows the data formats in memory. The H8S/2000 CPU can access word data and
longword data in 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.
When SP (ER7) is used as an address register to access the stack, the operand size should be word
size or longword size.
Data T ypeAddress
70
1-bit data
Byte data
Word data
Longword dataAddress 2N
Address L
Address L
Address 2M
Address 2M + 1
Address 2N + 1
Address 2N + 2
Address 2N + 3
76 543210
MSB
MSB
MSB
Figure 2.10 Memory Data Formats
Data Image
LSB
LSB
LSB
Rev. 3.00 Jan 25, 2006 page 32 of 872
REJ09B0286-0300
Page 87
Section 2 CPU
2.6Instruction Set
The H8S/2000 CPU has 65 types of instructions. The instructions are classified by function as
shown in table 2.1.
Table 2.1Instruction Classification
FunctionInstructionsSizeTypes
Data transfer
Arithmetic
operations
Logic operationsAND, OR, XOR, NOTB/W/L 4
ShiftSHAL, SHAR, SHLL, SHLR, ROTL, ROTR, ROTXL,
Bit manipulationBSET, BCLR, BNOT, BTST, BLD, BILD, BST, BIST, BAND,
BranchB
System controlTRAPA, RTE, SLEEP, LDC, STC, ANDC, ORC, XORC,
Block data transfer EEPMOV—1
Legend: B: Byte size
W: Word size
L: Longword size
Notes: 1. POP.W Rn and PUSH.W Rn are identical to MOV.W @SP+, Rn and MOV.W Rn,
@-SP. POP.L ERn and PUSH.L ERn are identical to MOV.L @SP+, ERn and
MOV.L ERn, @-SP.
2. Since register ER7 functions as the stack pointer in an STM/LDM instruction, it cannot
be used as an STM/LDM register.
3. Cannot be used in this LSI.
4. B
CC
MOVB/W/L5
1
*
POP
, PUSH
LDM, STM
MOVFPE
1
*
2
*
3
*
, MOVTPE
3
*
ADD, SUB, CMP, NEGB/W/L 19
ADDX, SUBX, DAA, DASB
INC, DECB/W/L
ADDS, SUBSL
MULXU, DIVXU, MULXS, DIVXSB/W
EXTU, EXTSW/L
TASB
ROTXR
BIAND, BOR, BIOR, BXOR, BIXOR
4
*
, JMP, BSR, JSR, RTS—5
CC
NOP
is the general name for conditional branch instructions.
W/L
L
B
B/W/L 8
B14
—9
Total: 65
Rev. 3.00 Jan 25, 2006 page 33 of 872
REJ09B0286-0300
Page 88
Section 2 CPU
2.6.1Table of Instructions Classified by Function
Tables 2.3 to 2.10 summarize the instructions in each functional category. The notation used in
tables 2.3 to 2.10 is defined below.
Table 2.2Operation Notation
SymbolDescription
RdGeneral register (destination)
RsGeneral register (source)
RnGeneral register
ERnGeneral register (32-bit register)
(EAd)Destination operand
(EAs)Source operand
EXRExtended control register
CCRCondition-code register
NN (negative) flag in CCR
ZZ (zero) flag in CCR
VV (overflow) flag in CCR
CC (carry) flag in CCR
PCProgram counter
SPStack pointer
#IMMImmediate data
dispDisplacement
+Addition
–Subtraction
×Multiplication
÷Division
∧Logical AND
∨Logical OR
⊕Logical exclusive OR
→Move
∼NOT (logical complement)
:8/:16/:24/:328-, 16-, 24-, or 32-bit length
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 registers (ER0 to ER7).
*
*
*
Rev. 3.00 Jan 25, 2006 page 34 of 872
REJ09B0286-0300
Page 89
Table 2.3Data Transfer Instructions
1
InstructionSize
MOVB/W/L(EAs) → Rd, Rs → (EAd)
MOVFPEBCannot be used in this LSI.
MOVTPEBCannot be used in this LSI.
POPW/L@SP+ → Rn
PUSHW/LRn → @-SP
2
*
LDM
2
*
STM
Notes: 1. Size refers to the operand size.
B: Byte
W: Word
L: Longword
2. Since register ER7 functions as the stack pointer in an STM/LDM instruction, it cannot
be used as an STM/LDM register.
*
Function
Moves data between two general registers or between a general register
and memory, or moves immediate data to a general register.
Pops a general register from the stack. POP.W Rn is identical to MOV.W
@SP+, Rn. 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. PUSH.L ERn is identical to MOV.L ERn, @-SP.
L@SP+ → Rn (register list)
Pops two or more general registers from the stack.
LRn (register list) → @-SP
Pushes two or more general registers onto the stack.
Section 2 CPU
Rev. 3.00 Jan 25, 2006 page 35 of 872
REJ09B0286-0300
Page 90
Section 2 CPU
Table 2.4Arithmetic Operations Instructions (1)
Instruction Size
ADD
SUB
ADDX
SUBX
INC
DEC
ADDS
SUBS
DAA
DAS
MULXUB/WRd × Rs → Rd
MULXSB/WRd × Rs → Rd
DIVXUB/WRd ÷ Rs → Rd
Note:* Size refers to the operand size.
*
B/W/LRd ± Rs → Rd, Rd ± #IMM → Rd
BRd ± Rs ± C → Rd, Rd ± #IMM ± C → Rd
B/W/LRd ± 1 → Rd, Rd ± 2 → Rd
LRd ± 1 → Rd, Rd ± 2 → Rd, Rd ± 4 → Rd
BRd (decimal adjust) → Rd
B: Byte
W: Word
L: Longword
Function
Performs addition or subtraction on data in two general registers, or on
immediate data and data in a general register. (Subtraction on
immediate data and data in a general register cannot be performed in
bytes. Use the SUBX or ADD instruction.)
Performs addition or subtraction with carry on data in two general
registers, or on immediate data and data in a general register.
Adds or subtracts the value 1 or 2 to or from data in a general register.
(Only the value 1 can be added to or subtracted from byte operands.)
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
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.
Rev. 3.00 Jan 25, 2006 page 36 of 872
REJ09B0286-0300
Page 91
Table 2.4Arithmetic Operations Instructions (2)
Section 2 CPU
Instruction Size
DIVXSB/WRd ÷ Rs → Rd
CMPB/W/LRd – Rs, Rd – #IMM
NEGB/W/L0 – Rd → Rd
EXTUW/LRd (zero extension) → Rd
EXTSW/LRd (sign extension) → Rd
TASB@ERd – 0, 1 → (<bit 7> of @ERd)
Note: * Size refers to the operand size.
*
B: Byte
W: Word
L: Longword
Function
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 the CCR bits according to the result.
Takes the two's complement (arithmetic complement) of data in a
general register.
Extends the lower 8 bits of a 16-bit register to word size, or the lower 16
bits of a 32-bit register to longword size, by padding with zeros on the
left.
Extends the lower 8 bits of a 16-bit register to word size, or the lower 16
bits of a 32-bit register to longword size, by extending the sign bit.
Tests memory contents, and sets the most significant bit (bit 7) to 1.
Rev. 3.00 Jan 25, 2006 page 37 of 872
REJ09B0286-0300
Page 92
Section 2 CPU
Table 2.5Logic Operations Instructions
Instruction Size
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 (logical complement) of data in a general
register.
Table 2.6Shift Instructions
Instruction Size
SHAL
SHAR
SHLL
SHLR
ROTL
ROTR
ROTXL
ROTXR
Note: * Size refers to the operand size.
*
B/W/LRd (shift) → Rd
B/W/LRd (shift) → Rd
B/W/LRd (rotate) → Rd
B/W/LRd (rotate) → Rd
B: Byte
W: Word
L: Longword
Function
Performs an arithmetic shift on data in a general register. 1-bit or 2 bit
shift is possible.
Performs a logical shift on data in a general register. 1-bit or 2 bit shift is
possible.
Rotates data in a general register. 1-bit or 2 bit rotation is possible.
Rotates data including the carry flag in a general register. 1-bit or 2 bit
rotation is possible.
Rev. 3.00 Jan 25, 2006 page 38 of 872
REJ09B0286-0300
Page 93
Table 2.7Bit Manipulation Instructions (1)
Section 2 CPU
B: Byte
*
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 three 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 three 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 three 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 three bits of a general register.
Logically ANDs the carry flag with a specified bit in a general register or
memory operand and stores the result in the carry flag.
Logically 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.
Logically ORs the carry flag with a specified bit in a general register or
memory operand and stores the result in the carry flag.
Logically 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.
Instruction Size
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
Note:* Size refers to the operand size.
Rev. 3.00 Jan 25, 2006 page 39 of 872
REJ09B0286-0300
Page 94
Section 2 CPU
Table 2.7Bit Manipulation Instructions (2)
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>)
Note:* Size refers to the operand size.
B: Byte
*
Function
Logically exclusive-ORs the carry flag with a specified bit in a general
register or memory operand and stores the result in the carry flag.
Logically 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 Jan 25, 2006 page 40 of 872
REJ09B0286-0300
Page 95
Section 2 CPU
Table 2.8Branch 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)
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
C = 0
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 Jan 25, 2006 page 41 of 872
REJ09B0286-0300
Page 96
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 a power-down state.
LDCB/W(EAs) → CCR, (EAs) → EXR
STCB/WCCR → (EAd), EXR → (EAd)
ANDCBCCR ∧ #IMM → CCR, EXR ∧ #IMM → EXR
ORCBCCR ∨ #IMM → CCR, EXR ∨ #IMM → EXR
XORCBCCR ⊕ #IMM → CCR, EXR ⊕ #IMM → EXR
NOP—PC + 2 → PC
Note:* Size refers to the operand size.
B: Byte
W: Word
*
Function
Moves the memory operand contents or immediate data to CCR or
EXR. Although CCR and EXR are 8-bit registers, word-size transfers
are performed between them and memory. The upper 8 bits are valid.
Transfers CCR or EXR contents to a general register or memory
operand. Although CCR and EXR are 8-bit registers, word-size
transfers are performed between them and memory. The upper 8 bits
are valid.
Logically ANDs the CCR or EXR contents with immediate data.
Logically ORs the CCR or EXR contents with immediate data.
Logically exclusive-ORs the CCR or EXR contents with immediate
data.
Only increments the program counter.
Rev. 3.00 Jan 25, 2006 page 42 of 872
REJ09B0286-0300
Page 97
Section 2 CPU
Table 2.10 Block Data Transfer Instructions
InstructionSizeFunction
EEPMOV.B—if R4L ≠ 0 then
Repeat @ER5+ → @ER6+
R4L–1 → R4L
Until R4L = 0
else next:
EEPMOV.W—if R4 ≠ 0 then
Repeat @ER5+ → @ER6+
R4–1 → R4
Until R4 = 0
else next:
Transfers a data block. Starting from the address set in ER5, transfers
data for the number of bytes set in R4L or R4 to the address location
set in ER6.
Execution of the next instruction begins as soon as the transfer is
completed.
2.6.2Basic Instruction Formats
The H8S/2000 CPU instructions consist of 2-byte (1-word) units. An instruction consists of an
operation field (op), a register field (r), an effective address extension (EA), and a condition field
(cc).
Figure 2.11 shows examples of instruction formats.
• 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 four bits of the instruction.
Some instructions have two operation fields.
• Register field
Specifies a general register. Address registers are specified by 3 bits, and data registers by 3
bits or 4 bits. Some instructions have two register fields, and some have no register field.
• Effective address extension
8, 16, or 32 bits specifying immediate data, an absolute address, or a displacement.
• Condition field
Specifies the branching condition of Bcc instructions.
Rev. 3.00 Jan 25, 2006 page 43 of 872
REJ09B0286-0300
Page 98
Section 2 CPU
(1) Operation field only
op
(2) Operation field and register fields
op
(3) Operation field, register fields, and effective address extension
op
EA (disp)
(4) Operation field, effective address extension, and condition field
opccEA (disp)BRA d:16
rn
rnrm
rm
NOP, RTS
ADD.B Rn, Rm
MOV.B @(d:16, Rn), Rm
Figure 2.11 Instruction Formats (Examples)
2.7Addressing Modes and Effective Address Calculation
The H8S/2000 CPU supports the eight addressing modes listed in table 2.11. Each instruction uses
a subset of these addressing modes.
Arithmetic and logic operations instructions can use the register direct and immediate addressing
modes. Data transfer instructions can use all addressing modes except program-counter relative
and memory indirect. Bit manipulation instructions can use register direct, register indirect, or
absolute 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.
Rev. 3.00 Jan 25, 2006 page 44 of 872
REJ09B0286-0300
Page 99
Section 2 CPU
Table 2.11 Addressing Modes
No.Addressing ModeSymbol
1Register directRn
2Register indirect@ERn
3Register indirect with displacement@(d:16,ERn)/@(d:32,ERn)
4Register indirect with post-increment
Register indirect with pre-decrement
5Absolute address@aa:8/@aa:16/@aa:24/@aa:32
6Immediate#xx:8/#xx:16/#xx:32
7Program-counter relative@(d:8,PC)/@(d:16,PC)
8Memory indirect@@aa:8
@ERn+
@–ERn
2.7.1Register Direct—Rn
The register field of the instruction code specifies an 8-, 16-, or 32-bit general register which
contains 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.
2.7.2Register Indirect—@ERn
The register field of the instruction code specifies an address register (ERn) which contains the
address of a memory operand. If the address is a program instruction address, the lower 24 bits are
valid and the upper 8 bits are all assumed to be 0 (H'00).
2.7.3Register Indirect with Displacement—@(d:16, ERn) or @(d:32, ERn)
A 16-bit or 32-bit displacement contained in the instruction code is added to an address register
(ERn) specified by the register field of the instruction, and the sum gives the address of a memory
operand. A 16-bit displacement is sign-extended when added.
2.7.4Register 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) which contains the address of a memory operand. After the
operand is accessed, 1, 2, or 4 is added to the address register contents and the sum is stored in the
address register. The value added is 1 for byte access, 2 for word access, and 4 for longword
access. For word or longword transfer instructions, the register value should be even.
Rev. 3.00 Jan 25, 2006 page 45 of 872
REJ09B0286-0300
Page 100
Section 2 CPU
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 result
becomes 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, and 4 for longword access. For word or
longword transfer instructions, the register value should be even.
2.7.5Absolute Address—@aa:8, @aa:16, @aa:24, or @aa:32
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), 24 bits long (@aa:24), or 32 bits long
(@aa:32). Table 2.12 indicates the accessible absolute address ranges.
To access data, the absolute address should be 8 bits (@aa:8), 16 bits (@aa:16), or 32 bits
(@aa:32) long. 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 16 bits are a sign extension. For a 32-bit absolute address,
the entire address space is accessed.
A 24-bit absolute address (@aa:24) indicates the address of a program instruction. The upper 8
bits are all assumed to be 0 (H'00).
Table 2.12 Absolute Address Access Ranges
Absolute AddressNormal ModeAdvanced Mode
Data address8 bits (@aa:8)H'FF00 to H'FFFFH'FFFF00 to H'FFFFFF
16 bits (@aa:16)H'0000 to H'FFFFH'000000 to H'007FFF,
H'FF8000 to H'FFFFFF
32 bits (@aa:32)H'000000 to H'FFFFFF
Program instruction
address
24 bits (@aa:24)
2.7.6Immediate—#xx:8, #xx:16, or #xx:32
The 8-bit (#xx:8), 16-bit (#xx:16), or 32-bit (#xx:32) immediate data contained in a instruction
code can be used directly as an operand.
The ADDS, SUBS, INC, and DEC instructions implicitly contain immediate data in their
instruction codes. Some bit manipulation instructions contain 3-bit immediate data in the
instruction code, specifying a bit number. The TRAPA instruction contains 2-bit immediate data
in its instruction code, specifying a vector address.
Rev. 3.00 Jan 25, 2006 page 46 of 872
REJ09B0286-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.