Document No. U16899EJ2V0UD00 (2nd edition)
Date Published April 2005 N CP(K)
Printed in Japan
2003
[MEMO]
2
User’s Manual U16899EJ2V0UD
NOTES FOR CMOS DEVICES
1
VOLTAGE APPLICATION WAVEFORM AT INPUT PIN
Waveform distor tion due to input noise or a reflected wave may cause malfunction. If the input of the
IL
CMOS device stays in the area between V
malfunction. Take care to prevent chattering noise from entering the device when the input level is fixed,
and also in the transition period when the input level passes through the area between V
IH
(MIN).
V
HANDLING OF UNUSED INPUT PINS
2
Unconnected CMOS device inputs can be cause of malfunction. If an input pin is unconnected, it is
possible that an internal input level may be generated due to noise, etc., causing malfunction. CMOS
devices behave differently than Bipolar or NMOS devices. Input levels of CMOS devices must be fixed
high or low by using pull-up or pull-down circuitry. Each unused pin should be connected to V
via a resistor if there is a possibility that it will be an output pin. All handling related to unused pins must
be judged separately for each device and according to related specifications governing the device.
3
PRECAUTION AGAINST ESD
A strong electric field, when exposed to a MOS device, can cause destruction of the gate oxide and
ultimately degrade the device operation. Steps must be taken to stop generation of static electricity as
much as possible, and quickly dissipate it when it has occurred. Environmental control must be
adequate. When it is dry, a humidifier should be used. It is recommended to avoid using insulators that
easily build up static electricity. Semiconductor devices must be stored and transported in an anti-static
container, static shielding bag or conductive material. All test and measurement tools including work
benches and floors should be grounded. The operator should be grounded using a wrist strap.
Semiconductor devices must not be touched with bare hands. Similar precautions need to be taken for
PW boards with mounted semiconductor devices.
(MAX) and VIH (MIN) due to noise, etc., the device may
IL
(MAX) and
DD
or GND
4
STATUS BEFORE INITIALIZATION
Power-on does not necessarily define the initial status of a MOS device. Immediately after the power
source is turned ON, devices with reset functions have not yet been initialized. Hence, power-on does
not guarantee output pin levels, I/O settings or contents of registers. A device is not initialized until the
reset signal is received. A reset operation must be executed immediately after power-on for devices
with reset functions.
5
POWER ON/OFF SEQUENCE
In the case of a device that uses different power supplies for the internal operation and external
interface, as a rule, switch on the external power supply after switching on the internal power supply.
When switching the power supply off, as a rule, switch off the external power supply and then the
internal power supply. Use of the reverse power on/off sequences may result in the application of an
overvoltage to the internal elements of the device, causing malfunction and degradation of internal
elements due to the passage of an abnormal current.
The correct power on/off sequence must be judged separately for each device and according to related
specifications governing the device.
6
INPUT OF SIGNAL DURING POWER OFF STATE
Do not input signals or an I/O pull-up power supply while the device is not powered. The current
injection that results from input of such a signal or I/O pull-up power supply may cause malfunction and
the abnormal current that passes in the device at this time may cause degradation of internal elements.
Input of signals during the power off state must be judged separately for each device and according to
related specifications governing the device.
User’s Manual U16899EJ2V0UD
3
EEPROM is a trademark of NEC Electronics Corporation.
Windows and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the
United States and/or other countries.
PC/AT is a trademark of International Business Machines Corporation.
HP9000 series 700 and HP-UX are trademarks of Hewlett-Packard Company.
SPARCstation is a trademark of SPARC International, Inc.
Solaris and SunOS are trademarks of Sun Microsystems, Inc.
SuperFlash
is a registered trademark of Silicon Storage Technology, Inc. in several countries including the
United States and Japan.
Caution: This product uses SuperFlash
®
technology licensed from Silicon Storage Technology, Inc.
•
The information in this document is current as of October, 2004. The information is subject to
change without notice. For actual design-in, refer to the latest publications of NEC Electronics data
sheets or data books, etc., for the most up-to-date specifications of NEC Electronics products. Not
all products and/or types are available in every country. Please check with an NEC Electronics sales
representative for availability and additional information.
No part of this document may be copied or reproduced in any form or by any means without the prior
•
written consent of NEC Electronics. NEC Electronics assumes no responsibility for any errors that may
appear in this document.
•
NEC Electronics does not assume any liability for infringement of patents, copyrights or other intellectual
property rights of third parties by or arising from the use of NEC Electronics products listed in this document
or any other liability arising from the use of such products. No license, express, implied or otherwise, is
granted under any patents, copyrights or other intellectual property rights of NEC Electronics or others.
Descriptions of circuits, software and other related information in this document are provided for illustrative
•
purposes in semiconductor product operation and application examples. The incorporation of these
circuits, software and information in the design of a customer's equipment shall be done under the full
responsibility of the customer. NEC Electronics assumes no responsibility for any losses incurred by
customers or third parties arising from the use of these circuits, software and information.
•
While NEC Electronics endeavors to enhance the quality, reliability and safety of NEC Electronics products,
customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To
minimize risks of damage to property or injury (including death) to persons arising from defects in NEC
Electronics products, customers must incorporate sufficient safety measures in their design, such as
redundancy, fire-containment and anti-failure features.
•
NEC Electronics products are classified into the following three quality grades: "Standard", "Special" and
"Specific".
The "Specific" quality grade applies only to NEC Electronics products developed based on a customerdesignated "quality assurance program" for a specific application. The recommended applications of an NEC
Electronics product depend on its quality grade, as indicated below. Customers must check the quality grade of
each NEC Electronics product before using it in a particular application.
"Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio
and visual equipment, home electronic appliances, machine tools, personal electronic equipment
and industrial robots.
systems, anti-crime systems, safety equipment and medical equipment (not specifically designed
for life support).
"Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life
support systems and medical equipment for life support, etc.
The quality grade of NEC Electronics products is "Standard" unless otherwise expressly specified in NEC
Electronics data sheets or data books, etc. If customers wish to use NEC Electronics products in applications
not intended by NEC Electronics, they must contact an NEC Electronics sales representative in advance to
determine NEC Electronics' willingness to support a given application.
(Note)
(1) "NEC Electronics" as used in this statement means NEC Electronics Corporation and also includes its
majority-owned subsidiaries.
(2) "NEC Electronics products" means any product developed or manufactured by or for NEC Electronics (as
defined above).
M8E 02. 11-1
4
User’s Manual U16899EJ2V0UD
Regional Information
Some information contained in this document may vary from country to country. Before using any NEC
Electronics product in your application, pIease contact the NEC Electronics office in your country to
obtain a list of authorized representatives and distributors. They will verify:
•
Device availability
•
Ordering information
•
Product release schedule
•
Availability of related technical literature
•
Development environment specifications (for example, specifications for third-party tools and
components, host computers, power plugs, AC supply voltages, and so forth)
•
Network requirements
In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary
from country to country.
How to Read This Manual It is assumed that the readers of this manual have general knowledge of electrical
engineering, logic circuits, and microcontrollers.
• To gain a general understanding of functions:
→ Read this manual in the order of the CONTENTS. The mark
shows major
revised points.
• How to interpret the register format:
→ For a bit number encl osed in brackets, the b it name is d efined as a r eserv ed wor d
in the RA78K0, and is defined as an sfr variable by #pr agma sfr directive in the
CC78K0.
• To check the details of a register when you know the register name:
→ Refer to APPENDIX C REGISTER INDEX.
• To know details of the 78K/0 Series instructions:
→ Refer to the separate document 78K/0 Series Instructions User’s Manual
(U12326E).
6
User’s Manual U16899EJ2V0UD
ConventionsData significance: Higher digits on the left and lower digits on the right Active low representations: ××× (overscore over pin and signal name)
Note: Footnote for item marked with Note in the text.
Caution: Information requiring particular attention
Remark: Supplementary information
Numerical representations: Binary
Decimal
Hexadecimal
...
×××× or ××××B
...
××××
...
××××H
Differences Between 78K0/KE1+ and 78K0/KE1
Series Name
Item
Mask ROM version None Available
Flash
memory
version
Version with on-chip debug function Available (µPD78F0138HD) None
Regulator None Available
Power-on clear function 2.1 V ±0.1 V (fixed) 2.85 V ±0.15 V or 3.5 V ±0.2 V selectable
Minimum instruction execution time 0.125 µs (at 16 MHz operation) 0.166 µs (at 12 MHz operation)
Power supply Single power supply Two power supplies
Self-programming function Available None
Option byte
Ring-OSC can be stopped/cannot be
stopped selectable
78K0/KE1+ 78K0/KE1
None
Related DocumentsThe related documents indicated in this publication may include preliminary versions.
However, preliminary versions are not marked as such.
Documents Related to Devices
Document Name Document No.
78K0/KE1+ User’s Manual This manual
78K0/KE1 User’s Manual U16228E
78K/0 Series Instructions User’s Manual U12326E
78K0/Kx1+ Flash Memory Self Programming User’s Manual Under preparation
Documents Related to Development Tools (Software) (User’s Manuals)
Document Name Document No.
RA78K0 Ver. 3.80 Assembler Package
Operation U17199E
Language U17198E
Structured Assembly Language U17197E
Operation U17201E CC78K0 Ver. 3.70 C Compiler
Language U17200E
Operation U17246E SM+ System Simulator
User Open Interface U17247E
Caution The related documents listed above are subject to change without notice. Be sure to use the latest
version of each document when designing.
User’s Manual U16899EJ2V0UD
7
Documents Related to Development Tools (Hardware) (User’s Manuals)
Document Name Document No.
SEMICONDUCTOR SELECTION GUIDE − Products and Packages − X13769X
Semiconductor Device Mount Manual Note
Quality Grades on NEC Semiconductor Devices C11531E
NEC Semiconductor Device Reliability/Quality Control System C10983E
Guide to Prevent Damage for Semiconductor Devices by Electrostatic Discharge (ESD) C11892E
Note See the “Semiconductor Device Mount Manual” website (http://www.necel.com/pkg/en/mount/index.html).
Caution The related documents listed above are subject to change without notice. Be sure to use the latest
2.2.15 X1 and X2.......................................................................................................................................40
2.2.16 XT1 and XT2 ..................................................................................................................................40
2.2.17 VDD and EVDD ................................................................................................................................40
2.2.18 VSS and EVSS .................................................................................................................................40
2.2.19 FLMD0 and FLMD1........................................................................................................................40
2.3 Pin I/O Circuits and Recommended Connection of Unused Pins......................................... 41
CHAPTER 3 CPU ARCHITECTURE...................................................................................................... 45
CHAPTER 4 PORT FUNCTIONS ........................................................................................................... 82
4.1 Port Functions............................................................................................................................ 82
4.2 Port Configuration...................................................................................................................... 84
4.2.1 Port 0............................................................................................................................................. 85
4.2.2 Port 1............................................................................................................................................. 89
4.2.3 Port 2............................................................................................................................................. 94
4.2.4 Port 3............................................................................................................................................. 95
4.2.5 Port 4............................................................................................................................................. 97
4.2.6 Port 5............................................................................................................................................. 98
4.2.7 Port 6............................................................................................................................................. 99
4.2.8 Port 7............................................................................................................................................100
4.2.9 Port 12..........................................................................................................................................101
4.2.10 Port 13..........................................................................................................................................102
4.2.11 Port 14..........................................................................................................................................103
4.3 Registers Controlling Port Func tion...................................................................................... 104
4.4 Port Function Operations........................................................................................................ 108
4.4.1 Writing to I/O port..........................................................................................................................108
4.4.2 Reading from I/O port...................................................................................................................108
4.4.3 Operations on I/O port ..................................................................................................................108
26.6.5 Port pins........................................................................................................................................442
26.6.6 Other signal pins...........................................................................................................................442
26.6.7 Power supply................................................................................................................................442
{ On-chip power-on-clear (POC) circuit and low-voltage detector (LVI)
{ Short startup is possible via the CPU default start using the on-chip Ring-OSC
{ On-chip clock monitor function using on-chip Ring-OSC
{ On-chip watchdog timer (operable with Ring-OSC clock)
{ On-chip multiplier/divider
{ On-chip key interrupt function
{ On-chip clock output/buzzer output controller
{ I/O ports: 51 (N-ch open drain: 4)
{ Timer
FLMD0, FLMD1: Flash programming mode
INTP0 to INTP7: External interrupt input
KR0 to KR7: Key return
NC: Non-connection
P00 to P06: Port 0
P10 to P17: Port 1
P20 to P27: Port 2
P30 to P33: Port 3
P40 to P43: Port 4
P50 to P53: Port 5
P60 to P63: Port 6
P70 to P77: Port 7
P120: Port 12
P140, P141: Port 14
PCL: Programmable clock output
RESET: Reset
RxD0, RxD6: Receive data
SCK10, SCK11
SI10, SI11
SO10, SO11
Note
SSI11
Note
: Serial clock input/output
Note
: Serial data input
Note
: Serial data output
: Serial interface chip select input
TI000, TI010,
TI001
Note
, TI011
Note
,
TI50, TI51: Timer input
TO00, TO01
Note
,
TO50, TO51,
TOH0, TOH1: Timer output
TxD0, TxD6: Transmit data
V
RESET pin Provided
POC Fixed to 2.7 V or lower
LVI 3.1 V/3.3 V ±0.15 V or 3.5 V/3.7 V/3.9 V/4.1 V/4.3 V ±0.2 V (selectable by software)
Clock monitor Provided (monitoring by Ring-OSC)
WDT1 Provided
WDT2 Provided
V850ES/KE1+ V850ES/KF1+ V850ES/KG1+ V850ES/KJ1+
−
−
128
−
−
−
−
− −
− −
128 256
−−
1 ch 2 ch 2 ch
128 KB 3 MB 15 MB
16 bits 22 bits 24 bits
Multiplexed mode onlyMultiplexed/separate mode
−
256
128/256
−
−
256
4 ch 4 ch
2 ch 2 ch
128/256
−
−
256
Note Provided in the Y version only.
User’s Manual U16899EJ2V0UD
27
1.6 Block Diagram
CHAPTER 1 OUTLINE
TO01
TO00/TI010/P01
TI000/P00
Note 1
/TI011
TI001
Note 1
Note 1
TOH0/P15
TOH1/P16
TI50/TO50/P17
TI51/TO51/P33
RxD0/P11
TxD0/P10
/P06
/P05
16-bit timer/
event counter 00
16-bit timer/
Note 1
event counter 01
8-bit timer H0
8-bit timer H1
8-bit timer/
event counter 50
8-bit timer/
event counter 51
Watch timer
Watchdog timer
Serial
interface UART0
78K/0
CPU
core
Flash
memory
Port 0
Port 1
Port 2
Port 3
Port 4
Port 5
Port 6
Port 7
Port 12
7
P00 to P06
8
P10 to P17
8
P20 to P27
4
P30 to P33
4
P40 to P43
4
P50 to P53
4
P60 to P63
8
P70 to P77
P120
Port 13P130
Port 14P140, P141
Buzzer output
2
BUZ/P141
Notes 1.
2.
RxD6/P14
TxD6/P13
SI10/P11
SO10/P12
SCK10/P10
Note 1
SI11
Note 1
SO11
Note 1
SCK11
Note 1
SSI11
ANI0/P20 to
ANI7/P27
INTP0/P120
INTP1/P30 to
INTP4/P33
INTP5/P16
INTP6/P140,
INTP7/P141
Serial
interface UART6
Serial
interface CSI10
Internal
high-speed
RAM
Internal
expansion
Note 2
RAM
Clock output control
/P03
/P02
/P04
Serial interface
Note 1
CSI11
/P05
8
AV
AV
REF
SS
A/D converter
4
Interrupt control
ROM correction
2
VSS,
Multiplier & divider
µ
PD78F0133H, 78F0134H, 78F0136H, 78F0138H, and 78F0138HD only.
µ
PD78F0136H, 78F0138H, and 78F0138HD only
VDD,
EV
FLMD0,
SS
DD
EV
FLMD1
Clock monitor
Power on clear/
low voltage
indicator
Key return
Reset control
Ring-OSC
System control
Note 2
PCL/P140
POC/LVI
control
KR0/P70 to
8
KR7/P77
RESET
X1
X2
XT1
XT2
28
User’s Manual U16899EJ2V0UD
CHAPTER 1 OUTLINE
1.7 Outline of Functions
(1/2)
Item
Internal
memory
(bytes)
Flash memory
(self-programming
supported)
Note 1
High-speed RAM
Expansion RAM
Memory space 64 KB
High-speed system clock
DD = 4.0 to 5.5 V, 2 to 10 MHz: VDD = 3.5 to 5.5 V,
DD = 3.0 to 5.5 V, 2 to 5 MHz: VDD = 2.5 to 5.5 V)
1 K
DD = 2.0 to 5.5 V
DD = 2.0 to 5.5 V
Note 2
)
µ
6 (PWM output: 4)
Note 2
)
PD78F0132H)
POC) of the power-on-
User’s Manual U16899EJ2V0UD
29
CHAPTER 1 OUTLINE
(2/2)
Item
Serial interface
Multiplier/divider
Vectored interrupt
sources
Internal 16 19
External 9
Key interrupt Key interrupt (INTKR) occurs by detecting falling edge of key input pins (KR0 to KR7).
Reset
ROM correction
On-chip debug function
Supply voltage VDD = 2.5 to 5.5 V (with Ring-OSC clock or subsystem clock: VDD = 2.0 to 5.5 V
Operating ambient temperature TA = −40 to +85°C
Package
8-bit timer H1 output
Clock output (for trimming of high-speed system clock,
P16/INTP5
Input P140/INTP6
subsystem clock)
BUZ Output Buzzer output Input P141/INTP7
ANI0 to ANI7 Input A/D converter analog input Input P20 to P27
Note SO11, SI11, SCK11, SSI11, TI001, TI011, and TO01 are available only in the
µ
PD78F0133H, 78F0134H,
78F0136H, 78F0138H, and 78F0138HD.
34
User’s Manual U16899EJ2V0UD
CHAPTER 2 PIN FUNCTIONS
(2) Non-port pins (2/2)
Pin Name I/O Function After Reset Alternate Function
AVREF Input
AVSS
KR0 to KR7 Input Key interrupt input Input P70 to P77
RESET Input System reset input
X1 Input
X2
XT1 Input
XT2
VDD
EVDD
VSS
EVSS
FLMD0
FLMD1
NC
A/D converter reference voltage input and positive power
supply for port 2
A/D converter ground potential. Make the same potential as
−
SS or VSS.
EV
Connecting resonator for high-speed system clock
−
Connecting resonator for subsystem clock
−
Positive power supply (except for ports)
−
Positive power supply for ports
−
Ground potential (except for ports)
−
Ground potential for ports
−
Flash memory programming mode setting.
−
Not internally connected. Leave open.
−
− −
− −
− −
− −
− −
− −
− −
− −
− −
− −
− −
− −
Input P17/TI50/TO50
−−
User’s Manual U16899EJ2V0UD
35
CHAPTER 2 PIN FUNCTIONS
2.2 Description of Pin Functions
2.2.1 P00 to P06 (port 0)
P00 to P06 function as a 7-bit I/O port. These pins also function as timer I/O, serial interface data I/O, clock I/O,
and chip select input.
The following operation modes can be specified in 1-bit units.
(1) Port mode
P00 to P06 function as a 7-bit I/O port. P00 to P06 can be set to input or output in 1-bit units using port mode
register 0 (PM0). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 0 (PU0).
(2) Control mode
P00 to P06 function as timer I/O, serial interface data I/O, clock I/O, and chip select input.
(a) TI000, TI001
These are the pins for inputting an external count clock to 16-bit tim er/event cou nters 00 and 01 a nd are als o
for inputting a capture trigger signal to the capture registers (CR000, CR010 or CR001, CR011) of 16-bit
timer/event counters 00 and 01.
(b) TI010, TI011
These are the pins for inputting a capture trigger signal to the capture register (CR000 or CR001) of 16-bit
timer/event counters 00 and 01.
(c) TO00, TO01
These are timer output pins.
(d) SI11
This is a serial interface serial data input pin.
(e) SO11
This is a serial interface serial data output pin.
(f) SCK11
This is the serial interface serial clock I/O pin.
(g) SSI11
This is the serial interface chip select input pin.
Note TI001, TI011, TO01, SI11, SO11, SCK11, and SSI11 are available only in the
Note
Note
Note
Note
Note
Note
Note
78F0134H, 78F0136H, 78F0138H, and 78F0138HD.
µ
PD78F0133H,
36
User’s Manual U16899EJ2V0UD
CHAPTER 2 PIN FUNCTIONS
2.2.2 P10 to P17 (port 1)
P10 to P17 function as an 8-bit I/O port. These pins also function as pins for external interrupt request input, serial
interface data I/O, clock I/O, timer I/O, and flash memory programming mode setting.
The following operation modes can be specified in 1-bit units.
(1) Port mode
P10 to P17 function as an 8-bit I/O port. P10 to P17 can be set to input or output in 1-bit units using port mode
register 1 (PM1). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 1 (PU1).
(2) Control mode
P10 to P17 function as external interrupt request input, serial interface data I/O, clock I/O, timer I/O, and flash
memory programming mode setting.
(a) SI10
This is a serial interface serial data input pin.
(b) SO10
This is a serial interface serial data output pin.
(c) SCK10
This is a serial interface serial clock I/O pin.
(d) RxD0, RxD6
These are the serial data input pins of the asynchronous serial interface.
(e) TxD0, TxD6
These are the serial data output pins of the asynchronous serial interface.
(f) TI50
This is the pin for inputting an external count clock to 8-bit timer/event counter 50.
(g) TO50, TOH0, and TOH1
These are timer output pins.
(h) INTP5
This is an external interrupt request input pin for which the valid edge (rising edge, falling edge, or both rising
and falling edges) can be specified.
(i) FLMD1
This is the pin for setting the flash memory programming mode.
User’s Manual U16899EJ2V0UD
37
CHAPTER 2 PIN FUNCTIONS
2.2.3 P20 to P27 (port 2)
P20 to P27 function as an 8-bit input-only port. These pins also function as pins for A/D converter analog input.
The following operation modes can be specified in 1-bit units.
(1) Port mode
P20 to P27 function as an 8-bit input-only port.
(2) Control mode
P20 to P27 function as A/D converter analog input pins (ANI0 to ANI7). When usin g these pins as analog input
pins, see (5) ANI0/P20 to ANI7/P27 in 12.6 Cautions for A/D Converter.
2.2.4 P30 to P33 (port 3)
P30 to P33 function as a 4-bit I/O port. These pins also function as pins for external interrupt request input and
timer I/O.
The following operation modes can be specified in 1-bit units.
(1) Port mode
P30 to P33 function as a 4-bit I/O port. P30 to P33 can be set to input or output in 1-bit units using port mode
register 3 (PM3). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 3 (PU3).
(2) Control mode
P30 to P33 function as external interrupt request input pins and timer I/O pins.
(a) INTP1 to INTP4
These are the external interrupt request input pins for which the valid edge (rising edge, falli ng edge, or both
rising and falling edges) can be specified.
(b) TI51
This is an external count clock input pin to 8-bit timer/event counter 51.
(c) TO51
This is a timer output pin.
Caution In the
µ
PD78F0138HD, be sure to pull the P31 pin down after reset to prevent malfunction.
Remark P31/INTP2 and P32/INTP3 of the
µ
PD78F0138HD can be used as on-chip de bug mode setting pins
when the on-chip debug function is used. For details, refer to CHAPTER 27 ON-CHIP DEBUG
FUNCTION (
µ
PD78F0138HD ONLY).
2.2.5 P40 to P43 (port 4)
P40 to P43 function as a 4-bit I/O port. P40 to P43 can be set to input or output in 1-bit units using port mode
register 4 (PM4). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 4 (PU4).
2.2.6 P50 to P53 (port 5)
P50 to P53 function as a 4-bit I/O port. P50 to P53 can be set to input or output in 1-bit units using port mode
register 5 (PM5). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 5 (PU5).
38
User’s Manual U16899EJ2V0UD
CHAPTER 2 PIN FUNCTIONS
2.2.7 P60 to P63 (port 6)
P60 to P63 function as a 4-bit I/O port. P60 to P63 can be set to input port or output port in 1-bit units using port
mode register 6 (PM6).
P60 to P63 are N-ch open-drain pins.
2.2.8 P70 to P77 (port 7)
P70 to P77 function as an 8-bit I/O port. These pins also function as key interrupt input pins.
The following operation modes can be specified in 1-bit units.
(1) Port mode
P70 to P77 function as an 8-bit I/O port. P70 to P77 can be set to input or output in 1-bit units using port mode
register 7 (PM7). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 7 (PU7).
(2) Control mode
P70 to P77 function as key interrupt input pins.
2.2.9 P120 (port 12)
P120 functions as a 1-bit I/O port. This pin also functions as a pin for external interrupt request input.
The following operation modes can be specified.
(1) Port mode
P120 functions as a 1-bit I/O port. P120 can be set to input or output using port mode register 12 (PM12). Use of
an on-chip pull-up resistor can be specified by pull-up resistor option register 12 (PU12).
(2) Control mode
P120 functions as an external interrupt request input pin (I NTP0) for which the valid edge (rising edge, falling
edge, or both rising and falling edges) can be specified.
2.2.10 P130 (port 13)
P130 functions as a 1-bit output-only port.
2.2.11 P140 and P141 (port 14)
P140 and P141 function as a 2-bit I/O port. These pins also function as external interrupt request input, cl ock
output, and buzzer output pins.
The following operation modes can be specified in 1-bit units.
(1) Port mode
P140 and P141 function as a 2-bit I/O port. P140 and P141 can be set to input or output in 1-bit units using port
mode register 14 (PM14). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 14
(PU14).
(2) Control mode
P140 and P141 function as external interrupt request input, clock output, and buzzer output pins.
(a) INTP6, INTP7
These are the external interrupt request input pins for which the valid edge (rising edge, falli ng edge, or both
rising and falling edges) can be specified.
User’s Manual U16899EJ2V0UD
39
CHAPTER 2 PIN FUNCTIONS
(b) PCL
This is a clock output pin.
(c) BUZ
This is a buzzer output pin.
2.2.12 AV
REF
This is the A/D converter reference voltage input pin.
When the A/D converter is not used, connect this pin directly to EV
DD or VDD
Note
.
Note Connect port 2 directly to EV
DD when it is used as a digital port.
2.2.13 AV
SS
This is the A/D converter ground potential pin. Even when the A/D conver ter is not used, always use thi s pin with
the same potential as the EV
SS pin or VSS pin.
2.2.14 RESET
This is the active-low system reset input pin.
2.2.15 X1 and X2
These are the pins for connecting a resonator for high-speed system clock.
When supplying an external clock, input a signal to the X1 pin and input the inverse signal to the X2 pin.
Remark The X1 and X2 pins of the
µ
PD78F0138HD can be used as on-chip debu g mode setting pins when the
on-chip debug function is used. For details, refer to CHAPTER 27 ON-CHIP DEBUG FUNCTION
(
µ
PD78F0138HD ONLY).
2.2.16 XT1 and XT2
These are the pins for connecting a resonator for subsystem clock.
When supplying an external clock, input a signal to the XT1 pin and input the inverse signal to the XT2 pin.
2.2.17 V
DD and EVDD
VDD is the positive power supply pin for other than ports.
EV
DD is the positive power supply pin for ports.
2.2.18 V
SS and EVSS
V
SS is the ground potential pin for other than ports.
EV
SS is the ground potential pin for ports.
2.2.19 FLMD0 and FLMD1
This is a pin for setting flash memory programming mode.
Connect FLMD0 to EV
SS or VSS in the normal operation mode (FLMD1 is not used in the normal operation mode).
In flash memory programming mode, be sure to connect these pins to the flash programmer.
40
User’s Manual U16899EJ2V0UD
CHAPTER 2 PIN FUNCTIONS
2.3 Pin I/O Circuits and Recommended Connection of Unused Pins
Table 2-2 shows the types of pin I/O circuits and the recommended connections of unused pins.
Refer to Figure 2-1 for the configuration of the I/O circuit of each type.
Table 2-2. Pin I/O Circuit Types (1/2)
Pin Name I/O Circuit Type I/O Recommended Connection of Unused Pins
8-A I/O Input: Independently connect to EV
P141/BUZ/INTP7
Note SO11, SI11, SCK11, SSI11, TI001, TI011, and TO01 are available only in the
78F0136H, 78F0138H, and 78F0138HD.
I/O Input: Independently connect to EV
Output: Leave open.
I/O
Input: Independently connect to EV
Output: Leave open.
Input: Independently connect to EV
Output: Leave open.
Input: Connect to EV
SS.
Output: Leave this pin open at low-level output after clearing
the output latch of the port to 0.
Input: Independently connect to EV
Output: Leave open.
Output: Leave open.
µ
PD78F0133H, 78F0134H,
DD or EVSS via a resistor.
DD or EVSS via a resistor.
DD or EVSS via a resistor.
DD or EVSS via a resistor.
DD or EVSS via a resistor.
User’s Manual U16899EJ2V0UD
41
CHAPTER 2 PIN FUNCTIONS
Table 2-2. Pin I/O Circuit Types (2/2)
Pin Name I/O Circuit Type I/O Recommended Connection of Unused Pins
RESET 2 Connect to EVDD or VDD.
XT1
16
XT2
AVREFConnect directly to EVDD or VDD
−
Input
Connect directly to EVSS or VSS
Leave open.
−
Note 1
Note 2
.
.
AVSSConnect directly to EVSS or VSS.
FLMD0
Connect to EVSS or VSS.
Notes 1. Bit 6 (FRC) of the processor clock control register (PCC) must be set to 1 after reset mode is released.
2. Connect port 2 directly to EVDD when it is used as a digital port.
42
User’s Manual U16899EJ2V0UD
CHAPTER 2 PIN FUNCTIONS
Figure 2-1. Pin I/O Circuit List (1/2)
Type 2
Type 8-A
EV
DD
IN
Schmitt-triggered input with hysteresis characteristics
Type 3-C
EV
DD
P-ch
Data
OUT
N-ch
Pullup
enable
Data
Output
disable
Type 9-C
IN
P-ch
N-ch
AV
SS
(threshold voltage)
V
DD
V
P-ch
P-ch
IN/OUT
N-ch
Comparator
+
–
REF
Type 5-A
Pullup
enable
Data
Output
disable
Input
enable
V
DD
P-ch
N-ch
EV
DD
P-ch
IN/OUT
Type 13-R
Output disable
Data
Input
enable
IN/OUT
N-ch
User’s Manual U16899EJ2V0UD
43
Type 13-W
CHAPTER 2 PIN FUNCTIONS
Figure 2-1. Pin I/O Circuit List (2/2)
Type 16
Output disable
Input
enable
Data
N-ch
Middle-voltage input buffer
IN/OUT
Feedback
cut-off
P-ch
XT1XT2
44
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
3.1 Memory Space
Products in the 78K0/KE1+ can each access a 64 KB memory space. Figures 3-1 to 3-6 show the memory maps.
Caution Regardless of the internal memory capacity, the initial values of the internal memory size
switching register (IMS) and internal expansion RAM size switching register (IXS) of all products
in the 78K0/KE1+ are fixed (IMS = CFH, IXS = 0CH). Therefore, set the value corresponding to
each product as indicated below. In addition, set the following values to the IMS and the IXS
when using the 78K0/KE1+ to evaluate the program of a mask ROM version of the 78K0/KE1.
Table 3-1. Set Values of Internal Memory Size Switching Register (IMS)
and Internal Expansion RAM Size Switching Register (IXS)
Flash Memory Version
(78K0/KE1+)
−
µ
PD78F0132H
µ
PD78F0133H
µ
PD78F0134H
µ
PD78F0136H
µ
PD78F0138H, 78F0138HD µPD780138 CFH
Target Mask ROM Version
(78K0/KE1)
µ
PD780131 42H
µ
PD780132 44H
µ
PD780133 C6H
µ
PD780134 C8H
µ
PD780136 CCH
IMS IXS
0CH
0AH
User’s Manual U16899EJ2V0UD
45
Data memory
space
CHAPTER 3 CPU ARCHITECTURE
Figure 3-1. Memory Map (µPD78F0132H)
F
FFF
H
Special function registers
F
00F
H
F
FFE
H
F
0EE
H
F
FDE
H
Internal high-speed RAM
F
00D
H
FFC
F
H
(SFR)
256 × 8 bits
General-purpose
registers
32 × 8 bits
512 × 8 bits
HFFF
3
Program area
000
H
1
0
FFF
H
CALLF entry area
0
008
H
0
HFF7
Program area
0
180
H
0
080
H
0
F70
H
0
040
H
0
F30
H
0
000
H
Option byte area
CALLT table area
Vector table area
Program
memory space
Reserved
000
4
H
FFF
3
H
Flash memory
16384 × 8 bits
0
00
0
H
Caution When replacing the µPD78F0132H with the µPD78F0138HD, note that the area from 0081H to
0083H in the
µ
PD78F0138HD cannot be used.
46
User’s Manual U16899EJ2V0UD
Data memory
space
CHAPTER 3 CPU ARCHITECTURE
Figure 3-2. Memory Map (µPD78F0133H)
F
FFF
H
Special function registers
F
00F
H
F
FFE
H
F
0EE
H
F
FDE
H
Internal high-speed RAM
F
00B
H
FFA
F
H
(SFR)
256 × 8 bits
General-purpose
registers
32 × 8 bits
1024 × 8 bits
HFFF
5
Program area
000
H
1
0
FFF
H
CALLF entry area
0
008
H
0
HFF7
Program area
0
180
H
0
H
080
0
F70
H
0
040
H
0
F30
H
0
000
H
Option byte area
CALLT table area
Vector table area
Program
memory space
Reserved
000
6
H
FFF
5
H
Flash memory
24576 × 8 bits
0
00
0
H
Caution When replacing the µPD78F0133H with the µPD78F0138HD, note that the area from 0081H to
0083H in the
µ
PD78F0138HD cannot be used.
User’s Manual U16899EJ2V0UD
47
Data memory
space
CHAPTER 3 CPU ARCHITECTURE
Figure 3-3. Memory Map (µPD78F0134H)
F
FFF
H
Special function registers
F
00F
H
F
FFE
H
F
0EE
H
F
FDE
H
Internal high-speed RAM
F
00B
H
FFA
F
H
(SFR)
256 × 8 bits
General-purpose
registers
32 × 8 bits
1024 × 8 bits
HFFF
7
Program area
000
H
1
0
FFF
H
CALLF entry area
0
008
H
0
HFF7
Program area
0
180
H
0
080
H
0
F70
H
0
040
H
0
F30
H
0
000
H
Option byte area
CALLT table area
Vector table area
Program
memory space
Reserved
000
8
H
FFF
7
H
Flash memory
32768 × 8 bits
0
00
0
H
Caution When replacing the µPD78F0134H with the µPD78F0138HD, note that the area from 0081H to
0083H in the
µ
PD78F0138HD cannot be used.
48
User’s Manual U16899EJ2V0UD
Data memory
space
FFFFH
FF00H
FEFFH
FEE0H
FEDFH
FB00H
FAFFH
F800H
F7FFH
RAM space in
which instruction
can be fetched
F400H
F3FFH
CHAPTER 3 CPU ARCHITECTURE
Figure 3-4. Memory Map (µPD78F0136H)
Special function registers
(SFR)
256 × 8 bits
General-purpose
registers
32 × 8 bits
Internal high-speed RAM
1024 × 8 bits
Reserved
Internal expansion RAM
1024 × 8 bits
Reserved
BFFFH
1000H
0FFFH
0800H
07FFH
0081H
0080H
007FH
Program area
CALLF entry area
Program area
Option byte area
CALLT table area
Vector table area
Program
memory space
C000H
BFFFH
0000H
Flash memory
49152 × 8 bits
0040H
003FH
0000H
Caution When replacing the µPD78F0136H with the µPD78F0138HD, note that the area from 0081H to
0083H in the
µ
PD78F0138HD cannot be used.
User’s Manual U16899EJ2V0UD
49
Data memory
space
FFFFH
FF00H
FEFFH
FEE0H
FEDFH
FB00H
FAFFH
F800H
F7FFH
RAM space in
which instruction
can be fetched
F400H
F3FFH
CHAPTER 3 CPU ARCHITECTURE
Figure 3-5. Memory Map (µPD78F0138H)
Special function registers
(SFR)
256 × 8 bits
General-purpose
registers
32 × 8 bits
Internal high-speed RAM
1024 × 8 bits
Reserved
Internal expansion RAM
1024 × 8 bits
Reserved
EFFFH
1000H
0FFFH
0800H
07FFH
0081H
0080H
007FH
Program area
CALLF entry area
Program area
Option byte area
CALLT table area
Vector table area
Program
memory space
F000H
EFFFH
0000H
Flash memory
61440 × 8 bits
0040H
003FH
0000H
Caution When replacing the µPD78F0138H with the µPD78F0138HD, note that the area from 0081H to
0083H in the
µ
PD78F0138HD cannot be used.
50
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-6. Memory Map (µPD78F0138HD)
FFFFH
FF00H
FEFFH
FEE0H
FEDFH
Special function registers
Internal high-speed RAM
(SFR)
256 × 8 bits
General-purpose
registers
32 × 8 bits
1024 × 8 bits
Note 1
EFFFH
1000H
0FFFH
0800H
07FFH
0190H
018FH
0084H
0083H
0081H
0080H
007FH
0040H
003FH
0000H
Program area
CALLF entry area
Program area
Note 2
Reserved for option byte
Option byte area
CALLT table area
Vector table area
Data memory
space
RAM space in
which instruction
can be fetched
Program
memory space
FB00H
FAFFH
Reserved
F800H
F7FFH
Internal expansion RAM
1024 × 8 bits
F400H
F3FFH
Reserved
F000H
EFFFH
Flash memory
61440 × 8 bits
Note 2
0000H
Notes 1. During on-chip debugging, 9 bytes of this area are used as the user data backup area for
communication.
2. During on-chip debugging, use of this area is disabled because it is used as the communication
command area (0084H to 018FH: debugger’s default setting).
User’s Manual U16899EJ2V0UD
51
CHAPTER 3 CPU ARCHITECTURE
3.1.1 Internal program memory space
The internal program memory space stores the program and table data. Normally, it is addressed with the program
counter (PC).
78K0/KE1+ products incorporate internal ROM (flash memory), as shown below.
Table 3-2. Internal ROM Capacity
Internal ROM Part Number
Structure Capacity
µ
PD78F0132H 16384 × 8 bits (0000H to 3FFFH)
µ
PD78F0133H 24576 × 8 bits (0000H to 5FFFH)
µ
PD78F0134H 32768 × 8 bits (0000H to 7FFFH)
µ
PD78F0136H 49152 × 8 bits (0000H to BFFFH)
µ
PD78F0138H, 78F0138HD
Flash memory
61440 × 8 bits (0000H to EFFFH)
The internal program memory space is divided into the following areas.
(1) Vector table area
The 64-byte area 0000H to 003FH is reserved as a vector table area. The program start addresses for branch
upon reset signal input or generation of each interrupt request are stored in the vector table area.
Of the 16-bit address, the lower 8 bits are stored at even addresses and the higher 8 bits are stored at odd
addresses.
PD78F0133H, 78F0134H, 78F0136H, 78F0138H, and 78F0138HD.
0020H INTTM000 0000H
0022H INTTM010
Note
Note
Note
52
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
(2) CALLT instruction table area
The 64-byte area 0040H to 007FH can store the subroutine entry address of a 1-byte call instruction (CALLT).
(3) Option byte area
The option byte area is assigned to the 1-byte area of 0080H. Refer to CHAPTER 24 OPTION BYTE for details.
(4) CALLF instruction entry area
The area 0800H to 0FFFH can perform a direct subroutine call with a 2-byte call instruction (CALLF).
3.1.2 Internal data memory space
78K0/KE1+ products incorporate the following RAMs.
(1) Internal high-speed RAM
Table 3-4. Internal High-Speed RAM Capacity
Part Number Internal High-Speed RAM
µ
PD78F0132H 512 × 8 bits (FD00H to FEFFH)
µ
PD78F0133H
µ
PD78F0134H
µ
PD78F0136H
µ
PD78F0138H, 78F0138HD
1024 × 8 bits (FB00H to FEFFH)
The 32-byte area FEE0H to FEFFH is assigned to four general-purpose register b anks consisting of eight 8-bit
registers per one bank.
This area cannot be used as a program area in which instructions are written and executed.
The internal high-speed RAM can also be used as a stack memory.
(2) Internal expansion RAM
Table 3-5. Internal Expansion RAM Capacity
Part Number Internal Expansion RAM
µ
PD78F0132H
µ
PD78F0133H
µ
PD78F0134H
µ
PD78F0136H
µ
PD78F0138H, 78F0138HD
1024 × 8 bits (F400H to F7FFH)
−
The internal expansion RAM can also be us ed as a normal data area simi lar to the internal high-speed RAM, as
well as a program area in which instructions can be written and executed.
The internal expansion RAM cannot be used as a stack memory.
User’s Manual U16899EJ2V0UD
53
CHAPTER 3 CPU ARCHITECTURE
3.1.3 Special function register (SFR) area
On-chip peripheral hardware special function registers (SFRs) are allocated in the area FF00H to FFFFH (refer to
Table 3-6 Special Function Register List in 3.2.3 Special function registers (SFRs)).
Caution Do not access addresses to which SFRs are not assigned.
3.1.4 Data memory addressing
Addressing refers to the method of specifying the address of the instruction to be executed next or the address of
the register or memory relevant to the execution of instructions.
Several addressing modes are provided for addressing the memory relev ant to the executi on of instructions for the
78K0/KE1+, based on operability and other considerations. For areas containing data memory in particular, sp ecial
addressing methods designed for the functions of special function registers (SFR) and general- purpose registers are
available for use. Figures 3-7 to 3-12 show correspondence b etween data memory and addressing. For details of
each addressing mode, refer to 3.4 Operand Address Addressing.
Figure 3-7. Correspondence Between Data Memory and Addressing (
µ
PD78F0132H)
F
FFF
H
Special function registers (SFR)
F
02F
H
F1F
F
H
F
00F
H
F
FFE
H
General-purpose registers
F
0EE
H
F
FDE
H
F
02E
H
F1E
F
H
F
00D
H
FFC
F
H
256 × 8 bits
32 × 8 bits
Internal high-speed RAM
512 × 8 bits
Reserved
SFR addressing
Register addressing
Short direct
addressing
Direct addressing
Register indirect addressing
Based addressing
Based indexed addressing
54
000
4
H
FFF
3
H
Flash memory
16384 × 8 bits
0
00
0
H
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-8. Correspondence Between Data Memory and Addressing (µPD78F0133H)
F
FFF
H
Special function registers (SFR)
F
02F
H
F1F
F
H
F
00F
H
F
FFE
H
General-purpose registers
F
0EE
H
F
FDE
H
F
02E
H
F1E
F
H
F
00B
H
FFA
F
H
256 × 8 bits
32 × 8 bits
Internal high-speed RAM
1024 × 8 bits
Reserved
SFR addressing
Register addressing
Short direct
addressing
Direct addressing
Register indirect addressing
Based addressing
Based indexed addressing
000
6
H
FFF
5
H
Flash memory
24576 × 8 bits
0
00
0
H
User’s Manual U16899EJ2V0UD
55
CHAPTER 3 CPU ARCHITECTURE
Figure 3-9. Correspondence Between Data Memory and Addressing (µPD78F0134H)
F
FFF
H
Special function registers (SFR)
F
02F
H
F1F
F
H
F
00F
H
F
FFE
H
General-purpose registers
F
0EE
H
F
FDE
H
F
02E
H
F1E
F
H
F
00B
H
FFA
F
H
256 × 8 bits
32 × 8 bits
Internal high-speed RAM
1024 × 8 bits
Reserved
SFR addressing
Register addressing
Short direct
addressing
Direct addressing
Register indirect addressing
Based addressing
Based indexed addressing
000
8
H
FFF
7
H
Flash memory
32768 × 8 bits
0
00
0
H
56
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-10. Correspondence Between Data Memory and Addressing (µPD78F0136H)
FFFFH
FF20H
FF1FH
FF00H
FEFFH
FEE0H
FEDFH
FE20H
FE1FH
FB00H
FAFFH
F800H
F7FFH
Special function registers (SFR)
256 × 8 bits
General-purpose registers
32 × 8 bits
Internal high-speed RAM
1024 × 8 bits
Reserved
Internal expansion RAM
1024 × 8 bits
SFR addressing
Register addressing
Short direct
addressing
Direct addressing
Register indirect addressing
Based addressing
Based indexed addressing
F400H
F3FFH
C000H
BFFFH
0000H
Reserved
Flash memory
49152 × 8 bits
User’s Manual U16899EJ2V0UD
57
CHAPTER 3 CPU ARCHITECTURE
Figure 3-11. Correspondence Between Data Memory and Addressing (µPD78F0138H)
FFFFH
FF20H
FF1FH
FF00H
FEFFH
FEE0H
FEDFH
FE20H
FE1FH
FB00H
FAFFH
F800H
F7FFH
Special function registers (SFR)
256 × 8 bits
General-purpose registers
32 × 8 bits
Internal high-speed RAM
1024 × 8 bits
Reserved
Internal expansion RAM
1024 × 8 bits
SFR addressing
Register addressing
Short direct
addressing
Direct addressing
Register indirect addressing
Based addressing
Based indexed addressing
F400H
F3FFH
Reserved
F000H
EFFFH
Flash memory
61440 × 8 bits
0000H
58
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
Figure 3-12. Correspondence Between Data Memory and Addressing (µPD78F0138HD)
FFFFH
FF20H
FF1FH
FF00H
FEFFH
FEE0H
FEDFH
FB00H
FAFFH
F800H
F7FFH
Special function registers (SFR)
256 × 8 bits
General-purpose registers
32 × 8 bits
Internal high-speed RAM
1024 × 8 bits
Note 1
Reserved
Internal expansion RAM
1024 × 8 bits
SFR addressing
Register addressing
Short direct
addressing
Direct addressing
Register indirect addressing
Based addressing
Based indexed addressing
F400H
F3FFH
Reserved
F000H
EFFFH
Flash memory
61440 × 8 bits
Note 2
0000H
Notes 1. During on-chip debugging, 9 bytes of this area are used as the user data backup area for
communication.
2. During on-chip debugging, use of this area is disabled because it is used as the communication
command area (0084H to 018FH: debugger’s default setting).
User’s Manual U16899EJ2V0UD
59
CHAPTER 3 CPU ARCHITECTURE
3.2 Processor Registers
The 78K0/KE1+ products incorporate the following processor registers.
3.2.1 Control registers
The control registers control the program sequence, statuses and stack memory. The control registers consist of a
program counter (PC), a program status word (PSW) and a stack pointer (SP).
(1) Program counter (PC)
The program counter is a 16-bit register that holds the address information of the next program to be executed.
In normal operation, the PC is automatically incremented ac cording to th e numbe r of bytes of the i nstruction to be
fetched. When a branch instruction is executed, immediate data and register contents are set.
RESET input sets the reset vector table values at addresses 0000H and 0001H to the program counter.
The program status word is an 8-bit register consisting of various flags set/reset by instruction execution.
Program status word contents are automatically stacked upon interrupt request generation or PUSH PSW
instruction execution and are restored upon execution of the RETB, RETI and POP PSW instructions.
RESET input sets the PSW to 02H.
Figure 3-14. Format of Program Status Word
7 0
PSW IE Z RBS1AC RBS00 ISP CY
(a) Interrupt enable flag (IE)
This flag controls the interrupt request acknowledge operations of the CPU.
When 0, the IE flag is set to the interrupt disabled (DI) state, and all maskable interrupt requests are
disabled. Other interrupt requests are all disabled.
When 1, the IE flag is set to the interrupt enabled (EI) state and interrupt request acknowledgement is
controlled with an in-service priority flag (ISP), an interrupt mask flag for various interrupt sourc es, and a
priority specification flag.
The IE flag is reset (0) upon DI instruction execution or in terrupt acknowledgement and is set (1) upon EI
instruction execution.
60
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
(b) Zero flag (Z)
When the operation result is zero, this flag is set (1). It is reset (0) in all other cases.
(c) Register bank select flags (RBS0 and RBS1)
These are 2-bit flags to select one of the four register banks.
In these flags, the 2-bit information that indicates the register bank selected by SEL RBn instruction
execution is stored.
(d) Auxiliary carry flag (AC)
If the operation result has a carry from bit 3 or a borrow at bit 3, this flag is set (1). It is reset (0) in all other
cases.
(e) In-service priority flag (ISP)
This flag manages the priority of acknowledgeable maskable vectored i nterrupts. When this flag is 0, lowlevel vectored interrupt requests specified by a priority specification flag regi ster (PR0L, PR 0H, PR1L, PR 1H )
(refer to 17.3 (3) Priority specification flag registers (PR0L, PR0H, PR1L, PR1H)) can not be
acknowledged. Actual request acknowledgement is controlled by the interrupt enable flag (IE).
(f) Carry flag (CY)
This flag stores overflow and underflow upon add/subtract instruction execution. It stores the s hift-out value
upon rotate instruction execution and functions as a bit accumulator during bit operation instruction
execution.
(3) Stack pointer (SP)
This is a 16-bit register to hold the start address of the memory stack area. Only the internal high-speed RAM
area can be set as the stack area.
The SP is decremented ahead of write (save) to the stack memory and is incremented after read (restored) from
the stack memory.
Each stack operation saves/restores data as shown in Figures 3-16 and 3-17.
Caution Since RESET input makes th e SP contents undefined, be sure to initialize the SP before using
Figure 3-17. Data to Be Restored from Stack Memory
(a) POP rp instruction (when SP = FEDEH)
SP
SP
FEE0H
FEDEH
FEE0H
FEDFH
FEDEH
Register pair higher
Register pair lower
(b) RET instruction (when SP = FEDEH)
SP
SP
FEE0H
FEDEH
FEE0H
FEDFH
FEDEH
PC15 to PC8
PC7 to PC0
(c) RETI, RETB instructions (when SP = FEDDH)
SP
FEE0H
FEE0H
SP
FEDDH
FEDFH
FEDEH
FEDDH
PSW
PC15 to PC8
PC7 to PC0
User’s Manual U16899EJ2V0UD
63
CHAPTER 3 CPU ARCHITECTURE
3.2.2 General-purpose registers
General-purpose registers are mapped at particular addresses (FEE0H to FEFFH) of the data memory. The
general-purpose registers consists of 4 banks, each bank consisting of eight 8-bit registers (X, A, C, B, E, D, L, and H).
Each register can be used as an 8-bit register, and two 8-bit registers can also be used in a pair as a 16- bit register
(AX, BC, DE, and HL).
These registers can be described in terms of function names (X, A, C, B, E, D, L, H, AX, BC, DE, and HL) and
absolute names (R0 to R7 and RP0 to RP3).
Register banks to be used for instruction execution are se t by the CPU control instruction (SEL RBn). Beca use of
the 4-register bank configuration, an efficient program can be created by switching between a register for normal
processing and a register for interrupts for each bank.
Figure 3-18. Configuration of General-Purpose Registers
(a) Absolute name
16-bit processing8-bit processing
FEFFH
FEF8H
FEF0H
FEE8H
FEE0H
BANK0
BANK1
BANK2
BANK3
RP3
RP2
RP1
RP0
15070
R7
R6
R5
R4
R3
R2
R1
R0
(b) Function name
16-bit processing8-bit processing
FEFFH
FEF8H
FEF0H
FEE8H
FEE0H
BANK0
BANK1
BANK2
BANK3
HL
DE
BC
AX
15070
H
L
D
E
B
C
A
X
64
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
3.2.3 Special function registers (SFRs)
Unlike a general-purpose register, each special function reg ister has a special function.
SFRs are allocated to the FF00H to FFFFH area.
Special function registers can be manipulated like general-purpose registers, using operation, transfer and bit
manipulation instructions. The manipulatable bit units, 1, 8, and 16, depend on the special function register type.
Each manipulation bit unit can be specified as follows.
• 1-bit manipulation
Describe the symbol reserved by the assembler for the 1-bit manipulation instruction operand (sfr.bit).
This manipulation can also be specified with an address.
• 8-bit manipulation
Describe the symbol reserved by the assembler for the 8-bit manipulation instruction operand (sfr).
This manipulation can also be specified with an address.
• 16-bit manipulation
Describe the symbol reserved by the assembler for the 16-bit manipulation instruction operand (sfrp).
When specifying an address, describe an even address.
Table 3-6 gives a list of the special function registers. The meanings of items in the table are as follows.
• Symbol
Symbol indic ating the addr ess of a spec ial function r egister. It is a re served word in the RA78K0, and is defined
as an sfr variable using the #pragma sfr directive in the CC78K0. When using the RA78K0, ID78K0-NS,
ID78K0, or SM78K0, symbols can be written as an instruction operand.
• R/W
Indicates whether the corresponding special function register can be read or written.
R/W: Read/write enable
R: Read only
W: Write only
• Manipulatable bit units
Indicates the manipulatable bit unit (1, 8, or 16). “−” indicates a bit unit for which manipulation is not possible.
• After reset
Indicates each register status upon RESET input.
User’s Manual U16899EJ2V0UD
65
CHAPTER 3 CPU ARCHITECTURE
Table 3-6. Special Function Register List (1/4)
FF00H Port register 0 P0 R/W
FF01H Port register 1 P1 R/W
FF02H Port register 2 P2 R
FF03H Port register 3 P3 R/W
FF04H Port register 4 P4 R/W
FF05H Port register 5 P5 R/W
FF06H Port register 6 P6 R/W
FF07H Port register 7 P7 R/W
FF08H
FF09H
FF0AH Receive buffer register 6 RXB6 R
FF0BH Transmit buffer register 6 TXB6 R/W
FF0CH Port register 12 P12 R/W
FF0DH Port register 13 P13 R/W
FF0EH Port register 14 P14 R/W
FF0FH Serial I/O shift register 10 SIO10 R
FF10H
FF11H
FF12H
FF13H
FF14H
FF15H
FF16H 8-bit timer counter 50 TM50 R
FF17H 8-bit timer compare register 50 CR50 R/W
FF18H 8-bit timer H compare register 00 CMP00 R/W
FF19H 8-bit timer H compare register 10 CMP10 R/W
FF1AH 8-bit timer H compare register 01 CMP01 R/W
FF1BH 8-bit timer H compare register 11 CMP11 R/W
FF1FH 8-bit timer counter 51 TM51 R
FF20H Port mode register 0 PM0 R/W
FF21H Port mode register 1 PM1 R/W
FF23H Port mode register 3 PM3 R/W
FF24H Port mode register 4 PM4 R/W
FF25H Port mode register 5 PM5 R/W
FF26H Port mode register 6 PM6 R/W
FF27H Port mode register 7 PM7 R/W
FF28H A/D converter mode register ADM R/W
FF29H Analog input channel specification register ADS R/W
FF2AH Power-fail comparison mode register PFM R/W
FF2BH Power-fail comparison threshold register PFT R/W
FF2CH Port mode register 12 PM12 R/W
FF2EH Port mode register 14 PM14 R/W
2. Regardless of the internal memory capacity, the initial values of the internal memory size switching
register (IMS) and internal expansion RAM size switching register (IXS) of all products in the 78K0/KE1 +
are fixed (IMS = CFH, IXS = 0CH). Therefore, set the value corresponding to each product as indicated
below. In addition, set the following values to the IMS and the IXS when using the 78K0/KE1+ to evaluat e
the program of a mask ROM version of the 78K0/KE1.
Flash Memory Version
(78K0/KE1+)
−
µ
PD78F0132H
µ
PD78F0133H
µ
PD78F0134H
µ
PD78F0136H
µ
PD78F0138H, 78F0138HD µPD780138 CFH
Target Mask ROM Version
(78K0/KE1)
µ
PD780131 42H
µ
PD780132 44H
µ
PD780133 C6H
µ
PD780134 C8H
µ
PD780136 CCH
IMS IXS
0CH
0AH
User’s Manual U16899EJ2V0UD
69
CHAPTER 3 CPU ARCHITECTURE
3.3 Instruction Address Addressing
An instruction address is determined by program counter (PC) contents and is n ormally incremented (+1 for each
byte) automatically according to the number of bytes of an instruction to be fetched each time another instruction i s
executed. When a branch instruction is executed, the branch destination information is set to the PC and branched by
the following addressing (for details of instructions, refer to 78K/0 Series Instructions User’s Manual (U12326E).
3.3.1 Relative addressing
[Function]
The value obtained by adding 8-bit immediate data (displac ement value: jdisp8) of an instruction code to the
start address of the following instruction is transferred to the program counter (PC) and branched. The
displacement value is treated as signed two’s complement data (−128 to +127) and bit 7 becomes a sign bit.
In other words, relative addressing consists of relative branching from the start address of the following
instruction to the −128 to +127 range.
This function is carried out when the BR $addr16 instruction or a conditional branch instruction is executed.
[Illustration]
150
PC
+
150
876
PC indicates the start address
...
of the instruction after the BR instruction.
α
150
PC
When S = 0, all bits of are 0.
When S = 1, all bits of are 1.
α
α
S
jdisp8
70
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
3.3.2 Immediate addressing
[Function]
Immediate data in the instruction word is transferred to the program counter (PC) and branched.
This function is carried out when the CALL !addr16 or BR !addr16 or CALLF !addr11 instruction is executed.
CALL !addr16 and BR !addr16 instructions can be branched to the entire memory space. The CALLF !addr11
instruction is branched to the 0800H to 0FFFH area.
[Illustration]
In the case of CALL !addr16 and BR !addr16 instructions
70
CALL or BR
Low Addr.
High Addr.
150
PC
In the case of CALLF !addr11 instruction
150
PC
00001
87
70
643
10–8
fa
CALLF
7–0
fa
11 10
87
User’s Manual U16899EJ2V0UD
71
CHAPTER 3 CPU ARCHITECTURE
3.3.3 Table indirect addressing
[Function]
Table contents (branch destination address) of the particular location to be addressed by bits 1 to 5 of the
immediate data of an operation code are transferred to the program counter (PC) and branched.
This function is carried out when the CALLT [addr5] instruction is executed.
This instruction references the address stored in the memory table from 40H to 7FH, a nd allows branching to
the entire memory space.
[Illustration]
76510
Operation code
ta
4–0
111
Effective address
Effective address+1
151
01
00000000
70
Memory (Table)
Low Addr.
High Addr.
150
PC
87
87
650
0
3.3.4 Register addressing
[Function]
Register pair (AX) contents to be specified with an instruction word are transferred to the program counter (PC)
and branched.
This function is carried out when the BR AX instruction is executed.
[Illustration]
70
07
72
rp
150
PC
AX
87
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4 Operand Address Addressing
The following methods are available to specify the register and memory (addressing) to undergo manipulation
during instruction execution.
3.4.1 Implied addressing
[Function]
The register that functions as an accumulator (A and AX) among the general-purpose registers is auto matically
(implicitly) addressed.
Of the 78K0/KE1+ instruction words, the following instructions employ implied addressing.
Instruction Register to Be Specified by Implied Addressing
MULU A register for multiplicand and AX register for product storage
DIVUW AX register for dividend and quotient storage
ADJBA/ADJBS A register for storage of numeric values that become decimal correction targets
ROR4/ROL4 A register for storage of digit data that undergoes digit rotation
[Operand format]
Because implied addressing can be automatically em ployed with an instruction, no particular opera nd format is
necessary.
[Description example]
In the case of MULU X
With an 8-bit × 8-bit multiply instruction, the product of A register and X register is stored in AX. In this example,
the A and AX registers are specified by implied addressing.
User’s Manual U16899EJ2V0UD
73
CHAPTER 3 CPU ARCHITECTURE
3.4.2 Register addressing
[Function]
The general-purpose register to be specified is accessed as an operand with the register bank select flags
(RBS0 to RBS1) and the register specify codes (Rn and RPn) of an operation code.
Register addressing is carried out when an instruction with the following opera nd format is executed. When an
8-bit register is specified, one of the eight registers is specified with 3 bits in the operation code.
[Operand format]
Identifier Description
r X, A, C, B, E, D, L, H
rp AX, BC, DE, HL
‘r’ and ‘rp’ can be described by absolute names (R0 to R7 and RP0 to RP3) as we ll as function names (X, A, C,
B, E, D, L, H, AX, BC, DE, and HL).
[Description example]
MOV A, C; when selecting C register as r
Operation code 0 1100010
Register specify code
INCW DE; when selecting DE register pair as rp
Operation code 1 0000100
Register specify code
74
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.3 Direct addressing
[Function]
The memory to be manipulated is directly addressed with immediate data in an instruction word becoming an
operand address.
[Operand format]
Identifier Description
addr16 Label or 16-bit immediate data
[Description example]
MOV A, !0FE00H; when setting !addr16 to FE00H
Operation code 10001110 OP code
00000000 00H
11111110 FEH
[Illustration]
07
OP code
addr16 (lower)
addr16 (upper)
Memory
User’s Manual U16899EJ2V0UD
75
CHAPTER 3 CPU ARCHITECTURE
3.4.4 Short direct addressing
[Function]
The memory to be manipulated in the fixed space is directly addressed with 8-bit data in an instruction word.
This addressing is applied to the 256-byte space FE20H to FF1FH. Internal RAM and special function registers
(SFRs) are mapped at FE20H to FEFFH and FF00H to FF1FH, respectively.
The SFR area (FF00H to FF1FH) where short direct addressing is applied is a part of the overall SFR area.
Ports that are frequently accessed in a program and compare and ca pture registers of the timer/event counter
are mapped in this area, allowing SFRs to be manipulated with a small number of bytes and clocks.
When 8-bit immediate data is at 20H to FFH, bit 8 of an effective address is set to 0. When it is at 00H to 1FH,
bit 8 is set to 1. Refer to the [Illustration] shown below.
[Operand format]
Identifier Description
saddr Immediate data that indicate label or FE20H to FF1FH
saddrp Immediate data that indicate label or FE20H to FF1FH (even address only)
[Description example]
MOV 0FE30H, A; when transferring value of A register to saddr (FE30H)
Operation code 1 1110010 OP code
0 0110000 30H (saddr-offset)
[Illustration]
07
OP code
saddr-offset
15
Effective address
1
111111
When 8-bit immediate data is 20H to FFH,
When 8-bit immediate data is 00H to 1FH,
76
87
α
α
= 0
α
= 1
User’s Manual U16899EJ2V0UD
Short direct memory
0
CHAPTER 3 CPU ARCHITECTURE
3.4.5 Special function register (SFR) addressing
[Function]
A memory-mapped special function register (SFR) is addressed with 8-bit immediate data in an instruction word.
This addressing is applied to the 240-byte spaces FF00H to FFCFH and FFE0H to FFFFH. However, the SFRs
mapped at FF00H to FF1FH can be accessed with short direct addressing.
[Operand format]
Identifier Description
sfr Special function register name
sfrp
16-bit manipulatable special function register name (even address
only)
[Description example]
MOV PM0, A; when selecting PM0 (FF20H) as sfr
Operation code 11110110 OP code
00100000 20H (sfr-offset)
[Illustration]
07
Effective address
OP code
sfr-offset
15
1
111111
87
1
SFR
0
User’s Manual U16899EJ2V0UD
77
CHAPTER 3 CPU ARCHITECTURE
3.4.6 Register indirect addressing
[Function]
Register pair contents specified by a register pair specify code in an instruction wor d and by a register bank
select flag (RBS0 and RBS1) serve as an operand address for addressing the memory. This addressing can b e
carried out for all the memory spaces.
[Operand format]
Identifier Description
−
[DE], [HL]
[Description example]
MOV A, [DE]; when selecting [DE] as register pair
Operation code 10000101
[Illustration]
160
8
7
DE
The contents of the memory
addressed are transferred.
A
D
7 0
E
Memory
The memory address
07
specified with the
register pair DE
78
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.7 Based addressing
[Function]
8-bit immediate data is added as offset data to the contents of the base register, that is, the HL register pair in
the register bank specified by the register bank select flag (RBS0 and RBS1), and the sum is used to addre ss
the memory. Addition is performed by expanding the offset data as a positive number to 16 bits. A car ry from
the 16th bit is ignored. This addressing can be carried out for all the memory spaces.
[Operand format]
Identifier Description
−
[HL + byte]
[Description example]
MOV A, [HL + 10H]; when setting byte to 10H
Operation code 10101110
00010000
[Illustration]
1608H7
HL
The contents of the memory
addressed are transferred.
7 0
A
L
Memory
07
+10
User’s Manual U16899EJ2V0UD
79
CHAPTER 3 CPU ARCHITECTURE
3.4.8 Based indexed addressing
[Function]
The B or C register contents specified in an instruction word are added to t he contents of the bas e register, that
is, the HL register pair in the register bank specified by the register bank select flag (RBS0 and RBS1), and the
sum is used to address the memory. Addition is performed by ex panding the B or C register contents as a
positive number to 16 bits. A carry from the 16th bit is ignored. This addressing can be carried out for all the
memory spaces.
[Operand format]
Identifier Description
−
[HL + B], [HL + C]
[Description example]
In the case of MOV A, [HL + B] (selecting B register)
Operation code 10101011
[Illustration]
160
78
HL
The contents of the memory
addressed are transferred.
7 0
A
H
+
L
B
Memory
07
07
80
User’s Manual U16899EJ2V0UD
CHAPTER 3 CPU ARCHITECTURE
3.4.9 Stack addressing
[Function]
The stack area is indirectly addressed with the stack pointer (SP) contents.
This addressing method is automatically employed when the PUSH, POP, subroutine call and return
instructions are executed or the register is saved/reset upon generation of an interrupt request.
With stack addressing, only the internal high-speed RAM area can be accessed.
[Description example]
In the case of PUSH DE (saving DE register)
Operation code 10110101
[Illustration]
Memory07
SP
SP
FEE0H
FEDEH
FEE0H
FEDFH
FEDEH
D
E
User’s Manual U16899EJ2V0UD
81
CHAPTER 4 PORT FUNCTIONS
4.1 Port Functions
There are two types of pin I/O buffer power supplies: AV
supplies and the pins is shown below.
Table 4-1. Pin I/O Buffer Power Supplies
Power Supply Corresponding Pins
AVREFP20 to P27
EVDDPort pins other than P20 to P27
78K0/KE1+ products are provided with the ports shown in Figure 4-1, which enable variety of control operations .
The functions of each port are shown in Table 4-2.
In addition to the function as digital I/O ports, these ports have several alternate functions. For details of the
alternate functions, refer to CHAPTER 2 PIN FUNCTIONS.
Figure 4-1. Port Types
REF and EVDD. The relationship between these power
Port 5
Port 6
Port 7
Port 12
Port 13
Port 14
P50
P53
P60
P63
P70
P77
P120
P130
P140
P141
P00
Port 0
P06
P10
Port 1
P17
P20
Port 2
P27
P30
Port 3
P33
82
P40
Port 4
P43
User’s Manual U16899EJ2V0UD
CHAPTER 4 PORT FUNCTIONS
Table 4-2. Port Functions (1/2)
Pin Name I/O Function After Reset Alternate Function
Input
4-bit I/O port.
Input/output can be specified in 1-bit units.
P33
Use of an on-chip pull-up resistor can be specified by a
INTP4/TI51/TO51
software setting.
P40 to P43 I/O
Port 4.
Input
−
4-bit I/O port.
Input/output can be specified in 1-bit units.
Use of an on-chip pull-up resistor can be specified by a
software setting.
P50 to P53 I/O
Port 5.
Input
−
4-bit I/O port.
Input/output can be specified in 1-bit units.
Use of an on-chip pull-up resistor can be specified by a
software setting.
P60 to P63 I/O
Port 6.
Input
−
4-bit I/O port (N-ch open drain).
Input/output can be specified in 1-bit units.
P70 to P77 I/O
Port 7.
Input KR0 to KR7
8-bit I/O port.
Input/output can be specified in 1-bit units.
Use of an on-chip pull-up resistor can be specified by a
software setting.
µ
Note SO11, SI11, SCK11, SSI11, TI001, TI011, and TO01 are available only in the
PD78F0133H, 78F0134H,
78F0136H, 78F0138H, and 78F0138HD.
Note
Note
User’s Manual U16899EJ2V0UD
83
CHAPTER 4 PORT FUNCTIONS
Table 4-2. Port Functions (2/2)
Pin Name I/O Function After Reset Alternate Function
P120 I/O
P130 Output
P140 PCL/INTP6
P141
I/O
Port 12.
1-bit I/O port.
Use of an on-chip pull-up resistor can be specified by a
software setting.
Port 13.
1-bit output-only port.
Port 14.
2-bit I/O port.
Input/output can be specified in 1-bit units.
Use of an on-chip pull-up resistor can be specified by a
software setting.
Port mode register (PM0, PM1, PM3 to PM7, PM12, PM14)
Port register (P0 to P7, P12 to P14)
Pull-up resistor option register (PU0, PU1, PU3 to PU5, PU7, PU12, PU14)
84
User’s Manual U16899EJ2V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.1 Port 0
Port 0 is a 7-bit I/O port with an output latch. Port 0 can be set to the input mode or output mode in 1-bit units
using port mode register 0 (PM0). When the P00 to P06 pins are used as an input port, use of an on-chip pull-up
resistor can be specified in 1-bit units by pull-up resistor option register 0 (PU0).
This port can also be used for timer I/O, serial interface data I/O, and clock I/O.
RESET input sets port 0 to input mode.
Figures 4-2 to 4-5 show block diagrams of port 0.
Caution When P02/SO11
Note
, P03/SI11
Note
, and P04/SCK11
Note
are used as general-purpose ports, do not
write to serial clock selection register 11 (CSIC11).
Figure 4-2. Block Diagram of P00, P03, and P05
EV
DD
WR
PU
PU0
RD
WR
PORT
Internal bus
WR
PU00, PU03, PU05
Alternate function
Selector
Output latch
(P00, P03, P05)
PM
PM0
PM00, PM03, PM05
P-ch
Note Available only in the µPD78F0133H, 78F0134H, 78F0136H, 78F0138H, and 78F0138HD.
PU0: Pull-up resistor option register 0
PM0: Port mode register 0
RD: Read signal
WR××: Write signal
P00/TI000,
P03/SI11
P05/SSI11
Note
Note
,
/TI001
Note
User’s Manual U16899EJ2V0UD
85
CHAPTER 4 PORT FUNCTIONS
Figure 4-3. Block Diagram of P01 and P06
EV
DD
WR
PU
PU0
PU01, PU06
P-ch
Alternate
function
RD
Selector
PORT
WR
Internal bus
Output latch
(P01, P06)
WR
PM
PM0
PM01, PM06
Alternate
function
Note Available only in the µPD78F0133H, 78F0134H, 78F0136H, 78F0138H, and 78F0138HD.
PU0: Pull-up resistor option register 0
PM0: Port mode register 0
RD: Read signal
WR××: Write signal
P01/TI010/TO00,
P06/TI011
Note
/TO01
Note
86
User’s Manual U16899EJ2V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-4. Block Diagram of P02
EV
DD
WR
PU
PU0
PU02
RD
Selector
PORT
WR
Output latch
Internal bus
WR
PM
(P02)
PM0
PM02
Alternate
function
Note Available only in the µPD78F0133H, 78F0134H, 78F0136H, 78F0138H, and 78F0138HD.
PU0: Pull-up resistor option register 0
PM0: Port mode register 0
RD: Read signal
WR××: Write signal
P-ch
P02/SO11
Note
User’s Manual U16899EJ2V0UD
87
CHAPTER 4 PORT FUNCTIONS
Figure 4-5. Block Diagram of P04
EV
DD
WR
PU
PU0
PU04
Alternate
function
RD
Selector
WR
PORT
Internal bus
Output latch
(P04)
WR
PM
PM0
PM04
Alternate
function
Note Available only in the µPD78F0133H, 78F0134H, 78F0136H, 78F0138H, and 78F0138HD.
PU0: Pull-up resistor option register 0
PM0: Port mode register 0
RD: Read signal
WR××: Write signal
P-ch
P04/SCK11
Note
88
User’s Manual U16899EJ2V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.2 Port 1
Port 1 is an 8-bit I/O port with an output latch. Port 1 can be set to the input mode or output mode in 1-bit units
using port mode register 1 (PM1). When the P10 to P17 pins are used as an input port, use of an on-chip pull-up
resistor can be specified in 1-bit units by pull-up resistor option register 1 (PU1).
This port can also be used for external interrupt request input, serial interface data I/O, clock I/O, timer I/O, and
flash memory programming mode setting.
RESET input sets port 1 to input mode.
Figures 4-6 to 4-10 show block diagrams of port 1.
Caution When P10/SCK10/TxD0, P11/SI10/RxD0, and P12/SO10 are used as general-purpose ports, do not
write to serial clock selection register 10 (CSIC10).
Figure 4-6. Block Diagram of P10
EV
DD
WR
PU
PU1
Internal bus
PU10
Alternate
function
RD
WR
PORT
Output latch
(P10)
WR
PM
PM1
PM10
Alternate
function
PU1: Pull-up resistor option register 1
PM1: Port mode register 1
RD: Read signal
WR××: Write signal
P-ch
Selector
P10/SCK10/TxD0
User’s Manual U16899EJ2V0UD
89
CHAPTER 4 PORT FUNCTIONS
Figure 4-7. Block Diagram of P11 and P14
EV
DD
WR
PU
PU1
PU11, PU14
Alternate
function
RD
Internal bus
WR
PORT
Output latch
(P11, P14)
WR
PM
PM1
PM11, PM14
PU1: Pull-up resistor option register 1
PM1: Port mode register 1
RD: Read signal
WR××: Write signal
P-ch
Selector
P11/SI10/RxD0,
P14/RxD6
90
User’s Manual U16899EJ2V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-8. Block Diagram of P12 and P15
EV
DD
PU
WR
PU1
PU12, PU15
RD
PORT
WR
Output latch
Internal bus
WR
PM
(P12, P15)
PM1
PM12, PM15
Alternate
function
PU1: Pull-up resistor option register 1
PM1: Port mode register 1
RD: Read signal
WR××: Write signal
P-ch
Selector
P12/SO10
P15/TOH0
User’s Manual U16899EJ2V0UD
91
CHAPTER 4 PORT FUNCTIONS
Figure 4-9. Block Diagram of P13
EVDD
PU
WR
PU1
PU13
RD
PORT
WR
Internal bus
WRPM
Output latch
(P13)
PM1
PM13
Alternate
function
PU1: Pull-up resistor option register 1
PM1: Port mode register 1
RD: Read signal
WR××: Write signal
P-ch
Selector
P13/TxD6
92
User’s Manual U16899EJ2V0UD
CHAPTER 4 PORT FUNCTIONS
Figure 4-10. Block Diagram of P16 and P17
EV
DD
PU
WR
PU1
Internal bus
PU16, PU17
Alternate
function
RD
WR
PORT
Output latch
(P16, P17)
WR
PM
PM1
PM16, PM17
Alternate
function
PU1: Pull-up resistor option register 1
PM1: Port mode register 1
RD: Read signal
WR××: Write signal
P-ch
Selector
P16/TOH1/INTP5,
P17/TI50/TO50/FLMD1
User’s Manual U16899EJ2V0UD
93
CHAPTER 4 PORT FUNCTIONS
4.2.3 Port 2
Port 2 is an 8-bit input-only port.
This port can also be used for A/D converter analog input.
Figure 4-11 shows a block diagram of port 2.
Figure 4-11. Block Diagram of P20 to P27
RD
A/D converter
Internal bus
P20/ANI0 to P27/ANI7
RD: Read signal
94
User’s Manual U16899EJ2V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.4 Port 3
Port 3 is a 4-bit I/O port with an output latch. Port 3 can be set to the input mode or output mode in 1-bit units
using port mode register 3 (PM3). When used as an input por t, use of an on-chip pull-up resistor c an be specified in
1-bit units by pull-up resistor option register 3 (PU3).
This port can also be used for external interrupt request input and timer I/O.
RESET input sets port 3 to input mode.
Figures 4-12 and 4-13 show block diagrams of port 3.
Caution In the
µ
PD78F0138HD, be sure to pull the P31 pin down after reset to prevent malfunction.
Remark P31/INTP2 and P32/INTP3 of the
µ
PD78F0138HD can be used for on-chip debug mod e setting when
the on-chip debug function is used. For details, refer to CHAPTER 27 ON-CHIP DEBUG FUNCTION
(
µ
PD78F0138HD ONLY).
Figure 4-12. Block Diagram of P30 to P32
EV
DD
PU
WR
PU3
PU30 to PU32
Alternate
function
RD
Internal bus
WR
PORT
Output latch
(P30 to P32)
WR
PM
PM3
PM30 to PM32
PU3: Pull-up resistor option register 3
PM3: Port mode register 3
RD: Read signal
WR××: Write signal
P-ch
Selector
P30/INTP1 to
P32/INTP3
User’s Manual U16899EJ2V0UD
95
CHAPTER 4 PORT FUNCTIONS
Figure 4-13. Block Diagram of P33
EV
DD
PU
WR
PU3
Internal bus
PU33
Alternate
function
RD
WR
PORT
Output latch
(P33)
WR
PM
PM3
PM33
Alternate
function
PU3: Pull-up resistor option register 3
PM3: Port mode register 3
RD: Read signal
WR××: Write signal
P-ch
Selector
P33/INTP4/TI51/TO51
96
User’s Manual U16899EJ2V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.5 Port 4
Port 4 is a 4-bit I/O port with an output latch. Port 4 can be set to the input mode or output mode in 1-bit units
using port mode register 4 (PM4). Use of an on-chip pull-up resistor can be specified in 1-bit units with pull-up resistor
option register 4 (PU4).
RESET input sets port 4 to input mode.
Figure 4-14 shows a block diagram of port 4.
Figure 4-14. Block Diagram of P40 to P43
EV
DD
WR
PU
PU4
RD
WR
WR
PORT
PM
Internal bus
PU40 to PU43
Selector
Output latch
(P40 to P43)
PM4
PM40 to PM43
P-ch
P40 to P43
PU4: Pull-up resistor option register 4
PM4: Port mode register 4
RD: Read signal
WR××: Write signal
User’s Manual U16899EJ2V0UD
97
CHAPTER 4 PORT FUNCTIONS
4.2.6 Port 5
Port 5 is a 4-bit I/O port with an output latch. Port 5 can be set to the input mode or output mode in 1-bit units
using port mode register 5 (PM5). Use of an on-chip pull-up resistor can be specified in 1-bit units using pull-up
resistor option register 5 (PU5).
RESET input sets port 5 to input mode.
Figure 4-15 shows a block diagram of port 5.
Figure 4-15. Block Diagram of P50 to P53
EV
DD
WR
PU
RD
WR
PORT
Internal bus
WR
PM
PU5
PU50 to PU53
Output latch
(P50 to P53)
PM5
P-ch
Selector
P50 to P53
PM50 to PM53
PU5: Pull-up resistor option register 5
PM5: Port mode register 5
RD: Read signal
WR××: Write signal
98
User’s Manual U16899EJ2V0UD
CHAPTER 4 PORT FUNCTIONS
4.2.7 Port 6
Port 6 is a 4-bit I/O port with an output latch. Port 6 can be set to the input mode or output mode in 1-bit units
using port mode register 6 (PM6).
The P60 to P63 pins are N-ch open-drain pins.
RESET input sets port 6 to input mode.
Figure 4-16 shows a block diagram of port 6.
Figure 4-16. Block Diagram of P60 to P63
RD
Selector
WR
PORT
Internal bus
WR
PM
Output latch
(P60 to P63)
PM6
PM60 to PM63
P60 to P63
PM6: Port mode register 6
RD: Read signal
WR××: Write signal
User’s Manual U16899EJ2V0UD
99
CHAPTER 4 PORT FUNCTIONS
4.2.8 Port 7
Port 7 is an 8-bit I/O port with an output latch. Port 7 can be set to the input mode or output mode in 1-bit units
using port mode register 7 (PM7). When the P70 to P77 pins are used as an input port, use of an on-chip pull-up
resistor can be specified in 1-bit units by pull-up resistor option register 7 (PU7).
This port can also be used for key return input.
RESET input sets port 7 to input mode.
Figure 4-17 shows a block diagram of port 7.
Figure 4-17. Block Diagram of P70 to P77
EV
DD
PU
WR
PU7
PU70 to PU77
Alternate function
RD
WR
PORT
Internal bus
WR
PM
Output latch
(P70 to P77)
PM7
PM70 to PM77
PU7: Pull-up resistor option register 7
PM7: Port mode register 7
RD: Read signal
WR××: Write signal
P-ch
Selector
P70/KR0 to
P77/KR7
100
User’s Manual U16899EJ2V0UD
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.