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 once, when it has occurred. Environmental control
must be adequate. When it is dry, humidifier should be used. It is recommended to avoid using
insulators that easily build 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 bench and floor should be grounded. The operator should be grounded using
wrist strap. Semiconductor devices must not be touched with bare hands. Similar precautions need
to be taken for PW boards with semiconductor devices on it.
2HANDLING OF UNUSED INPUT PINS FOR CMOS
Note:
No connection for CMOS device inputs can be cause of malfunction. If no connection is provided
to the input pins, it is possible that an internal input level may be generated due to noise, etc., hence
causing malfunction. CMOS devices behave differently than Bipolar or NMOS devices. Input levels
of CMOS devices must be fixed high or low by using a pull-up or pull-down circuitry. Each unused
pin should be connected to V
being an output pin. All handling related to the unused pins must be judged device by device and
related specifications governing the devices.
DD or GND with a resistor, if it is considered to have a possibility of
3STATUS BEFORE INITIALIZATION OF MOS DEVICES
Note:
Power-on does not necessarily define initial status of MOS device. Production process of MOS
does not define the initial operation status of the device. Immediately after the power source is
turned ON, the devices with reset function have not yet been initialized. Hence, power-on does
not guarantee out-pin levels, I/O settings or contents of registers. Device is not initialized until the
reset signal is received. Reset operation must be executed immediately after power-on for devices
having reset function.
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.
TRON is an abbreviation of The Realtime Operating system Nucleus.
ITRON is an abbreviation of Industrial TRON.
User’s Manual U16227EJ2V0UD
3
Page 4
These commodities, technology or software, must be exported in accordance
with the export administration regulations of the exporting country.
Diversion contrary to the law of that country is prohibited.
•
The information in this document is current as of May, 2003. 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":
"Special":
"Specific":
Computers, office equipment, communications equipment, test and measurement equipment, audio
and visual equipment, home electronic appliances, machine tools, personal electronic equipment
and industrial robots.
Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster
systems, anti-crime systems, safety equipment and medical equipment (not specifically designed
for life support).
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’sManual U16227EJ2V0UD
Page 5
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.
2.2.12 X1 and X2...................................................................................................................................... 36
2.2.13 XT1 and XT2.................................................................................................................................. 36
2.2.14 VDD and EVDD................................................................................................................................. 36
2.2.15 VSS and EVSS ................................................................................................................................. 36
3.2.1 Control registers ............................................................................................................................ 54
CHAPTER 4 PORT FUNCTIONS ........................................................................................................... 75
4.1 Port Functions............................................................................................................................ 75
4.2 Port Configuration ..................................................................................................................... 77
4.2.1 Port 0..............................................................................................................................................78
4.2.2 Port 1..............................................................................................................................................80
4.2.3 Port 2..............................................................................................................................................85
4.2.4 Port 3..............................................................................................................................................86
4.2.5 Port 6..............................................................................................................................................88
4.2.6 Port 7..............................................................................................................................................89
4.2.7 Port 12............................................................................................................................................90
4.2.8 Port 13............................................................................................................................................91
4.3 Registers Controlling Port Function........................................................................................ 92
4.4 Port Function Operations.......................................................................................................... 96
4.4.1 Writing to I/O port ...........................................................................................................................96
4.4.2 Reading from I/O port.....................................................................................................................96
4.4.3 Operations on I/O port ....................................................................................................................96
23.5.4 Port pins .......................................................................................................................................391
23.5.5 Other signal pins........................................................................................................................... 391
23.5.6 Power supply ................................................................................................................................391
DD = 2.7 to 5.5 V (standard product, (A) grade product)
VDD = 3.3 to 5.5 V ((A1) grade product, (A2) grade product)
{ Operating ambient temperature: T
T
A = −40 to +85°C (standard product, (A) grade product)
A = −40 to +105°C (flash memory version of (A1) grade product)
TA = −40 to +110°C (mask ROM version of (A1) grade product)
T
A = −40 to +125°C (mask ROM version of (A2) grade product)
Note Select either of the functions of these alternate-function pins.
User’s Manual U16227EJ2V0UD
17
Page 18
CHAPTER 1 OUTLINE
1.2 Applications
{ Automotive equipment
• System control for body electricals (power windows, keyless entry reception, etc.)
• Sub-microcontrollers for control
{ Home audio, car audio
{ AV equipment
{ PC peripheral equipment (keyboards, etc.)
{ Household electrical appliances
• Outdoor air conditioner units
• Microwave ovens, electric rice cookers
{ Industrial equipment
• Pumps
• Vending machines
• FA (Factory Automation)
18
User’s Manual U16227EJ2V0UD
Page 19
CHAPTER 1 OUTLINE
1.3 Ordering Information
Part Number Package Quality Grade
µ
PD780111GB-×××-8ES 44-pin plastic LQFP (10 × 10) Standard
µ
PD780112GB-×××-8ES 44-pin plastic LQFP (10 × 10) Standard
µ
PD780113GB-×××-8ES 44-pin plastic LQFP (10 × 10) Standard
µ
PD780114GB-×××-8ES 44-pin plastic LQFP (10 × 10) Standard
µ
PD780111GB(A)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780112GB(A)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780113GB(A)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780114GB(A)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780111GB(A1)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780112GB(A1)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780113GB(A1)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780114GB(A1)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780111GB(A2)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780112GB(A2)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780113GB(A2)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD780114GB(A2)-×××-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD78F0114M1GB-8ES 44-pin plastic LQFP (10 × 10) Standard
µ
PD78F0114M2GB-8ES 44-pin plastic LQFP (10 × 10) Standard
µ
PD78F0114M3GB-8ES 44-pin plastic LQFP (10 × 10) Standard
µ
PD78F0114M4GB-8ES 44-pin plastic LQFP (10 × 10) Standard
µ
PD78F0114M5GB-8ES 44-pin plastic LQFP (10 × 10) Standard
µ
PD78F0114M6GB-8ES 44-pin plastic LQFP (10 × 10) Standard
µ
PD78F0114M1GB(A)-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD78F0114M2GB(A)-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD78F0114M3GB(A)-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD78F0114M4GB(A)-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD78F0114M5GB(A)-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD78F0114M6GB(A)-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD78F0114M1GB(A1)-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD78F0114M2GB(A1)-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD78F0114M5GB(A1)-8ES 44-pin plastic LQFP (10 × 10) Special
µ
PD78F0114M6GB(A1)-8ES 44-pin plastic LQFP (10 × 10) Special
Remark××× indicates ROM code suffix.
Please refer to "Quality Grades on NEC Semiconductor Devices" (Document No. C11531E) published by
NEC Electronics Corporation to know the specification of the quality grade on the device and its
recommended applications.
User’s Manual U16227EJ2V0UD
19
Page 20
CHAPTER 1 OUTLINE
Mask ROM versions (µPD780111, 780112, 780113, and 780114) include mask options. When ordering, it is
possible to select “Power-on-clear (POC) circuit can be used/cannot be used”, “Ring-OSC clock can be
stopped/cannot be stopped by software” and “Pull-up resistor incorporated/not incorporated in 1-bit units (P60 to
P63)”.
Flash memory versions corresponding to the mask options of the mask ROM versions are as follows.
Table 1-1. Flash Memory Versions Corresponding to Mask Options of Mask ROM Versions
Flash Memory Versions
(Part Number)
µ
PD78F0114M1GB-8ES
µ
PD78F0114M1GB(A)-8ES
µ
PD78F0114M1GB(A1)-8ES
µ
PD78F0114M2GB-8ES
µ
PD78F0114M2GB(A)-8ES
µ
PD78F0114M2GB(A1)-8ES
µ
PD78F0114M3GB-8ES
µ
PD78F0114M3GB(A)-8ES
µ
PD78F0114M4GB-8ES
µ
PD78F0114M4GB(A)-8ES
µ
PD78F0114M5GB-8ES
µ
PD78F0114M5GB(A)-8ES
µ
PD78F0114M5GB(A1)-8ES
µ
PD78F0114M6GB-8ES
µ
PD78F0114M6GB(A)-8ES
µ
PD78F0114M6GB(A1)-8ES
POC Circuit Ring-OSC
POC cannot be used
POC used (VPOC = 2.85 V ±0.15 V)
POC used (VPOC = 3.5 V ±0.2 V)
Mask Option
Cannot be stopped
Can be stopped by software
Cannot be stopped
Can be stopped by software
Cannot be stopped
Can be stopped by software
20
User’s Manual U16227EJ2V0UD
Page 21
1.4 Pin Configuration (Top View)
• 44-pin plastic LQFP (10 × 10)
44 43 42 41 40 39 38 37 36 35 34
REF
AV
AV
IC (VPP)
V
V
X1
X2
RESET
XT1
XT2
P130
SS
DD
SS
1
2
3
4
5
6
7
8
9
10
11
12 13 14 15 16 17 18 19 20 21 22
P20/ANI0
P21/ANI1
P22/ANI2
CHAPTER 1 OUTLINE
P23/ANI3
P24/ANI4
P25/ANI5
P26/ANI6
P27/ANI7
P70/KR0
P71/KR1
P72/KR2
33
32
31
30
29
28
27
26
25
24
23
P73/KR3
P00/TI000
P01/TI010/TO00
P10/SCK10/TxD0
P11/SI10/RxD0
P12/SO10
P13/TxD6
P14/RxD6
P15/TOH0
P16/TOH1/INTP5
DD
EV
P60
P61
P62
P63
P32/INTP3
P31/INTP2
P120/INTP0
P33/TI51/TO51/INTP4
P30/INTP1
P17/TI50/TO50
Cautions 1. Connect the IC (Internally Connected) pin directly to VSS.
2. Connect the AVSS pin to VSS.
3. Connect the V
PP pin to EVSS or VSS during normal operation.
Remark Figures in parentheses apply only to the
µ
PD78F0114.
SS
EV
User’s Manual U16227EJ2V0UD
21
Page 22
CHAPTER 1 OUTLINE
Pin Identification
ANI0 to ANI7: Analog input
AV
REF: Analog reference voltage
AV
SS: Analog ground
EV
DD: Power supply for port
EV
SS: Ground for port
IC: Internally connected
INTP0 to INTP5: External interrupt input
KR0 to KR3: Key return
P00, P01: Port 0
P10 to P17: Port 1
P20 to P27: Port 2
P30 to P33: Port 3
P60 to P63: Port 6
P70 to P73: Port 7
P120: Port 12
P130: Port 13
RESET: Reset
RxD0, RxD6: Receive data
SCK10: Serial clock input/output
SI10: Serial data input
SO10: Serial data output
TI000, TI010,
TI50, TI51: Timer input
TO00, TO50, TO51,
TOH0, TOH1: Timer output
TxD0, TxD6: Transmit data
V
DD: Power supply
V
PP: Programming power supply
V
SS: Ground
X1, X2: Crystal oscillator (X1 input clock)
XT1, XT2: Crystal oscillator (Subsystem clock)
22
User’s Manual U16227EJ2V0UD
Page 23
1.5 K1 Family Lineup
1.5.1 78K0/Kx1 product lineup
78K0/KB1: 30-pin (7.62 mm 0.65 mm pitch)
µ
PD78F0103Flash memory: 24 KB, RAM: 768 bytes
PD780103
µ
PD780102
µ
PD780101
µ
78K0/KC1: 44-pin (10 × 10 mm 0.8 mm pitch)
PD78F0114Flash memory: 32 KB, RAM: 1 KB
µ
µ
PD780114
PD780113
µ
PD780112
µ
Mask ROM: 24 KB, RAM: 768 bytes
Mask ROM: 16 KB, RAM: 768 bytes
Mask ROM: 8 KB, RAM: 512 bytes
Mask ROM: 32 KB, RAM: 1 KB
Mask ROM: 24 KB, RAM: 1 KB
Mask ROM: 16 KB, RAM: 512 bytes
PD780111
µ
Mask ROM: 8 KB, RAM: 512 bytes
CHAPTER 1 OUTLINE
78K0/KD1: 52-pin (10 × 10 mm 0.65 mm pitch)
PD78F0124Flash memory: 32 KB, RAM: 1 KB
µ
PD780124
µ
PD780123
µ
PD780122
µ
Mask ROM: 32 KB, RAM: 1 KB
Mask ROM: 24 KB, RAM: 1 KB
Mask ROM: 16 KB, RAM: 512 bytes
PD780121
µ
Mask ROM: 8 KB, RAM: 512 bytes
78K0/KE1: 64-pin (10 × 10 mm 0.5 mm pitch, 12 × 12 mm 0.65 mm pitch, 14 × 14 mm 0.8 mm pitch)
PD78F0134Flash memory:
µ
PD780134
µ
PD780133
µ
PD780132
µ
Mask ROM: 32 KB, RAM: 1 KB
Mask ROM: 24 KB, RAM: 1 KB
PD780131
µ
32 KB, RAM: 1 KB
Mask ROM: 16 KB, RAM: 512 bytes
Mask ROM: 8 KB, RAM: 512 bytes
PD78F0138Flash memory:
µ
PD780138
µ
PD780136
µ
Mask ROM: 60 KB, RAM: 2 KB
Mask ROM:
78K0/KF1: 80-pin (12 × 12 mm 0.5 mm pitch, 14 × 14 mm 0.65 mm pitch)
PD78F0148Flash memory: 60 KB, RAM: 2 KB
µ
PD780148
µ
PD780146
µ
PD780144
µ
Mask ROM: 60 KB, RAM: 2 KB
Mask ROM: 48 KB, RAM: 2 KB
Mask ROM: 32 KB, RAM: 1 KB
PD780143
µ
Mask ROM: 24 KB, RAM: 1 KB
60 KB, RAM: 2 KB
48 KB, RAM
:
2 KB
User’s Manual U16227EJ2V0UD
23
Page 24
CHAPTER 1 OUTLINE
The list of functions in the 78K0/Kx1 is shown below.
FFE0H Interrupt request flag register 0L IF0 IF0L R/W
FFE1H Interrupt request flag register 0H IF0H R/W
FFE2H Interrupt request flag register 1L IF1L R/W
FFE4H Interrupt mask flag register 0L MK0 MK0L R/W
FFE5H Interrupt mask flag register 0H MK0H R/W
FFE6H Interrupt mask flag register 1L MK1L R/W
FFE8H Priority specification flag register 0L PR0 PR0L R/W
FFE9H Priority specification flag register 0H PR0H R/W
FFEAH Priority specification flag register 1L PR1L R/W
FFF0H Internal memory size switching register
FFFBH Processor clock control register PCC R/W
Note 2
IMS R/W
Manipulatable Bit Unit Address Special Function Register (SFR) Name Symbol R/W
1 Bit 8 Bits 16 Bits
− √ −
√ √ −
√ √ −
√ √ −
√ √ −
√ √ −
− √ −
√ √ √
√ √
√ √ −
√ √ √
√ √
√ √ −
√ √ √
√ √
√ √ −
− √ −
√ √ −
00H
FFH
FFH
Notes 1. This value varies depending on the reset source.
2. The default value of IMS is fixed (IMS = CFH) in all 78K0/KC1 products regardless of the internal memory
capacity. Therefore, set the following value to each product.
Internal Memory Size Switching Register (IMS)
µ
PD780111 42H
µ
PD780112 44H
µ
PD780113 C6H
µ
PD780114 C8H
µ
PD78F0114 Value corresponding to mask ROM version
62
User’s Manual U16227EJ2V0UD
Page 63
CHAPTER 3 CPU ARCHITECTURE
3.3 Instruction Address Addressing
An instruction address is determined by program counter (PC) contents and is normally incremented (+1 for each
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 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 (displacement 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
User’s Manual U16227EJ2V0UD
63
Page 64
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
64
User’s Manual U16227EJ2V0UD
Page 65
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, and allows branching to
the entire memory space.
[Illustration]
76510
Operation code
ta
4–0
151
111
87
650
Effective address
Effective address+1
01
00000000
Memory (Table)
70
Low Addr.
High Addr.
150
PC
87
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
rp
150
PC
AX
87
User’s Manual U16227EJ2V0UD
65
Page 66
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 automatically
(implicitly) addressed.
Of the 78K0/KC1 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 employed with an instruction, 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 A register and X register is stored in AX. In this example,
the A and AX registers are specified by implied addressing.
66
User’s Manual U16227EJ2V0UD
Page 67
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 and RBS1) and the register specify codes (Rn and RPn) of an operation code.
Register addressing is carried out when an instruction with the following operand 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 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
User’s Manual U16227EJ2V0UD
67
Page 68
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
68
User’s Manual U16227EJ2V0UD
Page 69
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 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 cleared to 0. When it is at 00H to
1FH, bit 8 is set to 1. Refer to [Illustration].
[Operand format]
Identifier Description
saddr Immediate data that indicates label or FE20H to FF1FH
saddrp Immediate data that indicates label or FE20H to FF1FH (even address only)
[Description example]
MOV 0FE30H, A; when transferring value of A register to saddr (FE30H)
Operation code 11110010 OP code
00110000 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,
87
α
α
= 0
α
= 1
User’s Manual U16227EJ2V0UD
Short direct memory
0
69
Page 70
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
111111
1
87
1
SFR
0
70
User’s Manual U16227EJ2V0UD
Page 71
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 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.
A
7 0
E
Memory
The memory address
07
specified with the
register pair DE
User’s Manual U16227EJ2V0UD
71
Page 72
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 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
72
User’s Manual U16227EJ2V0UD
Page 73
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 and 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 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
User’s Manual U16227EJ2V0UD
73
Page 74
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
74
User’s Manual U16227EJ2V0UD
Page 75
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/KC1 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 3
Port 6
Port 7
Port 12
Port 13
P30
P33
P60
P63
P70
P73
P120
P130
P00
P01
P10
P17
P20
P27
Port 0
Port 1
Port 2
User’s Manual U16227EJ2V0UD
75
Page 76
CHAPTER 4 PORT FUNCTIONS
Table 4-2. Port Functions
Pin Name I/O Function After Reset Alternate Function
P00 TI000
P01
P10 SCK10/TxD0
P11 SI10/RxD0
P12 SO10
P13 TxD6
P14 RxD6
P15 TOH0
P16 TOH1/INTP5
P17
P20 to P27 Input
P30 to P32 INTP1 to INTP3
P33
P60 to P63 I/O
P70 to P73 I/O
P120 I/O
P130 Output
I/O
I/O
I/O
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 1.
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 2.
8-bit input-only port.
Port 3.
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.
Port 6.
4-bit I/O port (N-ch open drain).
Input/output can be specified in 1-bit units.
Use of an on-chip pull-up resistor can be specified by a mask
option only for mask ROM versions.
Port 7.
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.
Port 12.
1-bit I/O port.
Use of an on-chip pull-up resistor can be specified by a
These registers specify whether the on-chip pull-up resistors of P00, P01, P10 to P17, P30 to P33, P70 to P73, or
P120 are to be used or not. On-chip pull-up resistors can be used in 1-bit units only for the bits set to input mode
of the pins to which the use of an on-chip pull-up resistor has been specified in PU0, PU1, PU3, PU7, and PU12.
On-chip pull-up resistors cannot be connected for bits set to output mode and bits used as alternate-function
output pins, regardless of the settings of PU0, PU1, PU3, PU7, and PU12.
These registers can be set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears these registers to 00H.
Caution Use of a pull-up resistor can be specified for P60 to P63 pins by a mask option only in the mask
ROM versions.
Figure 4-18. Format of Pull-up Resistor Option Register
Symbol
PU0
7
0
6
0
5
0
4
0
3
0
2
0
1
PU010PU00
Address
FF30H
After reset
00H
R/W
R/W
PU1
PU3
PU7
PU12
7
PU17
7
0
7
0
7
0
6
PU165PU154PU143PU132PU121PU110PU10FF31H00HR/W
6
0
6
0
6
0
5
0
5
0
5
0
4
0
4
0
4
0
PUmn
0 On-chip pull-up resistor not connected
1 On-chip pull-up resistor connected
3
PU332PU321PU310PU30FF33H00HR/W
3
PU732PU721PU710PU70FF37H00HR/W
3
0
Pmn pin on-chip pull-up resistor selection
2
0
(m = 0, 1, 3, 7, 12; n = 0 to 7)
1
0
0
PU120FF3CH00HR/W
User’s Manual U16227EJ2V0UD
95
Page 96
CHAPTER 4 PORT FUNCTIONS
4.4 Port Function Operations
Port operations differ depending on whether the input or output mode is set, as shown below.
Caution In the case of a 1-bit memory manipulation instruction, although a single bit is manipulated, the
port is accessed as an 8-bit unit. Therefore, on a port with a mixture of input and output pins,
the output latch contents for pins specified as input are undefined, even for bits other than the
manipulated bit.
4.4.1 Writing to I/O port
(1) Output mode
A value is written to the output latch by a transfer instruction, and the output latch contents are output from the
pin.
Once data is written to the output latch, it is retained until data is written to the output latch again.
The data of the output latch is cleared by reset.
(2) Input mode
A value is written to the output latch by a transfer instruction, but since the output buffer is off, the pin status does
not change.
Once data is written to the output latch, it is retained until data is written to the output latch again.
4.4.2 Reading from I/O port
(1) Output mode
The output latch contents are read by a transfer instruction. The output latch contents do not change.
(2) Input mode
The pin status is read by a transfer instruction. The output latch contents do not change.
4.4.3 Operations on I/O port
(1) Output mode
An operation is performed on the output latch contents, and the result is written to the output latch. The output
latch contents are output from the pins.
Once data is written to the output latch, it is retained until data is written to the output latch again.
The data of the output latch is cleared by reset.
(2) Input mode
The pin level is read and an operation is performed on its contents. The result of the operation is written to the
output latch, but since the output buffer is off, the pin status does not change.
96
User’s Manual U16227EJ2V0UD
Page 97
CHAPTER 5 CLOCK GENERATOR
5.1 Functions of Clock Generator
The clock generator generates the clock to be supplied to the CPU and peripheral hardware.
The following three system clock oscillators are available.
• X1 oscillator
The X1 oscillator oscillates a clock of f
XP = 2.0 to 10.0 MHz. Oscillation can be stopped by executing the STOP
instruction or setting the main OSC control register (MOC) and processor clock control register (PCC).
• Ring-OSC oscillator
The Ring-OSC oscillator oscillates a clock of f
R = 240 kHz (TYP.). Oscillation can be stopped by setting the
Ring-OSC mode register (RCM) when “Can be stopped by software” is set by a mask option and the X1 input
clock is used as the CPU clock.
• Subsystem clock oscillator
The subsystem clock oscillator oscillates a clock of f
XT = 32.768 kHz. Oscillation cannot be stopped. When
subsystem clock oscillator is not used, setting not to use the on-chip feedback resistor is possible using the
processor clock control register (PCC), and the operating current can be reduced in the STOP mode.
Remarks 1. f
2. f
3. f
XP: X1 input clock oscillation frequency
R: Ring-OSC clock oscillation frequency
XT: Subsystem clock oscillation frequency
5.2 Configuration of Clock Generator
The clock generator includes the following hardware.
Table 5-1. Configuration of Clock Generator
Item Configuration
Control registers Processor clock control register (PCC)
Ring-OSC mode register (RCM)
Main clock mode register (MCM)
Main OSC control register (MOC)
Oscillation stabilization time counter status register (OSTC)
Oscillation stabilization time select register (OSTS)
Oscillators X1 oscillator
Ring-OSC oscillator
Subsystem clock oscillator
User’s Manual U16227EJ2V0UD
97
Page 98
CHAPTER 5 CLOCK GENERATOR
Figure 5-1. Block Diagram of Clock Generator
Internal bus
Oscillation
stabilization time
select register
(OSTS)
OSTS1 OSTS0OSTS2
3
X1 oscillation
MOST
MOST
MOST
14
13
15
Oscillation
stabilization
MOST
time counter
16
status
register
(OSTC)
Processor clock
control register
(PCC)
CSS PCC2CLS
PCC1 PCC0
4
Controller
Control signal
C
P
U
CPU clock
CPU
)
(f
STOP
MSTOP
Main OSC
control
register
(MOC)
MCSCLSMCC
Main clock
mode register
(MCM)
MCM0
stabilization time counter
MOST
11
X1
X2
Mask option
1: Cannot be stopped
0: Can be stopped
X1 oscillator
Ring-OSC
oscillator
Ring-OSC mode
register (RCM)
RSTOP
f
XP
Operation
clock switch
f
R
Internal bus
Prescaler
f
X
8-bit timer H1,
watchdog timer
f
X
2
Prescaler
f
X
f
2
2
2
X
f
X
3
4
2
Prescaler
Clock to peripheral
hardware
Selector
f
1/2
CPU
Subsystem
clock oscillator
f
XT
Watch clock
XT1
XT2
FRC
98
User’s Manual U16227EJ2V0UD
Page 99
CHAPTER 5 CLOCK GENERATOR
5.3 Registers Controlling Clock Generator
The following six registers are used to control the clock generator.
• Processor clock control register (PCC)
• Ring-OSC mode register (RCM)
• Main clock mode register (MCM)
• Main OSC control register (MOC)
• Oscillation stabilization time counter status register (OSTC)
• Oscillation stabilization time select register (OSTS)
(1) Processor clock control register (PCC)
The PCC register is used to select the CPU clock, the division ratio, main system clock oscillator operation/stop
and whether to use the on-chip feedback resistor
PCC can be set by a 1-bit or 8-bit memory manipulation instruction.
RESET input clears PCC to 00H.
Note The feedback resistor is required to control the bias point of the oscillation waveform so that the bias point
is in the middle of the power supply voltage.
When the subsystem clock is not used, the operating current in the STOP mode can be reduced by setting
bit 6 (FRC) of PCC to 1 (see Figure 5-11 Subsystem Clock Feedback Resistor).
Note
of the subsystem clock oscillator.
User’s Manual U16227EJ2V0UD
99
Page 100
CHAPTER 5 CLOCK GENERATOR
Address: FFFBH After reset: 00H R/W
Symbol <7> <6> <5> <4> 3 2 1 0
PCC MCC FRC CLS CSS 0 PCC2 PCC1 PCC0
Note 1
Figure 5-2. Format of Processor Clock Control Register (PCC)
MCC Control of X1 oscillator operation
0 Oscillation possible
1 Oscillation stopped
Note 2
FRC Subsystem clock feedback resistor selection
0 On-chip feedback resistor used
1 On-chip feedback resistor not used
Note 3
CLS CPU clock status
0 X1 input clock or Ring-OSC clock
1 Subsystem clock
Note 4
CPU clock (fCPU) selection
0 0 0 fX fR fXP
0 0 1 fX/2 fR/2 fXP/2
0 1 0 fX/22 fR/22 fXP/22
0 1 1 fX/23 fR/23 fXP/23
0 0 0
0 0 1
0 1 0
0 1 1
Other than above Setting prohibited
CSS
PCC2 PCC1 PCC0
0
1 0 0 fX/24 fR/24 fXP/24
1
1 0 0
MCM0 = 0 MCM0 = 1
XT/2
f
Notes 1. Bit 5 is read-only.
2. When the CPU is operating on the subsystem clock, MCC should be used to stop the X1 oscillator
operation. When the CPU is operating on the Ring-OSC clock, use bit 7 (MSTOP) of the main OSC
control register (MOC) to stop the X1 oscillator operation (this cannot be set by MCC). A STOP
instruction should not be used.
3. This bit can be set to 1 only when the subsystem clock is not used.
4. Be sure to switch CSS from 1 to 0 when bits 1 (MCS) and 0 (MCM0) of the main clock mode register
(MCM) are 1.
Caution Be sure to clear bit 3 to 0.
Remarks 1. MCM0: Bit 0 of the main clock mode register (MCM)
2. f
X: Main system clock oscillation frequency (X1 input clock oscillation frequency or Ring-OSC
clock oscillation frequency)
3. f
4. f
R: Ring-OSC clock oscillation frequency
XP: X1 input clock oscillation frequency
5. fXT: Subsystem clock oscillation frequency
100
User’s Manual U16227EJ2V0UD
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.