All information contained in these materials, including products and product specifications,
represents information on the product at the time of publication and is subject to change by
Renesas Electronics Corp. without notice. Please review the latest information published by
Renesas Electronics Corp. through various means, including the Renesas Electronics Corp.
website (http://www.renesas.com).
www.renesas.com
Rev.2.03 Jun 2012
Notice
1. 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 responsibility for any losses incurred by you
or third parties arising from the use of these circuits, software, or information.
2. Renesas Electronics has used reasonable care 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.
3. Renesas 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 Renesas 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.
4. You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part.
Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from such alteration,
modification, copy or otherwise misappropriation of Renesas Electronics product.
5. Renesas Electronics products are classified according to the following two quality grades: “Standard” and “High Quality”. The
recommended applications for each Renesas Electronics product depends on the product’s quality grade, as indicated below.
“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 etc.
Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct threat to
human life or bodily injury (artificial life support devices or systems, surgical implantations etc.), or may cause serious property
damages (nuclear reactor control systems, military equipment etc.). You must check the quality grade of each Renesas
Electronics product before using it in a particular application. You may not use any Renesas Electronics product for any
application for which it is not intended. 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 which the product is not intended by Renesas
Electronics.
6. 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 other product characteristics. Renesas Electronics shall have no liability for malfunctions or
damages arising out of the use of Renesas Electronics products beyond such specified ranges.
7. Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor 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 measures 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 systems manufactured by
you.
8. 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.
9. Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose
manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. You should not use
Renesas Electronics products or technology 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. When exporting the Renesas
Electronics 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.
10. It is the responsibility of the buyer or distributor of Renesas Electronics products, who distributes, disposes of, or otherwise
places the product with a third party, to notify such third party in advance of the contents and conditions set forth in this
document, Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of
unauthorized use of Renesas Electronics products.
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.
(2012.4)
NOTES FOR CMOS DEVICES
(1) VOLTAGE APPLICATION WAVEFORM AT INPUT PIN: Waveform distortion due to input noise or a
reflected wave may cause malfunction. If the input of the CMOS device stays in the area between VIL
(MAX) and VIH (MIN) due to noise, etc., the device may malfunction. Take care to prevent chattering noise
from entering the device when the input level is fixed, and also in the tra nsition period when the input level
passes through the area between VIL (MAX) and VIH (MIN).
(2) HANDLING OF UNUSED INPUT PINS: 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 generate d 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-do wn circuitry. Each unused pin should be
connected to VDD or GND 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 b e 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 gr oun ded usin g 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.
(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 e xternal power suppl y after switching on th e 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 po wer on/off sequences may result in the application of an
overvoltage to the internal elements of the device, causing malfunction and degr adation of internal elements
due to the passage of an abnormal current. The correct po wer 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.
How to Use This Manual
ReadersThis manual is intended for user engineers who wish to understand the functions of the
78K0/Fx2-L microcontrollers and design and develop application system s and programs for
these devices.
The target products are as follows.
• 78K0/FY2-L:
• 78K0/FA2-L:
• 78K0/FB2-L:
Purpose This manual is intended to give users an understanding of the functions described in the
Organization below.
Organization The manual for the 78K0/Fx2-L microcontrollers is separated into two parts: this manual
and the instructions edition (common to the 78K0 microcontrollers).
μ
PD78F0854, 78F0855, 78F0856
μ
PD78F0857, 78F0858, 78F0859
μ
PD78F0864, 78F0865
78K0/Fx2-L
User’s Manual
(This Manual)
78K/0 Series
User’s Manual
Instructions
• Pin functions
• Internal block functions
• Interrupts
• Other on-chip peripheral functions
• Electrical specifications
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 “<R>” shows major
revised points. The revised points can be easily searched by copying an “<R>” in the
PDF file and specifying it in the “Find what.” field.
• How to interpret the register format:
→ For a bit number enclosed in angle brackets, the bit name is defined as a reserved
word in the RA78K0, and is defined as an sfr variable using the #pragma sfr directive
in the CC78K0.
• To know details of the 78K0 microcontroller instructions:
→ Refer to the separate document 78K/0 Series Instructions User’s Manual
(U12326E).
Conventions Data 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
• CPU functions
• Instruction set
• Explanation of each instruction
...
×××× or ××××B
...
××××
...
××××H
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/Fx2-L User’s Manual U19856E
78K/0 Series Instructions User’s Manual U12326E
78K0 Microcontrollers User’s Manual Self Programming Library Type 01 U18274E
78K0 Microcontrollers Self Programming Library Type 01 Ver. 3.10 Operating Precautions (Notification
Documents Related to Development Tools (Hardware) (User’ s Manual)
Document Name Document No.
QB-78K0FX2L In-Circuit Emulator To be prepared
QB-MINI2 On-Chip Debug Emulator with Programming Function U18371E
QB-Programmer Programming GUI Operation U18527E
Documents Related to Flash Memory Programming (User’s Manual)
Document Name Document No.
PG-FP5 Flash Memory Programmer U18865E
Caution The related documents listed above are subject to change without notice. Be sure to use the latest
version of each document for designing.
Documents Related to Development Tools (Software)
Document Name Document No.
Note 1
Operation U17199E
Language U17198E
Structured Assembly Language U17197E
Note 1
Operation U17201E
Language U17200E
Note 2
Operation U18601E SM+ System Simulator User’s Manual
User Open Interface U18212E
Notes 1. This document is installed into the PC together with the tool when installing RA78K0 Ver. 4.01. For
descriptions not included in “78K0 Assembler Package RA78K0 Ver. 4.01 Operating Prec autions”, refer to the
user’s manual of RA78K0 Ver. 3.80.
2. This document is installed into the PC together with the tool when installing CC78K0 Ver. 4.00. For
descriptions not included in “78K0 C Compiler CC78K0 Ver. 4.00 Operating Precautions”, refer to the user’s
manual of CC78K0 Ver. 3.70.
3. PM plus Ver. 5.20 is the integrated development environment included with RA78K0 Ver. 3.80.
4. PM+ Ver. 6.30 is the integrated development environment included with RA78K0 Ver. 4.01. Software tool (assembler, C compiler, debugger, and simulator) products of different versions can be managed.
Other Documents
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://www2.renesas.com/pkg/en/mount/index.html).
Caution The related documents listed above are subject to change without notice. Be sure to use the latest
version of each document when designing.
All trademarks and registered trademarks are the property of their respective owners.
EEPROM is a trademark of Renesas Electronics Corporation.
Windows is a registered trademark or trademark of Microsoft Corporation in the United States and/or other countries.
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.
3.2.1 Control registers ................................................................................................................................ 57
3.4.3 Direct addressing............................................................................................................................... 73
3.4.4 Short direct addressing...................................................................................................................... 74
3.4.5 Special function register (SFR) addressing ....................................................................................... 75
3.4.7 Based addressing.............................................................................................................................. 77
3.4.8 Based indexed addressing ................................................................................................................ 78
CHAPTER 4 PORT FUNCTIONS...........................................................................................................80
4.1 Port Functions..............................................................................................................................80
4.2 Port Configuration........................................................................................................................84
4.2.1 Port 0................................................................................................................................................. 85
4.2.2 Port 2................................................................................................................................................. 88
4.2.3 Port 3................................................................................................................................................. 94
4.2.4 Port 6............................................................................................................................................... 103
4.2.5 Port 7............................................................................................................................................... 106
4.2.6 Port 12............................................................................................................................................. 108
4.3 Registers Controlling Port Function ........................................................................................ 110
4.4 Port Function Operations..........................................................................................................120
4.4.1 Writing to I/O port............................................................................................................................. 120
4.4.2 Reading from I/O port......................................................................................................................120
4.4.3 Operations on I/O port.....................................................................................................................120
4.5 Settings of Port Mode Register and Output Latch When Using Alternate Function...........121
4.6 Cautions on 1-bit Memory Manipulation Instruction for Port Register n (Pn) ..................... 127
18.2 Standby Function Operation................................................................................................... 561
18.2.1 HALT mode.................................................................................................................................... 561
24.4.3 Port pins ........................................................................................................................................ 615
24.4.5 Other signal pins............................................................................................................................ 615
24.4.6 Power supply.................................................................................................................................615
24.4.7 On-board writing when connecting crystal/ceramic resonator ....................................................... 616
• 16-bit timer X … PWM output, operation in conjunction with an external signal, synchronous output
of up to four channels (available only in 78K0/FB2-L), A/D conversion trigger
generation
• 16-bit timer/event counter … PPG output, capture input, external event co unter input
Power-on-clear (POC) circuit
Low-voltage detector (LVI) circuit (An interrupt/reset (selectable) is generated when the detection voltage is
reached))
• Detection voltage: Selectable from sixteen levels between 1.91 and 4.22 V
Single-power-supply flash memory
• Flash self programming enabled
• Software protection function: Protected from outside party copying (no flash reading command)
Safety function
• Watchdog timer operated by clock independent from CPU
… A hang-up can be detected even if the system clock stops
• Supply voltage drop detectable by LVI
… Appropriate processi ng can be executed before the supply voltage drops below the operation voltage
• Equipped with option byte function
… Important system operation settings set in hardware
On-chip debug function …Available to control for the target device, and to reference memory
Assembler and C language supported
Enhanced development environment
• Support for full-function emulator (IECUBE), and simplified emulator (MINICUBE2)
Power supply voltage: V
Operating ambient temperature: • (A) grade products: T
• (A2) grade products: TA = −40 to +125°C
UART6 IICA CSI11
1 ch 1 ch
1 ch
DD = 1.8 to 5.5 V
A = −40 to +85°C
−
R01UH0068EJ0203 Rev.2.03 16
Jun 29, 2012
78K0/Fx2-L CHAPTER 1 OUTLINE
1.2 Ordering Information
[Part Number]
μ
PD78F08xy ΔΔ× - ××× -×
Product Type
F Flash memory version
[Example of Part Number]
μ
PD78F08 54 MA-A-FAA-G
Semiconductor
G
Quality Grade
A Special (TA = −40 to +85°C)
A2 Special (TA = −40 to +125°C)
AV
ANI0/P20
ANI1/P21
ANI2/P22
ANI3/P23/CMP2+
P00/TI000/INTP0
P01/TO00/TI010
P30/TOH1/TI51/INTP1
ANI0 to ANI3: Analog Input RESET: Reset
REF: Analog Reference RxD6: Receive Data
AV
Voltage SCLA0: Serial Clock Input/Output
CMP2+: Comparator Input SDAA0: Serial Data Input/Output
EXCLK: External Clock Input TI000, TI010, TI51: Timer Input
(Main System Clock) TO00, TOH1: Timer Output
INTP0, INTP1: External Interrupt TOOLC0: Clock Input for Tool
Input TOOLD0: Data Input/Output for Tool
P00, P01: Port 0 TxD6: Transmit Data
P20 to P23: Port 2 V
P30: Port 3 V
P60, P61: Port 6 X1, X2: Crystal Oscillator
P121, P122: Port 12 (Main System Clock)
REGC: Regulator Capacitance
DD: Power Supply
SS: Ground
Cautions 1. V
SS functions alternately as the ground potential of the A/D converter. Be sure to connect VSS to
a stabilized GND (= 0 V).
2. Connect the REGC pin to V
SS via a capacitor (0.47 to 1
μ
F).
3. ANI0/P20, ANI1/P21, ANI2/P22, and ANI3/P23/CMP2+ are set in the analog input mode after
release of reset.
R01UH0068EJ0203 Rev.2.03 19
Jun 29, 2012
78K0/Fx2-L CHAPTER 1 OUTLINE
1.3.2 78K0/FA2-L (20 pins)
• 20-pin plastic SSOP (7.62 mm (300))
AV
ANI5/P25/CMP1+
ANI4/P24/CMP0+
P60/SCLA0/TxD6
P61/SDAA0/RxD6
RESET
P122/X2/EXCLK/TOOLD0
P121/X1/TOOLC0
REGC
V
V
1
2
3
4
5
6
7
8
SS
DD
9
10
20
19
18
17
16
15
14
13
12
11
ANI0 to ANI5: Analog Input RESET: Reset
REF: Analog Reference RxD6: Receive Data
AV
Voltage SCLA0: Serial Clock Input/Output
CMP0+ to CMP2+: Comparator Input SDAA0: Serial Data Input/Output
EXCLK: External Clock Input TI000, TI010, TI51: Timer Input
(Main System Clock) TO00, TOH1: Timer Output
INTP0 to INTP3: External Interrupt TOOLC0, TOOLC1: Clock Input for Tool
Input TOOLD0, TOOLD1: Data Input/Output for Tool
P00, P01: Port 0 TOX00, TOX01: Timer Output
P20 to P25: Port 2 TxD6: Transmit Data
P30 to P32: Port 3 V
P60, P61: Port 6 V
P121, P122: Port 12 X1, X2: Crystal Oscillator
REGC: Regulator Capacitance (Main System Clock)
DD: Power Supply
SS: Ground
Cautions 1. V
SS functions alternately as the ground potential of the A/D converter. Be sure to connect VSS to
a stabilized GND (= 0 V).
2. Connect the REGC pin to V
SS via a capacitor (0.47 to 1
μ
3. ANI0/P20, ANI1/P21, ANI2/P22, ANI3/P23/CMP2+, ANI4/P24/CMP0+, and ANI5/P25/CMP1+ are set in
the analog input mode after release of reset.
REF:Analog Reference Voltage SCLA0, SCK11: Serial Clock Input/Output
AV
SS:Analog Ground SDAA0: Serial Data Input/Output
AV
CMP0+ to CMP2+: Comparator Input SI11: Serial Data Input
SO11: Serial Data Output EXCLK: External Clock Input
(Main System Clock) SSI11: Serial Interface Chip
CMPCOM: Comparator Common Input TI000, TI010, TI51: Timer Input
INTP0 to INTP5: External Interrupt Input TO00, TOH1: Timer Output
P00 to P02: Port 0 TOOLC0, TOOLC1: Clock Input for Tool
P20 to P27: Port 2 TOOLD0, TOOLD1: Data Input/Output for Tool
P30 to P37: Port 3 TOX00, TOX01,
P60, P61: Port 6 TOX10, TOX11: Timer Output
P70: Port 7 TxD6: Transmit Data
P121, P122: Port 12 V
REGC: Regulator Capacitance V
RESET: Reset X1, X2: Crystal Oscillator
(Main System Clock)
DD: Power Supply
SS: Ground
Cautions 1. Connect the REGC pin to V
SS via a capacitor (0.47 to 1
μ
F).
2. ANI0/P20, ANI1/P21, ANI2/P22, ANI3/P23/CMP2+, ANI4/P24/CMP0+, ANI5/P25/CMP1+,
ANI6/P26/CMPCOM, ANI7/P27, and ANI8/P70 are set in the analog input mode after release of
reset.
Remark Functions in angle brackets < > can be assigned by setting the input switch control register (MUXSEL).
R01UH0068EJ0203 Rev.2.03 21
Jun 29, 2012
78K0/Fx2-L CHAPTER 1 OUTLINE
1.4 Block Diagram
1.4.1 78K0/FY2-L (16 pins)
TO00/TI010/P01
TI000/P00
RxD6/P61<LINSEL>
TI51/P30
TOH1/P30
RxD6/P61
TxD6/P60
SDAA0/P61
SCLA0/P60
AV
REF
ANI0/P20-ANI3/P23
CMP2+/P23
16-bit TIMER
16-bit TIMER/
EVENT COUNTER 00
8-bit TIMER
8-bit TIMER
INTERNAL
LOW-SPEED
OSCILLATOR
WATCHDOG TIMER
SERIAL
INTERFACE UART6
LINSEL
SERIAL
INTERFACE IICA
A/D CONVERTER
4
COMPARATOR
X0
51
H1
78K/0
CPU
CORE
INTERNAL
HIGH-SPEED
RAM
FLASH
MEMORY
PORT 0
PORT 2
PORT 3
PORT 6
PORT 12
POWER ON CLEAR/
LOW VOLTAGE
INDICATOR
RESET CONTROL
ON-CHIP DEBUG
SYSTEM
CONTROL
INTERNAL
HIGH-SPEED
OSCILLATOR
VOLTAGE
REGULATOR
2
P00, P01
4
P20-P23
P30
2
P60, P61
2
P121, P122
POC/LVI
CONTROL
TOOLC0/X1
TOOLD0/X2
RESET
X1/P121
X2/EXCLK/P122
REGC
RxD6/P61<LINSEL>
INTP0/P00
INTP1/P30
INTERRUPT
CONTROL
V
V
SS
DD
Cautions 1. VSS functions alternately as the ground potential of the A/D converter. Be sure to connect VSS to
a stabilized GND (= 0 V).
2. Connect the REGC pin to V
SS via a capacitor (0.47 to 1
μ
F).
3. ANI0/P20, ANI1/P21, ANI2/P22, and ANI3/P23/CMP2+ are set in the analog input mode after
release of reset.
R01UH0068EJ0203 Rev.2.03 22
Jun 29, 2012
78K0/Fx2-L CHAPTER 1 OUTLINE
1.4.2 78K0/FA2-L (20 pins)
TOX00/P31
TOX01/P32
16-bit TIMER
X0
PORT 0
2
P00, P01
TO00/TI010/P01
RxD6/P61<LINSEL>
INTP1/P30, INTP2/P31, INTP3/P32
TI000/P00
TI51/P30
TOH1/P30
RxD6/P61
TxD6/P60
SDAA0/P61
SCLA0/P60
AV
REF
ANI0/P20-ANI5/P25
CMP+/P24,
CMP1+/P25,
CMP2+/P23
RxD6/P61<LINSEL>
INTP0/P00
6
3
3
16-bit TIMER/
EVENT COUNTER 00
8-bit TIMER
8-bit TIMER
LOW-SPEED
OSCILLATOR
WATCHDOG TIMER
SERIAL
INTERFACE UART6
SERIAL
INTERFACE IICA
A/D CONVERTER
COMPARATOR
INTERRUPT
CONTROL
51
H1
INTERNAL
LINSEL
78K/0
CPU
CORE
INTERNAL
HIGH-SPEED
RAM
V
DD
FLASH
MEMORY
V
SS
PORT 2
PORT 3
PORT 6
PORT 12
POWER ON CLEAR/
LOW VOLTAGE
INDICATOR
RESET CONTROL
ON-CHIP DEBUG
SYSTEM
CONTROL
INTERNAL
HIGH-SPEED
OSCILLATOR
VOLTAGE
REGULATOR
6
P20-P25
3
P30-P32
2
P60, P61
2
P121, P122
POC/LVI
CONTROL
TOOLC0/X1, TOOLC1/P31
TOOLD0/X2, TOOLD1/P32
RESET
X1/P121
X2/EXCLK/P122
REGC
Cautions 1. V
SS functions alternately as the ground potential of the A/D converter. Be sure to connect VSS to
a stabilized GND (= 0 V).
2. Connect the REGC pin to V
SS via a capacitor (0.47 to 1
μ
F).
3. ANI0/P20, ANI1/P21, ANI2/P22, ANI3/P23/CMP2+, ANI4/P24/CMP0+, and ANI5/P25/CMP1+ are set in
the analog input mode after release of reset.
R01UH0068EJ0203 Rev.2.03 23
Jun 29, 2012
78K0/Fx2-L CHAPTER 1 OUTLINE
1.4.3 78K0/FB2-L (30 pins)
TOX00/P31
TOX01/P32
16-bit TIMER
X0
PORT 0
3
P00 to P02
TOX10/P33
TOX11/P34
TO00/TI010/P01
<TI000>/P121
TI000/P00
RxD6/P61 (LINSEL)
TI51/P30
TOH1/P30
RxD6/P61
TxD6/P60
SDAA0/P61
SCLA0/P60
SCK11/P35
SI11/P36
SO11/P37
SSI11/P02
AV
AV
ANI0/P20 to ANI7/P27
ANI8/P70
CMP0+/P24,
CMP1+/P25,
CMP2+/P23
CMPCOM/P26
REF
16-bit TIMER
16-bit TIMER/
EVENT COUNTER 00
8-bit TIMER/
EVENT COUNTER 51
8-bit TIMER
LOW-SPEED
OSCILLATOR
WATCHDOG TIMER
SERIAL
INTERFACE UART6
SERIAL
INTERFACE IICA
SERIAL
INTERFACE CSI11
SS
A/D CONVERTER
8
3
COMPARATOR
INTERNAL
LINSEL
X1
H1
78K/0
CPU
CORE
INTERNAL
HIGH-SPEED
RAM
FLASH
MEMORY
PORT 2
PORT 3
PORT 6
PORT 7
PORT 12
POWER ON CLEAR/
LOW VOLTAGE
INDICATOR
RESET CONTROL
ON-CHIP DEBUG
SYSTEM
CONTROL
INTERNAL
HIGH-SPEED
OSCILLATOR
VOLTAGE
REGULATOR
8
P20 to P27
8
P30 to P37
2
P60, P61
P70
2
P121, P122
POC/LVI
CONTROL
TOOLC0/X1, TOOLC1/P31
TOOLD0/X2, TOOLD1/P32
RESET
X1/P121
X2/EXCLK/P122
REGC
TxD6/P60 (LINSEL)
INTP0/P00
INTP1/P30 to INTP3/P32,
<INTP0>/P121
INTP4/P34, INTP5/P02
5
INTERRUPT
CONTROL
V
SS
V
DD
Cautions 1. Connect the REGC pin to V
SS via a capacitor (0.47 to 1
μ
F).
2. ANI0/P20, ANI1/P21, ANI2/P22, ANI3/P23/CMP2+, ANI4/P24/CMP0+, ANI5/P25/CMP1+,
ANI6/P26/CMPCOM, ANI7/P27, and ANI8/P70 are set in the analog input mode after release of
reset.
Remark Functions in angle brackets < > can be assigned by setting the input switch control register (MUXSEL).
R01UH0068EJ0203 Rev.2.03 24
Jun 29, 2012
78K0/Fx2-L CHAPTER 1 OUTLINE
1.5 Outline of Functions
(1/2)
78K0/FY2-L 78K0/FA2-L 78K0/FB2-L Item
16 pins 20 pins 30 pins
Internal
memory
Memory space
General-purpose registers
Instruction set
I/O ports
Flash memory
4 KB to 16 KB 8 KB and 16 KB
(self-programming
supported)
High-Speed RAM
384 bytes to 768 bytes 512 bytes and 768 bytes
64 KB
High-speed system
(crystal/ceramic
oscillation, external
clock input)
Main
Internal high-
Clock
speed oscillation
Internal low-speed
2 to 20 MHz
2 to 5 MHz: V
4 MHz ±2% (T
to +85°C): V
30 kHz (TYP.): V
Note 1
: VDD = 4.0 to 5.5 V, 2 to 10 MHz: VDD = 2.7 to 5.5 V, or
• Internal reset by low-voltage detector (LVI)
Provided
(A) grade products: TA = –40 to +85°C, (A2) grade products: TA = −40 to +125°C
16-pin plastic SSOP
(5.72 mm (225))
20-pin plastic SSOP
(7.62 mm (300))
30-pin plastic SSOP
(7.62 mm (300))
R01UH0068EJ0203 Rev.2.03 26
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
CHAPTER 2 PIN FUNCTIONS
2.1 Pin Function List
There are two types of pin I/O buffer power supplies: AV
and the pins is shown below.
Table 2-1. Pin I/O Buffer Power Supplies
Power Supply Corresponding Pins
AVREF
VDD
P20 to P27, P70
Pins other than P20 to P27, P70
Note 78K0/FY2-L: P20 to P23
78K0/FA2-L: P20 to P25
78K0/FB2-L: P20 to P27, P70
REF and VDD. The relationship between these power supplies
Note
Note
R01UH0068EJ0203 Rev.2.03 27
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
2.1.1 78K0/FY2-L
(1) Port functions: 78K0/FY2-L
Function Name I/O Function After Reset Alternate Function
P00 TI000/INTP0
P01
P20 ANI0
P21 ANI1
P22 ANI2
P23
P30 I/O
P60 SCLA0/TxD6
P61
P121 X1/TOOLC0
P122
I/O
I/O
I/O
Input
Port 0.
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 2.
4-bit I/O port.
Input/output can be specified in 1-bit units.
Port 3.
1-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 6.
2-bit I/O port.
Input/output can be specified in 1-bit units.
Input can be set to SMBus input buffer in 1-bit units.
Output can be set to N-ch open-drain output (V
tolerance).
Use of an on-chip pull-up resistor can be specified by a
software setting.
Port 12.
2-bit input-only port.
DD
Input port
TO00/TI010
Analog input
ANI3/CMP2+
Input port TOH1/TI51/INTP1
Input port
SDAA0/RxD6
Input port
X2/EXCLK/TOOLD0
R01UH0068EJ0203 Rev.2.03 28
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
(2) Non-port functions: 78K0/FY2-L
Function Name I/O Function After Reset Alternate Function
ANI0 P20
ANI1 P21
RESET Input System reset input Reset Input
RxD6 Input Serial data input to UART6 P61/SDAA0
TxD6 Output
SCLA0 Clock input/output for I2C P60/TxD6
SDAA0
TI000 External count clock input to 16-bit timer/event counter
TI010
TI51 Input External count clock input to 8-bit timer/event counter 51Input port P30/TOH1/INTP1
TO00 Output 16-bit timer/event counter 00 output Input port P01/TI010
TOH1 Output 8-bit timer H1 output Input port P30/TI51/INTP1
X1 P121/TOOLC0
X2
EXCLK Input External clock input for main system clock Input port P122/X2/TOOLD0
VDDPositive power supply for pins other than port 2
AVREF
VSS
TOOLC0 Input Clock input for flash memory programmer/on-chip
TOOLD0 I/O Data I/O for flash memory programmer/on-chip debugger
Input A/D converter analog input Analog input
Input
I/O
Input
External interrupt request input for which the valid edge
(rising edge, falling edge, or both rising and falling
edges) can be specified
Port 0.
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 2.
6-bit I/O port.
Input/output can be specified in 1-bit units.
Port 3.
3-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 6.
2-bit I/O port.
Input/output can be specified in 1-bit units.
Input can be set to SMBus input buffer in 1-bit units.
Output can be set to N-ch open-drain output (V
tolerance).
Use of an on-chip pull-up resistor can be specified by a
software setting.
Port 12.
2-bit input-only port.
DD
Input port
TO00/TI010
Analog input
ANI5/CMP1+
Input port
TOOLC1
TOX01/INTP3/
TOOLD1
Input port
SDAA0/RxD6
Input port
X2/EXCLK/TOOLD0
Function Name I/O Function After Reset Alternate Function
ANI0 P20
ANI1 P21
ANI2 P22
ANI3 P23
ANI4 P24
ANI5
Input A/D converter analog input Analog input
P25
R01UH0068EJ0203 Rev.2.03 30
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
(2) Non-port functions : 78K0/FA2-L (2/2)
Function Name I/O Function After Reset Alternate Function
CMP0+ P24/ANI4
CMP1+ P25/ANI5
CMP2+
INTP0 P00/TI000
INTP1 P30/TOH1/TI51
INTP2 P31/TOOLC1
INTP3
REGC
RESET Input System reset input Reset Input
RxD6 Input Serial data input to UART6 P61/SDAA0
TxD6 Output Serial data output from UART6
SCLA0 Clock input/output for I2C P60/TxD6
SDAA0
TI000 External count clock input to 16-bit timer/event counter
TI010
TI51 Input External count clock input to 8-bit timer/event counter 51Input port P30/TOH1/INTP1
TO00 Output 16-bit timer/event counter 00 output Input port
TOH1 Output 8-bit timer H1 output Input port P30/TI51/INTP1
TOX00 P31/INTP2/TOOLC1
TOX01
X1 P121/TOOLC0
X2
EXCLK Input External clock input for main system clock Input port P122/X2/TOOLD0
VDDPositive power supply for pins other than port 2
AVREF
Remark Functions in angle brackets < > can be assigned by setting the input switch control register (MUXSEL).
Port 0.
3-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 2.
8-bit I/O port.
Input/output can be specified in 1-bit units.
Port 3.
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.
Port 6.
2-bit I/O port.
Input/output can be specified in 1-bit units.
Input can be set to SMBus input buffer in 1-bit units.
Output can be set to N-ch open-drain output (V
tolerance).
Use of an on-chip pull-up resistor can be specified by a
software setting.
Port 7.
1-bit I/O port.
Input/output can be specified in 1-bit units.
Port 12.
2-bit input port.
DD
Input port
SSI11/INTP5
Analog input
ANI7
Input port
SO11
Input port
SDAA0/RxD6
Analog input ANI8
Input port
X1/TOOLC0/
<TI000>/<INTP0>
X2/EXCLK/TOOLD0
R01UH0068EJ0203 Rev.2.03 32
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
(2) Non-port functions : 78K0/FB2-L (1/2)
Function Name I/O Function After Reset Alternate Function
ANI0 P20
ANI1 P21
ANI2 P22
ANI3 P23/CMP2+
ANI4 P24/CMP0+
ANI5 P25/CMP1+
ANI6 P26/CMPCOM
ANI7 P27
ANI8
CMP0+ P24/ANI4
CMP1+ P25/ANI5
CMP2+
CMPCOM Input Comparator common input Analog input P26/ANI6
RESET Input System reset input Reset input
RxD6 Input Serial data input to UART6 P61/SDAA0
TxD6 Output Serial data output from UART6
SCLA0 Clock input/output for I2C P60/TxD6
SDAA0
Remark Functions in angle brackets < > can be assigned by setting the input switch control register (MUXSEL).
Input A/D converter analog input Analog input
Input Comparator input Analog input
Input
I/O
External interrupt request input for which the valid edge
(rising edge, falling edge, or both rising and falling
edges) can be specified
−
capacitance for internal operation.
Connect to V
Serial data I/O for I2C
SS via a capacitor (0.47 to 1
Input port
− −
μ
F).
Input port
Input port
P70
P23/ANI3
P00/TI000 INTP0
P121/X1/TOOLC0/
<TI000>
P02/SSI11
−
P60/SCLA0
P61/RxD6
R01UH0068EJ0203 Rev.2.03 33
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
(2) Non-port functions : 78K0/FB2-L (2/2)
Function Name I/O Function After Reset Alternate Function
SCK11 I/O Clock input/output for CSI11 P35
SI11 Input Serial data input to CSI11 P36
SO11 Output Serial data output from CSI11
SSI11 Input Chip select input to CSI11 Input port P02/INTP5
Input
00
Capture trigger input to capture registers (CR000,
CR010) of 16-bit timer/event counter 00
TI010
TI51 Input External count clock input to 8-bit timer/event counter 51Input port P30/TOH1/INTP1
TO00 Output 16-bit timer/event counter 00 output Input port P01/TI010
TOH1 Output 8-bit timer H1 output Input port P30/TI51/INTP1
TOX00 P31/INTP2/TOOLC1
TOX01
TOX10 P33
TOX11
X1 P121/TOOLC0/
X2
EXCLK Input External clock input for main system clock Input port P122/X2/TOOLD0
VDDPositive power supply for pins other than ports 2, 7
AVREF
VSSGround potential for pins other than ports 2, 7
AVSS
TOOLC0 P121/X1/<TI000>/
TOOLC1
TOOLD0 P122/X2/EXCLK
TOOLD1
Output
Input Clock input for flash memory programmer/on-chip
I/O Data I/O for flash memory programmer/on-chip debugger
Capture trigger input to capture register (CR000) of 16bit timer/event counter 00
16-bit timer X0 output
16-bit timer X1 output
Connecting resonator for main system clock Input port
−
−
A/D converter reference voltage input and positive power
supply for ports 2, 7 and A/D converter
−
Ground potential for ports 2, 7 and A/D converter
debugger
Remark Functions in angle brackets < > can be assigned by setting the input switch control register (MUXSEL).
The following operation modes can be specified in 1-bit units.
(1) Port mode
P00 to P02 function as an I/O port. P00 to P02 can be set to input or output port 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 P02 function as timer I/O, external interrupt request input, and chip select input.
(a) TI000
This is the pin for inputting an external count clock to 16-bit timer/event counter 00 and is also for inputting a
capture trigger signal to the capture registers (CR000, CR010) of 16-bit timer/event counter 00.
(b) TI010
This is the pin for inputting a capture trigger signal to the capture register (CR000) of 16-bit timer/event counter
00.
(c) TO00
This is a timer output pin of 16-bit timer/event counter 00.
(d) INTP0, INTP5
These are external interrupt request input pins for which the valid edge (rising e dge, falling edge, or both rising
and falling edges) can be specified.
(e) SSI11
This is a chip select input pin of serial interface CSI11.
P02/SSI11/INTP5
R01UH0068EJ0203 Rev.2.03 35
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
2.2.2 P20 to P27 (port 2)
P20 to P27 function as an I/O port. These pins also function as pins for A/D converter analog input and c omparator
The following operation modes can be specified in 1-bit units.
(1) Port mode
P20 to P27 function as an I/O port. P20 to P27 can be set to input or output port in 1-bit units using port mode
register 2 (PM2).
(2) Control mode
P20 to P27 function as A/D converter analog input and comparator input.
(a) ANI0 to ANI7
These are A/D converter analog input pins. When using these pins as analog input pins, refer to (5) ANI0/P20
to ANI7/P27 and ANI8/P10 to ANI10/P12 in 11.6 Cautions for A/D Converter.
(b) CMP0+ to CMP2+
These are comparator input pins.
(c) CMPCOM
This is a comparator common input pin.
Caution ANI0/P20 to ANI7/P27 are set in the analog input mode after release of reset.
The following operation modes can be specified in 1-bit units.
(1) Port mode
P30 to P37 function as an I/O port. P30 to P37 can be set to input or output port 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 P37 function as external interrupt request input, timer I/O, clock input and data I/O for flash memory
programmer/on-chip debugger, and clock input for serial interface.
(a) INTP1 to INTP4
These are the external interrupt request input pins for which the valid edge (rising edge, falling 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 from 8-bit timer/event counter 51.
(d) TOH1
This is the timer output pin of 8-bit timer H1.
(e) TOX00, TOX01
These are the timer output pins of 16-bit timer X0.
(f) TOX10, TOX11
These are the timer output pins of 16-bit timer X1.
(g) TOOLC1
This is the clock input pin for flash memory programmer/on-chip debugger.
(h) TOOLD1
This is the data I/O pin for flash memory programmer/on-chip debugger.
This is a serial clock I/O pin of serial interface CSI11.
(j) SI11
This is a serial data input pin of serial interface CSI11.
(k) SO11
This is a serial data output pin of serial interface CSI11.
Remark For how to connect a flash memory programmer using T OOLC1/P31, TOOLD1/P32, ref er to CH APTER 24
FLASH MEMORY. For how to connect TOOLC1/P31, TOOLD1/P32 and an on-chip debug emulator, refer
to CHAPTER 25 ON-CHIP DEBUG FUNCTION.
R01UH0068EJ0203 Rev.2.03 38
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
2.2.4 P60 and P61 (port 6)
P60 and P61 function as an I/O port. These pins also function as pins for serial interface data I/O and clock I/O.
Input to the P60 and P61 pins can be specified through a normal input buffer or an SMBus input buffer in 1-bit units ,
using port input mode register 6 (PIM6).
Output from the P60 and P61 pins can be specified as normal CMOS output or N-ch open-drain output (V
in 1-bit units, using port output mode register 6 (POM6).
The following operation modes can be specified in 1-bit units.
(1) Port mode
P60 and P61 function as an I/O port. P60 and P61 can be set to input port or output port in 1-bit units using port
mode register 6 (PM6). Use of an on-chip pull-up resistor can be specified by pull-up resistor option register 6 (PU6).
(2) Control mode
P60 and P61 function as serial interface data I/O and clock I/O.
(a) SDAA0
This is a serial data I/O pin for serial interface IICA.
(b) SCLA0
This is a serial clock I/O pin for serial interface IICA.
(c) RxD6
This is a serial data input pin for serial interface UART6.
(d) TxD6
This is a serial data output pin for serial interface UART6.
DD tolerance)
R01UH0068EJ0203 Rev.2.03 39
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
2.2.5 P70 (port 7)
P70 functions as an I/O port. This pin also functions as the pin for A/D converter analog input.
The following operation modes can be specified in 1-bit units.
(1) Port mode
P70 functions as an I/O port. P70 can be set to input or output port in 1-bit units using port mode register 7 (PM7).
(2) Control mode
P70 functions as A/D converter analog input.
(a) ANI8
This is an A/D converter analog input pin. When using this pin as analog input pin, refer to (5) ANI0/P20 to
ANI7/P27 and ANI8/P70 in 11.6 Cautions for A/D Converter.
Cautions 1. ANI8/P70 is set in the analog input mode after release of reset.
2. Make the AV
REF pin the same potential as the VDD pin when ANI8 is used.
2.2.6 P121 and P122 (port 12)
P121 and P122 function as an input port. These pins also function as pins for external interrupt request input,
connecting resonator for main system clock, external clock input for main system clock, timer input, and clock input and
data I/O for flash memory programmer/on-chip debugger.
Remark Functions in angle brackets < > can be assigned by setting the input switch control register (MUXSEL).
The following operation modes can be specified in 1-bit units.
P70/ANI8
R01UH0068EJ0203 Rev.2.03 40
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
(1) Port mode
P121 and P122 function as an input port.
(2) Control mode
P121 and P122 function as pins for external interrupt request input, connecting resonator for main system clock,
external clock input for main system clock, timer input, and clock input and data I/O for flash memory programmer/onchip debugger.
(a) INTP0
This functions as an external interrupt request input (INTP0) for which the valid edge (rising e dge, falling edge, or
both rising and falling edges) can be specified.
(b) X1, X2
These are the pins for connecting a resonator for main system clock.
(c) EXCLK
This is an external clock input pin for main system clock.
(d) TI000
This is the pin for inputting an external count clock to 16-bit timer/event counter 00 and is also for inputting a
capture trigger signal to the capture registers (CR000, CR010) of 16-bit timer/event counter 00.
(e) TOOLC0
This is the clock input pin for flash memory programmer/on-chip debugger.
(f) TOOLD0
This is the data I/O pin for flash memory programmer/on-chip debugger.
Remark For how to connect a flash memory programmer usin g TOOLC0/X1, TOOLD0/X2, refer to CHAPTER 24
FLASH MEMORY. For how to connect TOOLC0/X1, TOOLD0/X2 and an on-chip debug emulator, refer to
CHAPTER 25 ON-CHIP DEBUG FUNCTION.
This is the A/D converter reference voltage input pin and the positive power supply pin of port 2 and A/D
converter.
When the A/D converter is not used, connect this pin directly to V
Note Make the AV
REF pin the same potential as the VDD pin when port 2 is used as a digital port.
(b) AV
SS
This is the ground potential pin of A/D converter and port 2. Even when the A/D conv erter is not used, always
use this pin with the same potential as the V
DD
(c) V
VDD is the positive power supply pin.
SS
(d) V
VSS is the ground potential pin
Note
Note In the 78K0/FY2-L and 78K0/FA2-L, V
Be sure to connect VSS to a stabilized GND (= 0 V).
This is the pin for connecting regulator output (2.0 V/2.4 V) stabilization capacitance for internal operation.
Connect this pin to V
SS via a capacitor (0.47 to 1
used to stabilize internal voltage.
SS pin.
.
SS functions alternately as the ground potential of the A/D converter.
μ
F). Also, use a capacitor with good characteristics, since it is
REGC
SS
V
Caution Keep the wiring length as short as possible for the broken-line part in the above figure.
R01UH0068EJ0203 Rev.2.03 42
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
2.3 Pin I/O Circuits and Recommended Connection of Unused Pins
Tables 2-2 to 2-4 show 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 (78K0/FY2-L)
Pin Name I/O Circuit Type I/O Recommended Connection of U nused Pins
P00/TI000/INTP0
P01/TO00/TI010
ANI0/P20
ANI1/P21
ANI2/P22
ANI3/P23/CMP2+
P30/TOH1/TI51/INTP1 5-AQ Input: Independently connect to VDD or VSS via a resistor.
P60/SCLA0/TxD6
P61/SDAA0/RxD6
P121/X1/TOOLC0
P122/X2/EXCLK/TOOLD0
2
RESET 2
AVREF
Note 1
5-AQ Input: Independently connect to V
11-G <Digital input setting>
5-AS
37-A
Notes 1,
− −
Notes 1. Use recommended connection above in input port mode (refer to Figure 5-2 Format of Clock Operation
Mode Select Register (OSCCTL)) when these pins are not used.
2. If operating in the standalone mode after writing to a load module file (extension: *.lnk or *.lmf) that has debugging information, pull up TOOLD0. Note that operation is not guaranteed in this environment.
3. If this pin is left open when specified as an analog i nput pin, the input volt age level might becom e undefined. It is therefore recommended to leave this pin open after specifying it as a digital output pin.
Caution ANI0/P20, ANI1/P21, ANI2/P22, and ANI3/P23/CMP2+ are set in the analog input mode after release of
reset.
I/O
Input
DD or VSS via a resistor.
Output: Leave open.
Independently connect to AV
<Analog output setting and digital input setting>
Leave open.
Output: Leave open.
Input: Independently connect to V
Output: Leave this pin open at low-level output after clearing
Independently connect to V
Connect directly to VDD or via a resistor.
Connect directly to VDD.
Note 3
the output latch of the port to 0.
REF or VSS via a resistor.
DD or VSS via a resistor.
DD or VSS via a resistor.
R01UH0068EJ0203 Rev.2.03 43
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
Table 2-3. Pin I/O Circuit Types (78K0/FA2-L)
Pin Name I/O Circuit Type I/O Recommended Connection of U nused Pins
P00/TI000/INTP0
5-AQ Input: Independently connect to V
P01/TO00/TI010
ANI0/P20
5-AQ Input: Independently connect to V
P31/INTP2/TOX00/TOOLC1
P32/TOH1/INTP3/TOX01/
TOOLD1
P60/SCLA0/TxD6
5-AS
P61/SDAA0/RxD6
P121/X1/TOOLC0
P122/X2/EXCLK/TOOLD0
2
Note 1
37-A Input
Notes 1,
RESET 42 Input Connect directly to VDD or via a resistor.
AVREF
− −
Notes 1. Use recommended connection above in input port mode (refer to Figure 5-2 Format of Clock Operation
Mode Select Register (OSCCTL)) when these pins are not used.
2. If operating in the standalone mode after writing to a load module file (extension: *.lnk or *.lmf) that has debugging information, pull up TOOLD0. Note that operation is not guaranteed in this environment.
3. If this pin is left open when specified as an analog i nput pin, the input volt age level might becom e undefined. It is therefore recommended to leave this pin open after specifying it as a digital output pin.
Caution ANI0/P20, ANI1/P21, ANI2/P22, ANI3/P23/CMP2+, ANI4/P24/CMP0+, and ANI5/P25/CMP1+ are set in the
analog input mode after release of reset.
I/O
DD or VSS via a resistor.
Output: Leave open.
Independently connect to AV
<Analog output setting and digital input setting>
Leave open.
Note 3
REF or VSS via a resistor.
DD or VSS via a resistor.
Output: Leave open.
Input: Independently connect to V
DD or VSS via a resistor.
Output: Leave this pin open at low-level output after clearing
the output latch of the port to 0.
Independently connect to V
DD or VSS via a resistor.
Connect directly to VDD.
R01UH0068EJ0203 Rev.2.03 44
Jun 29, 2012
78K0/Fx2-L CHAPTER 2 PIN FUNCTIONS
Table 2-4. Pin I/O Circuit Types (78K0/FB2-L)
Pin Name I/O Circuit Type I/O Recommended Connection of U nused Pins
P00/TI000/INTP0
5-AQ Input: Independently connect to V
P01/TO00/TI010
P02/SSI11/INTP5
ANI0/P20
5-AS Input: Independently connect to V
P61/SDAA0/RxD6
ANI8/P70
P121/X1/TOOLC0
<TI000>/<INTP0>
Note 1
/
P122/X2/EXCLK/TOOLD0
2
11-G
37-A Independently connect to V
Notes 1,
RESET 2
AVREF
AVSS
− −
− −
Notes 1. Use recommended connection above in input port mode (refer to Figure 5-2 Format of Clock Operation
Mode Select Register (OSCCTL)) when these pins are not used.
2. If operating in the standalone mode after writing to a load module file (extension: *.lnk or *.lmf) that has debugging information, pull up TOOLD0. Note that operation is not guaranteed in this environment.
3. If this pin is left open when specified as an analog i nput pin, the input volt age level might becom e undefined. It is therefore recommended to leave this pin open after specifying it as a digital output pin.
Notes 1. When boot swap is not used: Set the option bytes to 0080H to 0084H, a nd the on-chip debug security IDs
to 0085H to 008EH.
When boot swap is used: Set the option bytes to 0080H to 0084H and 1080H to 1084H, and the on-chip
debug security IDs to 0085H to 008EH and 1085H to 108EH.
2. Writing boot cluster 0 can be prohibited depending on the setting of security (refer to 24.6 Security
Settings).
Remark The flash memory is divided into blocks (one block = 1 KB). For the address value s and block numbers,
refer to Table 3-2 Correspondence Between Address Values and Block Numbers in Flash Memory.
3FFFH
3C00H
3BFFH
Block 0FH
3FFFH
108FH
108EH
1085H
1084H
1080H
107FH
1000H
0FFFH
0800H
07FFH
008FH
008EH
0085H
0084H
0080H
007FH
0040H
003FH
0000H
Program area
On-chip debug security
ID setting area
10 × 8 bits
Option byte area
Program area
CALLF entry area
2048 × 8 bits
Program area
1905 × 8 bits
On-chip debug security
ID setting area
10 × 8 bits
Option byte area
CALLT table area
64 × 8 bits
Vector table area
64 × 8 bits
Note 1
Note 1
5 × 8 bits
Note 1
Note 1
5 × 8 bits
1FFFH
Boot cluster 1
Boot cluster 0
Note 2
0800H
07FFH
0400H
03FFH
0000H
Block 01H
Block 00H
1 KB
R01UH0068EJ0203 Rev.2.03 50
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
Correspondence between the address values and block numbers in the flash memory are shown below.
Table 3-2. Correspondence Between Address Values and Block Numbers in Flash Memory
Address Value Block Number
0000H to 03FFH 00H
0400H to 07FFH 01H
0800H to 0BFFH 02H
0C00H to 0FFFH 03H
1000H to 13FFH 04H
1400H to 17FFH 05H
1800H to 1BFFH 06H
1C00H to 1FFFH 07H
2000H to 23FFH 08H
2400H to 27FFH 09H
2800H to 2BFFH 0AH
2C00H to 2FFFH 0BH
3000H to 33FFH 0CH
3400H to 37FFH 0DH
3800H to 3BFFH 0EH
3C00H to 3FFFH 0FH
Remark
3.1.1 Internal program memory space
The internal program memory
counter (PC).
78K0/Fx2-L microcontrollers incorporate internal ROM (flash memory), as shown below.
μ
PD78F0854, 78F0857: Block numbers 00H to 03H
μ
PD78F0855, 78F0858, 78F0864: Block numbers 00H to 07H
μ
PD78F0856, 78F0859, 78F0865: Block numbers 00H to 0FH
space stores the program and table data. Normally, it is address ed with the program
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 st art addresses for branch upon
reset 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.
The 64-byte area 0040H to 007FH can store the subroutine entry address of a 1-byte call instruction (CALLT).
(3) Option byte area
A 5-byte area of 0080H to 0084H and 1080H to 1084H c an be used as an option byte area. Set the option byte at
0080H to 0084H when the boot swap is not used, and at 0080H to 0084H and 1080H to 1084H when the boot swap is
used. For details, refer to CHAPTER 23 OPTION BYTE.
(4) On-chip debug security ID setting area
A 10-byte area of 0085H to 008EH and 1085H to 108EH can be used as an on-chip debug security ID setting area.
Set the on-chip debug security ID of 10 bytes at 0085H to 008EH when the boot swap is not used and at 0085H to
008EH and 1085H to 108EH when the boot swap is used. For details, refer to CHAPTER 25 ON-CHIP DEBUG
FUNCTION.
(5) 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
x2-L microcontrollers i
78K0/F
(1) Internal high-speed RAM
ncorporate the following RAMs.
Table 3-5. Internal High-Speed RAM Capacity
Product
78K0/FY2-L 78K0/FA2-L 78K0/FB2-L
μ
PD78F0854
μ
PD78F0855
μ
PD78F0856
μ
PD78F0857
μ
PD78F0858
μ
PD78F0859
−
μ
PD78F0864
μ
PD78F0865
Internal High-Speed
RAM
384 × 8 bits
(FD80H to FEFFH)
512 × 8 bits
(FD00H to FEFFH)
768 × 8 bits
(FC00H to FEFFH)
The 32-byte area FEE0H to FEFFH is assigned to four general-purpose register banks consisting of eight 8-bit
registers per 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.
3.1.3 Special function register (SFR) area
On
-chip periphe
ral 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 (SF Rs)).
Caution Do not access addresses to which SFRs are not assigned.
R01UH0068EJ0203 Rev.2.03 53
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
3.1.4 Data memory addressing
Addressing refers to the method of specifying the address of the instruction to be execu ted next or the address of the
register or memory relevant to the execution of instructions.
Several addressing modes are provided for addressing the memor y relevant to the execution of instructions for the
78K0/Fx2-L microcontrollers, based on operability and other considerations. For areas containing data memory in
particular, special addressing methods designed for the functions of special function registers (SFR) and general- purpose
registers are available for use. Figures 3-4 to 3-6 show correspondence bet ween data memory and addressing. For
details of each addressing mode, refer to 3.4 Operand Address Addressing.
Figure 3-4. Correspondence Between Data Memory and Addressing
(
μ
PD78F0854, 78F0857)
FFFFH
FF20H
FF1FH
FF00H
FEFFH
FEE0H
FEDFH
Special function registers
(SFR)
256 × 8 bits
General-purpose
registers
32 × 8 bits
SFR addressing
Register addressing
Short direct
addressing
FE20H
FE1FH
FD80H
FD7FH
1000H
0FFFH
0000H
Internal high-speed RAM
384 × 8 bits
Direct addressing
Register indirect addressing
Based addressing
Based indexed addressing
Reserved
Flash memory
4096 × 8 bits
R01UH0068EJ0203 Rev.2.03 54
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
Figure 3-5. Correspondence Between Data Memory and Addressing
(μPD78F0855, 78F0858, 78F0864)
FFFFH
FF20H
FF1FH
FF00H
FEFFH
FEE0H
FEDFH
FE20H
FE1FH
FD00H
FCFFH
Special function registers
(SFR)
256 × 8 bits
General-purpose
registers
32 × 8 bits
Internal high-speed RAM
512 × 8 bits
SFR addressing
Register addressing
Short direct
addressing
Direct addressing
2000H
1FFFH
0000H
Register indirect addressing
Based addressing
Based indexed addressing
Reserved
Flash memory
8192 × 8 bits
R01UH0068EJ0203 Rev.2.03 55
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
Figure 3-6. Correspondence Between Data Memory and Addressing
(μPD78F0856, 78F0859, 78F0865)
FFFFH
FF20H
FF1FH
FF00H
FEFFH
FEE0H
FEDFH
FE20H
FE1FH
FC00H
FBFFH
Special function registers
(SFR)
256 × 8 bits
General-purpose
registers
32 × 8 bits
Internal high-speed RAM
768 × 8 bits
SFR addressing
Register addressing
Short direct
addressing
Direct addressing
Register indirect addressing
Based addressing
Based indexed addressing
Reserved
4000H
3FFFH
Flash memory
16384 × 8 bits
0000H
R01UH0068EJ0203 Rev.2.03 56
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
3.2 Processor Registers
The 78K0/Fx2-L microcontrollers incorporate the following processor registers.
3.2.1 Control registers
T
he 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, PC is automatically incremented according to the number of bytes of the instruction to be fetched.
When a branch instruction is executed, immediate data and register contents are set.
Reset signal generation sets the reset vector table values at addresses 0000H and 0001H to the program counter.
Figure 3-7. Format of Program Counter
15
PC15 PC14PC13PC12 PC11PC10
PC
PC9 PC8 PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0
(2) Program status word (PSW)
The program status word is an 8-bit register consisting of various flags set/reset by instruction execution.
Program status word contents are stored in the stack area upon vectored interrupt request acknowledge or PUSH
PSW instruction execution and are restored upon execution of the RETB, RETI and POP PSW instructions.
Reset signal generation sets PSW to 02H.
Figure 3-8. Format of Program Status Word
70
IEZRBS1ACRBS0ISPCY
0PSW
(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.
When 1, the IE flag is set to the interrupt enabled (EI) state and interrupt request acknowledgment is controlled
with an in-service priority flag (ISP), an interrupt mask flag for various interrupt sources, and a priority
specification flag.
The IE flag is reset (0) upon DI instruction execution or interrupt acknowledgment and is set (1) upon EI
instruction execution.
(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 e xecution is
stored.
0
R01UH0068EJ0203 Rev.2.03 57
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
(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 in terrupts. When this flag is 0, low-level
vectored interrupt requests specified by a priority specification flag regist er (PR0L, PR0H, PR1L, PR1H) (refer to
17.3 (3) Priority specification flag registers (PR0L, PR0H, PR1L, PR1H)) can not be acknowledged. Actual
request acknowledgment 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 shift-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.
Figure 3-9. Format of Stack Pointer
15
SP15 SP14 SP13 SP12 SP11 SP10
SP
SP9 SP8 SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0
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-10 and 3-11.
Caution Since reset signal generation makes the SP contents undefined, be sure to initialize the SP before
Figure 3-11. 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
R01UH0068EJ0203 Rev.2.03 60
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
3.2.2 General-purpose registers
General-purpose registers are mapped at particular addresses (F EE0H to FEFFH) of the data memory. The generalpurpose 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 (A X,
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 set by the CPU co ntrol instruction (SEL RBn). B ecaus e of the 4register 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-12. Configuration of General-Purpose Registers
(a) Function name
16-bit processing8-bit processing
FEFFH
Register bank 0
FEF8H
Register bank 1
FEF0H
Register bank 2
FEE8H
Register bank 3
FEE0H
15070
HL
DE
BC
AX
(b) Absolute name
16-bit processing8-bit processing
FEFFH
Register bank 0
FEF8H
Register bank 1
FEF0H
Register bank 2
FEE8H
Register bank 3
FEE0H
15070
RP3
RP2
RP1
RP0
H
L
D
E
B
C
A
X
R7
R6
R5
R4
R3
R2
R1
R0
R01UH0068EJ0203 Rev.2.03 61
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
3.2.3 Special function registers (SFRs)
Unlike a general-purpose register, each special function register 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 reserv ed 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 reserv ed 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 reserv ed 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 indicating the address of a special function register. It is a reserved word in the RA78K0, and is defined as
an sfr variable using the #pragma sfr directive in the CC78K0. When using the RA78K0, ID78K0-QB, and system
simulator, 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
• Manipul atable bit units
Indicates the manipulatabl e bit unit (1, 8, or 16). “−” indicates a bit unit for which manipulation is not possible.
• After reset
Indicates each register status upon reset signal generation.
R01UH0068EJ0203 Rev.2.03 62
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
Table 3-6. Special Function Register List (1/5)
After
Reset
00H
00H
00H
00H
00H
00H
FFH
FFH
00H
00H
00H
00H
00H
00H
00H
00H
00H
FFH
FFH
FFH
FFH
FFH
00H
00H
00H
FY
2-L FA2-LFB2-L
√ √√
√ √√
√ √√
√ √√
− −√
√ √√
√ √√
√ √√
√ √√
√ √√
√ √√
√ √√
− −√
√ √√
√ √√
√ √√
√ √√
√ √√
− −√
− −√
√ √√
√ √√
√ √√
√ √√
√ √√
√ √√
√ √√
− −√
√ √√
√ √√
√ √√
FF00H Port register 0 P0 R/W
FF02H Port register 2 P2 R/W
FF03H Port register 3 P3 R/W
FF06H Port register 6 P6 R/W
FF07H Port register 7 P7 R/W
FF08H 10-bit 8-bit A/D conversion result register L ADCRL R
FF09H A/D conversion result register ADCR R
FF0AH Receive buffer register 6 RXB6 R
FF0BH Transmit buffer register 6 TXB6 R/W
FF0CH Port register 12 P12 R/W
FF0DH 8-bit A/D conversion result register ADCRH R
FF0EH Analog input channel specification register ADS R/W
FF0FH Serial I/O shift register 11 SIO11 R
FF10H
FF11H
FF12H
FF13H
FF14H
FF15H
FF16H
FF17H
FF18H
FF19H
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
FF22H Port mode register 2 PM2 R/W
FF23H Port mode register 3 PM3 R/W
FF26H Port mode register 6 PM6 R/W
FF27H Port mode register 7 PM7 R/W
FF28H A/D converter mode register 0 ADM0 R/W
FF2AH Port output mode register 6 POM6 R/W
FF2BH Self programming mode select register FPCTL R/W
Notes 1. The reset values of LVIM and LVIS vary depending on the reset source.
2. Reset signal generation makes the setting of the ROM area undefined. Therefore, set the value
corresponding to each product as indicated below after release of reset.
An instruction address is determined by contents of the program counter (PC) and is normall y incr eme nt ed (+1 for eac h
byte) automatically according to the number of bytes of an instruction to be fetched each time another instruction is
executed. When a branch instruction is executed, the branch destination information is set to PC and br anched by the
following addressing (for details of instructions, refer to the 78K/0 Series Instructions User’s Manual (U12326E)).
3.3.1 Relative addressing
[Func
tion]
The value obtained
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 o f the foll o wing instruction t o
the −128 to +127 range.
This function is carried out when the BR $addr16 instruction or a conditional branch instruction is executed.
[Illustration]
150
150
by adding 8-bit immediate data (displacement value: j disp8) of an instruction code to the start
PC indicates the start address
PC
+
876
...
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
R01UH0068EJ0203 Rev.2.03 68
Jun 29, 2012
78K0/Fx2-L 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
PC
87
70
643
10–8
fa
150
00001
CALLF
fa
7–0
11 10
87
R01UH0068EJ0203 Rev.2.03 69
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
3.3.3 Table indirect addressing
[Function]
Table contents (branch destination address) of the particul ar 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 that is indicated by addr5 and is stored in the memory table from 0040H to
007FH, and allows branching to the entire memory space.
[Illustration]
Operation code
151
addr5
01
00000000
76510
ta
4–0
650
111
ta
4–0
0
Effective address
Effective address+1
151
01
00000000
Memory (Table)
70
Low Addr.
High Addr.
150
PC
87
87
650
... The value of the effective address is
0
the same as that of addr5.
R01UH0068EJ0203 Rev.2.03 70
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
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
rp
150
PC
AX
87
3.4 Operand Address Addressing
The following methods are available to specify the register and memory (addressin g) to undergo manipulation during
instruction execution.
3.4.1 Implied addressing
tion]
[Func
The register that functions as an accumulat
(implicitly) addressed.
Of the 78K0/Fx2-L microcontroller 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 determined with an in struction, no particular operand format is
necessary.
[Description example]
In the case of MULU X
With an 8-bit × 8-bit multiply instruction, the product of the A register and X register is stored in AX. In this example,
the A and AX registers are specified by implied addressing.
or (A and AX) among the general-purpose registers is automatically
R01UH0068EJ0203 Rev.2.03 71
Jun 29, 2012
78K0/Fx2-L 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 of an operation code.
Register addressing is carried out when an instruction with the follo wing operand format is execute d. When an 8-bit
register is specified, one of the eight registers is specified with 3 bits in the operation code.
[Operand format]
IdentifierDescription
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 well 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 01100010
Register specify code
INCW DE; when selecting DE register pair as rp
Operation code 10000100
Register specify code
R01UH0068EJ0203 Rev.2.03 72
Jun 29, 2012
78K0/Fx2-L 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.
This addressing can be carried out for all of the memory spaces.
[Operand format]
IdentifierDescription
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
R01UH0068EJ0203 Rev.2.03 73
Jun 29, 2012
78K0/Fx2-L 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 hig h-speed 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 applie d is a part of the overall SFR area. Ports
that are frequently accessed in a program and compare and capture 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]
LB1 EQU 0FE30H ; Defines FE30H by LB1.
:
MOV LB1, A ; When LB1 indicates FE30H of the saddr area and the value of register A is transferred to that
address
Operation code 1 1110010 OP code
0 0110000 30H (saddr-offset)
[Illustration]
07
OP code
saddr-offset
Short direct memory
Effective address
15
1
111111
87
α
0
When 8-bit immediate data is 20H to FFH,
When 8-bit immediate data is 00H to 1FH,
α
α
= 0
= 1
R01UH0068EJ0203 Rev.2.03 74
Jun 29, 2012
78K0/Fx2-L 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 1 1110110 OP code
0 0100000 20H (sfr-offset)
[Illustration]
07
Effective address
OP code
sfr-offset
15
1
111111
87
1
SFR
0
R01UH0068EJ0203 Rev.2.03 75
Jun 29, 2012
78K0/Fx2-L CHAPTER 3 CPU ARCHITECTURE
3.4.6 Register indirect addressing
[Function]
Register pair contents specified by a register pair specify code in an instruction word and by a register bank select
flag (RBS0 and RBS1) serve as an operand address for addressing the memory.
This addressing can be carried out for all of the memory spaces.
[Operand format]
Identifier Description
[DE], [HL]
−
[Description example]
MOV A, [DE]; when selecting [DE] as register pair
Operation code 10000101
[Illustration]
1608D7
DE
The contents of the memory
addressed are transferred.
7 0
A
E
Memory
The memory address
07
specified with the
register pair DE
R01UH0068EJ0203 Rev.2.03 76
Jun 29, 2012
78K0/Fx2-L 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 address the
memory. Addition is performed by expanding the offset data as a positive number to 16 bits. A carry from the 16t h
bit is ignored.
This addressing can be carried out for all of 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
R01UH0068EJ0203 Rev.2.03 77
Jun 29, 2012
78K0/Fx2-L 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 the contents of the base register, that is,
the HL register pair in the register bank specified by the register bank select flag (RBS0 a nd RBS1), and the sum is
used to address the memory. Addition is performed by expanding 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 of the memory spaces.
[Operand format]
Identifier Description
[HL + B], [HL + C]
−
[Description example]
MOV A, [HL +B]; when 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
R01UH0068EJ0203 Rev.2.03 78
Jun 29, 2012
78K0/Fx2-L 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]
PUSH DE; when saving DE register
Operation code 10110101
[Illustration]
Memory07
SP
SP
FEE0H
FEDEH
FEE0H
FEDFH
FEDEH
D
E
R01UH0068EJ0203 Rev.2.03 79
Jun 29, 2012
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
CHAPTER 4 PORT FUNCTIONS
4.1 Port Functions
There are two types of pin I/O buffer power supplies: AV
and the pins is shown below.
Table 4-1. Pin I/O Buffer Power Supplies
Power Supply Corresponding Pins
AVREF
VDD
P20 to P27, P70
Pins other than P20 to P27, P70
Note 78K0/FY2-L: P20 to P23
78K0/FA2-L: P20 to P25
78K0/FB2-L: P20 to P27, P70
78K0/Fx2-L microcontrollers are provided with digital I/O ports, which enable variety of control operations. The
functions of each port are shown in Tables 4-2 to 4-4.
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.
REF and VDD. The relationship between these power supplies
Note
Note
R01UH0068EJ0203 Rev.2.03 80
Jun 29, 2012
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
Table 4-2. Port Functions (78K0/FY2-L)
Function Name I/O Function After Reset Alternate Function
P00 TI000/INTP0
P01
P20 ANI0
P21 ANI1
P22 ANI2
P23
P30 I/O
P60 SCLA0/TxD6
P61
P121 X1/TOOLC0
P122
I/O
I/O
I/O
Input
Port 0.
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 2.
4-bit I/O port.
Input/output can be specified in 1-bit units.
Port 3.
1-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 6.
2-bit I/O port.
Input/output can be specified in 1-bit units.
Input can be set to SMBus input buffer in 1-bit units.
Output can be set to N-ch open-drain output (V
tolerance).
Use of an on-chip pull-up resistor can be specified by a
software setting.
Port 12.
2-bit input-only port.
DD
Input port
TO00/TI010
Analog input
ANI3/CMP2+
Input port TOH1/TI51/INTP1
Input port
SDAA0/RxD6
Input port
X2/EXCLK/TOOLD0
R01UH0068EJ0203 Rev.2.03 81
Jun 29, 2012
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
Table 4-3. Port Functions (78K0/FA2-L)
Function Name I/O Function After Reset Alternate Function
P00 TI000/INTP0
P01
Port 0.
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 2.
6-bit I/O port.
Input/output can be specified in 1-bit units.
Port 3.
3-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 6.
2-bit I/O port.
Input/output can be specified in 1-bit units.
Input can be set to SMBus input buffer in 1-bit units.
Output can be set to N-ch open-drain output (V
tolerance).
Use of an on-chip pull-up resistor can be specified by a
software setting.
Port 12.
2-bit input-only port.
DD
Input port
TO00/TI010
Analog input
ANI5/CMP1+
Input port
TOX01/INTP3/TOOLD1
Input port
SDAA0/RxD6
Input port
X2/EXCLK/TOOLD0
R01UH0068EJ0203 Rev.2.03 82
Jun 29, 2012
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
Table 4-4. Port Functions (78K0/FB2-L)
Function Name I/O Function After Reset Alternate Function
P00 TI000/INTP0
P01 TO00/TI010
P02
Remark Functions in angle brackets < > can be assigned by setting the input switch control register (MUXSEL).
Port 0.
3-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 2.
8-bit I/O port.
Input/output can be specified in 1-bit units.
Port 3.
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.
Port 6.
2-bit I/O port.
Input/output can be specified in 1-bit units.
Input can be set to SMBus input buffer in 1-bit units.
Output can be set to N-ch open-drain output (V
tolerance).
Use of an on-chip pull-up resistor can be specified by a
software setting.
Port 7.
1-bit I/O port.
Input/output can be specified in 1-bit units.
Port 12.
2-bit input port.
DD
Input port
SSI11/INTP5
Analog input
ANI7
Input port
SO11
Input port
SDAA0/RxD6
Analog input ANI8
Input port
X1/TOOLC0/
<TI000>/<INTP0>
X2/EXCLK/TOOLD0
R01UH0068EJ0203 Rev.2.03 83
Jun 29, 2012
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
4.2 Port Configuration
Ports include the following hardware.
Table 4-5. Port Configuration
Item Configuration
Control registers
Port
Pull-up resistor
Note 78K0/FB2-L only.
• 78K0/FY2-L, 78K0/FA2-L
Port mode register (PMxx): PM0, PM2, PM3, PM6
Port register (Pxx): P0, P2, P3, P6, P12
Pull-up resistor option register (PUxx): PU0, PU3, PU6
Port input mode register 6 (PIM6)
Port output mode register 6 (POM6)
A/D port configuration register 0 (ADPC0)
• 78K0/FB2-L
Port mode register (PMxx): PM0, PM2, PM3, PM6, PM7
Port register (Pxx): P0, P2, P3, P6, P7, P12
Pull-up resistor option register (PUxx): PU0, PU3, PU6
Port input mode register 6 (PIM6)
Port output mode register 6 (POM6)
A/D port configuration register 0 (ADPC0)
A/D port configuration register 1 (ADPC1)
Port alternate switch control register (MUXSEL)
Port 0 is an 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 P02 pins are used as an input port, us e 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, external interrupt request input, and serial interface chip select input.
Reset signal generation sets port 0 to input mode.
Figures 4-1 to 4-3 show block diagrams of port 0.
Figure 4-1. Block Diagram of P00
WR
PU
PU0
P02/SSI11/INTP5
V
DD
PU00
Alternate function
RD
WR
PORT
Internal bus
WR
PM
P0
Output latch
(P00)
PM0
PM00
P0: Port register 0
PU0: Pull-up resistor option register 0
PM0: Port mode register 0
RD: Read signal
WR××: Write signal
P-ch
Selector
P00/TI000/INTP0
R01UH0068EJ0203 Rev.2.03 85
Jun 29, 2012
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
Figure 4-2. Block Diagram of P01
V
DD
WR
PU
PU0
PU01
Alternate
function
RD
WR
PORT
Internal bus
WR
PM
P0
Output latch
(P01)
PM0
PM01
Alternate
function
P0: Port register 0
PU0: Pull-up resistor option register 0
PM0: Port mode register 0
RD: Read signal
WR××: Write signal
P-ch
Selector
P01/TI010/TO00
R01UH0068EJ0203 Rev.2.03 86
Jun 29, 2012
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
Figure 4-3. Block Diagram of P02
V
DD
WR
PU
PU0
PU02
RD
Alternate
function
WR
WR
PORT
P0
Output latch
(P02)
PM
PM0
PM02
Internal bus
P0: Port register 0
PU0: Pull-up resistor option register 0
PM0: Port mode register 0
RD: Read signal
WR××: Write signal
Table 4-6. Setting Functions of P20/ANI0 and P22/ANI2 Pins
SS (for example, the P27/ANI7
ADPC0 Register PM2 Register
Digital I/O
selection
Output mode
Analog input
selection
Output mode
ADS Register
(n = 0, 2)
Selects ANIn. Setting prohibited Input mode
Does not select ANIn. Digital input
Selects ANIn. Setting prohibited
Does not select ANIn. Digital output
Selects ANIn. Analog input (to be converted into digital signals) Input mode
Does not select ANIn. Analog input (not to be converted into digital signals)
−
Setting prohibited
Remark ADPC0: A/D port configuration register 0 PM2: Port mode register 2
ADS: Analog input channel specification register
P20/ANI0 and P22/ANI2 Pins
R01UH0068EJ0203 Rev.2.03 88
Jun 29, 2012
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
Table 4-7. Setting Functions of P21/ANI1 Pin
ADPC0
Register
Digital I/O
selection
Analog input
selection
PM2 Register ADS Register P21/ANI1 Pin
Selects ANI1. Setting prohibited Input mode
Does not select ANI1. Digital input
Output mode
Output mode
Selects ANI1. Setting prohibited
Does not select ANI1. Digital output
Selects ANI1. Analog input (to be converted into digital signals) Input mode
Does not select ANI1. Analog input (not to be converted into digital signals)
−
Setting prohibited
Table 4-8. Setting Functions of P23/ANI3/CMP2+, P24/ANI4/CMP0+, P25/ANI5/CMP1+ Pins
ADPC0
Register
Digital I/O
selection
Analog input
selection
PM2 Register
Output mode
Input mode
Output mode
CMPmEN bit
(m = 0 to 2)
−
−
1
−−
ADS Register
(n = 3 to 5)
Selects ANIn. Setting prohibited Input mode
Does not select ANIn.Digital input
Selects ANIn. Setting prohibited
Does not select ANIn.Digital output
Selects ANIn. Analog input (to be converted into digital signal) 0
Does not select ANIn.Analog input (not to be converted into digital signal)
Selects ANIn. Analog input (to be converted into digital signal),
Comparator input
Does not select ANIn.Comparator input
Setting prohibited
Remark ADPC0: A/D port configuration register 0 PM2: Port mode register 2
CMPmEN: Bit 7 of comparator m control register (CmCTL)
ADS: Analog input channel specification register
P23/ANI3/CMP2+, P24/ANI4/CMP0+,
P25/ANI5/CMP1+ Pins
R01UH0068EJ0203 Rev.2.03 89
Jun 29, 2012
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
Table 4-9. Setting Functions of P26/ANI6/CMPCOM Pin
ADPC0
Register
Digital I/O
selection
Analog input
selection
PM2 Register
Output mode
Input mode
Output mode
CmMODSEL1
bit (m = 0 to 2)
CmMODSEL1 = 0, or
CmMODSEL0 = 0
CmMODSEL1 = 1,
CmMODSEL0 = 1
CmMODSEL0
bit (m = 0 to 2)
−
−
− −
ADS Register P26/ANI6/CMPCOM Pin
Selects ANI6. Setting prohibited Input mode
Does not select ANI6. Digital input
Selects ANI6. Setting prohibited
Does not select ANI6. Digital output
Selects ANI6.
Does not select ANI6.
Selects ANI6.
Does not select ANI6. Comparator common input
Analog input (to be converted into
digital signal)
Analog input (not to be converted
into digital signal)
Analog input (to be converted into
digital signal),
Comparator common input
Setting prohibited
Remark ADPC0: A/D port configuration register 0 PM2: Port mode register 2
CmMODSEL1, CmMODSEL0: Bits 4, 3 of comparator m control register (CmCTL)
ADS: Analog input channel specification register
Selects ANI7. Setting prohibited Input mode
Does not select ANI7. Digital input
Selects ANI7. Setting prohibited
Does not select ANI7. Digital output
Selects ANI7. Analog input (to be converted into digital signal) Input mode
Does not select ANI7. Analog input (not to be converted into digital signal)
−
Remark ADPC0: A/D port configuration register 0 PM2: Port mode register 2
ADS: Analog input channel specification register
Reset signal generation sets port 2 to analog input.
Figures 4-4 to 4-8 show block diagrams of port 2.
Caution Make the AV
REF pin the same potential as the VDD pin when port 2 is used as a digital port.
Setting prohibited
R01UH0068EJ0203 Rev.2.03 90
Jun 29, 2012
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
Figure 4-4. Block Diagram of P20 to P22 and P27
RD
Selector
WR
PORT
Internal bus
WR
PM
P2
Output latch
(P20 to P22, P27)
PM2
PM20-PM22,
PM27
P20/ANI0 to
P22/ANI2 and
P27/ANI7
A/D converter
Figure 4-5. Block Diagram of P23
RD
Selector
PORT
WR
Internal bus
WR
PM
P2
Output latch
(P23)
PM2
PM23
A/D converter
Comparator 2 (+) input
P23/ANI3/CMP2+
P2: Port register 2
PM2: Port mode register 2
RD: Read signal
WR××: Write signal
R01UH0068EJ0203 Rev.2.03 91
Jun 29, 2012
+
78K0/Fx2-L CHAPTER 4 PORT FUNCTIONS
Figure 4-6. Block Diagram of P24
RD
Selector
PORT
WR
Internal bus
WR
PM
P2
Output latch
(P24)
PM2
PM24
P24/ANI4/CMP0+
A/D converter
Comparator 0 (+) input
Figure 4-7. Block Diagram of P25
RD
Selector
PORT
WR
Internal bus
WR
PM
P2
Output latch
(P25)
PM2
PM25
A/D converter
Comparator 1 (+) input
P25/ANI5/CMP1
P2: Port register 2
PM2: Port mode register 2
RD: Read signal
WR××: Write signal
Port 3 is an 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 the P30 to P37 pins are used as an input port, us e of an on-chip pull-up resistor can 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, timer I/O, clock I/O and data I/O for serial interface, and
clock input and data I/O for flash memory programmer/on-chip debugger.
Reset signal generation sets port 3 to input mode.
Figures 4-9 to 4-16 show block diagrams of port 3.
Caution To use P35/SCK11 and P37/SO11 of 78K0/FB2-L as general-purpose ports, set serial operation mode
register 11 (CSIM11) and serial clock selection register 11 (CSIC11) to the default status (00H).
Remark For how to connect a flash memory programmer using TOOLC1/P31, TOOLD1/P32, refer to CH APTER 24
FLASH MEMORY. For how to connect TOOLC1/P31, TOOLD1/P32 and an on-chip debug emulator, refer