UPD78F9116A NECElectronics
UPD78F9116A NECElectronics
com
User’s Manual
DataShee
µ PD789101A µ PD789121A
DataSheet4U.com
µ PD789102A µ PD789122A
µ PD789104A µ PD789124A
µ PD789111A µ PD789131A
µ PD789112A µ PD789132A
µ PD789114A µ PD789134A
µ PD78F9116A µ PD78F9136A
µ PD789101A(A) µ PD789121A(A)
µ PD789102A(A) µ PD789122A(A)
µ PD789104A(A) µ PD789124A(A)
µ PD789111A(A) µ PD789131A(A)
µ PD789112A(A) µ PD789132A(A)
µ PD789114A(A) µ PD789134A(A)
© 2000
DataSheet4U.com
Printed in Japan
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
3 DataSheet4U.com
STATUS 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.
DataSheet 4 U .com
www.DataSheet4U.com
The export of these products from Japan is regulated by the Japanese government. The export of some or all of these
products may be prohibited without governmental license. To export or re-export some or all of these products from a
country other than Japan may also be prohibited without a license from that country. Please call an NEC sales
representative.
• The information in this document is current as of June, 2000. The information is subject to change
without notice. For actual design-in, refer to the latest publications of NEC's data sheets or data
books, etc., for the most up-to-date specifications of NEC semiconductor products. Not all products
and/or types are available in every country. Please check with an NEC 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 prior
written consent of NEC. NEC assumes no responsibility for any errors that may appear in this document.
• NEC 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 semiconductor 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 or others.
• Descriptions of circuits, software and other related information in this document are provided for illustrative
et4U.co m purposes in semiconductor product operation and application examples. The incorporation of these
circuits, software and information in the design of customer's equipment shall be done under the full DataShee
responsibility of customer. NEC assumes no responsibility for any losses incurred by customers or third
DataSheet4U.com
parties arising from the use of these circuits, software and information.
• While NEC endeavours to enhance the quality, reliability and safety of NEC semiconductor 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
semiconductor products, customers must incorporate sufficient safety measures in their design, such as
redundancy, fire-containment, and anti-failure features.
• NEC semiconductor products are classified into the following three quality grades:
"Standard", "Special" and "Specific". The "Specific" quality grade applies only to semiconductor products
developed based on a customer-designated "quality assurance program" for a specific application. The
recommended applications of a semiconductor product depend on its quality grade, as indicated below.
Customers must check the quality grade of each semiconductor product before using it in a particular
application.
"Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio
and visual equipment, home electronic appliances, machine tools, personal electronic equipment
and industrial robots
"Special": 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)
"Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life
support systems and medical equipment for life support, etc.
The quality grade of NEC semiconductor products is "Standard" unless otherwise expressly specified in NEC's
data sheets or data books, etc. If customers wish to use NEC semiconductor products in applications not
intended by NEC, they must contact an NEC sales representative in advance to determine NEC's willingness
to support a given application.
(Note)
(1) "NEC" as used in this statement means NEC Corporation and also includes its majority-owned subsidiaries.
(2) "NEC semiconductor products" means any semiconductor product developed or manufactured by or for
NEC (as defined above).
DataSheet4U.com
M8E 00. 4
DataSheet 4 U .com
www.DataSheet4U.com
Regional Information
Some information contained in this document may vary from country to country. Before using any NEC
product in your application, pIease contact the NEC office in your country to obtain a list of authorized
representatives and distributors. They will verify:
• Device availability
• Ordering information
• 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
et4U.com from country to country. DataShee
DataSheet4U.com
NEC Electronics Inc. (U.S.) NEC Electronics (Germany) GmbH NEC Electronics Hong Kong Ltd.
Santa Clara, California Benelux Office Hong Kong
Tel: 408-588-6000 Eindhoven, The Netherlands Tel: 2886-9318
800-366-9782 Tel: 040-2445845 Fax: 2886-9022/9044
Fax: 408-588-6130 Fax: 040-2444580
800-729-9288 NEC Electronics Hong Kong Ltd.
NEC Electronics (France) S.A. Seoul Branch
NEC Electronics (Germany) GmbH Velizy-Villacoublay, France Seoul, Korea
Duesseldorf, Germany Tel: 01-30-67 58 00 Tel: 02-528-0303
Tel: 0211-65 03 02 Fax: 01-30-67 58 99 Fax: 02-528-4411
Fax: 0211-65 03 490
NEC Electronics (France) S.A. NEC Electronics Singapore Pte. Ltd.
NEC Electronics (UK) Ltd. Spain Office United Square, Singapore 1130
Milton Keynes, UK Madrid, Spain Tel: 65-253-8311
Tel: 01908-691-133 Tel: 91-504-2787 Fax: 65-250-3583
Fax: 01908-670-290 Fax: 91-504-2860
NEC Electronics Taiwan Ltd.
NEC Electronics Italiana s.r.l. NEC Electronics (Germany) GmbH Taipei, Taiwan
Milano, Italy Scandinavia Office Tel: 02-2719-2377
Tel: 02-66 75 41 Taeby, Sweden Fax: 02-2719-5951
Fax: 02-66 75 42 99 Tel: 08-63 80 820
Fax: 08-63 80 388 NEC do Brasil S.A.
Electron Devices Division
Rodovia Presidente Dutra, Km 214
07210-902-Guarulhos-SP Brasil
Tel: 55-11-6465-6810
Fax: 55-11-6465-6829
J99.1
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
INTRODUCTION
Target Readers This manual is intended for users who wish to understand the functions of the
µPD789104A, 789114A, 789124A, 789134A Subseries and to design and develop
application systems and programs using these microcontrollers.
The target devices are shown as follows:
• µPD789104A Subseries: µPD789101A, 789102A, 789104A,
µPD789101A(A), 789102A(A), 789104A(A)
• µPD789114A Subseries: µPD789111A, 789112A, 789114A, 78F9116A,
µPD789111A(A), 789112A(A), 789114A(A)
• µPD789124A Subseries: µPD789121A, 789122A, 789124A,
µPD789121A(A), 789122A(A), 789124A(A)
• µPD789134A Subseries: µPD789131A, 789132A, 789134A, 78F9136A,
µPD789131A(A), 789132A(A), 789134A(A)
The µPD789104A/114A/124A/134A Subseries is a generic term for all the target
devices in this manual.
The oscillation frequency of the system clock is regarded as fX for ceramic/crystal
oscillation (µPD789104A and 789114A Subseries), and regarded as fCC for an RC
oscillation (µPD789124A and 789134A Subseries).
Purpose This manual is intended for users to understand the functions described in the
et4U.com organization below.
DataShee
Organization DataSheet4U.com
The µPD789104A, 789114A, 789124A, 789134A Subseries User's Manual is divided
into two parts: this manual and instructions (common to the 78K/0S Series).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
How to Read This Manual It is assumed that the readers of this manual have general knowledge in the fields
of electrical engineering, logic circuits, and microcontrollers.
For users who use this document as the manual for the µPD789101A(A), 789102A(A),
789104A(A), 789111A(A), 789112A(A), 789114A(A), 789121A(A), 789122A(A),
789124A(A), 789131A(A), 789132A(A), and 789134A(A)
→ The only differences between standard products and (A) products are the quality
grades and the electrical specifications. (refer to 1.9 Differences between
Standard Quality Grade Products and (A) Products and 2.9 Differences
between Standard Quality Grade Products and (A) Products). For the (a)
products, read the part numbers in the following manner.
µPD789101A → µPD789101A(A) µPD789121A → µPD789121A(A)
µPD789102A → µPD789102A(A) µPD789122A → µPD789122A(A)
µPD789104A → µPD789104A(A) µPD789124A → µPD789124A(A)
µPD789111A → µPD789111A(A) µPD789131A → µPD789131A(A)
µPD789112A → µPD789112A(A) µPD789132A → µPD789132A(A)
µPD789114A → µPD789114A(A) µPD789134A → µPD789134A(A)
To understand the overall functions in general
→ Read this manual in the order of the CONTENTS.
How to interpret register formats
→ The name ¡V a bit whose number is encircled is reserved for the assembler and
is defined for the C compiler by the header file sfrbit.h.
et4U.com To learn the detailed functions of a register whose register name is known
DataShee
→ Refer to APPENDIX C REGISTER INDEX.
DataSheet4U.com
To learn the details of the instruction functions of the 78K/0S Series
→ Refer to 78K/0S Series User’s Manual Instructions (U11047E).
To know the electrical specifications of the µPD789104A/114A/124A/134A Subseries
→ Refer to separately available Data Sheet.
Caution The application examples in this manual are created for "Standard" quality
grade products for general electric equipment. When using the application
examples in this manual for purposes which require "Special" quality grades,
thoroughly examine the quality grade of each part and circuit actually used.
Conventions Data significance: Higher digits on the left and lower digits on the right
Active low representation: ××× (overscore over pin or signal name)
Note: Footnote for item marked with Note in the text
Caution: Information requiring particular attention
Remark: Supplementary information
Numerical representation: Binary ... ×××× or ××××B
Decimal ... ××××
Hexadecimal ... ××××H
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
Related Documents The related documents indicated in this publication may include preliminary versions.
However, preliminary versions are not marked as such.
English Japanese
µPD789101A,102A,104A,111A,112A,114A,101A(A),102A(A),104A(A),111A(A), U14590E U14590J
112A(A),114A(A) Data Sheet
µPD789121A,122A,124A,131A,132A,134A,121A(A),122A(A),124A(A),131A(A), U14678E U14678J
132A(A),134A(A) Data Sheet
English Japanese
RA78K0S Assembler Package Operation U11622E U11622J
et4U.com DataShee
Assembly Language U11599E U11599J
DataSheet4U.com
Structured Assembly Language U11623E U11623J
CC78K0S C Compiler Operation U11816E U11816J
Language U11817E U11817J
Caution The related documents listed above are subject to change without notice. Be sure to use the latest
version of each document for designing.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
English Japanese
Other Documents
Caution The related documents listed above are subject to change without notice. Be sure to use the latest
version of each document for designing.
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CONTENTS
DataSheet 4 U .com
www.DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
1-1. Differences between Standard Quality Grade Products and (A) Products ...................................... 30
2-1. Differences between Standard Quality Grade Products and (A) Products ...................................... 38
3-1. Types of Pin Input/Output Circuits and Recommended Connection of Unused Pins ...................... 44
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
18-1. Differences between Flash Memory and Mask ROM Versions ........................................................ 231
18-2. Communication Mode ......................................................................................................................... 232
18-3. Functions of Flash Memory Programming ......................................................................................... 233
18-4. Example of Settings for PG-FP3 ........................................................................................................ 237
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
1.1 Features
1.2 Applications
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 1 GENERAL (µPD789104A, 789114A SUBSERIES)
Please refer to “Quality Grades on NEC Semiconductor Devices” (Document No. C11531E) published by
NEC Corporation to know the specification of quality grade on the devices and its recommended applications.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 1 GENERAL (µPD789104A, 789114A SUBSERIES)
P23/INTP0/CPT20/SS20 1 30 P22/SI20/RXD20
P24/INTP1/TO80/TO20 2 29 P21/SO20/TXD20
P25/INTP2/TI80 3 28 P20/SCK20/ASCK20
AVDD 4 27 P11
P60/ANI0 5 26 P10
P61/ANI1 6 25 VDD
P62/ANI2 7 24 VSS
P63/ANI3 8 23 X1
AVSS 9 22 X2
IC0 10 21 IC0
P50 11 20 IC0 (VPP)
et4U.com
P51 12 19 RESET
P52 13 18 P03 DataShee
P53 DataSheet4U.com
14 17 P02
P00 15 16 P01
Cautions 1. Connect the IC0 (internally connected) pin directly to the VSS pin.
2. Connect the AVDD pin to the VDD pin.
3. Connect the AVSS pin to the VSS pin.
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 1 GENERAL (µPD789104A, 789114A SUBSERIES)
The products in the 78K/0S Series are listed below. The names enclosed in boxes are subseries names.
Small, general-purpose
For ASSP
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 1 GENERAL (µPD789104A, 789114A SUBSERIES)
µPD789114A − 4 ch −
µPD789104A 4 ch −
µPD789446 6 ch −
µPD789436 − 6 ch 40 pins
µPD789426 6 ch −
µPD789306 −
µPD789327 − 1 ch 21 pins
µPD789860 Internal
EEPROM
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 1 GENERAL (µPD789104A, 789114A SUBSERIES)
TO20/TO80
/INTP1/P24 PORT1 P10, P11
16-bit TIMER 20
CPT20/INTP0
/SS20/P23
ANI0/P60 to
ANI3/P63
et4U.com AVDD A/D CONVERTER SYSTEM
RESET
DataShee
X1
CONTROL
AVSS X2
DataSheet4U.com
INTP0/CPT20
/P23/SS20
INTERRUPT
INTP1/TO80
CONTROL /TO20/P24
VDD VSS IC0
(VPP) INTP2/TI80/P25
Remarks 1. The size of the internal ROM varies depending on the product.
2. Items in parentheses apply to the µPD78F9116A.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 1 GENERAL (µPD789104A, 789114A SUBSERIES)
Minimum instruction execution time 0.4/1.6 µs (@5.0-MHz operation with system clock)
General registers 8 bits × 8 registers
Instruction set • 16-bit operations
• Bit manipulations (such as set, reset, and test)
Note Since the watchdog timer provides the watchdog timer function and interval timer function, select the one
out of two functions.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 1 GENERAL (µPD789104A, 789114A SUBSERIES)
1.9 Differences between Standard quality Grade Products and (A) Products
Table 1-1 shows the differences between the standard quality grade products (µPD789101A, 789102A, 789104A,
789111A, 789112A, 789114A) and (A) products (µPD789101A(A), 789102A(A), 789104A(A), 789111A(A), 789112A(A),
789114A(A)).
Table 1-1. Differences between Standard Quality Grade Products and (A) Products
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
2.1 Features
2.2 Applications
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 2 GENERAL (µPD789124A, 789134A SUBSERIES)
Please refer to “Quality Grades on NEC Semiconductor Devices” (Document No. C11531E) published by
NEC Corporation to know the specification of quality grade on the devices and its recommended applications.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 2 GENERAL (µPD789124A, 789134A SUBSERIES)
P23/INTP0/CPT20/SS20 1 30 P22/SI20/RXD20
P24/INTP1/TO80/TO20 2 29 P21/SO20/TXD20
P25/INTP2/TI80 3 28 P20/SCK20/ASCK20
AVDD 4 27 P11
P60/ANI0 5 26 P10
P61/ANI1 6 25 VDD
P62/ANI2 7 24 VSS
P63/ANI3 8 23 CL1
AVSS 9 22 CL2
IC0 10 21 IC0
P50 11 20 IC0 (VPP)
P51 12 19 RESET
Cautions 1. Connect the IC0 (internally connected) pin directly to the VSS pin.
2. Connect the AVDD pin to the VDD pin.
3. Connect the AVSS pin to the VSS pin.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 2 GENERAL (µPD789124A, 789134A SUBSERIES)
The products in the 78K/0S Series are listed below. The names enclosed in boxes are subseries names.
Small, general-purpose
78K/0S
series For driving LCD
For ASSP
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 2 GENERAL (µPD789124A, 789134A SUBSERIES)
µPD789114A − 4 ch −
µPD789104A 4 ch −
µPD789446 6 ch −
µPD789436 − 6 ch 40 pins
µPD789426 6 ch −
µPD789306 −
µPD789327 − 1 ch 21 pins
µPD789860 Internal
EEPROM
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 2 GENERAL (µPD789124A, 789134A SUBSERIES)
TO20/TO80
/INTP1/P24 PORT1 P10, P11
16-bit TIMER 20
CPT20/INTP0
/SS20/P23
ANI0/P60 to
ANI3/P63
RESET
et4U.com AVDD A/D CONVERTER SYSTEM
CL1 DataShee
CONTROL
AVSS CL2
DataSheet4U.com
INTP0/CPT20
/P23/SS20
INTERRUPT
INTP1/TO80
CONTROL /TO20/P24
VDD VSS IC0
(VPP)
INTP2/TI80/P25
Remarks 1. The size of the internal ROM varies depending on the product.
2. Items in parentheses apply to the µPD78F9136A.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 2 GENERAL (µPD789124A, 789134A SUBSERIES)
Minimum instruction execution time 0.5/2.0 µs (@4.0-MHz operation with system clock)
General registers 8 bits × 8 registers
Instruction set • 16-bit operations
• Bit manipulations (such as set, reset, and test)
Note Since the watchdog timer provides the watchdog timer function and interval timer function, select the one
out of two functions.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 2 GENERAL (µPD789124A, 789134A SUBSERIES)
2.9 Differences between Standard quality Grade Products and (A) Products
Table 2-1 shows the differences between the standard quality grade products (µPD789121A, 789122A, 789124A,
789131A, 789132A, 789134A) and (A) products (µPD789121A(A), 789122A(A), 789124A(A), 789131A(A), 789132A(A),
789134A(A)).
Table 2-1. Differences between Standard Quality Grade Products and (A) Products
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 3 PIN FUNCTIONS
INTP1 edge, falling edge, or both rising and falling edges) P24/TO80/TO20
INTP2 can be specified. P25/TI80
SI20 Input Serial data input to serial interface Input P22/RxD20
SO20 Output Serial data output from serial interface Input P21/TxD20
SCK20 Input/output Serial clock input/output for serial interface Input P20/ASCK20
ASCK20 Input Serial clock input to asynchronous serial interface Input P20/SCK20
TI80 Input External count clock input to 8-bit timer (TM80) Input P25/INTP2
TO80 Output 8-bit timer (TM80) output Input P24/INTP1/TO20
TO20 Output 16-bit timer (TM20) output Input P24/INTP1/TO80
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 3 PIN FUNCTIONS
(a) TI80
This is the external clock input pin for 8-bit timer/event counter 80.
(c) CPT20
This is the input pin of the capture edge.
(f) SCK20
These are the serial clock I/O pins of the serial interface.
(g) SS20
This is the chip select input pin of the serial interface.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 3 PIN FUNCTIONS
(i) ASCK20
This is the serial clock input pin of the asynchronous serial interface.
Caution When using these pins as serial interface pins, the input/output mode and output latch must be
set according to the functions to be used. For the details of the setting, refer to Table 13-2 Serial
Interface 20 Operating Mode Settings.
3.2.9 AVDD
Analog power supply pin of the A/D converter. Always use the same potential as that of the VDD pin even when
the A/D converter is not used.
3.2.10 AVSS
This is a ground potential pin of the A/D converter. Always use the same potential as that of the VSS pin even
when the A/D converter is not used.
3.2.11 VDD
Positive power supply pin
3.2.12 VSS
Ground pin
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 3 PIN FUNCTIONS
Keep short
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 3 PIN FUNCTIONS
The input/output circuit type for each pin and the recommended connection of pins are shown in Table 3-1.
For the input/output circuit configuration of each type, refer to Figure 3-1.
Table 3-1. Types of Pin Input/Output Circuits and Recommended Connection of Unused Pins
Pin Name Input/Output Circuit Type Input/Output Recommended Connection of Unused Pins
P00 to P03 5-A Input/output Input: Independently connect these pins to VDD or
P10, P11 VSS via a resistor.
Output: Leave open
P20/SCK20/ASCK20 8-A
P21/SO20/TxD20
P22/SI20/RxD20
P23/INTP0/CPT20/SS20 Input: Independently connect these pins to VSS via
P24/INTP1/TO80/TO20 a resistor.
Output: Leave open
P25/INTP2/TI80
P50 to P53 13-W Input: Independently connect these pins to VDD via a
(Mask ROM version) resistor.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 3 PIN FUNCTIONS
P-ch Comparator
IN +
N-ch –
IN
AVSS
VREF
(Threshold voltage)
Pull-up
P-ch IN/OUT
enable
Output data
VDD N-ch
Output disable
Input
enable
IN/OUT VSS
Output N-ch Input enable
disable
VSS
Middle-voltage input buffer
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The µPD789104A/114A/124A/134A Subseries can access 64 Kbytes of memory space. Figures 4-1 through 4-
4 show the memory maps.
FFFFH
FF00H
FEFFH
FE00H
et4U.com FDFFH
DataShee
DataSheet4U.com
Reserved
Data
memory space
07FFH
0800H
07FFH
Program area
Program 0080H
Internal ROM
memory space 2,048 × 8 bits 007FH
CALLT table area
0040H
003FH
Program area
0016H
0015H
Vector table area
0000H 0000H
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
FFFFH
FF00H
FEFFH
FE00H
FDFFH
Reserved
Data
memory space
0FFFH
1000H
0FFFH
Program area
et4U.com DataShee
Internal ROMDataSheet4U.com
Program 0080H
memory space 4,096 × 8 bits 007FH
CALLT table area
0040H
003FH
Program area
0016H
0015H
Vector table area
0000H 0000H
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
FFFFH
FF00H
FEFFH
FE00H
FDFFH
Reserved
Data
memory space
1FFFH
2000H
1FFFH
Program area
et4U.com DataShee
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
FFFFH
FF00H
FEFFH
FE00H
FDFFH
Reserved
Data
memory space
3FFFH
4000H
3FFFH
Program area
et4U.com DataShee
0080H
Program Flash memoryDataSheet4U.com
memory space 16,384 × 8 bits 007FH
CALLT table area
0040H
003FH
Program area
0016H
0015H
Vector table area
0000H 0000H
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
The following areas are allocated to the internal program memory space:
Vector Table Address Interrupt Request Vector Table Address Interrupt Request
0000H RESET input 000CH INTSR20/INTCSI20
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
FFFFH
FF00H
et4U.com FEFFH DataShee
DataSheet4U.com Short direct
Internal high-speed RAM
addressing
256 × 8 bits
FE20H
FE1FH
FE00H
FDFFH Direct addressing
Register indirect
addressing
Based addressing
Reserved
0800H
07FFH
Internal ROM
2,048 × 8 bits
0000H
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
FFFFH
FF00H
FEFFH
Short direct
Internal high-speed RAM
addressing
256 × 8 bits
FE20H
FE1FH
FE00H
FDFFH Direct addressing
Register indirect
addressing
Based addressing
Reserved
et4U.com DataShee
DataSheet4U.com
1000H
0FFFH
Internal ROM
4,096 × 8 bits
0000H
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
FFFFH
FF00H
FEFFH
Short direct
Internal high-speed RAM
addressing
256 × 8 bits
FE20H
FE1FH
FE00H
FDFFH
Direct addressing
Register indirect
addressing
Based addressing
Reserved
et4U.com DataShee
DataSheet4U.com
2000H
1FFFH
Internal ROM
8,192 × 8 bits
0000H
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
FFFFH
FF00H
FEFFH
Short direct
Internal high-speed RAM
addressing
256 × 8 bits
FE20H
FE1FH
FE00H
FDFFH
Direct addressing
Register indirect
addressing
Based addressing
Reserved
et4U.com DataShee
DataSheet4U.com
4000H
3FFFH
Flash memory
16,384 × 8 bits
0000H
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
15 0
PC PC15 PC14 PC13 PC12 PC11 PC10 PC9 PC8 PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0
7 0
PSW IE Z 0 AC 0 0 1 CY
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
15 0
SP SP15 SP14 SP13 SP12 SP11 SP10 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 (restore)
from the stack memory.
Each stack operation saves/restores data as shown in Figures 4-12 and 4-13.
Caution Since RESET input makes the SP contents undefined, be sure to initialize the SP before
instruction execution.
SP SP _ 2 SP SP _ 2
DataSheet4U.com SP _ 3 PC7 to PC0
Register pair
SP _ 2 SP _ 2 PC7 to PC0 SP _ 2 PC15 to PC8
lower
Register pair
SP _ 1 SP _ 1 PC15 to PC8 SP _ 1 PSW
higher
SP SP SP
Register pair
SP SP PC7 to PC0 SP PC7 to PC0
lower
Register pair
SP + 1 SP + 1 PC15 to PC8 SP + 1 PC15 to PC8
higher
SP SP + 2 SP SP + 2 SP + 2 PSW
SP SP + 3
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
R7
RP3
R6
R5
RP2
R4
R3
RP1
R2
et4U.com R1
DataShee
RP0
R0
DataSheet4U.com
15 0 7 0
H
HL
L
D
DE
E
B
BC
C
A
AX
X
15 0 7 0
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
• 1-bit manipulation
A symbol reserved by assembler is described as the operand (sfr.bit) of a 1-bit manipulation instruction. This
manipulation can also be specified with an address.
• 8-bit manipulation
A symbol reserved by assembler is described as the operand (sfr) of an 8-bit manipulation instruction. This
manipulation can also be specified with an address.
• 16-bit manipulation
A symbol reserved by assembler is described as the operand of a 16-bit manipulation instruction. When
specifying an address, describe an even address.
Table 4-3 lists the special function registers. The meanings of the symbols in this table are as follows:
et4U.com • Symbol
DataShee
Indicates the addresses of the implemented special function registers. The symbols shown in this column are
DataSheet4U.com
the reserved words of the assembler, and have already been defined in the header file called “sfrbit.h” of the
C compiler. Therefore, these symbols can be used as instruction operands if assembler or integrated debugger
is used.
• R/W
Indicates whether the special function register in question can be read or written.
R/W: Read/write
R: Read only
W: Write only
• After reset
Indicates the status of the special function register when the RESET signal is input.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
Address Special Function Register (SFR) Name Symbol R/W Bit Units for Manipulation After Reset
1 bit 8 bits 16 bits
FF05H Port 5 P5 √ √ —
FF06H Port 6 P6 R √ √ —
FF10H 16-bit multiplication result storage register 0 MUL0L MUL0 — √ Note 1 √ Note 2 Undefined
FF11H MUL0H
FF14H A/D conversion result register Note 3 ADCR0 — √ √ Note 2
FF15H
FF19H TM20H
FF1AH 16-bit capture register 20 TCP20L TCP20 — √ Note 1 √ Note 2 Undefined
FF1BH TCP20H
Notes 1. Although these registers are usually accessed in 16-bit units, they can also be accessed in 8-bit units.
Access these registers in 8-bit units by means of direct addressing.
2. These registers can be accessed in 16-bit units only by means of short direct addressing.
3. When this register is used as an 8-bit A/D converter (µPD789104A and 789124A Subseries), it can
be accessed only in 8-bit units. At this time, the register address is FF15H. When this register is used
as a 10-bit A/D converter (µPD789114A and 789134A Subseries), it can be accessed only in 16-bit
units. When using the µPD78F9116A as the flash memory version of the µPD789101A, 789102A,
or 789104A, or when using the µPD78F9136A as the flash memory version of the µPD789121A,
789122A, or 789124A, this register can be accessed in 8-bit units. However, only the object file
assembled with the µPD789101A, 789102A, or 789104A, or object file assembled with the µPD789121A,
789122A, or 789124A can be used.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
Address Special Function Register (SFR) Name Symbol R/W Bit Units for Manipulation After Reset
1 bit 8 bits 16 bits
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
An instruction address is determined by the program counter (PC) contents. The PC contents are 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 each instruction, refer to 78K/0S Series User’s
Manual Instruction (U11047E)).
[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, the range of branch in relative addressing is between –128 and +127 of the start address of
the following instruction.
This function is carried out when the “BR $addr16” instruction or a conditional branch instruction is executed.
[Illustration]
15 0
... PC is the start address of
et4U.com PC
the next instruction of DataShee
a BR instruction.
+
DataSheet4U.com
15 8 7 6 0
α S
jdisp8
15 0
PC
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
[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 and BR !addr16” instructions are executed.
CALL !addr16 and BR !addr16 instructions can branch to all the memory spaces.
[Illustration]
In case of CALL !addr16, BR !addr16 instruction
7 0
CALL or BR
Low Addr.
High Addr.
15 8 7 0
PC
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
[Function]
Table contents (branch destination address) of the particular location to be addressed by the lower 5-bit
immediate data of an instruction code from bit 1 to bit 5 are transferred to the program counter (PC) and
branched.
Table indirect addressing is carried out when the CALLT [addr5] instruction is executed. This instruction can
refer to the address stored in the memory table 40H to 7FH and branch to all the memory spaces.
[Illustration]
7 6 5 1 0
15 8 7 6 5 1 0
Effective address 0 0 0 0 0 0 0 0 0 1 0
7 Memory (Table) 0
Low Addr.
15 8 7 0
PC
[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]
7 0 7 0
rp A X
15 8 7 0
PC
DataSheet4U.com
DataShe4
e tU . c o m
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
The following various methods are available to specify the register and memory (addressing) which undergo
manipulation during instruction execution.
[Function]
The memory indicated by immediate data in an instruction word is directly addressed.
[Operand format]
Identifier Description
addr16 Label or 16-bit immediate data
[Description example]
MOV A, !FE00H; When setting !addr16 to FE00H
0 0 0 0 0 0 0 0 00H
et4U.com 1 1 1 1 1 1 1 0 FEH
DataShee
DataSheet4U.com
[Illustration]
7 0
OP code
addr16 (low)
addr16 (high)
Memory
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
[Function]
The memory to be manipulated in the fixed space is directly addressed with 8-bit data in an instruction word.
The fixed space where this addressing is applied to is the 256-byte space FE20H to FF1FH. An internal high-
speed RAM and a special function register (SFR) 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 all SFR areas. In this
area, ports which are frequently accessed in a program and a compare register of the timer/event counter are
mapped, and these SFRs can 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 [Illustration].
[Operand format]
Identifier Description
saddr Label or FE20H to FF1FH immediate data
[Description example]
MOV FE90H, #50H; When setting saddr to FE90H and the immediate data to 50H
[Illustration]
7 0
OP code
saddr-offset
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
[Function]
Memory-mapped special function registers (SFRs) are 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, SFRs
mapped at FF00H to FF1FH can be accessed with short direct addressing.
[Operand format]
Identifier Description
[Description example]
MOV PM0, A; When selecting PM0 for sfr
Instruction code 1 1 1 0 0 1 1 1
0 0 1 0 0 0 0 0
[Illustration]
et4U.com DataShee
7 0
OP code DataSheet4U.com
sfr-offset
SFR
15 8 7 0
Effective
1 1 1 1 1 1 1 1
address
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
[Function]
General registers are accessed as operands. The general register to be accessed is specified with the register
specify code and functional name in the instruction 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 instruction 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 with 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 the C register for r
Instruction code 0 0 0 0 1 0 1 0
et4U.com 0 0 1 0 0 1 0 1 DataShee
DataSheet4U.com
Register specify code
Instruction code 1 0 0 0 1 0 0 0
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
[Function]
The memory is addressed with the contents of the register pair specified as an operand. The register pair
to be accessed is specified with the register pair specify code in the instruction code. This addressing can
be carried out for all the memory spaces.
[Operand format]
Identifier Description
— [DE], [HL]
[Description example]
MOV A, [DE]; When selecting register pair [DE]
Instruction code 0 0 1 0 1 0 1 1
[Illustration]
15 8 7 0
DE D E
et4U.com Memory address specified DataShee
7 0 by register pair DE
DataSheet4U.com
The contents of addressed
memory are transferred
7 0
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 4 CPU ARCHITECTURE
[Function]
8-bit immediate data is added to the contents of the base register, that is, the HL register pair, 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
Instruction code 0 0 1 0 1 1 0 1
0 0 0 1 0 0 0 0
[Description example]
In the case of PUSH DE
Instruction code 1 0 1 0 1 0 1 0
DataSheet4U.com
D a t a S h e4eU
t .com
www.DataSheet4U.com
[MEMO]
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The µPD789104A/114A/124A/134A Subseries provides the ports shown in Figure 5-1, enabling various methods
of control.
Numerous other functions are provided that can be used in addition to the digital I/O port function. For more
information on these additional functions, refer to CHAPTER 3 PIN FUNCTIONS.
P50 P00
Port 5 Port 0
P53 P03
P60 P10
P11 Port 1
Port 6
P63
P20
Port 2
et4U.com P25
DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
Parameter Configuration
Control register Port mode register (PMm: m = 0 to 2, 5)
Pull-up resistor option register 0 (PU0)
Pull-up option register B2 (PUB2)
Port Total: 20 (input: 7, input/output: 16)
5.2.1 Port 0
This is a 4-bit I/O port with output latches. Port 0 can be specified as input or output mode in 1-bit units by using
port mode register 0 (PM0). When pins P00 to P03 are used as input port pins, on-chip pull-up resistors can be
connected in 4-bit units by using pull-up resistor option register 0 (PU0).
RESET input sets port 0 to input mode.
Figure 5-2 shows the block diagram of port 0.
et4U.com DataShee
Figure 5-2. Block Diagram of P00 to P03
DataSheet4U.com
VDD
WRPU0
PU00
P-ch
RD
Selector
Internal bus
WRPORT
Output latch
P00 to P03
(P00 to P03)
WRPM
PM00 to PM03
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
5.2.2 Port 1
This is a 2-bit I/O port with output latches. Port 1 can be specified as input or output mode in 1-bit units by using
port mode register 1 (PM1). When pins P10 and P11 are used as input port pins, on-chip pull-up resistors can be
connected in 2-bit units by using pull-up resistor option register 0 (PU0).
RESET input sets port 1 to input mode.
Figure 5-3 shows the block diagram of port 1.
VDD
WRPU0
PU01
P-ch
RD
Selector
Internal bus
WRPORT
Output latch
P10, P11
(P10, P11)
et4U.com WRPM DataShee
DataSheet4U.com
PM10, PM11
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
5.2.3 Port 2
This is a 6-bit I/O port with output latches. Port 2 can be specified as input or output mode in 1-bit units by using
port mode register 2 (PM2). Use of on-chip pull-up resistors can be specified for pins P20 to P25 in 1-bit units by
using pull-up resistor option register B2 (PUB2).
The port is also used as a serial interface I/O, clock I/O, timer I/O, and external i;Derrupt input.
RESET input sets port 2 to input mode.
Figures 5-4 through 5-7 show block diagrams of port 2.
Caution When using the pins of port 2 as the serial interface, the I/O or output latch must be set according
to the function to be used. For how to set the latches, see Table 13-2 Serial Interface 20 Operating
Mode Settings.
VDD
WRPUB2
PUB20 P-ch
Alternate
function
et4U.com DataShee
RD
DataSheet4U.com
Selector
Internal bus
WRPORT
Output latch
(P20) P20/ASCK20/
SCK20
WRPM
PM20
Alternate
function
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
VDD
WRPUB2
PUB21 P-ch
RD
Selector
Internal bus
WRPORT
Output latch
(P21) P21/TxD20/
SO20
WRPM
PM21
et4U.com DataShee
Alternate
function DataSheet4U.com
Serial output
enable signal
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
VDD
WRPUB2
PUB22, PUB23,
P-ch
PUB25
Alternate
function
RD
Selector
Internal bus
WRPORT
Output latch
P22/RxD20/SI20
(P22, P23, P25)
P23/INTP0/CPT20/
WRPM SS20
P25/INTP2/TI80
PM22, PM23,
PM25
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
VDD
WRPUB2
PUB24 P-ch
Alternate
function
RD
Selector
P24/INTP1/
TO80/TO20
Internal bus
WRPORT
Output latch
(P24)
WRPM
PM24
Alternate
et4U.com function
DataShee
Alternate DataSheet4U.com
function
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
5.2.4 Port 5
This is a 4-bit N-ch open-drain I/O port with output latches. Port 5 can be specified as input or output mode in
1-bit units by using port mode register 5 (PM5). For a mask ROM version, whether a pull-up resistor is to be
incorporated can be specified by the mask option.
RESET input sets port 5 to input mode.
Figure 5-8 shows a block diagram of port 5.
RD VDD
Selector
P50 to P53
Internal bus
WRPORT
Output latch
(P50 to P53) N-ch
et4U.com DataShee
WRPM
DataSheet4U.com
PM50 to PM53
Caution When using port 5 of µPD78F9116A and 78F9136A as an input port, be sure to observe the
restrictions listed below.
If the above restrictions are not observed, the input value may be read incorrectly.
Note, however, that these resrictions do not apply when port 5 pins are used as output pins, or
DataSheet4U.com when the product is other than µPD78F9116A or 78F9136A.
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
5.2.5 Port 6
This is a 4-bit input port.
The port is also used as an analog input to the A/D converter.
RESET input sets port 6 to input mode.
Figure 5-9 shows a block diagram of port 6.
RD
Internal bus
+ P60/ANI0 to P63/ANI3
A/D converter
et4U.com –
DataShee
DataSheet4U.com
VREF
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
Caution As port 2 has an alternate function as external interrupt input, when the port function output
mode is specified and the output level is changed, the interrupt request flag is set. When
the output mode is used, therefore, the interrupt mask flag should be set to 1 beforehand.
Table 5-3. Port Mode Register and Output Latch Settings When Using Alternate Functions
Caution When Port 2 is used for serial interface pin, the I/O latch or output latch must be set according
to its function. For the setting method, refer to Table 13-2 Serial Interface 20 Operating Mode
Settings.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
PM2 1 1 PM25 PM24 PM23 PM22 PM21 PM20 FF22H FFH R/W
Symbol 7 6 <5> <4> <3> <2> <1> <0> Address After reset R/W
PUB2 0 0 PUB25 PUB24 PUB23 PUB22 PUB21 PUB20 FF32H 00H R/W
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
The operation of a port differs depending on whether the port is set in input or output mode, as described below.
Caution A 1-bit memory manipulation instruction is executed to manipulate 1 bit of a port. However,
this instruction accesses the port in 8-bit units. When this instruction is executed to
manipulate a bit of an input/output port, therefore, the contents of the output latch of the pin
that is set in the input mode and not subject to manipulation become undefined.
Caution When using port 5 of µPD78F9116A and 78F9136A as an input port, be sure to observe the
restrictions listed below.
If the above restrictions are not observed, the input value may be read incorrectly.
Note, however, that these resrictions do not apply when port 5 pins are used as output pins, or
when the product is other than µPD78F9116A or 78F9136A.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 5 PORT FUNCTIONS
Caution A 1-bit memory manipulation instruction is executed to manipulate 1 bit of a port. However,
this instruction accesses the port in 8-bit units. When this instruction is executed to
manipulate a bit of an input/output port, therefore, the contents of the output latch of the pin
that is set in the input mode and not subject to manipulation become undefined.
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The clock generator generates the clock to be supplied to the CPU and peripheral hardware.
The system clock oscillator is the following type.
Item Configuration
et4U.com DataShee
Figure 6-1. Block Diagram of Clock Generator
DataSheet4U.com
Prescaler
Clock to peripheral
X1 hardware
System clock Prescaler
X2 oscillator fX
fX
22
Selector
Standby
STOP Wait control
control CPU clock (fCPU)
circuit
circuit
PCC1
Internal bus
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 6 CLOCK GENERATOR (µPD789104A, 789114A SUBSERIES)
0 fX (0.2 µ s)
1 fX/22 (0.8 µ s)
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 6 CLOCK GENERATOR (µPD789104A, 789114A SUBSERIES)
VSS External
X1 clock X1
Open X2
X2
Crystal
or
ceramic resonator
Caution When using the system clock oscillator, wire as follows in the area enclosed by the broken lines
et4U.com in the above figures to avoid an adverse effect from wiring capacitance.
DataShee
• DataSheet4U.com
Keep the wiring length as short as possible.
• Do not cross the wiring with the other signal lines. Do not route the wiring near a signal
line through which a high fluctuating current flows.
• Always make the ground point of the oscillator capacitor the same potential as VSS. Do
not ground the capacitor to a ground pattern through which a high current flows.
• Do not fetch signals from the oscillator.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 6 CLOCK GENERATOR (µPD789104A, 789114A SUBSERIES)
PORTn
(n = 0 to 2, 5, 6)
VSS X1 X2 VSS X1 X2
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 6 CLOCK GENERATOR (µPD789104A, 789114A SUBSERIES)
(c) Wiring near high fluctuating current (d) Current flowing through ground line of
oscillator (potential at points A, B, and
C fluctuates)
VDD
Pmn
VSS X1 X2
VSS X1 X2
High current
A B C
High current
et4U.com DataShee
(e) Signal is fetched
DataSheet4U.com
VSS X1 X2
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 6 CLOCK GENERATOR (µPD789104A, 789114A SUBSERIES)
6.4.2 Divider
The divider divides the output of the system clock oscillator (fX) to generate various clocks.
The clock generator generates the following clocks and controls the operating modes of the CPU, such as the
standby mode:
• System clock fX
• CPU clock fCPU
• Clock to peripheral hardware
The operation of the clock generator is determined by the processor clock control register (PCC), as follows:
(a) The slow mode 2fCPU (1.6 µs: at 5.0-MHz operation) of the system clock is selected when the RESET signal
is generated (PCC = 02H). While a low level is input to the RESET pin, oscillation of the system clock is
stopped.
(b) Two types of CPU clocks fCPU (0.2 µs and 0.8 µs: at 5.0-MHz operation) can be selected by the PCC setting.
et4U.com (d) The clock to the peripheral hardware is supplied by dividing the system clock. The other peripheral
DataShee
hardware is stopped when the system clock is stopped (except the external clock input operation).
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 6 CLOCK GENERATOR (µPD789104A, 789114A SUBSERIES)
0 4 clocks
1 2 clocks
RESET
CPU clock
Slow Fastest
operation operation
<1> The CPU is reset when the RESET pin is made low on power application. The effect of resetting is released
when the RESET pin is later made high, and the system clock starts oscillating. At this time, the time during
which oscillation stabilizes (215/fX) is automatically secured.
After that, the CPU starts instruction execution at the low speed of the system clock (1.6 µs: at 5.0-MHz
operation).
<2> After the time during which the VDD voltage rises to the level at which the CPU can operate at the highest
speed has elapsed, the processor clock control register (PCC) is rewritten so that the highest speed can
be selected.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The clock generator generates the clock to be supplied to the CPU and peripheral hardware. The system clock
oscillator consists of the following type.
Item Configuration
et4U.com DataShee
Figure 7-1. Block Diagram of Clock Generator
DataSheet4U.com
Prescaler
Clock to peripheral
CL1 hardware
System clock Prescaler
CL2 oscillator fCC
fCC
22
Selector
Standby
STOP Wait control
control CPU clock (fCPU)
circuit
circuit
PCC1
Internal bus
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 7 CLOCK GENERATOR (µPD789124A, 789134A SUBSERIES)
0 fCC (0.25 µ s)
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 7 CLOCK GENERATOR (µPD789124A, 789134A SUBSERIES)
External CL1
CL1
clock
C R
CL2 Open CL2
VSS
Caution When using the system clock oscillator, wire as follows in the area enclosed by the broken lines
et4U.com in the above figures to avoid an adverse effect from wiring capacitance.
DataShee
• DataSheet4U.com
Keep the wiring length as short as possible.
• Do not cross the wiring with the other signal lines. Do not route the wiring near a signal
line through which a high fluctuating current flows.
• Always make the ground point of the oscillator capacitor the same potential as VSS. Do
not ground the capacitor to a ground pattern through which a high current flows.
• Do not fetch signals from the oscillator.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 7 CLOCK GENERATOR (µPD789124A, 789134A SUBSERIES)
PORTn
(n = 0 to 2, 5, 6)
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 7 CLOCK GENERATOR (µPD789124A, 789134A SUBSERIES)
(c) Wiring near high fluctuating current (d) Current flowing through ground line of
oscillator (potential at points A and B
fluctuates)
VDD
PORTn
(n = 0 to 2, 5, 6)
A B
High current
et4U.com DataShee
(e) Signal is fetched
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 7 CLOCK GENERATOR (µPD789124A, 789134A SUBSERIES)
7.4.2 Divider
The divider divides the output of the system clock oscillator (fCC) to generate various clocks.
The clock generator generates the following clocks and controls the operating modes of the CPU, such as the
standby mode:
The operation of the clock generator is determined by the processor clock control register (PCC), as follows:
(a) The slow mode 2fCPU (2.0 µs: at 4.0-MHz operation) of the system clock is selected when the RESET signal
is generated (PCC = 02H). While a low level is input to the RESET pin, oscillation of the system clock is
stopped.
(b) Two types of CPU clocks fCPU (0.5 µs and 1.0 µs: at 4.0-MHz operation) can be selected by the PCC setting.
et4U.com (d) The clock to the peripheral hardware is supplied by dividing the system clock. The other peripheral
DataShee
hardware is stopped when the system clock is stopped (except the external clock input operation).
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 7 CLOCK GENERATOR (µPD789124A, 789134A SUBSERIES)
0 4 clocks
1 2 clocks
RESET
CPU clock
Slow Fastest
operation operation
<1> The CPU is reset when the RESET pin is made low on power application. The effect of resetting is released
when the RESET pin is later made high, and the system clock starts oscillating. At this time, the time during
which oscillation stabilizes (27/fCC) is automatically secured.
After that, the CPU starts instruction execution at the low speed of the system clock (2.0 µs: at 4.0-MHz
operation).
<2> After the time during which the VDD voltage rises to the level at which the CPU can operate at the highest
speed has elapsed, the processor clock control register (PCC) is rewritten so that the highest speed can
be selected.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The 16-bit timer counter references the free running counter and provides the functions such as timer interrupt
and timer output. In addition, the count value can be captured by a trigger pin.
• Timer interrupt
• Timer output
• Count value capture
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 8 16-BIT TIMER 20
Item Configuration
Timer counter 16 bits × 1 (TM20)
Register Compare register: 16 bits × 1 (CR20)
Capture register: 16 bits × 1 (TCP20)
Timer output 1 (TO20)
Control register 16-bit timer mode control register 20 (TMC20)
Port mode register 2 (PM2)
Internal bus
16-bit timer mode
control register 20
(TMC20)
P24
TOF20 CPT201CPT200 TOC20 TCL201TCL200 TOE20 output latch PM24
et4U.com DataShee
F/F TO20/P24/
DataSheet4U.comTOD20
16-bit compare register 20 (CR20) INTP1/TO80
16-bit timer mode
Match control register 20
INTTM20
2
fCLK/2
Selector
OVF
16-bit timer counter 20 (TM20)
fCLK/26
Internal bus
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 8 16-BIT TIMER 20
Cautions 1. Although this register is manipulated with a 16-bit memory manipulation instruction, an
8-bit memory manipulation instruction can be used. When manipulated with an 8-bit
memory manipulation instruction, the accessing method should be direct addressing.
2. When rewriting CR20 during count operation, set CR20 to interrupt disable from interrupt
mask flag register 0 (MK10) beforehand. Also, set the timer output data to inversion
disable using 16-bit timer mode control register 20 (TMC20).
When CR20 is rewritten in the interrupt-enabled state, an interrupt request may occur
at the moment of rewrite.
Cautions 1. The count value after releasing stop becomes undefined because the count operation
et4U.com is executed during the oscillation stabilization time.
DataShee
2. Although this register is manipulated with a 16-bit memory manipulation instruction, an
DataSheet4U.com
8-bit memory manipulation instruction can be used. When manipulated with an 8-bit
memory manipulation instruction, the accessing method should be direct addressing.
3. When manipulated with an 8-bit memory manipulation instruction, readout should be
performed in the order from lower byte to higher byte and must be in pairs.
Caution Although this register is manipulated with a 16-bit memory manipulation instruction, an 8-
bit memory manipulation instruction can be used. When manipulated with an 8-bit memory
manipulation instruction, the accessing method should be direct addressing.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 8 16-BIT TIMER 20
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 8 16-BIT TIMER 20
0 Timer output of 0
1 Timer output of 1
et4U.com DataShee
TOC20 Timer output data inverse control
DataSheet4U.com
0 Inverse disabled
1 Inverse enabled
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 8 16-BIT TIMER 20
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 8 16-BIT TIMER 20
In the timer interrupt function, interrupts are repeatedly generated at the count value set to 16-bit compare register
20 (CR20) in advance based on the intervals of the value set in TCL201 and TCL200.
To operate the 16-bit timer 20 as a timer interrupt, the following settings are required.
• Set count values to CR20
• Set 16-bit timer mode control counter 20 (TMC20) as shown in Figure 8-4.
Figure 8-4. Settings of 16-Bit Timer Mode Control Register 20 at Timer Interrupt Operation
Caution If both the CPT201 and CPT200 flags are set to 0, the capture edge becomes setting prohibited.
When the count value of 16-bit timer counter 20 (TM20) coincides with the value set to CR20, counting of TM20
continues and an interrupt request signal (INTTM20) is generated.
Table 8-3 shows the interval time, and Figure 8-5 shows the timing of the timer interrupt operation.
et4U.com DataShee
Caution When rewriting CR20 during count operation, be sure to follow the procedure below.
<1> DataSheet4U.com
Set CR20 to interrupt disable (by setting bit 7 of interrupt mask flag register 0 (MK0) to 1).
<2> Set inversion control of timer output data to disable (TOC20 = 0)
When CR20 is rewritten in the interrupt-enabled state, an interrupt request may occur at the
moment of rewrite.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 8 16-BIT TIMER 20
Count clock
CR20 N N N N N
INTTM20
TO20
TOF20
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 8 16-BIT TIMER 20
Figure 8-6. Settings of 16-Bit Timer Mode Control Register 20 at Timer Output Operation
Caution If both CPT201 flag and CPT200 flag are set to 0, the capture edge becomes operation prohibited.
When the count value of the 16-bit timer counter 20 (TM20) matches the value set in CR20, the output status of
the TO20/P24/INTP1/TO80 pin is inverted. This enables timer output. At that time, TM20 count is continued and
et4U.com an interrupt request signal (INTTM20) is generated.
DataShee
Figure 8-7 shows the timing of timer output (see Table 8-2 for the interval time of the 16-bit timer 20).
DataSheet4U.com
Figure 8-7. Timer Output Timing
Count clock
CR20 N N N N N
INTTM20
TO20Note
TOF20
Note The TO20 initial value becomes low level during output enable (TOE20 = 1).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 8 16-BIT TIMER 20
Figure 8-8. Settings of 16-Bit Timer Mode Control Register 20 at Capture Operation
16-bit capture register 20 (TCP20) starts the capture operation after the CPT20 capture trigger edge has been
detected, and latches and retains the count value of 16-bit timer counter 20. TCP20 fetches the count value within
2 clocks and retains the count value until the next capture edge detection.
Table 8-3 and Figure 8-9 show the setting contents of the capture edge and capture operation timing, respectively.
Caution Because TCP20 is rewritten when a capture trigger edge is detected during TCP20 read, disable
the capture trigger detection during TCP20 read.
Figure 8-9. Capture Operation Timing (Both Edges of CPT20 Pin Are Specified)
Count clock
TCP20 Undefined N M
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 8 16-BIT TIMER 20
Cautions 1. The count value after releasing stop becomes undefined because the count operation is
executed during oscillation stabilization time.
2. Although TM20 is a dedicated 16-bit transfer instruction register, an 8-bit transfer instruction
can be used.
Execute an 8-bit transfer instruction by direct addressing.
3. When using an 8-bit transfer instruction, execute in the order from lower byte to higher byte
in pairs. If the only lower byte is read, the pending state of the counter read buffer is not
canceled, and if the only higher byte is read, an undefined count value is read.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The 8-bit timer/event counter can be used as an interval timer, external event counter, and for square wave output
and PWM output of arbitrary frequency.
• Interval timer
• External event counter
• Square wave output
• PWM output
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
Item Configuration
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
Internal bus
Match
INTTM80
TO20
fCLK output Note
Clear
Selector
et4U.com DataShee
Note Refer to block diagram of 16-bit timer 20
DataSheet4U.com
Remark fCLK: fX or fCC
Cautions 1. When rewriting CR80 in timer counter operation mode (i.e. PWME80 (bit 6 of 8-bit timer
mode control register 80 (TMC80) is set to 0), be sure to stop the timer operation before
hand. If CR80 is rewritten in the timer operation-enabled state, a match interrupt request
signal may occur at the moment of rewrite.
2. Do not set CR80 to 00H in the PWM output mode (when PWME80 = 1); otherwise, PWM
may not be output normally.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
The following two types of registers are used to control the 8-bit timer/event counter 80.
1 Operation enable
et4U.com DataShee
PWME80 Operation mode selection
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
<1> Set 8-bit timer counter 80 (TM80) to operation disable (by setting TCE80 (bit 7 of 8-bit timer mode control
register 80 (TMC80)) to 0).
<2> Set the count clock of the 8-bit timer/event counter 80 (see Tables 9-4 and 9-5)
<3> Set the count value to CR80
<4> Set TM80 to operation enable (TCE80 = 1)
When the count value of 8-bit timer counter 80 (TM80) matches the value set to CR80, the value of TM80 is cleared
to 0 and TM80 continue counting. At the same time, an interrupt request signal (INTTM80) is generated.
Tables 9-4 and 9-5 show the interval time, and Figure 9-4 shows the timing of interval timer operation.
Cautions 1. Before rewriting CR80, stop the timer operation once. If CR80 is rewritten in the timer
operation-enabled state, a match interrupt request signal may occur at the moment of rewrite.
2. If the count clock setting and TM80 operation-enabled are set in TMC80 simultaneously using
an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may
occur after the timer starts.
et4U.com Therefore, always follow the above procedure when operating the 8-bit timer/event counter
DataShee
as an interval timer.
DataSheet4U.com
Table 9-4. Interval Time of 8-Bit Timer/Event Counter 80 (At fX = 5.0-MHz Operation)
1 0 TI80 input cycle 28 × TI80 input cycle TI80 input edge cycle
1 1 TI80 input cycle 28 × TI80 input cycle TI80 input edge cycle
Table 9-5. Interval Time of 8-Bit Timer/Event Counter 80 (At fCC = 4.0-MHz Operation)
1 0 TI80 input cycle 28 × TI80 input cycle TI80 input edge cycle
1 1 TI80 input cycle 2 × TI80 input cycle
8
TI80 input edge cycle
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
Count clock
Clear Clear
CR80 N N N N
TCE80
Count start
INTTM80
TO80
DataSheet4U.com
D a t 4
a US
. ch oe m
e t
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
Each time the valid edge specified by bit 1 (TCL800) of TMC80 is input, the value of 8-bit timer counter 80 (TM80)
is incremented.
When the count value of TM80 matches the value set to CR80, the value of TM80 is cleared to 0 and TM80 continues
counting. At the same time, an interrupt request signal (INTTM80) is generated.
Figure 9-5 shows the timing of the external event counter operation (with rising edge specified).
Cautions 1. Before rewriting CR80, stop the timer operation once. If CR80 is rewritten in the timer
operation-enabled state, a match interrupt request signal may occur at the moment of rewrite.
2. If the count clock setting and TM80 operation-enabled are set in TMC80 simultaneously using
et4U.com an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may
DataShee
occur after the timer starts.
DataSheet4U.com
Therefore, always follow the above procedure when operating the 8-bit timer/event counter
as an interval timer.
Figure 9-5. External Event Counter Operation Timing (with Rising Edge Specified)
TM80 count value 00H 01H 02H 03H 04H 05H N–1 N 00H 01H 02H 03H
CR80 N
TCE80
INTTM80
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
<1> Set P24 to output mode (PM24 = 0) and the P24 output latch to 0.
<2> Set 8-bit timer counter 80 (TM80) to operation disable (TCE80 = 0).
<3> Set the count clock of the 8-bit timer/event counter 80 (see Tables 9-4 and 9-5), TO80 to output enable
(TOE80 = 1), and PWM output to disable (PWME80 = 0).
<4> Set the count value to CR80.
<5> Set TM80 to operation enable (TCE80 = 1).
When the count value of 8-bit timer counter 80 (TM80) matches the value set in CR80, the TO80/P24/INTP1/TO20
pin output will be inverted. Through application of this mechanism, square waves of any frequency can be output.
As soon as a match occurs, the TM80 value is cleared to 0 and TM80 continues counting. At the same time, an interrupt
request signal (INTTM80) is generated.
Square wave output is cleared (0) when bit 7 (TCE80) in TMC80 is set to 0.
Table 9-6 shows square wave output range, and Figure 9-6 shows timing of square wave output.
Cautions 1. Before rewriting CR80, stop the timer operation once. If CR80 is rewritten in the timer
operation-enabled state, a match interrupt request signal may occur at the moment of rewrite.
2. If the count clock setting and TM80 operation-enabled are set in TMC80 simultaneously using
et4U.com an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may
DataShee
occur after the timer starts.
Therefore, always followDataSheet4U.com
the above procedure when operating the 8-bit timer/event counter
as an interval timer.
Table 9-6. Square Wave Output Range of 8-Bit Timer/Event Counter 80 (At fX = 5.0-MHz Operation)
Table 9-7. Square Wave Output Range of 8-Bit Timer/Event Counter 80 (At fCC = 4.0-MHz Operation)
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
Count clock
Clear Clear
CR80 N N N N
TCE80
Count start
INTTM80
TO80Note
Note The initial value of TO80 during output enable (TOE80 = 1) becomes low level.
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
D a t 4
a U .S ch oe me t
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
<1> Set P24 to output mode (PM24 = 0) and the P24 output latch to 0.
<2> Set 8-bit timer counter 80 (TM80) to operation disable (TCE80 = 0).
<3> Set the count clock of the 8-bit timer/event counter 80 (see Tables 9-4 and 9-5), TO80 to output enable
(TOE80 = 1), and PWM output to enable (PWME80 = 1).
<4> Set the count value to CR80
<5> Set TM80 to operation enable (TCE80 = 1)
When the count value of 8-bit timer counter 80 (TM80) matches the value set to CR80, TM80 continues counting,
and an interrupt request signal (INTTM80) is generated.
Cautions 1. When CR80 is rewritten during timer operation, a high level may be output for the next one
cycle (refer to 9.5 (2) Setting of 8-bit compare register 80).
2. If the count clock setting and TM80 operation-enabled are set in TMC80 simultaneously using
an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may
occur after the timer starts. Therefore, always follow the above procedure when operating
8-bit compare register 80 as a PWM output.
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
Count clock
TM80 00H 01H ••• M ••• FFH 00H 01H 02H ••• M M+1 M+2 ••• FFH 00H 01H ••• M ••• •••
CR80 M
TCE80
OVF
INTTM80
TO80Note
M = 01H to FFH
et4U.com DataShee
Note The initial value of TO80 upon output enable (TOE80 = 1) is low level.
DataSheet4U.com
Caution Do not set CR80 to 00H in the PWM output mode; otherwise PWM may not be output normally.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
Count pulse
TM80
00H 01H 02H 03H 04H
count value
Timer start
CR80 00H
TM80
count value 00H 00H 00H 00H
Cautions 1. When rewriting CR80 in timer counter operation mode (i.e. PWME80 (bit 6 of 8-bit timer
mode control register 80 (TMC80) is set to 0), be sure to stop the timer operation before
hand. If CR80 is rewritten in the timer operation-enabled state, a match interrupt request
signal may occur at the moment of rewrite.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 9 8-BIT TIMER/EVENT COUNTER 80
2. When rewriting CR80 in PWM output operation mode (PWME80 = 1), a high level may be
output for the next one cycle (count pulse x 256). This phenomenon occurs if a value
smaller than the value of TM80 is written to CR80.
Count clock
TM80 00H 01H … M … FFH 00H 01H 02H … FFH 00H 01H … …
CR80 M 01H
TCE80
OVF
Match Signal
TO80
3. Do not set CR80 to 00H in the PWM output mode (when PWME80 = 1); otherwise, PWM
may not be output normally.
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The watchdog timer can generate non-maskable interrupts, maskable interrupts and RESET with arbitrary preset
intervals.
• Watchdog timer
• Interval timer
Caution Select the watchdog timer mode or interval timer mode by using the watchdog timer mode
register (WDTM).
fW: fX or fCC
fX: System clock oscillation frequency (ceramic/crystal oscillation)
fCC: System clock oscillation frequency (RC oscillation)
2 11
× 1/fW 410 µs 512 µs
2 13
× 1/fW 1.64 ms 2.05 ms
2 15
× 1/fW 6.55 ms 8.19 ms
2 17
× 1/fW 26.2 ms 32.8 ms
fW: fX or fCC
fX: System clock oscillation frequency (ceramic/crystal oscillation)
fCC: System clock oscillation frequency (RC oscillation)
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 10 WATCHDOG TIMER
Item Configuration
Control register Timer clock select register 2 (TCL2)
Watchdog timer mode register (WDTM)
Internal bus
fW
Prescaler TMMK4
24
fW fW fW
26 28 210 INTWDT
TMIF4 maskable
interrupt request
Selector
Control
7-bit counter RESET
circuit
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 10 WATCHDOG TIMER
The following two types of registers are used to control the watchdog timer.
TCL22 TCL21 TCL20 Watchdog timer count clock selection Interval time
At fX = 5.0-MHz operation At fCC = 4.0-MHz operation At fX = 5.0-MHz operation At fCC = 4.0-MHz operation
0 0 0 fX/24 (312.5 kHz) fCC/24 (250 KHZ) 211/fX (410 µ s) 211/fCC (512 µs)
0 1 0 fX/26 (78.1 kHz) fCC/26 (62.5 KHZ) 213/fX (1.64 ms) 213/fCC (2.05 ms)
et4U.com 1 0 0 fX/28 (19.5 kHz) fCC/28 (15.6 KHZ) 215/fX (6.55 ms) 215/fCC (8.19 ms)
DataShee
1 1 0 fX/210 (4.88 kHz) fCC/210 (3.91 KHZ) 217/fX (26.2 ms) 217/fCC (32.8 ms)
DataSheet4U.com
Other than above Setting prohibited
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 10 WATCHDOG TIMER
0 Stops counting
0 0 Operation stop
0 1 Interval timer mode (overflow and maskable interrupt occur)Note 3
1 0 Watchdog timer mode 1 (overflow and non-maskable interrupt occur)
1 1 Watchdog timer mode 2 (overflow occurs and reset operation started)
et4U.com DataShee
Notes 1. Once RUN has been set (1), it cannot be cleared (0) by software. Therefore, when counting is
started, it cannot be stopped byDataSheet4U.com
any means other than RESET input.
2. Once WDTM3 and WDTM4 have been set (1), they cannot be cleared (0) by software.
3. The watchdog timer starts operations as an interval timer when RUN is set to 1.
Cautions 1. When the watchdog timer is cleared by setting RUN to 1, the actual overflow time is up
to 0.8% shorter than the time set by timer clock select register 2 (TCL2).
2. In watchdog timer mode 1 or 2, set WDTM4 to 1 after confirming TMIF4 (bit 0 of interrupt
request flag 0) has been set to 0. When watchdog timer mode 1 or 2 is selected under
the condition where TMIF4 is 1, a non-maskable interrupt occurs at the completion of
rewriting.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 10 WATCHDOG TIMER
Caution The actual runaway detection time may be up to 0.8% shorter than the set time.
TCL22 TCL21 TCL20 Runaway Detection Time At fX = 5.0-MHz Operation At fCC = 4.0-MHz Operation
0 0 0 211 × 1/fW 410 µs 512 µs
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 10 WATCHDOG TIMER
Cautions 1. Once bit 4 (WDTM4) of WDTM is set to 1 (when the watchdog timer mode is selected),
the interval timer mode is not set, unless the RESET signal is input.
2. The interval time immediately after the setting by WDTM may be up to 0.8% shorter than
the set time.
TCL22 TCL21 TCL20 Interval Time At fX = 5.0-MHz Operation At fCC = 4.0-MHz Operation
0 0 0 2 11
× 1/fW 410 µs 512 µs
0 1 0 2 13
× 1/fW 1.64 ms 2.05 ms
1 0 0 2 15
× 1/fW 6.55 ms 8.19 ms
et4U.com DataShee
1 1 0 2 17
× 1/fW 26.2 ms 32.8 ms
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The 8-bit A/D converter is an 8-bit resolution converter to convert analog input to digital signals. This converter
can control up to four channels of analog inputs (ANI0 to ANI3).
A/D conversion can only be started by software.
One of analog inputs ANI0 to ANI3 is selected for A/D conversion. A/D conversion is performed repeatedly, with
an interrupt request (INTAD0) being issued each time an A/D session is completed.
Item Configuration
Analog input 4 channels (ANI0 to ANI3)
Register Successive approximation register (SAR)
A/D conversion result register 0 (ADCR0)
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
AVDD
P-ch
Tap selector
Sample and hold circuit
ANI0/P60
Selector
ANI1/P61 Voltage comparator
ANI2/P62
AVSS
ANI3/P63
AVSS Successive
approximation
register (AR)
Control INTAD0
circuit
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
Caution Do not supply pins ANI0 to ANI3 with voltages that fall outside the rated range. If a voltage
greater than AVDD or less than AVSS (even if within the absolute maximum rating) is supplied
to any of these pins, the conversion value for the corresponding channel will be undefined.
Furthermore, the conversion values for the other channels may also be affected.
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
The following two registers are used to control the 8-bit A/D converter.
0 Conversion disabled
1 Conversion enabled
Notes 1. The specifications of FR02, FR01, and FR00 must be such that the A/D conversion time is at least
14 µs.
2. These bit combinations must not be used, as the A/D conversion time will fall below 14 µs.
Cautions 1. The result of conversion performed immediately after bit 7 (ADCS0) is set is undefined.
2. The result of conversion after ADCS0 is cleared may be undefined (for details, refer to
11.5 (5) Timing when A/D conversion result become undefined).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
0 0 ANI0
0 1 ANI1
1 0 ANI2
1 1 ANI3
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
Cautions 1. The first A/D conversion value immediately after starting the A/D conversion operation
may be undefined.
2. When in standby mode, the A/D converter stops operation.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
Conversion
time
Sampling
time
A/D converter
Sampling A/D conversion
operation
C0H Conversion
SAR Undefined 80H or 40H result
Conversion
ADCR0
result
INTAD0
A/D conversion continues until bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) is reset (0) by software.
If an attempt is made to write to ADM0 or Analog input channel specification register 0 (ADS0) during A/D
conversion, the ongoing A/D conversion is canceled. In this case, if ADCS0 is set (1), A/D conversion is restarted
et4U.com from the beginning. DataShee
RESET input makes the A/D conversion result register 0 (ADCR0) undefined.
DataSheet4U.com
VIN
ADCR0 = INT ( × 256 + 0.5)
AVDD
or
AVDD AVDD
(ADCR0 – 0.5) × ≤ VIN < (ADCR0 + 0.5) ×
256 256
Figure 11-5 shows the relationships between the analog input voltage and the A/D conversion result.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
Figure 11-5. Relationships between Analog Input Voltage and A/D Conversion Result
255
254
253
A/D conversion
result (ADCR0)
3
0
et4U.com 1 1 3 2 5 3 507 254 509 255 511 1 DataShee
512 256 512 256 512 256 512 256 512 256 512
DataSheet4U.com
Input voltage/AVDD
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
INTAD0
Remarks 1. n = 0, 1, 2, 3
2. m = 0, 1, 2, 3
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
AVDD
P-ch ADCS0
AVSS
<1> Conflict between writing to A/D conversion result register 0 (ADCR0) at the end of conversion and reading
from ADCR0
Reading from ADCR0 takes precedence. After reading, the new conversion result is written to the ADCR0.
<2> Conflict between writing to ADCR0 at the end of conversion and writing to A/D converter mode register
0 (ADM0) or Analog input channel specification register 0 (ADS0)
Writing to ADM0 or ADS0 takes precedence. A request to write to ADCR0 is ignored. No conversion
end interrupt request signal (INTAD0) is generated.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
Figure 11-8. Conversion Result Readout Timing (When Conversion Result Is Undefined Value)
INTAD0
ADCS0
et4U.com Normal conversion result read out A/D operation stopped Undefined value read out DataShee
DataSheet4U.com
Figure 11-9. Conversion Result Readout Timing (When Conversion Result Is Normal Value)
INTAD0
ADCS0
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
VDD
AVDD
C = 100 to 1000 pF
AVSS
et4U.com VSS
DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 11 8-BIT A/D CONVERTER (µPD789104A, 789124A SUBSERIES)
INTAD0
Remarks 1. n = 0, 1, 2, 3
2. m = 0, 1, 2, 3
VDD
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The 10-bit A/D converter is a 10-bit resolution converter to convert an analog input to digital signals. This converter
can control up to four channels of analog inputs (ANI0 to ANI3).
A/D conversion can only be started by software.
One of analog inputs ANI0 to ANI3 is selected for A/D conversion. A/D conversion is performed repeatedly, with
an interrupt request (INTAD0) being issued each time an A/D session is completed.
Item Configuration
Analog input 4 channels (ANI0 to ANI3)
Register Successive approximation register (SAR)
A/D conversion result register 0 (ADCR0)
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
AVDD
P-ch
Tap selector
Sample and hold circuit
ANI0/P60 Selector
ANI1/P61 Voltage comparator
ANI2/P62
ANI3/P63 AVSS
AVSS Successive
approximation
register (SAR)
Control INTAD0
circuit
DataSheet4U.com
Caution When using the µPD78F9116A as a flash memory version of the µPD789101A, 789102A, or
789104A, or the µPD78F9136A as a flash memory version of the µPD789121A, 789122A, or
789124A, an 8-bit access can be made by ADCR0. However, it is performed only with the
object file assembled by the µPD789101A, 789102A, or 789104A, or by the µPD789121A,
789122A, or 789124A, respectively.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
Caution Do not supply pins ANI0 to ANI3 with voltages that fall outside the rated range. If a voltage
greater than AVDD or less than AVSS (even if within the absolute maximum rating) is supplied
to any of these pins, the conversion value for the corresponding channel will be undefined.
Furthermore, the conversion values for the other channels may also be affected.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
The following two registers are used to control the 10-bit A/D converter.
0 Conversion disabled
1 Conversion enabled
Notes 1. The specifications of FR02, FR01, and FR00 must be such that the A/D conversion time is at least
14 µs.
2. These bit combinations must not be used, as the A/D conversion time will fall below 14 µs.
Cautions 1. The result of conversion performed immediately after bit 7 (ADCS0) is set is undefined.
2. The result of conversion after ADCS0 is cleared may be undefined (for details, refer to
12.5 (5) Timing when A/D conversion result becomes undefined).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
0 0 ANI0
0 1 ANI1
1 0 ANI2
1 1 ANI3
et4U.com DataShee
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
Cautions 1. The A/D conversion value immediately after starting the A/D conversion operation may
be undefined.
2. When in standby mode, the A/D converter stops operation.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
Conversion
Sampling time
time
A/D converter
Sampling A/D conversion
operation
Conversion
SAR Undefined result
Conversion
ADCR0
result
INTAD0
A/D conversion continues until bit 7 (ADCS0) of A/D converter mode register 0 (ADM0) is reset (0) by software.
If an attempt is made to write to ADM0 or Analog input channel specification register 0 (ADS0) during A/D
conversion, the ongoing A/D conversion is canceled. In this case, A/D conversion is restarted from the beginning,
et4U.com if ADCS0 is set (1). DataShee
RESET input makes A/D conversion result register 0 (ADCR0) undefined.
DataSheet4U.com
VIN
ADCR0 = INT ( × 1,024 + 0.5)
AVDD
or
AVDD AVDD
(ADCR0 – 0.5) × ≤ VIN < (ADCR0 + 0.5) ×
1,024 1,024
Figure 12-5 shows the relationships between the analog input voltage and the A/D conversion result.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
Figure 12-5. Relationships between Analog Input Voltage and A/D Conversion Result
1,023
1,022
1,021
A/D conversion
result (ADCR0)
3
0
et4U.com e
1 1 3 2 5 3
2,048 1,024 2,048 1,024 2,048 1,024
2,043 1,022 2,045 1,023 2,047
2,048 1,024 2,048 1,024 2,048
1
DataShe
DataSheet4U.com
Input voltage/AVDD
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
et4U.com e
DataShe
A/D conversion ANIn ANIn ANIn ANIm ANIm
DataSheet4U.comConversion is
discontinued; Stop
no conversion
result is preserved.
INTAD0
Remarks 1. n = 0, 1, 2, 3
2. m = 0, 1, 2, 3
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
AVDD
P-ch ADCS0
AVSS
<1> Conflict between writing to A/D conversion result register 0 (ADCR0) at the end of conversion and reading
from ADCR0
Reading from ADCR0 takes precedence. After reading, the new conversion result is written to ADCR0.
<2> Conflict between writing to ADCR0 at the end of conversion and writing to A/D converter mode register
0 (ADM0) or Analog input channel specification register 0 (ADS0)
Writing to ADM0 or ADS0 takes precedence. A request to write to ADCR0 is ignored. No conversion
end interrupt request signal (INTAD0) is generated.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
Figure 12-8. Conversion Result Readout Timing (When Conversion Result Is Undefined Value)
INTAD0
ADCS0
et4U.com e
Normal conversion result read out A/D operation stopped Undefined value read out DataShe
DataSheet4U.com
Figure 12-9. Conversion Result Readout Timing (When Conversion Result Is Normal Value)
INTAD0
ADCS0
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
VDD
AVDD
C = 100 to 1000 pF
AVSS
et4U.com VSS e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 12 10-BIT A/D CONVERTER (µPD789114A, 789134A SUBSERIES)
INTAD0
Remarks 1. n = 0, 1, 2, 3
2. m = 0, 1, 2, 3
et4U.com e
(9) AVDD pin DataShe
The AVDD pin is used to supply power to the analog circuit. It is also used to supply power to the ANI0 to ANI3
DataSheet4U.com
input circuit.
Therefore, if the application is designed to be changed to backup power, the AVDD pin must be supplied with
the same voltage level as for the VDD pin, as shown in Figure 12-10.
VDD
AVDD
Main power Backup
source capacitor
VSS
AVSS
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
Item Configuration
Register Transmit shift register 20 (TXS20)
Receive shift register 20 (RXS20)
Receive buffer register 20 (RXB20)
Control register Serial operating mode register 20 (CSIM20)
Asynchronous serial interface mode register 20 (ASIM20)
Asynchronous serial interface status register 20 (ASIS20)
Baud rate generator control register 20 (BRGC20)
DataSheet4U.com
DataSheet 4 U .com
et4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
164
Internal bus
Serial operation mode Asynchronous serial Asynchronous serial
register 20 (CSIM20) interface status register 20 interface mode register 20
Receive buffer (ASIS20) (ASIM20)
CSIE20 SSE20 DAP20 DIR20 CSCK20 CKP20 PE20 FE20 OVE20 TXE20 RXE20 PS201 PS200 CL20 SL20
register 20 (RXB20)
CHAPTER 13
Selector CSIE20
Reception
Port mode
User’s Manual U14643EJ1V0UM00
shift clock
register (PM21) Data phase
DAP20
SO20/P21/ control
TxD20 Parity operation
DataSheet4U.com
SERIAL INTERFACE 20
Stop bit addition
4 INTST20
Transmission data counter
Parity operation
SL20, CL20, PS200, PS201
Stop bit addition INTSR20/INTCSI20
Reception data counter
Reception enabled Transmission
Reception clock and reception Baud rate CSIE20
Start bit clock control generator note CSCK20
Detection clock
detection fX/2 to fX/28
Reception detected
4
SS20/P23/ CSIE20
CPT20/INTP0 TPS203 TPS202 TPS201 TPS200
CSCK20 Internal clock output Baud rate generator
SCK20/P20/ Clock phase
control register 20 (BRGC20)
ASCK20 control
External clock input
Internal bus
Note See Figure 13-2 for the configuration of the baud rate generator.
DataShe
e
et4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
Figure 13-2. Baud Rate Generator Block Diagram
Transmission
Transmission shift clock 1/2 clock counter
fX/2
fX/22
Selector
Selector
fX/23
Reception shift clock 1/2 fX/24
Selector
Reception fX/25
clock counter fX/26
CHAPTER 13
fX/27
fX/28
User’s Manual U14643EJ1V0UM00
DataSheet4U.com
TXE20 SCK20/ASCK20/P20
RXE20
SERIAL INTERFACE 20
CSIE20
Reception detection
DataShe
e
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
0 Operation disabled
1 Operation enabled
et4U.com e
DataShe
SSE20 SS20-pin selection Function of the SS20/P23 pin Communication status
DataSheet4U.com
0 Not used Port function Communication enabled
1 Used 0 Communication enabled
1 Communication disabled
0 MSB
1 LSB
0 Clock is low active, and SCK20 is at high level in the idle state
1 Clock is high active, and SCK20 is at low level in the idle state
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
ASIM20 TXE20 RXE20 PS201 PS200 CL20 SL20 0 0 FF70H 00H R/W
et4U.com 0 0 No parity e
DataShe
0 1 Always add 0 parity at transmission.
DataSheet4U.com
Parity check is not performed at reception (No parity error is generated).
1 0 Odd parity
1 1 Even parity
0 7 bits
1 8 bits
0 1 bit
1 2 bits
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
ASIM20 CSIM20 PM22 P21 PM21 P21 PM20 P20 First Shift P22/SI20/RxD20 P21/SO20/TxD20 P20/SCK20/
TXE20 RXE20 CSIE20 DIR20 CSCK20 Bit Clock Pin Function Pin Function ASCK20 Pin
Function
0 0 0 × × ×Note 1 ×Note 1 ×Note 1 ×Note 1 ×Note 1 ×Note 1 — — P22 P21 P20
Other than above Setting prohibited
ASIM20 CSIM20 PM22 P22 PM21 P21 PM20 P20 First Shift P22/SI20/RxD20 P21/SO20/TxD20 P20/SCK20/
TXE20 RXE20 CSIE20 DIR20 CSCK20 Bit Clock Pin Function Pin Function ASCK20 Pin
Function
0 0 1 0 0 ×Note 1 ×Note 2 0 1 1 × MSB External SI20Note 2 SCK20 SCK20
clock (CMOS output) input
1 0 1 Internal SCK20
clock output
1 1 0 1 × LSB External SCK20
clock input
1 0 1 Internal SCK20
clock output
et4U.com e
Other than above Setting prohibited DataShe
DataSheet4U.com
(3) Asynchronous serial interface mode
ASIM20 CSIM20 PM22 P22 PM21 P21 PM20 P20 First Shift P22/SI20/RxD20 P21/SO20/TxD20 P20/SCK20/
TXE20 RXE20 CSIE20 DIR20 CSCK20 Bit Clock Pin Function Pin Function ASCK20 Pin
Function
1 0 0 0 0 ×Note 1 ×Note 1 0 1 1 × LSB External P22 TxD20 ASCK20
clock (CMOS output) input
×Note 1 ×Note 1 Internal P20
clock
0 1 0 0 0 1 × ×Note 1 ×Note 1 1 × External RD20 P21 ASCK20
clock input
×Note 1 ×Note 1 Internal P20
clock
1 1 0 0 0 1 × 0 1 1 × External TxD20 ASCK20
clock (CMOS output) input
×Note 1 ×Note 1 Internal P20
clock
Other than above Setting prohibited
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
et4U.com e
OVE20 Overrun error flag DataShe
0 No overrun error has occurred. DataSheet4U.com
Note 2
1 An overrun error has occurred.
(Before data was read from the reception buffer register, the subsequent reception sequence was
completed.)
Notes 1. Even when the stop bit length is set to 2 bits by setting bit 2 (SL20) of asynchronous serial interface
mode register 20 (ASIM20), the stop bit detection in the case of reception is performed with 1 bit.
2. Be sure to read receive buffer register 20 (RXB20) when an overrun error occurs. If not, every
time the data is received an overrun error is generated.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
Cautions 1. When writing to BRGC20 is performed during a communication operation, the output of
baud rate generator is disrupted and communications cannot be performed normally. Be
sure not to write to BRGC20 during communication operations.
2. Be sure not to select n = 1 during operation at fX = 5.0 MHz because n = 1 exceeds the
baud rate limit.
3. When the external input clock is selected, set port mode register 2 (PM2) in input mode.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
The baud rate transmit/receive clock to be generated is either a signal scaled from the system clock, or a signal
scaled from the clock input from the ASCK20 pin.
fX
[Baud rate] = [Hz]
2n + 1 ×8
Table 13-3. Example of Relationship between System Clock and Baud Rate
DataSheet4U.com
DataSheet4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
(b) Generation of baud rate transmit/receive clock by means of external clock from ASCK20 pin
The transmit/receive clock is generated by scaling the clock input from the ASCK20 pin. The baud rate
generated from the clock input from the ASCK20 pin is estimated by using the following expression.
fASCK
[Baud rate] = [Hz]
16
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
CSIM20 CSIE20 SSE20 0 0 DAP20 DIR20 CSCK20 CKP20 FF72H 00H R/W
et4U.com e
DataShe
CSIE20 Operation control in 3-wire serial I/O mode
DataSheet4U.com
0 Operation disable
1 Operation enable
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
ASIM20 TXE20 RXE20 PS201 PS200 CL20 SL20 0 0 FF70H 00H R/W
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
0 Operation disabled
1 Operation enabled
et4U.com e
DataShe
DIR20 First-bit specification
DataSheet4U.com
0 MSB
1 LSB
0 Clock is low active, and SCK20 is high level in the idle state
1 Clock is high active, and SCK20 is low level in the idle state
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
ASIM20 TXE20 RXE20 PS201 PS200 CL20 SL20 0 0 FF70H 00H R/W
0 0 No parity
0 1 Always add 0 parity at transmission.
Parity check is not performed at reception (No parity error is generated).
1 0 Odd parity
et4U.com e
1 1 Even parity DataShe
DataSheet4U.com
CL20 Character length specification
0 7 bits
1 8 bits
0 1 bit
1 2 bits
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
1 Parity error generated (when the parity of transmit data does not match.)
et4U.com e
DataShe
Notes 1. Even when the stop bit length is set to 2 bits by setting bit 2 (SL20) of asynchronous serial interface
DataSheet4U.com
mode register 20 (ASIM20), the stop bit detection in the case of reception is performed with 1 bit.
2. Be sure to read receive buffer register 20 (RXB20) when an overrun error occurs. If not, every
time the data is received an overrun error is generated.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
et4U.com Cautions 1. When writing to BRGC20 is performed during a communication operation, the output of e
DataShe
baud rate generator is disrupted and communications cannot be performed normally. Be
DataSheet4U.com
sure not to write to BRGC20 during communication operation.
2. Be sure not to select n = 1 during an operation at fX = 5.0 MHz because n = 1 exceeds
the baud rate limit.
3. When the external input clock is selected, set port mode register 2 (PM2) to input mode.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
The baud rate transmit/receive clock to be generated is either a signal scaled from the system clock, or
a signal scaled from the clock input from the ASCK20 pin.
fx
[Baud rate] = [Hz]
2n + 1 × 8
Table 13-5. Example of Relationship between System Clock and Baud Rate
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
(ii) Generation of baud rate transmit/receive clock by means of external clock from ASCK20 pin
The transmit/receive clock is generated by scaling the clock input from the ASCK20 pin. The baud
rate generated from the clock input from the ASCK20 pin is estimated by using the following
expression.
fASCK
[Baud rate] = [Hz]
16
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
Start Parity
D0 D1 D2 D3 D4 D5 D6 D7 Stop bit
bit bit
When 7 bits are selected as the number of character bits, only the lower 7 bits (bits 0 to 6) are valid; in
et4U.com transmission the most significant bit (bit 7) is ignored, and in reception the most significant bit (bit 7) is e
DataShe
always “0”.
DataSheet4U.com
The serial transfer rate is selected by means of ASIM20 and baud rate generator control register 20
(BRGC20).
If a serial data receive error is generated, the receive error contents can be determined by reading the
status of asynchronous serial interface status register 20 (ASIS20).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
• At transmission
The transmission operation is controlled so that the number of bits with a value of “1” in the transmit
data including parity bit may be even. The parity bit value should be as follows.
The number of bits with a value of “1” is an odd number in transmit data: 1
The number of bits with a value of “1” is an even number in transmit data: 0
• At reception
The number of bits with a value of “1” in the receive data including parity bit is counted, and if the
number is odd, a parity error is generated.
• At transmission
Conversely to even parity, the transmission operation is controlled so that the number of bits with
et4U.com a value of “1” in the transmit data including parity bit may be odd. The parity bit value should be e
DataShe
as follows.
DataSheet4U.com
The number of bits with a value of “1” is an odd number in transmit data: 0
The number of bits with a value of “1” is an even number in transmit data: 1
• At reception
The number of bits with a value of “1” in the receive data including parity bit is counted, and if the
number is even, a parity error is generated.
(iii) 0 Parity
When transmitting, the parity bit is set to “0” irrespective of the transmit data.
At reception, a parity bit check is not performed. Therefore, a parity error is not generated, irrespective
of whether the parity bit is set to “0” or “1”.
(iv) No parity
A parity bit is not added to the transmit data. At reception, data is received assuming that there is
no parity bit. Since there is no parity bit, a parity error is not generated.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
(c) Transmission
A transmit operation is started by writing transmit data to transmit shift register 20 (TXS20). The start
bit, parity bit and stop bit are added automatically.
When the transmit operation starts, the data in TXS20 is shifted out, and when TXS20 is empty, a
transmission completion interrupt (INTST20) is generated.
STOP
TxD20 (Output) D0 D1 D2 D6 D7 Parity
START
INTST20
Caution Do not rewrite asynchronous serial interface mode register 20 (ASIM20) during a transmit
operation. If ASIM20 register is rewritten during transmission, subsequent transmission
may not be performed (the normal state is restored by RESET input).
It is possible to determine whether transmission is in progress by software by using a
transmission completion interrupt (INTST20) or the interrupt request flag (STIF20) set by
INTST20.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
(d) Reception
When bit 6 (RXE20) of asynchronous serial interface mode register 20 (ASIM20) is set (1), a receive
operation is enabled and sampling of the RxD20 pin input is performed.
RxD20 pin input sampling is performed using the serial clock specified by ASIM20.
When the RxD20 pin input becomes low, the 3-bit counter starts counting, and when half the time
determined by the specified baud rate has passed, the data sampling start timing signal is output. If the
RxD20 pin input sampled again as a result of this start timing signal is low, it is identified as a start bit,
the 3-bit counter is initialized and starts counting, and data sampling is performed. When character data,
a parity bit and one stop bit are detected after the start bit, reception of one frame of data ends.
When one frame of data has been received, the receive data in the shift register is transferred to receive
buffer register 20 (RXB20), and a reception completion interrupt (INTSR20) is generated.
If an error is generated, the receive data in which the error was generated is still transferred to RXB20,
and INTSR20 is generated.
If the RXE20 bit is reset (0) during the receive operation, the receive operation is stopped immediately.
In this case, the contents of RXB20 and asynchronous serial interface status register 20 (ASIS20) are
not changed, and INTSR20 is not generated.
STOP
RxD20 (Input) D0 D1 D2 D6 D7 Parity
START
et4U.com e
DataShe
INTSR20
DataSheet4U.com
Caution Be sure to read receive buffer register 20 (RXB20) even if a receive error occurs. If RXB20
is not read, an overrun error will be generated when the next data is received, and the
receive error state will continue indefinitely.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
et4U.com e
DataShe
STOP
RxD20 (Input) D0 D1 D2 D6 D7 Parity
DataSheet4U.com
START
INTSR20
STOP
RxD20 (Input) D0 D1 D2 D6 D7 Parity
START
INTSR20
Cautions 1. The contents of the ASIS20 register are reset (0) by reading receive buffer register 20
(RXB20) or receiving the next data. To ascertain the error contents, read ASIS20
before reading RXB20.
2. Be sure to read receive buffer register 20 (RXB20) even if a receive error is generated.
If RXB20 is not read, an overrun error will be generated when the next data is received,
and the receive error state will continue indefinitely.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
(a) When bit 7 (TXE20) of asynchronous serial interface mode register 20 (ASIM20) is cleared during
transmission, be sure to set transmit shift register 20 (TXS20) to FFH, then set TXE20 to 1 before executing
the next transmission.
(b) When bit 6 (RXE20) of asynchronous serial interface mode register 20 (ASIM20) is cleared during
reception, receive buffer register 20 (RXB20) and receive completion interrupt 20 (INTSR20) are as
follows.
RXB20
INTSR20
et4U.com
<1> <3>
e
DataShe
<2>
DataSheet4U.com
When RXE20 is set to 0 at a time indicated by <1>, RXB20 holds the previous data and does not generate
INTSR20.
When RXE20 is set to 0 at a time indicated by <2>, RXB20 renews the data and does not generate INTSR20.
When RXE20 is set to 0 at a time indicated by <3>, RXB20 renews the data and generates INTSR20.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
CSIM20 CSIE20 SSE20 0 0 DAP20 DIR20 CSCK20 CKP20 FF72H 00H R/W
0 Operation disabled
1 Operation enabled
0 MSB
1 LSB
0 Clock is low active, and SCK20 is at high level in the idle state
1 Clock is high active, and SCK20 is at low level in the idle state
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
ASIM20 TXE20 RXE20 PS201 PS200 CL20 SL20 0 0 FF70H 00H R/W
0 0 No parity
0 1 Always add 0 parity at transmission.
Parity check is not performed at reception (No parity error is generated).
et4U.com e
1 0 Odd parity DataShe
1 1 Even parity DataSheet4U.com
0 7 bits
1 8 bits
0 1 bit
1 2 bits
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
Cautions 1. When writing to BRGC20 is performed during a communication operation, the baud
rate generator output is disrupted and communication cannot be performed normally.
et4U.com Be sure not to write to BRGC20 during communication operation. e
DataShe
2. Be sure not to select n = 1 during an operation at fX = 5.0 MHz because n = 1 exceeds
DataSheet4U.com
the baud rate limit.
3. When the external input clock is selected, set port mode register 2 (PM2) in input mode.
If the internal clock is used as the serial clock for the 3-wire serial I/O mode, set the TPS200 to TPS203
bits to set the frequency of the serial clock. To obtain the frequency to be set, use the following formula.
When the serial clock is input from off-chip, setting BRGC20 is not necessary.
fx
Serial clock frequency = [Hz]
2n + 1
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
SIO20
Write
SCK20 1 2 3 4 5 6 7 8
SO20 Note
et4U.com
DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0
e
DataShe
DataSheet4U.com
SI20 DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0
INTCSI20
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
SIO20
Write
SCK20 1 2 3 4 5 6 7 8
SO20 Note DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0
INTCSI20
SIO20
Write
SCK20 1 2 3 4 5 6 7 8
Hi-Z Note 1
Hi-Z
SO20 DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0Note 2
INTCSI20
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
SIO20
Write
SCK20 1 2 3 4 5 6 7 8
INTCSI20
et4U.com e
SIO20 DataShe
Write
DataSheet4U.com
SCK20 1 2 3 4 5 6 7 8
INTCSI20
Note The data of SI20 is loaded at the first rising edge of SCK20. Make sure that the master outputs the
first bit before the first rising of SCK20.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
SS20
SIO20
Write
SCK20 1 2 3 4 5 6 7 8
Hi-Z Note 2
Hi-Z
SO20 DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0
INTCSI20
et4U.com Notes 1. The data of SI20 is loaded at the first rising edge of SCK20. Make sure that the master outputs e
DataShe
the first bit before the first rising of SCK20.
2. SO20 is high until SS20DataSheet4U.com
rises after completion of DO0 output. When SS20 is high, SO20 is in
a high-impedance state.
SIO20
Write
SCK20 1 2 3 4 5 6 7 8
INTCSI20
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
SIO20
Write
SCK20 1 2 3 4 5 6 7 8
INTCSI20
Note The data of SI20 is loaded at the first falling edge of SCK20. Make sure that the master outputs the
first bit before the first falling of SCK20.
et4U.com e
DataShe
(ix) Slave operation (when DAP20 = 1, CKP20 = 0, SSE20 = 1)
DataSheet4U.com
SS20
SIO20
Write
SCK20 1 2 3 4 5 6 7 8
Hi-Z Note 2
Hi-Z
SO20 DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0
INTCSI20
Notes 1. The data of SI20 is loaded at the first falling edge of SCK20. Make sure that the master outputs
the first bit before the first falling of SCK20.
2. SO20 is high until SS20 rises after completion of DO0 output. When SS20 is high, SO20 is in
a high-impedance state.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
SIO20
Write
SCK20 1 2 3 4 5 6 7 8
SO20 Note DO7 DO6 DO5 DOI4 DO3 DO2 DO1 DO0
INTCSI20
SCK20 1 2 3 4 5 6 7 8
SO20 Note DO7 DO6 DO5 DOI4 DO3 DO2 DO1 DO0
INTCSI20
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 13 SERIAL INTERFACE 20
SS20
SIO20
Write
SCK20 1 2 3 4 5 6 7 8
Hi-Z Hi-Z
SO20 Note 1
DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0Note 2
INTCSI20
et4U.com e
DataShe
Notes 1. The value of the last bit previously output is output.
2. DO0 is output until SS20 rises.DataSheet4U.com
When SS20 is high, SO20 is in a high-impedance state.
Caution If CSIE20 is set to “1” after data write to TXS20/SIO20, transfer does not start.
A termination of 8-bit transfer stops the serial transfer automatically and generates the interrupt request signal
(INTCSI20).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 14 MULTIPLIER
Caution Although this register is manipulated with a 16-bit memory manipulation instruction, it can
be also manipulated with an 8-bit memory manipulation instruction. When using an 8-bit
memory manipulation instruction, however, access the register by means of direct addressing.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 14 MULTIPLIER
Internal bus
Counter value
Selector 3-bit counter CPU clock
3
Start Clear
Counter output
16-bit
adder
MULST0 Reset
Multiplier control
register 0 (MULC0)
Internal bus
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 14 MULTIPLIER
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 14 MULTIPLIER
The multiplier of the µPD789104A/114A/124A/134A Subseries can execute the calculation of 8 bits × 8 bits = 16
bits. Figure 14-3 shows the operation timing of the multiplier where MRA0 is set to AAH and MRB0 is set to D3H.
CPU clock
MRA0 AA
MRB0 D3
MULST0
et4U.com e
DataShe
Counter 000B 001B 010B 011B
DataSheet4U.com 100B 101B 110B 111B 000B
Selector output 00AA 0154 0000 0000 0AA0 0000 2A80 5500 00AA
(Slave) 0000 00AA 01FE 01FE 01FE 0C9E 0C9E 371E 0000
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
et4U.com There are total of 10 non-maskable and maskable interrupts in the interrupt sources (see Table 15-1). e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
et4U.com e
Notes 1. Priority is the priority applicable when two or more maskable interrupts are simultaneously generated. DataShe
0 is the highest priority and 8 is the lowest priority.
DataSheet4U.com
2. Basic configuration types A to C correspond to A to C in Figure 15-1.
Remark As the interrupt source of the watchdog timer (INTWDT), either a non-maskable interrupt or a maskable
interrupt (internal) can be selected.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
Internal bus
Internal bus
MK IE
et4U.com
Vector table
e
Interrupt request IF
address generator DataShe
DataSheet4U.com
Standby release signal
Internal bus
Vector table
Interrupt Edge address generator
request detector IF
Standby
release signal
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
The following four registers are used to control the interrupt functions.
Table 15-2 gives a listing of interrupt request flag and interrupt mask flag names corresponding to interrupt
requests.
Interrupt Request Signal Name Interrupt Request Flag Interrupt Mask Flag
INTWDT TMIF4 TMMK4
INTP0 PIF0 PMK0
INTP1 PIF1 PMK1
INTP2 PIF2 PMK2
INTSR20/INTCSI20 SRIF20 SRMK20
INTST20 STIF20 STMK20
INTTM80 TMIF80 TMMK80
et4U.com e
INTTM20 TMIF20 TMMK20 DataShe
INTAD0 ADIF0 DataSheet4U.com ADMK0
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
Symbol <7> <6> <5> <4> <3> <2> <1> <0> Address After reset R/W
IF0 TMIF20 TMIF80 STIF20 SRIF20 PIF2 PIF1 PIF0 TMIF4 FFE0H 00H R/W
Cautions 1. TMIF4 flag is R/W enabled only when the watchdog timer is used as an interval timer.
If the watchdog timer mode 1 and 2 are used, set the TMIF4 flag to 0.
et4U.com e
2. Because port 2 has an alternate function as the external interrupt input, when the output DataShe
level is changed by specifying the output mode of the port function, an interrupt request
DataSheet4U.com
flag is set. Therefore, the interrupt mask flag should be set to 1 before using the output
mode.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
Symbol <7> <6> <5> <4> <3> <2> <1> <0> Address After reset R/W
MK0 TMMK20 TMMK80 STMK20 SRMK20 PMK2 PMK1 PMK0 TMMK4 FFE4H FFH R/W
Cautions 1. If the TMMK4 flag is read when the watchdog timer is used in watchdog timer mode 1
and 2, its value becomes undefined.
2. Because port 2 has an alternate function as the external interrupt input, when the output
level is changed by specifying the output mode of the port function, an interrupt request
et4U.com flag is set. Therefore, the interrupt mask flag should be set to 1 before using the output e
DataShe
mode.
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
INTM0 ES21 ES20 ES11 ES10 ES01 ES00 0 0 FFECH 00H R/W
0 0 Falling edge
0 1 Rising edge
1 0 Setting prohibited
0 0 Falling edge
0 1 Rising edge
1 0 Setting prohibited
et4U.com e
1 1 Both rising and falling edges DataShe
DataSheet4U.com
ES01 ES00 INTP0 valid edge selection
0 0 Falling edge
0 1 Rising edge
1 0 Setting prohibited
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
PSW IE Z 0 AC 0 0 1 CY 02H
0 Disable
1 Enable
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
Caution During a non-maskable interrupt service program execution, do not input another non-maskable
interrupt request; if it is input, the service program will be interrupted and the new interrupt
request will be acknowledged.
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
Start
WDTM4 = 1
No
(watchdog timer mode
is selected)
Interval timer
Yes
WDT No
overflows
Yes
WDTM3 = 0
No
(non-maskable interrupt
is selected)
Reset processing
Yes
TMIF4
Main routine
NMI request
NMI request (second)
(first)
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
9 clocks 19 clocks
1
Remark 1 clock: (fCPU: CPU clock)
fCPU
When two or more maskable interrupt requests are generated at the same time, they are acknowledged starting
from the interrupt request assigned the highest priority.
A pending interrupt is acknowledged when the status where it can be acknowledged is set.
Figure 15-9 shows the algorithm of acknowledging interrupt requests.
et4U.com e
When a maskable interrupt request is acknowledged, the contents of PSW and PC are saved to the stack in that DataShe
order, the IE flag is reset to 0, and the data in the vector table determined for each interrupt request is loaded to the
DataSheet4U.com
PC, and execution branches.
To return from interrupt processing, use the RETI instruction.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
Start
No
××IF = 1 ?
No
××MK = 0 ?
No
IE = 1 ?
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
8 clocks
Clock
Interrupt
If an interrupt request flag (××IF) is set before an instruction clock n (n = 4 to 10) under execution becomes n–
1, the interrupt is acknowledged after the instruction under execution is complete. Figure 15-10 shows an example
of the interrupt request acknowledgement timing for an 8-bit data transfer instruction MOV A,r. Since this instruction
is executed for 4 clocks, if an interrupt occurs for 3 clocks after the execution starts, the interrupt acknowledgement
processing is performed after the MOV A,r instruction is completed.
8 clocks
et4U.com e
Clock DataShe
DataSheet4U.com
Interrupt
If an interrupt request flag (××IF) is set at the last clock of the instruction, the interrupt acknowledgement processing
starts after the next instruction is executed.
Figure 15-11 shows an example of the interrupt acknowledgement timing for an interrupt request flag that is set
at the second clock of NOP (2-clock instruction). In this case, the MOV A,r instruction after the NOP instruction is
executed, and then the interrupt acknowledgement processing is performed.
Caution Interrupt requests are reserved while the interrupt request flag register (IF0, IF1) or the interrupt
mask flag register (MK0, MK1) is being accessed.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
IE = 0 IE = 0
EI EI
INTxx INTyy
RETI RETI
During interrupt INTxx servicing, interrupt request INTyy is acknowledged, and a multiple interrupt is generated.
An EI instruction is issued before each interrupt request acknowledgement, and the interrupt request acknowledgement
et4U.com enable state is set. e
DataShe
DataSheet4U.com
Example 2. A multiple interrupt is not generated because interrupts are not enabled
EI IE = 0
INTyy INTyy is kept pending
RETI
INTxx
IE = 0
RETI
Because interrupts are not enabled in interrupt INTxx servicing (an EI instruction is not issued), interrupt request
INTyy is not acknowledged, and a multiple interrupt is not generated. The INTyy request is reserved and acknowledged
after the INTxx processing is performed.
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 15 INTERRUPT FUNCTIONS
• Manipulation instruction for the interrupt request flag register (IF0, IF1)
• Manipulation instruction for the interrupt mask flag register (MK0, MK1)
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
In both modes, the previous contents of the registers, flags, and data memory before setting the standby mode
are all retained. In addition, the statuses of the output latch of the I/O ports and output buffer are also retained.
Caution To set the STOP mode, be sure to stop the operations of the peripheral hardware, and then
execute the STOP instruction.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 16 STANDBY FUNCTION
X1 pin voltage
waveform
a
VSS
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 16 STANDBY FUNCTION
Port (Output latch) Retains the status before setting the HALT mode.
16-bit timer 20 Operable
8-bit timer/event counter 80 Operable
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 16 STANDBY FUNCTION
HALT
instruction Wait
Standby
release signal
Operating
mode HALT mode Wait Operating mode
Oscillation
Clock
Remarks 1. The broken lines indicate the case where the interrupt request that has released the
standby mode is acknowledged.
2. The wait time is as follows:
et4U.com • When vectored interrupt processing is performed: 9 to 10 clocks e
DataShe
• When vectored interrupt processing is not performed: 1 to 2 clocks
DataSheet4U.com
(b) Releasing by non-maskable interrupt request
The HALT mode is released regardless of whether the interrupt is enabled or disabled, and vectored
interrupt processing is performed.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 16 STANDBY FUNCTION
HALT
instruction WaitNote
RESET
signal
Oscillation
Operating Reset stabilization Operating
mode HALT mode period wait status mode
Oscillation
Oscillation stop Oscillation
Clock
Note In the µPD789104A and 789114A Subseries, 215/fX: 6.55 ms (at fX = 5.0-MHz operation)
In the µPD789124A and 789134A Subseries, 27/fCC: 32 µs (at fCC = 4.0-MHz operation)
×: don’t care
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 16 STANDBY FUNCTION
Cautions 1. When the STOP mode is set, the X2 or CL2 pin is internally pulled up to VDD to suppress
the current leakage of the oscillation circuit block. Therefore, do not use the STOP mode
in a system where the external clock is used as the system clock.
2. Because the standby mode can be released by an interrupt request signal, the standby
mode is released as soon as it is set if there is an interrupt source whose interrupt request
flag is set and interrupt mask flag is reset. When the STOP mode is set, therefore, the
HALT mode is set immediately after the STOP instruction has been executed, the wait
time set by the oscillation stabilization time select register (OSTS) elapses, and then an
operation mode is set.
The operation status in the STOP mode is shown in the following table.
Notes 1. Operation is possible only when TI80 is selected as the count clock.
2. Operation is possible in both 3-wire serial I/O and UART modes while an external clock is being
used.
3. Maskable interrupt that is not masked
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 16 STANDBY FUNCTION
WaitNote
STOP (set time by OSTS)
instruction
Standby
release signal
Note OSTS is not provided in the µPD789124A and 789134A Subseries, and the wait time is fixed to
27/fCC.
et4U.com e
DataShe
Remark The broken lines indicate the case where the interrupt request that has released the standby
DataSheet4U.com
mode is acknowledged.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 16 STANDBY FUNCTION
STOP
WaitNote
instruction
RESET
signal
Oscillation
Operating Reset stabilization Operating
mode STOP mode period wait status mode
Oscillation
Oscillation stop Oscillation
Clock
Note In the µPD789104A and 789114A Subseries, 215/fX: 6.55 ms (at fX = 5.0-MHz operation)
In the µPD789124A and 789134A Subseries, 27/fCC: 32 µs (at fCC = 4.0-MHz operation)
×: don’t care
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
External and internal reset have no functional differences. In both cases, program execution starts at the addresses
0000H and 0001H by reset signal input.
When a low level is input to the RESET pin or the watchdog timer overflows, a reset is applied and each hardware
item is set to the status shown in Table 17-1. Each pin has a high impedance during reset input or during the oscillation
stabilization time just after reset clear.
When a high level is input to the RESET pin, the reset is cleared and program execution is started after the oscillation
stabilization time has elapsed. The reset applied by the watchdog timer overflow is automatically cleared after reset,
and program execution is started after the oscillation stabilization time has elapsed (see Figures 17-2 through 17-
4).
Cautions 1. For an external reset, input a low level for 10 µs or more to the RESET pin.
2. When the STOP mode is cleared by reset, the STOP mode contents are held during reset input.
However, the port pins become high impedance.
et4U.com e
DataShe
Figure 17-1. Block Diagram of Reset Function
DataSheet4U.com
Over-
flow Interrupt function
Count clock Watchdog timer
Stop
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 17 RESET FUNCTION
X1, CL1
Reset period Oscillation
During normal Normal operation
(oscillation stabilization
operation (reset processing)
stops) time wait
RESET
Internal
reset signal
Delay Delay
Hi-Z
Port pin
X1, CL1
Hi-Z
Port pin
X1, CL1
STOP instruction execution
Stop status Reset period Oscillation Normal operation
During normal operation (oscillation (oscillation stabilization
stops) stops) time wait (reset processing)
RESET
Internal
reset signal
Delay Delay
Hi-Z
Port pin
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 17 RESET FUNCTION
Notes 1. During reset input and oscillation stabilization time wait, only the PC contents among the hardware
statuses become undefined.
All other hardware remains unchanged after reset.
2. If the reset signal is input in the standby mode, the status before reset is retained even after reset.
3. µPD789104A, 789114A Subseries only
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 17 RESET FUNCTION
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The µPD78F9116A is a version with flash memory instead of the internal ROM of the mask ROM version in the
µPD789104A and 789114A Subseries. The µPD78F9136A is a version with flash memory instead of the internal ROM
of the mask ROM version in the µPD789124A and 789134A Subseries. The differences between the flash memory
and the mask ROM versions are shown in Table 18-1.
Table 18-1. Differences between Flash Memory and Mask ROM Versions
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 18 µPD78F9116A, 78F9136A
Caution Be sure to select a communication mode based on the VPP pulse number shown in Table 18-2.
10 V
VPP VDD
1 2 n
VSS
VDD
RESET
VSS
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 18 µPD78F9116A, 78F9136A
Function Description
Batch erase Erases all contents of memory
Batch blank check Checks erased state of entire memory
Data write Write to flash memory based on write start address and number of data written (number of bytes)
Batch verify Compares all contents of memory with input data
RESET RESET
CLK X1
SCK SCK20
SO SI20
SI SO20
Note n = 1, 2
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 18 µPD78F9116A, 78F9136A
VPPnNote VPP
RESET RESET
CLK X1
SO RxD20
SI TxD20
GND VSS, AVSS
Note n = 1, 2
Figure 18-4. Flashpro III Connection in Pseudo 3-Wire Mode (When P0 Is Used)
VPPnNote VPP
RESET RESET
et4U.com e
CLK X1 DataShe
SCK DataSheet4U.com P00 (Serial clock)
SO P02 (Serial input)
Note n = 1, 2
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 18 µPD78F9116A, 78F9136A
VPPnNote VPP
RESET RESET
CLK P03
SCK SCK20
SO SI20
SI SO20
Note n = 1, 2
RESET RESET
CLK P03
SO RxD20
SI TxD20
GND VSS, AVSS
Note n = 1, 2
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 18 µPD78F9116A, 78F9136A
Figure 18-7. Flashpro III Connection in Pseudo 3-Wire Mode (When P0 Is Used)
VPPnNote VPP
RESET RESET
CLK P03
Note n = 1, 2
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 18 µPD78F9116A, 78F9136A
Notes 1. The number of VPP pulses supplied from Flashpro III when serial communication is initialized. The
pins to be used for communication are determined according to the number of these pulses.
2. Select one of 9600 bps, 19200 bps, 38400 bps, or 76800 bps.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
For P50 to P53 (port 5), an on-chip pull-up resistor can be specified by the mask option. The mask option is specified
in 1-bit units.
Caution The flash memory versions do not provide the on-chip pull-up resistor function.
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
This chapter lists the instruction set of the µPD789104A/114A/124A/134A Subseries. For the details of the
operation and machine language (instruction code) of each instruction, refer to 78K/0S Series User’s Manual
Instruction (U11047E).
20.1 Operation
In the case of immediate data, describe an appropriate numeric value or a label. When using a label, be sure to
describe the #, !, $ and [ ] symbols.
For operand register identifiers, r and rp, either function names (X, A, C, etc.) or absolute names (names in
et4U.com parenthesis in the table below, R0, R1, R2, etc.) can be used for description. e
DataShe
DataSheet4U.com
Table 20-1. Operand Identifiers and Description Methods
Remark Refer to Table 4-3 Special Function Register List for symbols of special function registers.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 20 INSTRUCTION SET
(Blank): Unchanged
0: Cleared to 0
1: Set to 1
×: Set/cleared according to the result
R: Previously saved value is restored
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 20 INSTRUCTION SET
Flag
Mnemonic Operands Byte Clock Operation
Z AC CY
MOV r,#byte 3 6 r ← byte
saddr,#byte 3 6 (saddr) ← byte
sfr,#byte 3 6 sfr ← byte
A,r Note 1
2 4 A←r
r,A Note 1
2 4 r←A
A,saddr 2 4 A ← (saddr)
saddr,A 2 4 (saddr) ← A
A,sfr 2 4 A ← sfr
sfr,A 2 4 sfr ← A
A,!addr16 3 8 A ← (addr16)
!addr16,A 3 8 (addr16) ← A
PSW,#byte 3 6 PSW ← byte × × ×
A,PSW 2 4 A ← PSW
PSW,A 2 4 PSW ← A × × ×
A,[DE] 1 6 A ← (DE)
[DE],A 1 6 (DE) ← A
et4U.com A ← (HL) e
A,[HL] 1 6
DataShe
[HL],A 1 6 (HL) ← A
DataSheet4U.com
A,[HL+byte] 2 6 A ← (HL+byte)
[HL+byte],A 2 6 (HL+byte) ← A
XCH A,X 1 4 A↔X
A,r Note 2 2 6 A↔r
A,saddr 2 6 A ↔ (saddr)
A,sfr 2 6 A ↔ sfr
A,[DE] 1 8 A ↔ (DE)
A,[HL] 1 8 A ↔ (HL)
A,[HL+byte] 2 8 A ↔ (HL+byte)
Notes 1. Except r = A.
2. Except r = A, X.
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the Processor Clock Control
Register (PCC).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 20 INSTRUCTION SET
Flag
Mnemonic Operands Byte Clock Operation
Z AC CY
MOVW rp,#word 3 6 rp ← word
AX,saddrp 2 6 AX ← (saddrp)
saddrp,AX 2 8 (saddrp) ← AX
AX,rp Note 1 4 AX ← rp
rp,AX Note 1 4 rp ← AX
XCHW AX,rp Note 1 8 AX ↔ rp
ADD A,#byte 2 4 A,CY ← A + byte × × ×
saddr,#byte 3 6 (saddr),CY ← (saddr) + byte × × ×
A,r 2 4 A,CY ← A + r × × ×
A,saddr 2 4 A,CY ← A + (saddr) × × ×
A,!addr16 3 8 A,CY ← A + (addr16) × × ×
A,[HL] 1 6 A,CY ← A + (HL) × × ×
A,[HL+byte] 2 6 A,CY ← A + (HL+byte) × × ×
ADDC A,#byte 2 4 A,CY ← A+ byte + CY × × ×
saddr,#byte 3 6 (saddr),CY ← (saddr) + byte + CY × × ×
A,r 2 4 A,CY ← A + r + CY × × ×
A,saddr 2 4 A,CY ← A + (saddr) + CY × × ×
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the Processor Clock Control
Register (PCC).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 20 INSTRUCTION SET
Flag
Mnemonic Operands Byte Clock Operation
Z AC CY
SUBC A,#byte 2 4 A,CY ← A – byte – CY × × ×
saddr,#byte 3 6 (saddr),CY ← (saddr) – byte – CY × × ×
A,r 2 4 A,CY ← A – r – CY × × ×
A,saddr 2 4 A,CY ← A – (saddr) – CY × × ×
A,!addr16 3 8 A,CY ← A – (addr16) – CY × × ×
A,[HL] 1 6 A,CY ← A – (HL) – CY × × ×
A,[HL+byte] 2 6 A,CY ← A – (HL+byte) – CY × × ×
AND A,#byte 2 4 A ← A ∧ byte ×
saddr,#byte 3 6 (saddr) ← (saddr) ∧ byte ×
A,r 2 4 A←A∧r ×
A,saddr 2 4 A ← A ∧ (saddr) ×
A,!addr16 3 8 A ← A ∧ (addr16) ×
A,[HL] 1 6 A ← A ∧ (HL) ×
A,[HL+byte] 2 6 A ← A ∧ (HL+byte) ×
OR A,#byte 2 4 A ← A ∨ byte ×
saddr,#byte 3 6 (saddr) ← (saddr) ∨ byte ×
A,r 2 4 A←A∨r ×
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the Processor Clock Control
Register (PCC).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 20 INSTRUCTION SET
Flag
Mnemonic Operands Byte Clock Operation
Z AC CY
CMP A,#byte 2 4 A – byte × × ×
saddr,#byte 3 6 (saddr) – byte × × ×
A,r 2 4 A–r × × ×
A,saddr 2 4 A – (saddr) × × ×
A,!addr16 3 8 A – (addr16) × × ×
A,[HL] 1 6 A – (HL) × × ×
A,[HL+byte] 2 6 A – (HL+byte) × × ×
ADDW AX,#word 3 6 AX,CY ← AX + word × × ×
SUBW AX,#word 3 6 AX,CY ← AX – word × × ×
CMPW AX,#word 3 6 AX – word × × ×
INC r 2 4 r←r+1 × ×
saddr 2 4 (saddr) ← (saddr) + 1 × ×
DEC r 2 4 r←r–1 × ×
saddr 2 4 (saddr) ← (saddr) – 1 × ×
INCW rp 1 4 rp ← rp + 1
DECW rp 1 4 rp ← rp – 1
ROR A,1 1 2 (CY,A7 ← A0, Am–1 ← Am) × 1 ×
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the Processor Clock Control
Register (PCC).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 20 INSTRUCTION SET
Flag
Mnemonic Operands Byte Clock Operation
Z AC CY
CALL !addr16 3 6 (SP – 1) ← (PC + 3)H, (SP – 2) ← (PC + 3)L,
PC ← addr16, SP ← SP – 2
CALLT [addr5] 1 8 (SP – 1) ← (PC + 1)H, (SP – 2) ← (PC + 1)L,
PCH ← (00000000, addr5 + 1),
PCL ← (00000000, addr5), SP ← SP – 2
RET 1 6 PCH ← (SP + 1), PCL ← (SP), SP ← SP + 2
RETI 1 8 PCH ← (SP + 1), PCL ← (SP), R R R
PSW ← (SP + 2), SP ← SP + 3, NMIS ← 0
PUSH PSW 1 2 (SP – 1) ← PSW, SP ← SP – 1
rp 1 4 (SP – 1) ← rpH, (SP – 2) ← rpL, SP ← SP – 2
POP PSW 1 4 PSW ← (SP), SP ← SP + 1 R R R
rp 1 6 rpH ← (SP + 1), rpL ← (SP), SP ← SP + 2
MOVW SP, AX 2 8 SP ← AX
AX, SP 2 6 AX ← SP
BR !addr16 3 6 PC ← addr16
$addr16 2 6 PC ← PC + 2 + jdisp8
AX 1 6 PCH ← A, PCL ← X
BC $addr16 2 6 PC ← PC + 2 + jdisp8 if CY = 1
BNC $addr16 2 6 PC ← PC + 2 + jdisp8 if CY = 0
et4U.com e
BZ $saddr16 2 6 PC ← PC + 2 + jdisp8 if Z = 1 DataShe
BNZ $saddr16 2 6 PC ← PC + 2 + jdisp8 if Z = 0
DataSheet4U.com
BT saddr.bit,$addr16 4 10 PC ← PC + 4 + jdisp8 if (saddr.bit) = 1
sfr.bit,$addr16 4 10 PC ← PC + 4 + jdisp8 if sfr.bit = 1
A.bit,$addr16 3 8 PC ← PC + 3 + jdisp8 if A.bit = 1
PSW.bit,$addr16 4 10 PC ← PC + 4 + jdisp8 if PSW.bit = 1
BF saddr.bit,$addr16 4 10 PC ← PC + 4 + jdisp8 if (saddr.bit) = 0
sfr.bit,$addr16 4 10 PC ← PC + 4 + jdisp8 if sfr.bit = 0
A.bit,$addr16 3 8 PC ← PC + 3 + jdisp8 if A.bit = 0
PSW.bit,$addr16 4 10 PC ← PC + 4 + jdisp8 if PSW.bit = 0
DBNZ B,$addr16 2 6 B ← B – 1, then PC ← PC + 2 + jdisp8 if B ≠ 0
C,$addr16 2 6 C ← C – 1, then PC ← PC + 2 + jdisp8 if C ≠ 0
saddr,$addr16 3 8 (saddr) ← (saddr) – 1, then
PC ← PC + 3 + jdisp8 if (saddr) ≠ 0
NOP 1 2 No Operation
EI 3 6 IE ← 1 (Enable Interrupt)
DI 3 6 IE ← 0 (Disable Interrupt)
HALT 1 2 Set HALT Mode
STOP 1 2 Set STOP Mode
Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the Processor Clock Control
Register (PCC).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 20 INSTRUCTION SET
2nd Operand
#byte A r sfr saddr !addr16 PSW [DE] [HL] [HL+byte] $addr16 1 None
1st Operand
A ADD MOVNote MOV MOV MOV MOV MOV MOV MOV ROR
ADDC XCHNote XCH XCH XCH XCH XCH ROL
SUB ADD ADD ADD ADD ADD RORC
SUBC ADDC ADDC ADDC ADDC ADDC ROLC
AND SUB SUB SUB SUB SUB
OR SUBC SUBC SUBC SUBC SUBC
XOR AND AND AND AND AND
CMP OR OR OR OR OR
XOR XOR XOR XOR XOR
CMP CMP CMP CMP CMP
B, C DBNZ
!addr16 MOV
[DE] MOV
[HL] MOV
[HL+byte] MOV
Note Except r = A.
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 20 INSTRUCTION SET
2nd Operand
#word AX rpNote saddrp SP None
1st Operand
AX ADDW MOVW MOVW MOVW
SUBW XCHW
CMPW
rp MOVW MOVWNote INCW
DECW
PUSH
POP
saddrp MOVW
SP MOVW
2nd Operand
$addr16 None
et4U.com e
1st Operand DataShe
A.bit BT SET1
DataSheet4U.com
BF CLR1
sfr.bit BT SET1
BF CLR1
saddr.bit BT SET1
BF CLR1
PSW.bit BT SET1
BF CLR1
[HL].bit SET1
CLR1
CY SET1
CLR1
NOT1
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
CHAPTER 20 INSTRUCTION SET
2nd Operand
AX !addr16 [addr5] $addr16
1st Operand
Basic Instructions BR CALL CALLT BR
BR BC
BNC
BZ
BNZ
Compound Instructions DBNZ
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The following development tools are available for the development of systems that employ the µPD789104A/114A/
124A/134A Subseries.
Figure A-1 shows the development tool configuration.
• Windows
Unless otherwise specified, “Windows” indicates the following OSs.
Windows 3.1
Windows 95
Windows NT™ Ver. 4.0
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
APPENDIX A DEVELOPMENT TOOLS
Interface adapter
Flash memory
write adapter
Conversion socket
Target system
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
APPENDIX A DEVELOPMENT TOOLS
RA78K0S A program that converts a program written in mnemonic into object codes that can
Assembler package be executed by microcontrollers.
In addition, automatic functions to generate symbol tables and optimize branch
instructions are also provided.
Used in combination with a device file (DF789136) (sold separately).
<Caution when used in PC environment>
The assembler package is a DOS-based application but may be used in the Windows
environment by using the Project Manager of Windows (included in the assembler
package).
Part number: µS××××RA78K0S
CC78K0S A program that converts a program written in C language into object codes that can
C compiler package be executed by microcontrollers.
Used in combination with an assembler package (RA78K0S) and device file
(DF789136) (both sold separately).
<Caution when used in PC environment>
The C compiler package is a DOS-based application but may be used in the Windows
environment by using the Project Manager of Windows (included in the assembler
package).
Part number: µS××××CC78K0S
DF789136Note File containing the information inherent to the device.
Device file Used in combination with RA78K0S, CC78K0S, and SM78K0S (all sold separately).
Part number: µS××××DF789136
et4U.com e
DataShe
CC78K0S-L Source file of functions for generating the object library included in the C compiler
C compiler source file package.
DataSheet4U.com
Necessary for changing the object library included in the C compiler package
according to customerís specifications. Since this is a source file, its working
environment does not depend on any particular operating system.
Part number: µS××××CC78K0S-L
Note DF789136 is a common file that can be used with RA78K0S, CC78K0S, and SM78K0S.
Remark ×××× in the part number differs depending on the host machine and operating system to be used.
µS××××RA78K0S
µS××××CC78K0S
µS××××DF789136
µS××××CC78K0S-L
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
APPENDIX A DEVELOPMENT TOOLS
Flashpro III Dedicated flash programmer for microcontrollers incorporating flash memory
(Part No. FL-PR3, PG-FP3)
Flash programmer
FA-30MC Adapter for writing to flash memory and connected to Flashpro III.
Flash memory writing adapter • FA-30MC: for 30-pin plastic SSOP (MC-5A4 type)
Remark The FL-PR3 and FA-30MC are products made by Naito Densei Machida Mfg. Co., Ltd.
(TEL +81-44-822-3813).
A.3.1 Hardware
IE-78K0S-NS In-circuit emulator for debugging the hardware and software of an application system using
In-circuit emulator the 78K/0S Series. Supports an integrated debugger (ID78K0S-NS). Used in combination
with an AC adapter, emulation probe, and interface adapter for connecting the host machine.
IE-70000-MC-PS-B Adapter for supplying power from an AC 100 to 240 V outlet.
AC adapter
IE-70000-98-IF-C Adapter necessary when using a PC-9800 series PC (except notebook type) as the host
Interface adapter machine of the IE-78K0S-NS (C bus supported)
IE-70000-CD-IF-A PC card and interface cable necessary when using a notebook PC as the host machine of
Remark The NP-36GS, and NGS-30 are products made by Naito Densei Machida Mfg. Co., Ltd. For details of
these products, contact Naito Densei Machida Mfg. Co., Ltd. (TEL +81-44-822-3813).
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
APPENDIX A DEVELOPMENT TOOLS
A.3.2 Software
Remark ×××× in the part number differs depending on the host machine and operating system to be used.
µS××××ID78K0S-NS
SM78K0S DataSheet4U.com
Debugs the program at C source level or assembler level while simulating operation of the
System simulator target system on the host machine.
SM78K0S runs in Windows.
By using SM78K0S, the logic and performance of an application can be verified independently
of hardware development even when the in-circuit emulator is not used. This enhances
development efficiency and improves software quality.
Used in combination with a device file (DF789136) (sold separately).
Part number: µS××××SM78K0S
DF789136Note File containing the information inherent to the device.
Device file Used in combination with the RA78K0S, CC78K0S, and SM78K0S (all sold separately).
Part number: µS××××DF789136
Note DF789136 is a common file that can be used with the RA78K0S, CC78K0S, and SM78K0S.
Remark ×××× in the part number differs depending on the host machine and operating system to be used.
µS××××SM78K0S
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
The following embedded software products are available for efficient program development and maintenance of
the µPD789104A/114A/124A/134A Subseries.
MX78K0S MX78K0S is a subset OS that is based on the µITRON specification. Supplied with the MX78K0S
OS nucleus. The MX78K0S OS controls tasks, events, and time. In task control, the MX78K0S OS
controls task execution order, and then perform the switching process to a task to be executed.
<Caution when used in a PC environment>
The MX78K0S is a DOS-based application. Use this software in the DOS pane when running it on
Windows.
Part number: µS××××MX78K0S
Remark ×××× in the part number differ depending on the host machine and OS used.
µS××××MX78K0S
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[MEMO]
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
[A]
Asynchronous serial interface mode register 20 (ASIM20) ............................................... 168, 175, 178, 190
Asynchronous serial interface status register 20 (ASIS20) ................................................................ 170, 179
A/D conversion result register 0 (ADCR0) ................................................................................................... 136
A/D converter mode register 0 (ADM0) ....................................................................................................... 138
Analog input channel specification register 0 (ADS0) ................................................................................ 139
et4U.com [B] e
DataShe
Baud rate generator control register 20 (BRGC20) ................................................................... 171, 180, 191
DataSheet4U.com
[E]
External interrupt mode register 0 (INTM0) ................................................................................................. 209
[I]
Interrupt mask flag register 0 (MK0) ............................................................................................................ 208
Interrupt mask flag register 1 (MK1) ............................................................................................................ 208
Interrupt request flag register 0 (IF0) ........................................................................................................... 207
Interrupt request flag register 1 (IF1) ........................................................................................................... 207
[M]
Multiplication data register A0 (MRA0) ........................................................................................................ 199
Multiplication data register B0 (MRB0) ........................................................................................................ 199
Multiplier control register 0 (MULC0) ........................................................................................................... 201
[O]
Oscillation stabilization time select register (OSTS) ................................................................................... 220
[P]
Port 0 (P0) ....................................................................................................................................................... 75
Port 1 (P1) ....................................................................................................................................................... 76
Port 2 (P2) ....................................................................................................................................................... 77
Port 5 (P5) ....................................................................................................................................................... 81
Port 6 (P6) ....................................................................................................................................................... 82
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
APPENDIX C REGISTER INDEX
[R]
Receive buffer register 20 (RXB20) ............................................................................................................. 166
[S]
Serial operating mode register 20 (CSIM20) ...................................................................... 167, 174, 177, 189
[T]
Timer clock select register 2 (TCL2) ............................................................................................................ 131
Transmit shift register 20 (TXS20) ............................................................................................................... 166
[W]
Watchdog timer mode register (WDTM) ...................................................................................................... 132
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
APPENDIX C REGISTER INDEX
[A]
ADCR0: A/D conversion result register 0 ................................................................................................ 136
ADM0: A/D converter mode register 0 .................................................................................................. 138
ADS0: Analog input channel specification register 0 ........................................................................... 139
ASIM20: Asynchronous serial interface mode register 20 ............................................. 168, 175, 178, 190
ASIS20: Asynchronous serial interface status register 20 .............................................................. 170, 179
[B]
BRGC20: Baud rate generator control register 20 ................................................................... 171, 180, 191
[C]
CR20: 16-bit compare register 20 ......................................................................................................... 106
CR80: 8- bit compare register 80 .......................................................................................................... 117
CSIM20: Serial operating mode register 20 .................................................................... 167, 174, 177, 189
[I]
IF0: Interrupt request flag register 0 ................................................................................................. 207
IF1: Interrupt request flag register 1 ................................................................................................. 207
INTM0: External interrupt mode register 0 ............................................................................................. 209
et4U.com [M] e
DataShe
MK0: Interrupt mask flag register 0 ..................................................................................................... 208
MK1: DataSheet4U.com
Interrupt mask flag register 1 ..................................................................................................... 208
MRA0: Multiplication data register A0 ................................................................................................... 199
MRB0: Multiplication data register B0 ................................................................................................... 199
MUL0: 16-bit multiplication result storage register 0 ............................................................................ 199
MULC0: Multiplier control register 0 ........................................................................................................ 201
[O]
OSTS: Oscillation stabilization time select register .............................................................................. 220
[P]
P0: Port 0 ............................................................................................................................................ 75
P1: Port 1 ............................................................................................................................................ 76
P2: Port 2 ............................................................................................................................................ 77
P5: Port 5 ............................................................................................................................................ 81
P6: Port 6 ............................................................................................................................................ 82
PCC: Processor clock control register ............................................................................................ 88, 96
PM0: Port mode register 0 .................................................................................................................... 83
PM1: Port mode register 1 .................................................................................................................... 83
PM2: Port mode register 2 ................................................................................................... 83, 109, 119
PM5: Port mode register 5 .................................................................................................................... 83
PU0: Pull-up resistor option register 0 ................................................................................................. 84
PUB2: Pull-up resistor option register B2 ............................................................................................... 84
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
APPENDIX C REGISTER INDEX
[R]
RXB20: Receive buffer register 20 .......................................................................................................... 166
[T]
TCL2: Timer clock select register 2 ...................................................................................................... 131
TCP20: 16-bit timer capture register 20 ................................................................................................. 106
TM20: 16-bit timer counter 20 ............................................................................................................... 106
TM80: 8-bit timer counter 80 ................................................................................................................. 117
TMC20: 16-bit timer mode control register 20 ........................................................................................ 116
TMC80: 8-bit timer mode control register 80 .......................................................................................... 118
TXS20: Transmit shift register 20 ........................................................................................................... 166
[W]
WDTM: Watchdog timer mode register .................................................................................................. 132
et4U.com e
DataShe
DataSheet4U.com
DataSheet4U.com
DataSheet 4 U .com
www.DataSheet4U.com
Tel. FAX
Address
North America Hong Kong, Philippines, Oceania Asian Nations except Philippines
NEC Electronics Inc. NEC Electronics Hong Kong Ltd. NEC Electronics Singapore Pte. Ltd.
Corporate Communications Dept. Fax: +852-2886-9022/9044 Fax: +65-250-3583
Fax: 1-800-729-9288
1-408-588-6130
Korea Japan
Europe
NEC Electronics Hong Kong Ltd. NEC Semiconductor Technical Hotline
NEC Electronics (Europe) GmbH
et4U.com Technical Documentation Dept. DataSheet4U.com
Seoul Branch Fax: 044-548-7900
Fax: 02-528-4411
Fax: +49-211-6503-274
South America Taiwan
NEC do Brasil S.A. NEC Electronics Taiwan Ltd.
Fax: +55-11-6465-6829 Fax: 02-2719-5951
Document title:
DataSheet 4 U .com