EN
NEC logo
Official user manual

NEC switch

234 pages·1.9 MB·Network Card·PDF·ENDEFRITNLJA
NEC switch
Table of Contents 164 sections COVER · Major Revisions in This Edition · INTRODUCTION · CHAPTER 1 GENERAL · … ShowHide
COVERp.1Major Revisions in This Editionp.6INTRODUCTIONp.7CHAPTER 1 GENERALp.211.1 Featuresp.211.2 Applicationsp.211.3 Ordering Informationp.211.4 Pin Configuration (Top View)p.221.5 78K/0S Series Lineupp.231.6 Block Diagramp.261.7 Functionsp.27CHAPTER 2 PIN FUNCTIONSp.282.1 List of Pin Functionsp.282.2 Pin Functionsp.302.2.1 P00 to P07 (Port 0)p.302.2.2 P10 to P17 (Port 1)p.302.2.3 P20 to P26 (Port 2)p.302.2.4 P40 to P47 (Port 4)p.312.2.5 RESET#p.312.2.6 X1, X2p.312.2.7 REGCp.312.2.8 USBDMp.312.2.9 USBDPp.312.2.10 VDD0, VDD1p.312.2.11 VSS0, VSS1p.312.2.12 VPP (uPD78F9801 only)p.322.2.13 IC (mask ROM version only)p.322.3 Pin I/O Circuits and Recommended Connection of Unused Pinsp.33CHAPTER 3 CPU ARCHITECTUREp.353.1 Memory Spacep.353.1.1 Internal program memory spacep.373.1.2 Internal data memory (internal high-speed RAM) spacep.373.1.3 Special function register (SFR) areap.373.1.4 Data memory addressingp.383.2 Processor Registersp.403.2.1 Control registersp.403.2.2 General-purpose registersp.433.2.3 Special function registers (SFRs)p.443.3 Instruction Address Addressingp.483.3.1 Relative addressingp.483.3.2 Immediate addressingp.493.3.3 Table indirect addressingp.503.3.4 Register addressingp.503.4 Operand Address Addressingp.513.4.1 Direct addressingp.513.4.2 Short direct addressingp.523.4.3 Special function register (SFR) addressingp.533.4.4 Register addressingp.543.4.5 Register indirect addressingp.553.4.6 Based addressingp.563.4.7 Stack addressingp.56CHAPTER 4 PORT FUNCTIONSp.574.1 Port Functionsp.574.2 Port Configurationp.594.2.1 Port 0p.604.2.2 Port 1p.614.2.3 Port 2p.624.2.4 Port 4p.684.3 Registers Controlling Port Functionp.694.4 Port Function Operationp.724.4.1 Writing to I/O portp.724.4.2 Reading from I/O portp.724.4.3 Arithmetic operation of I/O portp.72CHAPTER 5 CLOCK GENERATORp.735.1 Clock Generator Functionsp.735.2 Clock Generator Configurationp.735.3 Register Controlling Clock Generatorp.745.4 System Clock Oscillatorsp.755.4.1 System clock oscillatorp.755.4.2 Examples of incorrect resonator connectionp.765.4.3 Frequency dividerp.775.5 Clock Generator Operationp.775.6 Changing Setting of CPU Clockp.785.6.1 Time required for switching CPU clockp.785.6.2 Switching CPU clockp.78CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01p.796.1 Functions of 8-Bit Timer/Event Counters 00 and 01p.796.2 Configuration of 8-Bit Timer/Event Counters 00 and 01p.806.3 Registers Controlling 8-Bit Timer/Event Counters 00 and 01p.826.4 Operation of 8-Bit Timer/Event Counters 00 and 01p.856.4.1 Operation as interval timerp.856.4.2 Operation as external event counter (timer 01 only)p.876.4.3 Operation as square-wave output (timer 01 only)p.886.5 Notes on Using 8-Bit Timer/Event Counters 00 and 01p.90CHAPTER 7 WATCHDOG TIMERp.917.1 Watchdog Timer Functionsp.917.2 Watchdog Timer Configurationp.927.3 Registers Controlling Watchdog Timerp.937.4 Watchdog Timer Operationp.957.4.1 Operation as watchdog timerp.957.4.2 Operation as interval timerp.96CHAPTER 8 USB FUNCTIONp.978.1 USB Overviewp.978.2 USB Function Featuresp.988.3 USB Function Configurationp.988.4 Registers Controlling USB Functionp.1098.5 USB Function Operationp.1228.5.1 USB timer operationp.1228.5.2 Remote wakeup control operationp.1258.6 Interrupt Request from USB Functionp.1278.6.1 Interrupt sourcesp.1278.6.2 Cautions when using interruptsp.1298.7 USB Function Controlp.1308.7.1 Relationship between packets and operation modesp.1308.7.2 Interrupt servicing flowp.1368.8 USB Function Internal Circuit Operationsp.1408.8.1 Operation of transmit/receive pointerp.1408.8.2 Receive bank switching ID detection buffer operationp.1478.8.3 Sync detection/USBCLK detector operationp.1488.8.4 NRZI encoder operationp.1508.8.5 Bit stuffing/strip controller operationp.151CHAPTER 9 SERIAL INTERFACE 10p.1549.1 Functions of Serial Interface 10p.1549.2 Configuration of Serial Interface 10p.1559.3 Register Controlling Serial Interface 10p.1579.4 Operation of Serial Interface 10p.1599.4.1 Operation stop modep.1599.4.2 3-wire serial I/O modep.160CHAPTER 10 REGULATORp.162CHAPTER 11 INTERRUPT FUNCTIONSp.16311.1 Interrupt Function Typesp.16311.2 Interrupt Sources and Configurationp.16311.3 Registers Controlling Interrupt Functionp.16611.4 Interrupt Servicing Operationp.17111.4.1 Non-maskable interrupt acknowledgment operationp.17111.4.2 Maskable interrupt acknowledgment operationp.17311.4.3 Multiplexed interrupt servicingp.17511.4.4 Interrupt request holdp.177CHAPTER 12 STANDBY FUNCTIONp.17812.1 Standby Function and Configurationp.17812.1.1 Standby functionp.17812.1.2 Register controlling standby functionp.17912.2 Standby Function Operationp.18012.2.1 HALT modep.18012.2.2 STOP modep.183CHAPTER 13 RESET FUNCTIONp.186CHAPTER 14 uPD78F9801p.19014.1 Flash Memory Characteristicsp.19114.1.1 Programming environmentp.19114.1.2 Communication modep.19214.1.3 On-board pin processingp.19514.1.4 Connection of adapter for flash writingp.198CHAPTER 15 INSTRUCTION SETp.20015.1 Operationp.20015.1.1 Operand identifiers and description methodsp.20015.1.2 Description of “operation” columnp.20115.1.3 Description of “flag operation” columnp.20115.2 Operation Listp.20215.3 Instructions Listed by Addressing Typep.207CHAPTER 16 ELECTRICAL SPECIFICATIONSp.210CHAPTER 17 PACKAGE DRAWINGSp.219CHAPTER 18 RECOMMENDED SOLDERING CONDITIONSp.220A.1 Software Packagep.223A.2 Language Processing Softwarep.223A.3 Control Softwarep.224A.4 Flash Memory Writing Toolsp.224A.5 Debugging Tools (Hardware)p.225A.6 Debugging Tools (Software)p.226A.7 Notes on Target System Designp.227APPENDIX A DEVELOPMENT TOOLSp.221APPENDIX B REGISTER INDEXp.229B.1 Register Index (Alphabetic Order of Register Name)p.229B.2 Register Index (Alphabetic Order of Register Symbol)p.231APPENDIX C REVISION HISTORYp.233
Page 1 of the NEC switch user manual — User’s Manual
Page 1 · click to enlarge
Page 1

User’s Manual

µ PD789800 Subseries

8-Bit Single-Chip Microcontrollers

µ PD789800 µ PD78F9801

Document No. U12978EJ3V0UD00 (3rd edition) Date Published February 2003 N CP (K)

1998, 2003 · Printed in Japan

Page 2 of the NEC switch user manual — [MEMO]
Page 2 · click to enlarge
Page 2

[MEMO]

Page 3 of the NEC switch user manual — NOTES FOR CMOS DEVICES
Page 3 · click to enlarge
Page 3

NOTES FOR CMOS DEVICES

1 PRECAUTION AGAINST ESD FOR SEMICONDUCTORS Note: Strong electric field, when exposed to a MOS device, can cause destruction of the gate oxide and ultimately degrade the device operation. Steps must be taken to stop generation of static electricity as much as possible, and quickly dissipate it once, when it has occurred. Environmental control must be adequate. When it is dry, humidifier should be used. It is recommended to avoid using insulators that easily build static electricity. Semiconductor devices must be stored and transported in an anti-static container, static shielding bag or conductive material. All test and measurement tools including work bench and floor should be grounded. The operator should be grounded using wrist strap. Semiconductor devices must not be touched with bare hands. Similar precautions need to be taken for PW boards with semiconductor devices on it.

2 HANDLING OF UNUSED INPUT PINS FOR CMOS Note: No connection for CMOS device inputs can be cause of malfunction. If no connection is provided to the input pins, it is possible that an internal input level may be generated due to noise, etc., hence causing malfunction. CMOS devices behave differently than Bipolar or NMOS devices. Input levels of CMOS devices must be fixed high or low by using a pull-up or pull-down circuitry. Each unused pin should be connected to VDD or GND with a resistor, if it is considered to have a possibility of being an output pin. All handling related to the unused pins must be judged device by device and related specifications governing the devices.

3 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.

FIP and EEPROM are trademarks of NEC Electronics Corporation.

Windows and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the

United States and/or other countries.

PC/AT is a trademark of International Business Machines Corporation.

HP9000 Series 700 and HP-UX are trademarks of Hewlett-Packard Company.

SPARCstation is a trademark of SPARC International, Inc.

Solaris and SunOS are trademarks of Sun Microsystems, Inc.

Page 4 of the NEC switch user manual — M8E 02. 11-1
Page 4 · click to enlarge
Page 4

These commodities, technology or software, must be exported in accordance with the export administration regulations of the exporting country. Diversion contrary to the law of that country is prohibited.

The information in this document is current as of September, 2002. The information is subject to change without notice. For actual design-in, refer to the latest publications of NEC Electronics data sheets or data books, etc., for the most up-to-date specifications of NEC Electronics products. Not all products and/or types are available in every country. Please check with an NEC Electronics sales representative for availability and additional information. No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Electronics. NEC Electronics assumes no responsibility for any errors that may appear in this document. NEC Electronics does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from the use of NEC Electronics products listed in this document or any other liability arising from the use of such products. No license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of NEC Electronics or others. Descriptions of circuits, software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples. The incorporation of these circuits, software and information in the design of a customer's equipment shall be done under the full responsibility of the customer. NEC Electronics assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. While NEC Electronics endeavors to enhance the quality, reliability and safety of NEC Electronics products, customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To minimize risks of damage to property or injury (including death) to persons arising from defects in NEC Electronics products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment and anti-failure features. NEC Electronics products are classified into the following three quality grades: "Standard", "Special" and "Specific". The "Specific" quality grade applies only to NEC Electronics products developed based on a customer- designated "quality assurance program" for a specific application. The recommended applications of an NEC Electronics product depend on its quality grade, as indicated below. Customers must check the quality grade of each NEC Electronics product before using it in a particular application. "Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio

and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots. "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 Electronics products is "Standard" unless otherwise expressly specified in NEC Electronics data sheets or data books, etc. If customers wish to use NEC Electronics products in applications not intended by NEC Electronics, they must contact an NEC Electronics sales representative in advance to determine NEC Electronics' willingness to support a given application.

(Note) (1) "NEC Electronics" as used in this statement means NEC Electronics Corporation and also includes its

majority-owned subsidiaries. (2) "NEC Electronics products" means any product developed or manufactured by or for NEC Electronics

(as defined above).

M8E 02. 11-1

Show 6 more labels / short text on this page
• · • · • · • · • · •
Page 5 of the NEC switch user manual — J02.11
Page 5 · click to enlarge
Page 5

Regional Information

Some information contained in this document may vary from country to country. Before using any NEC Electronics product in your application, pIease contact the NEC Electronics office in your country to obtain a list of authorized representatives and distributors. They will verify:

  • Device availability
  • Ordering information
  • Product release schedule
  • Availability of related technical literature
  • Development environment specifications (for example, specifications for third-party tools and components, host computers, power plugs, AC supply voltages, and so forth)
  • Network requirements

In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary from country to country.

NEC Electronics America, Inc. (U.S.) Santa Clara, California Tel: 408-588-6000 800-366-9782 Fax: 408-588-6130 800-729-9288

  • Filiale Italiana Milano, Italy Tel: 02-66 75 41 Fax: 02-66 75 42 99

NEC Electronics Hong Kong Ltd. Hong Kong Tel: 2886-9318 Fax: 2886-9022/9044

  • Branch The Netherlands Eindhoven, The Netherlands Tel: 040-244 58 45 Fax: 040-244 45 80

NEC Electronics Hong Kong Ltd. Seoul Branch Seoul, Korea Tel: 02-528-0303 Fax: 02-528-4411

NEC Electronics (Europe) GmbH Duesseldorf, Germany Tel: 0211-65 03 01 Fax: 0211-65 03 327

  • Tyskland Filial Taeby, Sweden Tel: 08-63 80 820 Fax: 08-63 80 388

NEC Electronics Shanghai, Ltd. Shanghai, P.R. China Tel: 021-6841-1138 Fax: 021-6841-1137

  • Sucursal en España Madrid, Spain Tel: 091-504 27 87 Fax: 091-504 28 60
  • United Kingdom Branch Milton Keynes, UK Tel: 01908-691-133 Fax: 01908-670-290

NEC Electronics Taiwan Ltd. Taipei, Taiwan Tel: 02-2719-2377 Fax: 02-2719-5951

  • Succursale Française
Vélizy-Villacoublay, France Tel01-30-67 58 00 Fax: 01-30-67 58 99

NEC Electronics Singapore Pte. Ltd. Novena Square, Singapore Tel: 6253-8311 Fax: 6250-3583

J02.11

Page 6 of the NEC switch user manual — Major Revisions in This Edition
Page 6 · click to enlarge
Page 6

Major Revisions in This Edition

PageContents ThroughoutDeletion of CU-type and GB-3BS type packages Deletion of indication “under development” for µPD78F9801 p. 21Modification of operating ambient temperature when flash memory is written in 1.1 Features p. 27Addition of outline of timer in 1.7 Functions pp. 29, 31 to 33Modification of handling of REGC and VPP pins pp. 35, 36Correction of address values in Figure 3-1 Memory Map (µPD789800) and Figure 3-2 Memory Map (µPD78F9801) p. 75Modification of Figure 5-3 External Circuit of System Clock Oscillator (b) External clock pp. 98, 103, 105, 106, 108 to 112, 115 to 117, 120, 125, 127 to 130CHAPTER 8 USB FUNCTION • Modification of chapter composition • Standardization of buffer name indications as receive token bank, receive data bank, and transmit data banks 0 and 1 • Addition of image diagrams for reception and transmission • Addition of register value for SETUP reception • Modification of description on data handshake packet receive mode register (URXMOD) • Addition of description on packet receive status register (RXSTAT) and modification of read-only bit • Addition of Note for token packet receive result store register (TRXRSL) • Addition of Caution for data packet transmit reservation register (DTXRSV) • Modification of description of bit 1 (DNAEN) of handshake packet transmit reservation register (HTXRSV) • Change of contents of 8.5.2 Remote wakeup control operation • Addition of Table 8-4 List of Sources of Interrupts from USB Function • Correction of incorrect flag name in 8.6 Interrupt Request from USB Function • Addition of description on USB reset/Resume detection interrupt (INTUSBRE) • Addition of 8.7 USB Function Control p. 162Modification of Figure 10-1 Block Diagram of Regulator and USB Driver/Receiver and Cautions p. 164Addition of Remark in Table 11-1 Interrupt Source List p. 167Addition of Caution 3 on watchdog timer interrupt to Figure 11-2 Format of Interrupt Request Flag Register p. 184Addition of 12.2.2 STOP mode (3) Cautions on STOP instruction execution pp. 191 to 199Revision of contents of flash memory programming as 14.1 Flash Memory Characteristics pp. 210 to 218Addition of CHAPTER 16 ELECTRICAL SPECIFICATIONS p. 219Addition of CHAPTER 17 PACKAGE DRAWING p. 220Addition of CHAPTER 18 RECOMMENDED SOLDERING CONDITIONS pp. 221 to 228Revision of APPENDIX A DEVELOPMENT TOOLS Deletion of embedded software and addition of notes on target system design pp. 233, 234Addition of the revision contents in 3rd edition in APPENDIX C REVISION HISTORY

The mark shows major revised points.

Page 7 of the NEC switch user manual — INTRODUCTION
Page 7 · click to enlarge
Page 7

INTRODUCTION

Readers This manual is intended for users who wish to understand the functions of the

µPD789800 Subseries and who design and develop its application systems and

programs.

Target products:

  • µ PD789800 Subseries: µ PD789800 and µ PD78F9801

Purpose This manual is intended to give users an understanding of the functions described in

the Organization below.

Organization Two manuals are available for the µPD789800 Subseries:

This manual and the Instruction Manual (common to the 78K/0S Series).

  • Pin functions
  • CPU function
  • Internal block functions
  • Instruction set
  • Interrupts
  • Instruction description
  • Other internal peripheral functions
  • Electrical specifications

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.

  • To understand the overall functions of the µ PD789800 Subseries

→Read this manual in the order of the CONTENTS.

  • How to read register formats

→The name of a bit whose number is enclosed in angle brackets (< >) is reserved

in the assembler and is defined in the C compiler by the header file sfrbit.h.

  • To learn the detailed functions of a register whose register name is known

→See APPENDIX B REGISTER INDEX.

  • To learn details of the instruction functions of the 78K/0S Series

→Refer to 78K/0S Series Instruction User’s Manual (U11047E) separately

available.

  • To know the electrical specifications of the µ PD789800 Subseries

→Refer to CHAPTER 16 ELECTRICAL SPECIFICATIONS.

Conventions Data significanceHigher digits on the left and lower digits on the right
Active low representationxxx (overscore over pin or signal name)
RemarkSupplementary information
Numerical representationBinary ... xxxx or xxxxB

Decimal ... xxxx

Hexadecimal ... xxxxH

Show 5 more labels / short text on this page
78K/0S Series · µPD789800 Subseries · User’s Manual · User’s Manual · Instruction
Page 8 of the NEC switch user manual — Documents Related to Flash Memory Writing
Page 8 · click to enlarge
Page 8

Related Documents The related documents indicated in this publication may include preliminary versions.

However, preliminary versions are not marked as such.

Documents Related to Devices

Document NameDocument No. µPD789800 Subseries User’s ManualThis manual 78K/0S Series Instructions User’s ManualU11047E

Documents Related to Development Tools (Software) (User’s Manuals)

Document NameDocument No. RA78K0S Assembler PackageOperationU14876E LanguageU14877E Structured Assembly LanguageU11623E CC78K0S C CompilerOperationU14871E LanguageU14872E SM78K Series System Simulator Ver. 2.30 or LaterOperation (WindowsTM Based)U15373E External Part User Open Interface SpecificationsU15802E ID78K Series Integrated Debugger Ver. 2.30 or LaterOperation (Windows Based)U15185E Project Manager Ver. 3.12 or Later (Windows Based)U14610E

Documents Related to Development Tools (Hardware) (User’s Manuals)

Document NameDocument No. IE-78K0S-NS In-Circuit EmulatorU13549E IE-78K0S-NS-A In-Circuit EmulatorU15207E IE-789801-NS-EM1 Emulation BoardU13390E

Documents Related to Flash Memory Writing

Document NameDocument No. PG-FP3 Flash Memory Programmer User’s ManualU13502E PG-FP4 Flash Memory Programmer User’s ManualU15260E

latest version of each document for designing.

Page 9 of the NEC switch user manual — Other Related Documents
Page 9 · click to enlarge
Page 9

Other Related Documents

Document NameDocument No. SEMICONDUCTOR SELECTION GUIDE - Products and Packages - (CD-ROM)X13769X Semiconductor Device Mounting Technology ManualC10535E Quality Grades on NEC Semiconductor DevicesC11531E NEC Semiconductor Device Reliability/Quality Control SystemC10983E Guide to Prevent Damage for Semiconductor Devices by Electrostatic Discharge (ESD)C11892E

latest version of each document for designing.

Page 10 of the NEC switch user manual — Table of contents
Page 10 · click to enlarge
Page 10

Table of contents

COVERp.1Major Revisions in This Editionp.6INTRODUCTIONp.7CHAPTER 1 GENERALp.211.1 Featuresp.211.2 Applicationsp.211.3 Ordering Informationp.211.4 Pin Configuration (Top View)p.221.5 78K/0S Series Lineupp.231.6 Block Diagramp.261.7 Functionsp.27CHAPTER 2 PIN FUNCTIONSp.282.1 List of Pin Functionsp.282.2 Pin Functionsp.302.2.1 P00 to P07 (Port 0)p.302.2.2 P10 to P17 (Port 1)p.302.2.3 P20 to P26 (Port 2)p.302.2.4 P40 to P47 (Port 4)p.312.2.5 RESET#p.312.2.6 X1, X2p.312.2.7 REGCp.312.2.8 USBDMp.312.2.9 USBDPp.312.2.10 VDD0, VDD1p.312.2.11 VSS0, VSS1p.312.2.12 VPP (uPD78F9801 only)p.322.2.13 IC (mask ROM version only)p.322.3 Pin I/O Circuits and Recommended Connection of Unused Pinsp.33CHAPTER 3 CPU ARCHITECTUREp.353.1 Memory Spacep.353.1.1 Internal program memory spacep.373.1.2 Internal data memory (internal high-speed RAM) spacep.373.1.3 Special function register (SFR) areap.373.1.4 Data memory addressingp.383.2 Processor Registersp.403.2.1 Control registersp.403.2.2 General-purpose registersp.433.2.3 Special function registers (SFRs)p.443.3 Instruction Address Addressingp.483.3.1 Relative addressingp.483.3.2 Immediate addressingp.493.3.3 Table indirect addressingp.503.3.4 Register addressingp.503.4 Operand Address Addressingp.513.4.1 Direct addressingp.513.4.2 Short direct addressingp.523.4.3 Special function register (SFR) addressingp.533.4.4 Register addressingp.543.4.5 Register indirect addressingp.553.4.6 Based addressingp.563.4.7 Stack addressingp.56CHAPTER 4 PORT FUNCTIONSp.574.1 Port Functionsp.574.2 Port Configurationp.594.2.1 Port 0p.604.2.2 Port 1p.614.2.3 Port 2p.624.2.4 Port 4p.684.3 Registers Controlling Port Functionp.694.4 Port Function Operationp.724.4.1 Writing to I/O portp.724.4.2 Reading from I/O portp.724.4.3 Arithmetic operation of I/O portp.72CHAPTER 5 CLOCK GENERATORp.735.1 Clock Generator Functionsp.735.2 Clock Generator Configurationp.735.3 Register Controlling Clock Generatorp.745.4 System Clock Oscillatorsp.755.4.1 System clock oscillatorp.755.4.2 Examples of incorrect resonator connectionp.765.4.3 Frequency dividerp.775.5 Clock Generator Operationp.775.6 Changing Setting of CPU Clockp.785.6.1 Time required for switching CPU clockp.785.6.2 Switching CPU clockp.78CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01p.796.1 Functions of 8-Bit Timer/Event Counters 00 and 01p.796.2 Configuration of 8-Bit Timer/Event Counters 00 and 01p.806.3 Registers Controlling 8-Bit Timer/Event Counters 00 and 01p.826.4 Operation of 8-Bit Timer/Event Counters 00 and 01p.856.4.1 Operation as interval timerp.856.4.2 Operation as external event counter (timer 01 only)p.876.4.3 Operation as square-wave output (timer 01 only)p.886.5 Notes on Using 8-Bit Timer/Event Counters 00 and 01p.90CHAPTER 7 WATCHDOG TIMERp.917.1 Watchdog Timer Functionsp.917.2 Watchdog Timer Configurationp.927.3 Registers Controlling Watchdog Timerp.937.4 Watchdog Timer Operationp.957.4.1 Operation as watchdog timerp.957.4.2 Operation as interval timerp.96CHAPTER 8 USB FUNCTIONp.978.1 USB Overviewp.978.2 USB Function Featuresp.988.3 USB Function Configurationp.988.4 Registers Controlling USB Functionp.1098.5 USB Function Operationp.1228.5.1 USB timer operationp.1228.5.2 Remote wakeup control operationp.1258.6 Interrupt Request from USB Functionp.1278.6.1 Interrupt sourcesp.1278.6.2 Cautions when using interruptsp.1298.7 USB Function Controlp.1308.7.1 Relationship between packets and operation modesp.1308.7.2 Interrupt servicing flowp.1368.8 USB Function Internal Circuit Operationsp.1408.8.1 Operation of transmit/receive pointerp.1408.8.2 Receive bank switching ID detection buffer operationp.1478.8.3 Sync detection/USBCLK detector operationp.1488.8.4 NRZI encoder operationp.1508.8.5 Bit stuffing/strip controller operationp.151CHAPTER 9 SERIAL INTERFACE 10p.1549.1 Functions of Serial Interface 10p.1549.2 Configuration of Serial Interface 10p.1559.3 Register Controlling Serial Interface 10p.1579.4 Operation of Serial Interface 10p.1599.4.1 Operation stop modep.1599.4.2 3-wire serial I/O modep.160CHAPTER 10 REGULATORp.162CHAPTER 11 INTERRUPT FUNCTIONSp.16311.1 Interrupt Function Typesp.16311.2 Interrupt Sources and Configurationp.16311.3 Registers Controlling Interrupt Functionp.16611.4 Interrupt Servicing Operationp.17111.4.1 Non-maskable interrupt acknowledgment operationp.17111.4.2 Maskable interrupt acknowledgment operationp.17311.4.3 Multiplexed interrupt servicingp.17511.4.4 Interrupt request holdp.177CHAPTER 12 STANDBY FUNCTIONp.17812.1 Standby Function and Configurationp.17812.1.1 Standby functionp.17812.1.2 Register controlling standby functionp.17912.2 Standby Function Operationp.18012.2.1 HALT modep.18012.2.2 STOP modep.183CHAPTER 13 RESET FUNCTIONp.186CHAPTER 14 uPD78F9801p.19014.1 Flash Memory Characteristicsp.19114.1.1 Programming environmentp.19114.1.2 Communication modep.19214.1.3 On-board pin processingp.19514.1.4 Connection of adapter for flash writingp.198CHAPTER 15 INSTRUCTION SETp.20015.1 Operationp.20015.1.1 Operand identifiers and description methodsp.20015.1.2 Description of “operation” columnp.20115.1.3 Description of “flag operation” columnp.20115.2 Operation Listp.20215.3 Instructions Listed by Addressing Typep.207CHAPTER 16 ELECTRICAL SPECIFICATIONSp.210CHAPTER 17 PACKAGE DRAWINGSp.219CHAPTER 18 RECOMMENDED SOLDERING CONDITIONSp.220A.1 Software Packagep.223A.2 Language Processing Softwarep.223A.3 Control Softwarep.224A.4 Flash Memory Writing Toolsp.224A.5 Debugging Tools (Hardware)p.225A.6 Debugging Tools (Software)p.226A.7 Notes on Target System Designp.227APPENDIX A DEVELOPMENT TOOLSp.221APPENDIX B REGISTER INDEXp.229B.1 Register Index (Alphabetic Order of Register Name)p.229B.2 Register Index (Alphabetic Order of Register Symbol)p.231APPENDIX C REVISION HISTORYp.233
Page 11 of the NEC switch user manual — CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01 ............................................................79
Page 11 · click to enlarge
Page 11

3.3.4 Register addressing 50 3.4 Operand Address Addressing 51

3.4.1 Direct addressing 51

3.4.2 Short direct addressing 52

3.4.3 Special function register (SFR) addressing 53

3.4.4 Register addressing 54

3.4.5 Register indirect addressing 55

3.4.6 Based addressing 56

3.4.7 Stack addressing 56

CHAPTER 4 PORT FUNCTIONS 57

4.1 Port Functions ............................................................................................................................57 4.2 Port Configuration......................................................................................................................59

4.2.1 Port 0 60

4.2.2 Port 1 61

4.2.3 Port 2 62

4.2.4 Port 4 68 4.3 Registers Controlling Port Function 69 4.4 Port Function Operation 72

4.4.1 Writing to I/O port 72

4.4.2 Reading from I/O port 72

4.4.3 Arithmetic operation of I/O port 72

CHAPTER 5 CLOCK GENERATOR 73

5.1 Clock Generator Functions 73 5.2 Clock Generator Configuration 73 5.3 Register Controlling Clock Generator 74 5.4 System Clock Oscillators 75

5.4.1 System clock oscillator 75

5.4.2 Examples of incorrect resonator connection 76

5.4.3 Frequency divider 77 5.5 Clock Generator Operation 77 5.6 Changing Setting of CPU Clock 78

5.6.1 Time required for switching CPU clock 78

5.6.2 Switching CPU clock 78

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01 79

6.1 Functions of 8-Bit Timer/Event Counters 00 and 01 79 6.2 Configuration of 8-Bit Timer/Event Counters 00 and 01 80 6.3 Registers Controlling 8-Bit Timer/Event Counters 00 and 01 82 6.4 Operation of 8-Bit Timer/Event Counters 00 and 01 85

6.4.1 Operation as interval timer 85

6.4.2 Operation as external event counter (timer 01 only) 87

6.4.3 Operation as square-wave output (timer 01 only) 88 6.5 Notes on Using 8-Bit Timer/Event Counters 00 and 01 90

Page 12 of the NEC switch user manual — CHAPTER 10 REGULATOR ................................................................................................................162
Page 12 · click to enlarge
Page 12

CHAPTER 7 WATCHDOG TIMER 91

7.1 Watchdog Timer Functions 91 7.2 Watchdog Timer Configuration 92 7.3 Registers Controlling Watchdog Timer 93 7.4 Watchdog Timer Operation 95

7.4.1 Operation as watchdog timer 95

7.4.2 Operation as interval timer 96

CHAPTER 8 USB FUNCTION 97

8.1 USB Overview 97 8.2 USB Function Features 98 8.3 USB Function Configuration 98 8.4 Registers Controlling USB Function 109 8.5 USB Function Operation 122

8.5.1 USB timer operation 122

8.5.2 Remote wakeup control operation 125 8.6 Interrupt Request from USB Function 127

8.6.1 Interrupt sources 127

8.6.2 Cautions when using interrupts 129 8.7 USB Function Control 130

8.7.1 Relationship between packets and operation modes 130

8.7.2 Interrupt servicing flow 136 8.8 USB Function Internal Circuit Operations 140

8.8.1 Operation of transmit/receive pointer 140

8.8.2 Receive bank switching ID detection buffer operation 147

8.8.3 Sync detection/USBCLK detector operation 148

8.8.4 NRZI encoder operation 150

8.8.5 Bit stuffing/strip controller operation 151

CHAPTER 9 SERIAL INTERFACE 10 154

9.1 Functions of Serial Interface 10 154 9.2 Configuration of Serial Interface 10 155 9.3 Register Controlling Serial Interface 10 157 9.4 Operation of Serial Interface 10 159

9.4.1 Operation stop mode 159

9.4.2 3-wire serial I/O mode 160

CHAPTER 10 REGULATOR 162

CHAPTER 11 INTERRUPT FUNCTIONS............................................................................................163

11.1 Interrupt Function Types 163 11.2 Interrupt Sources and Configuration 163 11.3 Registers Controlling Interrupt Function 166 11.4 Interrupt Servicing Operation 171

11.4.1 Non-maskable interrupt acknowledgment operation 171

Page 13 of the NEC switch user manual — Table of contents
Page 13 · click to enlarge
Page 13

Table of contents

COVERp.1Major Revisions in This Editionp.6INTRODUCTIONp.7CHAPTER 1 GENERALp.211.1 Featuresp.211.2 Applicationsp.211.3 Ordering Informationp.211.4 Pin Configuration (Top View)p.221.5 78K/0S Series Lineupp.231.6 Block Diagramp.261.7 Functionsp.27CHAPTER 2 PIN FUNCTIONSp.282.1 List of Pin Functionsp.282.2 Pin Functionsp.302.2.1 P00 to P07 (Port 0)p.302.2.2 P10 to P17 (Port 1)p.302.2.3 P20 to P26 (Port 2)p.302.2.4 P40 to P47 (Port 4)p.312.2.5 RESET#p.312.2.6 X1, X2p.312.2.7 REGCp.312.2.8 USBDMp.312.2.9 USBDPp.312.2.10 VDD0, VDD1p.312.2.11 VSS0, VSS1p.312.2.12 VPP (uPD78F9801 only)p.322.2.13 IC (mask ROM version only)p.322.3 Pin I/O Circuits and Recommended Connection of Unused Pinsp.33CHAPTER 3 CPU ARCHITECTUREp.353.1 Memory Spacep.353.1.1 Internal program memory spacep.373.1.2 Internal data memory (internal high-speed RAM) spacep.373.1.3 Special function register (SFR) areap.373.1.4 Data memory addressingp.383.2 Processor Registersp.403.2.1 Control registersp.403.2.2 General-purpose registersp.433.2.3 Special function registers (SFRs)p.443.3 Instruction Address Addressingp.483.3.1 Relative addressingp.483.3.2 Immediate addressingp.493.3.3 Table indirect addressingp.503.3.4 Register addressingp.503.4 Operand Address Addressingp.513.4.1 Direct addressingp.513.4.2 Short direct addressingp.523.4.3 Special function register (SFR) addressingp.533.4.4 Register addressingp.543.4.5 Register indirect addressingp.553.4.6 Based addressingp.563.4.7 Stack addressingp.56CHAPTER 4 PORT FUNCTIONSp.574.1 Port Functionsp.574.2 Port Configurationp.594.2.1 Port 0p.604.2.2 Port 1p.614.2.3 Port 2p.624.2.4 Port 4p.684.3 Registers Controlling Port Functionp.694.4 Port Function Operationp.724.4.1 Writing to I/O portp.724.4.2 Reading from I/O portp.724.4.3 Arithmetic operation of I/O portp.72CHAPTER 5 CLOCK GENERATORp.735.1 Clock Generator Functionsp.735.2 Clock Generator Configurationp.735.3 Register Controlling Clock Generatorp.745.4 System Clock Oscillatorsp.755.4.1 System clock oscillatorp.755.4.2 Examples of incorrect resonator connectionp.765.4.3 Frequency dividerp.775.5 Clock Generator Operationp.775.6 Changing Setting of CPU Clockp.785.6.1 Time required for switching CPU clockp.785.6.2 Switching CPU clockp.78CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01p.796.1 Functions of 8-Bit Timer/Event Counters 00 and 01p.796.2 Configuration of 8-Bit Timer/Event Counters 00 and 01p.806.3 Registers Controlling 8-Bit Timer/Event Counters 00 and 01p.826.4 Operation of 8-Bit Timer/Event Counters 00 and 01p.856.4.1 Operation as interval timerp.856.4.2 Operation as external event counter (timer 01 only)p.876.4.3 Operation as square-wave output (timer 01 only)p.886.5 Notes on Using 8-Bit Timer/Event Counters 00 and 01p.90CHAPTER 7 WATCHDOG TIMERp.917.1 Watchdog Timer Functionsp.917.2 Watchdog Timer Configurationp.927.3 Registers Controlling Watchdog Timerp.937.4 Watchdog Timer Operationp.957.4.1 Operation as watchdog timerp.957.4.2 Operation as interval timerp.96CHAPTER 8 USB FUNCTIONp.978.1 USB Overviewp.978.2 USB Function Featuresp.988.3 USB Function Configurationp.988.4 Registers Controlling USB Functionp.1098.5 USB Function Operationp.1228.5.1 USB timer operationp.1228.5.2 Remote wakeup control operationp.1258.6 Interrupt Request from USB Functionp.1278.6.1 Interrupt sourcesp.1278.6.2 Cautions when using interruptsp.1298.7 USB Function Controlp.1308.7.1 Relationship between packets and operation modesp.1308.7.2 Interrupt servicing flowp.1368.8 USB Function Internal Circuit Operationsp.1408.8.1 Operation of transmit/receive pointerp.1408.8.2 Receive bank switching ID detection buffer operationp.1478.8.3 Sync detection/USBCLK detector operationp.1488.8.4 NRZI encoder operationp.1508.8.5 Bit stuffing/strip controller operationp.151CHAPTER 9 SERIAL INTERFACE 10p.1549.1 Functions of Serial Interface 10p.1549.2 Configuration of Serial Interface 10p.1559.3 Register Controlling Serial Interface 10p.1579.4 Operation of Serial Interface 10p.1599.4.1 Operation stop modep.1599.4.2 3-wire serial I/O modep.160CHAPTER 10 REGULATORp.162CHAPTER 11 INTERRUPT FUNCTIONSp.16311.1 Interrupt Function Typesp.16311.2 Interrupt Sources and Configurationp.16311.3 Registers Controlling Interrupt Functionp.16611.4 Interrupt Servicing Operationp.17111.4.1 Non-maskable interrupt acknowledgment operationp.17111.4.2 Maskable interrupt acknowledgment operationp.17311.4.3 Multiplexed interrupt servicingp.17511.4.4 Interrupt request holdp.177CHAPTER 12 STANDBY FUNCTIONp.17812.1 Standby Function and Configurationp.17812.1.1 Standby functionp.17812.1.2 Register controlling standby functionp.17912.2 Standby Function Operationp.18012.2.1 HALT modep.18012.2.2 STOP modep.183CHAPTER 13 RESET FUNCTIONp.186CHAPTER 14 uPD78F9801p.19014.1 Flash Memory Characteristicsp.19114.1.1 Programming environmentp.19114.1.2 Communication modep.19214.1.3 On-board pin processingp.19514.1.4 Connection of adapter for flash writingp.198CHAPTER 15 INSTRUCTION SETp.20015.1 Operationp.20015.1.1 Operand identifiers and description methodsp.20015.1.2 Description of “operation” columnp.20115.1.3 Description of “flag operation” columnp.20115.2 Operation Listp.20215.3 Instructions Listed by Addressing Typep.207CHAPTER 16 ELECTRICAL SPECIFICATIONSp.210CHAPTER 17 PACKAGE DRAWINGSp.219CHAPTER 18 RECOMMENDED SOLDERING CONDITIONSp.220A.1 Software Packagep.223A.2 Language Processing Softwarep.223A.3 Control Softwarep.224A.4 Flash Memory Writing Toolsp.224A.5 Debugging Tools (Hardware)p.225A.6 Debugging Tools (Software)p.226A.7 Notes on Target System Designp.227APPENDIX A DEVELOPMENT TOOLSp.221APPENDIX B REGISTER INDEXp.229B.1 Register Index (Alphabetic Order of Register Name)p.229B.2 Register Index (Alphabetic Order of Register Symbol)p.231APPENDIX C REVISION HISTORYp.233
Page 14 of the NEC switch user manual — APPENDIX C REVISION HISTORY ....................................................................................................233
Page 14 · click to enlarge
Page 14

B.1 Register Index (Alphabetic Order of Register Name) 229 B.2 Register Index (Alphabetic Order of Register Symbol) 231

APPENDIX C REVISION HISTORY 233

Page 15 of the NEC switch user manual — LIST OF FIGURES (1/4)
Page 15 · click to enlarge
Page 15

LIST OF FIGURES (1/4)

Figure No. Title Page

2-1 Pin I/O Circuits 34

3-1 Memory Map (µPD789800) 35

3-2 Memory Map (µPD78F9801) 36

3-3 Data Memory Addressing (µPD789800) 38

3-4 Data Memory Addressing (µPD78F9801) 39

3-5 Configuration of Program Counter 40

3-6 Configuration of Program Status Word 40

3-7 Configuration of Stack Pointer 42

3-8 Data to Be Saved to Stack Memory 42

3-9 Data to Be Restored from Stack Memory 42

3-10 Configuration of General-Purpose Registers 43

4-1 Port Types 57

4-2 Block Diagram of P00 to P07 60

4-3 Block Diagram of P10 to P17 61

4-4 Block Diagram of P20 62

4-5 Block Diagram of P21 63

4-6 Block Diagram of P22 64

4-7 Block Diagram of P23 and P24 65

4-8 Block Diagram of P25 66

4-9 Block Diagram of P26 67

4-10 Block Diagram of P40 to P47 68

4-11 Format of Port Mode Register 69

4-12 Format of Pull-up Resistor Option Register 0 70

4-13 Format of Port Output Mode Register 0 71

4-14 Format of Port Output Mode Register 1 71

5-1 Block Diagram of Clock Generator 73

5-2 Format of Processor Clock Control Register 74

5-3 External Circuit of System Clock Oscillator 75

5-4 Examples of Incorrect Resonator Connection 76

5-5 Switching of CPU Clock 78

6-1 Block Diagram of 8-Bit Timer 00 80

6-2 Block Diagram of 8-Bit Timer/Event Counter 01 81

6-3 Format of 8-Bit Timer Mode Control Register 00 82

6-4 Format of 8-Bit Timer Mode Control Register 01 83

6-5 Format of Port Mode Register 2 84

6-6 Interval Timer Operation Timing of 8-Bit Timer 00 86

Page 16 of the NEC switch user manual — LIST OF FIGURES (2/4)
Page 16 · click to enlarge
Page 16

LIST OF FIGURES (2/4)

Figure No. Title Page

6-7 Interval Timer Operation Timing of 8-Bit Timer/Event Counter 01 86

6-8 Timing of External Event Counter Operation (with Rising Edge Specified) 87

6-9 Timing of Square-Wave Output 89

6-10 Start Timing of 8-Bit Timer Counter 90

6-11 Timing of External Event Counter Operation 90

7-1 Block Diagram of Watchdog Timer 92

7-2 Format of Timer Clock Select Register 2 93

7-3 Format of Watchdog Timer Mode Register 94

8-1 USB Bus Topology (Desktop Type PC) 97

8-2 Block Diagram of USB Function 99

8-3 Block Diagram of USB Timer 100

8-4 Configuration of Receive Token Bank 102

8-5 Configuration of Receive Data Bank 103

8-6 Configuration of Transmit Data Bank 0 (Buffer 0) 104

8-7 Configuration of Transmit Data Bank 1 (Buffer 1) 105

8-8 Configuration of TIDCMP and ADRCMP 107

8-9 Configuration of DIDCMP 108

8-10 Format of USB Receiver Enable Register 109

8-11 Format of Data/Handshake Packet Receive Mode Register 110

8-12 Format of Packet Receive Status Register 112

8-13 Format of Data/Handshake Packet Receive Result Store Register 113

8-14 Format of Token Packet Receive Result Store Register 114

8-15 Format of Data Packet Transmit Reservation Register 115

8-16 Format of Handshake Packet Transmit Reservation Register 116

8-17 Configuration of Handshake Packet Transmit Reservation Register 119

8-18 Format of USB Timer Start Reservation Control Register 120

8-19 Format of Remote Wakeup Control Register 121

8-20 Flowchart of USB Timer Operation 123

8-21 Flow Chart of Remote Wakeup Control Operation 125

8-22 Configuration of Remote Wakeup Control 126

8-23 Timing of Data/Handshake Packet Receive Interrupt Request Generation 127

8-24 Timing of INTUSBRE Generation 128

8-25 Flowchart of Transmit/Receive Pointer Operation 140

8-26 Flowchart of Receive Bank Switching ID Detection Buffer Operation 147

8-27 Timing of Sync Detection/USBCLK Detector Operation 148

8-28 Timing of Sync Detection/USBCLK Generation Operation 148

8-29 Flowchart of Sync Detection/USBCLK Detector Operation 149

8-30 Timing of NRZI Encoder Operation 150

Page 17 of the NEC switch user manual — LIST OF FIGURES (3/4)
Page 17 · click to enlarge
Page 17

LIST OF FIGURES (3/4)

Figure No. Title Page

8-31 Flow Chart of NRZI Encoder Operation 150

8-32 Timing of Bit Stuffing/Strip Controller Operation 151

8-33 Flow Chart of Bit Stuffing Control Operation 152

8-34 Flow Chart of Bit Strip Control Operation 153

9-1 Block Diagram of Serial Interface 10 156

9-2 Format of Serial Operation Mode Register 10 157

9-3 3-Wire Serial I/O Mode Timing 161

10-1 Block Diagram of Regulator and USB Driver/Receiver 162

11-1 Basic Configuration of Interrupt Function 165

11-2 Format of Interrupt Request Flag Register 167

11-3 Format of Interrupt Mask Flag Register 168

11-4 Format of External Interrupt Mode Register 0 168

11-5 Configuration of Program Status Word 169

11-6 Format of Key Return Mode Register 00 170

11-7 Block Diagram of Falling Edge Detector 170

11-8 Flowchart of Non-Maskable Interrupt Request Acknowledgment 172

11-9 Timing of Non-Maskable Interrupt Request Acknowledgment 172

11-10 Acknowledging Non-Maskable Interrupt Request 172

11-11 Interrupt Acknowledgment Program Algorithm 173

11-12 Timing of Interrupt Request Acknowledgment (Example of MOV A,r) 174

11-13 Timing of Interrupt Request Acknowledgment

(When Interrupt Request Flag Is Generated at Last Clock of Instruction Execution) 174

11-14 Example of Multiplexed Interrupt Servicing 176

12-1 Format of Oscillation Stabilization Time Select Register 179

12-2 Releasing HALT Mode by Interrupt 181

12-3 Releasing HALT Mode by RESET Input 182

12-4 Releasing STOP Mode by Interrupt 184

12-5 Releasing STOP Mode by RESET Input 185

13-1 Block Diagram of Reset Function 186

13-2 Reset Timing by RESET Input 187

13-3 Reset Timing by Overflow in Watchdog Timer 187

13-4 Reset Timing by RESET Input in STOP Mode 187

14-1 Environment for Writing Program to Flash Memory 191

14-2 Communication Mode Selection Format 192

Page 18 of the NEC switch user manual — LIST OF FIGURES (4/4)
Page 18 · click to enlarge
Page 18

LIST OF FIGURES (4/4)

Figure No. Title Page

14-3 Example of Connection with Dedicated Flash Programmer 193

14-4 VPP Pin Connection Example 195

14-5 Signal Conflict (Input Pin of Serial Interface) 196

14-6 Abnormal Operation of Other Device 196

14-7 Signal Conflict (RESET Pin) 197

14-8 Wiring Example for Flash Writing Adapter with 3-Wire Serial I/O 198

14-9 Wiring Example for Flash Writing Adapter with Pseudo-3-Wire Method 199

A-1 Development Tools 222

A-2 Distance Between In-Circuit Emulator and Conversion Adapter 227

A-3 Connection Condition of Target System (NP-H44GB-TQ) 228

Page 19 of the NEC switch user manual — LIST OF TABLES (1/2)
Page 19 · click to enlarge
Page 19

LIST OF TABLES (1/2)

Table No. Title Page

2-1 Type of Pin I/O Circuit Recommended Connection of Unused Pins 33

3-1 Vector Table 37

3-2 Special Function Register List 45

4-1 Functions of Ports 58

4-2 Configuration of Port 59

4-3 Port Mode Register and Output Latch Settings When Using Alternate Functions 70

5-1 Configuration of Clock Generator 73

5-2 Maximum Time Required for Switching CPU Clock 78

6-1 Interval Time of 8-Bit Timer 00 79

6-2 Interval Time of 8-Bit Timer/Event Counter 01 79

6-3 Square Wave Output Range of 8-Bit Timer/Event Counter 01 80

6-4 Configuration of 8-Bit Timer/Event Counters 00 and 01 80

6-5 Interval Time of 8-Bit Timer 00 85

6-6 Interval Time of 8-Bit Timer/Event Counter 01 85

6-7 Square-Wave Output Range of 8-Bit Timer/Event Counter 01 88

7-1 Inadvertent Loop Detection Time of Watchdog Timer 91

7-2 Interval Time 91

7-3 Configuration of Watchdog Timer 92

7-4 Inadvertent Loop Detection Time of Watchdog Timer 95

7-5 Interval Time of Interval Timer 96

8-1 Configuration of USB Function 98

8-2 Flag of RXSTAT After Reception of USB Reset Signal and Resume Signal 113

8-3 Conditions in Transmit Reservation 117

8-4 List of Sources of Interrupts from USB Function 127

9-1 Configuration of Serial Interface 10 155

9-2 Operating Mode Settings of Serial Interface 10 158

11-1 Interrupt Source List 164

11-2 Flags Corresponding to Interrupt Request Signals 166

11-3 Time from Generation of Maskable Interrupt Request to Servicing 173

12-1 HALT Mode Operation Status 180

12-2 Operation After Release of HALT Mode 182

Page 20 of the NEC switch user manual — LIST OF TABLES (2/2)
Page 20 · click to enlarge
Page 20

LIST OF TABLES (2/2)

Table No. Title Page

12-3 STOP Mode Operation Status 183

12-4 Operation After Release of STOP Mode 185

13-1 Hardware Status After Reset 188

14-1 Differences Between µPD78F9801 and Mask ROM Versions 190

14-2 Communication Mode List 192

14-3 Pin Connection List 194

15-1 Operand Identifiers and Description Methods 200

18-1 Surface Mounting Type Soldering Conditions 220

Page 21 of the NEC switch user manual — 1.3 Ordering Information
Page 21 · click to enlarge
Page 21

CHAPTER 1 GENERAL

1.1 Features

  • On-chip USB functions
  • Implements a USB (Universal Serial Bus) by connecting to Hub and Host.
  • Transfer speed: 1.5 Mbps (at 6.0 MHz operation with system clock)
  • On-chip regulator
  • Controls the USB port voltage by using a bus power supply (V REG = 3.3 ± 0.3 V) dedicated to the USB

driver/receiver.

  • On-chip ROM and RAM
  • Internal ROM: 8 KB

Flash memory (for µPD78F9801 only): 16 KB

  • Internal high-speed RAM: 256 bytes
  • Variable minimum instruction execution time: From high-speed (0.33 µ s) to low speed (1.33 µ s) with the system

clock operating at 6.0 MHz

  • 31 I/O ports
  • Two serial interface channels
  • USB function
  • 3-wire serial I/O mode
  • Three timers:
  • 8-bit timer
  • 8-bit timer/event counter
  • Watchdog timer
  • On-chip key return signal detector
  • 12 vectored interrupt sources
  • Power supply voltage: V DD = 4.0 to 5.5 V
  • Operating ambient temperature: T A = –40 to +85 ° C (when the USB is not operating)

TA = 0 to +70°C (when the USB is operating)

TA = 10 to 40°C (when the flash memory is written)

1.2 Applications

USB keyboards, etc.

1.3 Ordering Information

Part Number Package Internal ROM

µPD789800GB-×××-8ES 44-pin plastic LQFP (10 × 10) Mask ROM

µPD78F9801GB-8ES 44-pin plastic LQFP (10 × 10) Flash memory

Remark ××× indicates ROM code suffix.

Page 22 of the NEC switch user manual — P04
Page 22 · click to enlarge
Page 22

CHAPTER 1 GENERAL

1.4 Pin Configuration (Top View)

  • 44-pin plastic LQFP (10 × 10)

µPD789800GB-×××-8ES, µPD78F9801GB-8ES

NEC switch — CHAPTER 1 GENERAL diagram (page 22)
Fig. 1

44 43 42 41 40 39 38 37 36 35 34

P04

P03

P02

P01

P00

V DD1

V SS1

P17

P16

P15

P14

12 13 14 15 16 17 18 19 20 21 22

2. Directly connect the V PP pin to the V SS0 pin in the normal operation mode.

Remark The parenthesized values apply to the µPD78F9801.

ICInternally connected SI10: Serial data input

INTP0: Interrupt from peripherals SO10: Serial data output KR00 to KR07 : Key return TI01: Timer input

NCNo connection TO01: Timer output
P00 to P07Port 0 USBDM, USBDP: Universal serial bus data
P10 to P17Port 1 V DD0 : Port power supply
P20 to P26Port 2 V DD1 : Power supply
P40 to P47Port 4 V PP : Programming power supply
RESETReset V SS0 : Port ground
REGCVoltage regulator for USB function V SS1 : Ground
SCK10Serial clock input/output X1, X2: Crystal
Page 23 of the NEC switch user manual — PD789860
Page 23 · click to enlarge
Page 23

CHAPTER 1 GENERAL

1.5 78K/0S Series Lineup

The products in the 78K/0S Series are listed below. The names enclosed in boxes are subseries names.

Products under development Products in mass production

Y subseries supports SMB.

Small-scale package, general-purpose applications

µ

PD789074 with subsystem clock added

µ

PD789046 PD789026

PD789014 with enhanced timer function and expanded ROM and RAM

30-pin PD789074 with enhanced timer function and expanded ROM and RAM

PD789074 PD789088

PD789026 with enhanced timer function

PD789062 PD789014

On-chip UART and capable of low-voltage (1.8 V) operation

RC oscillation version of PD789052

PD789052

PD789860 without EEPROMTM, POC, and LVI µ

Small-scale package, general-purpose applications and A/D function

PD789177 PD789167 30-pin 30-pin

µ

PD789177Y

µ

PD789167 with 10-bit A/D PD789104A with enhanced timer

PD789167Y

PD789146 PD789156

PD789104A with EEPROMTM added PD789146 with 10-bit A/D

30-pin

PD789124A PD789134A

PD789124A with 10-bit A/D RC oscillation version of PD789104A

PD789104A PD789114A

PD789104A with 10-bit A/D PD789026 with 8-bit A/D and multiplier added

µ

UART + dot LCD (40 × 16) UART + 8-bit A/D + dot LCD (total display outputs: 96)

SIO + 10-bit A/D + internal voltage boosting method LCD (28 × 4) 80-pin

PD789489

SIO + 8-bit A/D + resistance division method LCD (28 × 4) 80-pin PD789479

µ

PD789417A PD789407A

PD789407A with 10-bit A/D

PD789446 with 10-bit A/D SIO + 8-bit A/D + resistance division method LCD (28 × 4)

PD789456

PD789436 PD789446

SIO + 8-bit A/D + internal voltage boosting method LCD (15 × 4)

PD789426 with 10-bit A/D

PD789426

SIO + 8-bit A/D + internal voltage boosting method LCD (5 × 4) RC oscillation version of PD789306 SIO + internal voltage boosting method LCD (24 × 4)

PD789316

PD789467 PD789306

8-bit A/D + internal voltage boosting method LCD (23 × 4) PD789327

52-pin SIO + resistance division method LCD (24 × 4)

USB

44-pin PD789800 For PC keyboard. On-chip USB function

44-pin PD789842 On-chip inverter controller and UART

30-pin PD789850 On-chip CAN controller

PD789862 µ µ µ

PD789860 with enhanced timer function, SIO, and expanded ROM and RAM

PD789861

RC oscillation version of PD789860

PD789860

On-chip POC and key return circuit

PD789871 On-chip VFD controller (total display outputs: 25)

PD789881 UART + resistance division method LCD (26 × 4)

TM (Fluorescent Indicator Panel) in some

Remark VFD (Vacuum Fluorescent Display) is referred to as FIP

documents, but the functions of the two are same.

Show 39 more labels / short text on this page
42-/44-pin 44-pin · 30-pin · 28-pin · 20-pin 20-pin · µ · 44-pin · 44-pin · µ · µ µ · LCD drive · PD789835 144-pin · 88-pin PD789830 · 78K/0S Series · 80-pin · µ · 80-pin · 64-pin · µ · 64-pin 64-pin · µ · 64-pin 64-pin · µ · 52-pin 64-pin · µ · Inverter control · µ · On-chip bus controller · µ · Keyless entry · 30-pin · µ · 20-pin 20-pin · µ · VFD drive · 52-pin · µ · Meter control · µ · 64-pin
Page 24 of the NEC switch user manual — Series for General-Purpose and LCD Drive
Page 24 · click to enlarge
Page 24

CHAPTER 1 GENERAL

The major differences between subseries are shown below.

Series for General-Purpose and LCD Drive

NEC switch — Series for General-Purpose and LCD Drive diagram (page 24)
Fig. 2 · Series for General-Purpose and LCD Drive

1.8 V − Small- scale package, general- purpose applica- tions µPD789062 4 K − 14 RC-oscillation version

µPD789088 16 K to 32 K 3 ch

µPD789074 2 K to 8 K 1 ch

µPD789014 2 K to 4 K 2 ch −

16 K to 24 K 3 ch 1 ch

µPD789835 24 K to 60 K 6 ch − 3 ch 37 1.8 V Note

µPD789479 24 K to 48 K 8 ch −

8 K to 16 K − 2 ch (UART: 1ch) 23

Page 25 of the NEC switch user manual — CHAPTER 1 GENERAL
Page 25 · click to enlarge
Page 25

CHAPTER 1 GENERAL

Series for ASSP

NEC switch — CHAPTER 1 GENERAL diagram (page 25)
Fig. 3

USB µPD789800 8 K 2 ch − − 1 ch − − 2 ch (USB: 1ch) 31 4.0 V −

µPD789842 8 K to 16 K 3 ch Note 1 1 ch 1 ch 8 ch − 1 ch (UART: 1ch) 30 4.0 V −

µPD789850 16 K 1 ch 1 ch − 1 ch 4 ch − 2 ch (UART: 1ch) 18 4.0 V −

4 K 2 ch − − 1 ch − − − 14 Keyless

µPD789862 16 K 1 ch 2 ch 1 ch (UART: 1ch) 22

µPD789871 4 K to 8 K 3 ch − 1 ch 1 ch − − 1 ch 33 2.7 V −

µPD789881 16 K 2 ch 1 ch − 1 ch − − 1 ch (UART: 1 ch) 28 2.7 V Note 2 −

2. Flash memory version: 3.0 V
Page 26 of the NEC switch user manual — (V PP )
Page 26 · click to enlarge
Page 26

CHAPTER 1 GENERAL

1.6 Block Diagram

TI01/TO01/P26/INTP0

8-bit timer/event counter 01

REGC

V REG

USBDM

RAM

USBDP

RESET X1 X2

SCK10/P20

SO10/P21

SI10/P22

INTP0/P26 VDD0 VDD1 VSS0 VSS1 IC

(V PP )

Remark The parenthesized values apply to the µPD78F9801.

Show 19 more labels / short text on this page
KR00 to KR07 · Key return 0 · 8-bit timer 00 · Port 0 · P00 to P07 · 78K/0S CPU core · ROM Flash memory · Port 1 · P10 to P17 · Watchdog timer · Port 2 · P20 to P26 · Regulator · Port 4 · P40 to P47 · USB function 0 · System control · Serial interface 1 · Interrupt control
Page 27 of the NEC switch user manual — CHAPTER 1 GENERAL
Page 27 · click to enlarge
Page 27

CHAPTER 1 GENERAL

1.7 Functions

µPD789800 µPD78F9801

Internal memory ROM Mask ROM 8 KB Flash memory 16 KB

High-speed RAM 256 bytes

Minimum instruction execution time 0.33 µs/1.33 µs (at 6.0 MHz operation with system clock)

  • Instruction set
  • 16-bit operation
  • Bit manipulation (set, reset, and test) etc.

I/O ports CMOS I/O 31

(Of the above COMS I/O ports, 18 ports can be switched to N-ch open-drain I/O ports.)

  • Serial interface
  • USB (Universal Serial Bus) function: 1 channel
  • Three-wired serial I/O mode: 1 channel
  • Timer
  • 8-bit timer: 1 channel
  • 8-bit timer/event counter: 1 channel
  • Watchdog timer: 1 channel

Regulator Incorporated (VREG = 3.3 ±0.3 V)

Maskable Internal9, external: 2 Vector interrupt sources Non-maskable Internal: 1

Power supply voltage VDD = 4.0 to 5.5 V

  • Operating ambient temperature
  • T A = –40 to + 85°C (when the USB is not operating)
  • T A = 0 to + 70°C (when the USB is operating)
  • T A = 10 to 40°C (when a flash memory is written)

Package 44-pin plastic LQFP (10 × 10)

An outline of the timer is shown below.

NEC switch — CHAPTER 1 GENERAL diagram (page 27)
Fig. 4

Interval timer 1 channel 1 channel 1 channel Note Operation mode

selecting either the watchdog timer function or interval timer function.

Product Item

Page 28 of the NEC switch user manual — INTP0/TI01/TO01
Page 28 · click to enlarge
Page 28

CHAPTER 2 PIN FUNCTIONS

2.1 List of Pin Functions

(1) Port pins

Pin Name I/O Function After Reset Alternate

P00 to P07 I/O Port 0

Input/output can be specified in 1-bit units.

When used as an input port, use of on-chip pull-up resistors can be specified by pull-up resistor option register 0 (PU0).

When used as an output port, CMOS output or N-ch open-drain output can be specified in 8-bit units by port output mode register 0 (POM0).

P10 to P17 I/O Port 1

Input/output can be specified in 1-bit units.

When used as an input port, use of on-chip pull-up resistors can be specified by pull-up resistor option register 0 (PU0).

When used as an output port, CMOS output or N-ch open-drain output can be specified in 8-bit units by port output mode register 0 (POM0).

P20 SCK10

P21 SO10

Input/output can be specified in 1-bit units.

P22 SI10

When used as an input port, use of on-chip pull-up resistors can be specified by pull-up resistor option register 0 (PU0).

P23 to P25 —

P26

When P25 or P26 is used as an output port, CMOS output or N-ch open-drain output can be specified in 1-bit units by port output mode register 1 (POM1).

INTP0/TI01/TO01

P40 to P47 I/O Port 4

Input KR00 to KR07

Input/output can be specified in 1-bit units.

When used as an input port, use of on-chip pull-up resistors can be specified by pull-up resistor option register 0 (PU0).

Show 9 more labels / short text on this page
Function · Input — · 8-bit I/O port · Input — · 8-bit I/O port · I/O Port 2 · Input · 7-bit I/O port · 8-bit I/O port
Page 29 of the NEC switch user manual — KR07
Page 29 · click to enlarge
Page 29

CHAPTER 2 PIN FUNCTIONS

(2) Non-port pins

Pin Name I/O Function After Reset Alternate

INTP0 Input External interrupt request input for which valid edge (rising and/or falling edge) can be specified

Input Input for detecting key return signals Input P40 to P47

KR07

NC — No connection. Can be left open. — —

REGC — Internally generated power supply for driving USB driver/receiver. Connect this pin to VSS via a 22 µF capacitor.

RESET Input System reset input Input —

SCK10 I/O Serial clock input/output for serial interface Input P20

SI10 Input Serial data input for serial interface Input P22

SO10 Output Serial data output for serial interface Input P21

TI01 Input External count clock input to 8-bit timer TM01 Input P26/INTP0/TO01

TO01 Output Output from 8-bit timer TM01 Input P26/INTP0/TI01

USBDM I/O Serial data input/output (negative side) for USB function. The pull-up resistor (1.5 kΩ) for the USBDM pin must be connected to the REGC pin.

USBDP I/O Serial data input/output (positive side) for USB function Input —

VDD0 — Positive power supply for ports — —

VDD1 — Positive power supply for circuits other than ports — —

VSS0 — Ground potential for ports — —

VSS1 — Ground potential for circuits other than ports — —

X1 Input Input —

Crystal resonator connection to for system clock oscillator

IC — Internally connected directly to VSS0 — —

VPP — Sets flash memory programming mode. Apply high voltage when a program is written or verified.

Show 4 more labels / short text on this page
Function · Input P26/TI01/TO01 · KR00 to · Input —
Page 30 of the NEC switch user manual — (e) INTP0
Page 30 · click to enlarge
Page 30

CHAPTER 2 PIN FUNCTIONS

2.2 Pin Functions

2.2.1 P00 to P07 (Port 0)

These pins constitute an 8-bit I/O port and can be set to the input or output port mode in 1-bit units by using port

mode register 0 (PM0). When these pins are used as an input port, an on-chip pull-up resistor can be used by

setting pull-up resistor option register 0 (PU0). When these pins are used as an output port, CMOS output or N-ch

open-drain output can be specified in 8-bit units by setting port output mode register 0 (POM0).

2.2.2 P10 to P17 (Port 1)

These pins constitute an 8-bit I/O port. Port 1 can be set to the input or output mode in 1-bit units by using port

mode register 1 (PM1). When the port is used as an input port, an on-chip pull-up resistor can be used by setting

pull-up resistor option register 0 (PU0). When these pins are used as an output port, CMOS output or N-ch open-

drain output can be specified in 8-bit units by setting port output mode register 0 (POM0).

2.2.3 P20 to P26 (Port 2)

These pins constitute a 7-bit I/O port. In addition, these pins function as data I/O, and clock I/O to and from the

serial interface, external interrupt input, and timer I/O.

Port 2 can be specified in the following operation modes in 1-bit units.

(1) Port mode

In the port mode, P20 to P26 function as a 7-bit I/O port. Port 2 can be set to the input or output mode in 1-bit

units by using port mode register 2 (PM2). When the port is used as an input port, an on-chip pull-up resistor

can be used by setting pull-up resistor option register 0 (PU0). When P25 or P26 is used as an output port,

CMOS output or N-ch open-drain output can be specified by setting in 1-bit units port output mode register 1

(POM1).

(2) Control mode

In this mode, P20 to P26 function as the data I/O and the clock I/O to and from the serial interface.

(a) SI10, SO10

These are the serial data I/O pins of the serial interface.

(b) SCK10

This is the serial clock I/O pin of the serial interface.

(c) TI01

This is the external clock input pin for the 8-bit timer/event counter.

(d) TO01

This is the output pin of the 8-bit timer.

(e) INTP0

This is an external interrupt input pin for which the valid edge (rising edge, falling edge, or both rising and

falling edges) can be specified.

according to the functions to be used. For setting details, see Table 9-2.

Page 31 of the NEC switch user manual — 2.2.11 V SS0 , V SS1
Page 31 · click to enlarge
Page 31

CHAPTER 2 PIN FUNCTIONS

2.2.4 P40 to P47 (Port 4)

These pins constitute an 8-bit I/O port. In addition, they also function as key return signal detection pins.

The following operation modes can be specified in 1-bit units.

(1) Port mode

In this mode, port 4 functions as an 8-bit I/O port. Port 4 can be set to the input or output mode in 1-bit units by

using port mode register 4 (PM4). When used as an input port an on-chip pull-up resistor can be used by

setting pull-up resistor option register 0 (PU0).

(2) Control mode

In this mode, the pins function as key return signal detection pins (KR00 to KR07).

2.2.5 RESET

This pin inputs an active-low system reset signal.

2.2.6 X1, X2

These pins are used to connect a crystal resonator for system clock oscillation.

To supply an external clock, input the clock to X1 and input the inverted signal to X2.

2.2.7 REGC

This pin is a power supply pin for driving a USB driver/receiver generated internally. Connect this pin to the VSS

pin via 22 µF capacitor.

2.2.8 USBDM

This pin (negative side) inputs or outputs serial data for the USB function.

2.2.9 USBDP

This pin (positive side) inputs or outputs serial data for the USB function.

2.2.10 V DD0 , V DD1

These pins are positive power supply pins.

2.2.11 V SS0 , V SS1

These pins are ground pins.

Page 32 of the NEC switch user manual — V SS0 IC
Page 32 · click to enlarge
Page 32

CHAPTER 2 PIN FUNCTIONS

2.2.12 V PP ( µ PD78F9801 only)

A high voltage should be applied to this pin when the flash memory programming mode is set and when the

program is written or verified.

Handle this pin in either of the following ways.

  • Independently connect a 10 k Ω pull-down resistor.
  • Switch this pin to be directly connected to the dedicated flash programmer in programming mode or to V SS0 in

normal operation mode using a jumper on the board.

2.2.13 IC (mask ROM version only)

The IC (Internally Connected) pin is used to set the µPD789800 Subseries in the test mode before shipment. In

the normal operation mode, directly connect this pin to the VSS0 pin with as short a wiring length as possible.

If a potential difference is generated between the IC pin and VSS0 pin due to a long wiring length between the IC

pin and VSS0 pin or an external noise superimposed on the IC pin, a user program may not run correctly.

  • Directly connect the IC pin to the V SS0 pin.

V SS0 IC

Keep short

Page 33 of the NEC switch user manual — Table 2-1. Type of Pin I/O Circuit Recommended Connection of Unused Pins
Page 33 · click to enlarge
Page 33

CHAPTER 2 PIN FUNCTIONS

2.3 Pin I/O Circuits and Recommended Connection of Unused Pins

Table 2-1 lists the types of I/O circuits for each pin and explains how unused pins are handled.

Figure 2-1 shows the configuration of each type of I/O circuit.

Table 2-1. Type of Pin I/O Circuit Recommended Connection of Unused Pins

NEC switch — Table 2-1. Type of Pin I/O Circuit Recommended Connection of Unused Pins diagram (page 33)
Fig. 5 · Table 2-1. Type of Pin I/O Circuit Recommended Conne…

Pin Name I/O Circuit Type I/O Recommended Connection of Unused Pins

Input: Independently connect to VDD0, VDD1, VSS0, or VSS1 via a resistor.

Independently connect to VSS0 or VSS1 via a resistor.

Independently connect a 10 kΩ pull-down resistor, or connect directly to VSS0.

Page 34 of the NEC switch user manual — CHAPTER 2 PIN FUNCTIONS
Page 34 · click to enlarge
Page 34

CHAPTER 2 PIN FUNCTIONS

Figure 2-1. Pin I/O Circuits

NEC switch — CHAPTER 2 PIN FUNCTIONS diagram (page 34)
Fig. 6
Page 35 of the NEC switch user manual — H 0 0 0 0
Page 35 · click to enlarge
Page 35

CHAPTER 3 CPU ARCHITECTURE

3.1 Memory Space

The µPD789800 Subseries can access 64 KB of memory space.

Figures 3-1 and 3-2 show the memory maps.

Figure 3-1. Memory Map (µPD789800)

H F

256 × 8 bits

H 0 0 F F

H F F E F

256 × 8 bits

H 0 0 E F

H F F D F

H F F F 1

H 0 0 0 2

H F F F 1

H 0 8 0 0 H F 7 0 0

Internal ROM 8,192 × 8 bits

H 0 4 0 0 H F 3 0 0

H A 1 0 0 H 9 1 0 0

H 0

H 0 0 0 0

Show 9 more labels / short text on this page
Special function register · Internal high-speed RAM · Data memory space · Reserved · Program area · Program memory space · CALLT table area · Program area · Vector table area
Page 36 of the NEC switch user manual — H 0 0 0 0
Page 36 · click to enlarge
Page 36

CHAPTER 3 CPU ARCHITECTURE

Figure 3-2. Memory Map (µPD78F9801)

H F

256 × 8 bits

H 0 0 F F

H F F E F

256 × 8 bits

H 0 0 E F

H F F D F

H F F F 3

H 0 0 0 4

H F F F 3

H 0 8 0 0 H F 7 0 0

Flash memory 16,384 × 8 bits

H 0 4 0 0 H F 3 0 0

H A 1 0 0 H 9 1 0 0

H 0

H 0 0 0 0

Show 9 more labels / short text on this page
Special function register · Internal high-speed RAM · Data memory space · Reserved · Program area · Program memory space · CALLT table area · Program area · Vector table area
Page 37 of the NEC switch user manual — 3.1.3 Special function register (SFR) area
Page 37 · click to enlarge
Page 37

CHAPTER 3 CPU ARCHITECTURE

3.1.1 Internal program memory space

The internal program memory space stores programs and table data. This space is usually addressed by the

program counter (PC).

The following areas are allocated to the internal program memory space.

(1) Vector table area

A 26-byte area of addresses 0000H to 0019H is reserved as a vector table area. This area stores program start

addresses to be used when branching by RESET input or interrupt request generation. Of a 16-bit program

address, the lower 8 bits are stored in an even address, and the higher 8 bits are stored in an odd address.

Table 3-1. Vector Table

Vector Table Address Interrupt Request Vector Table Address Interrupt Request

0000H RESET input 000EH INTUSBRE

0004H INTWDT 0010H INTP0

0006H INTUSBTM 0012H INTCSI10

0008H INTUSBRT 0014H INTTM00

000AH INTUSBRD 0016H INTTM01

000CH INTUSBST 0018H INTKR00

(2) CALLT instruction table area

The subroutine entry address of a 1-byte call instruction (CALLT) can be stored in a 64-byte area of addresses

0040H to 007FH.

3.1.2 Internal data memory (internal high-speed RAM) space

An internal high-speed RAM is incorporated in the area between FE00H and FEFFH.

The internal high-speed RAM is also used as a stack.

3.1.3 Special function register (SFR) area

Special function registers (SFRs) of on-chip peripheral hardware are allocated to an area of FF00H to FFFFH

(see Table 3-2).

Page 38 of the NEC switch user manual — 0000H
Page 38 · click to enlarge
Page 38

CHAPTER 3 CPU ARCHITECTURE

3.1.4 Data memory addressing

The µPD789800 Subseries provides a variety of addressing modes which take account of memory manipulability,

etc. Especially at addresses corresponding to data memory area (FE00H to FFFFH), particular addressing modes

are possible to meet the functions of the special function registers (SFR) and general-purpose registers. Figures 3-3

and 3-4 show the data memory addressing modes.

Figure 3-3. Data Memory Addressing (µPD789800)

FFFFH

Special function registers (SFR)

256 × 8 bits

FF20H FF1FH

FF00H FEFFH

256 × 8 bits

FE20H FE1FH

FE00H FDFFH

2000H 1FFFH

Internal ROM 8,192 × 8 bits

0000H

Show 7 more labels / short text on this page
SFR addressing · Short direct addressing · Internal high-speed RAM · Direct addressing · Register indirect addressing · Reserved · Based addressing
Page 39 of the NEC switch user manual — 0000H
Page 39 · click to enlarge
Page 39

CHAPTER 3 CPU ARCHITECTURE

Figure 3-4. Data Memory Addressing (µPD78F9801)

FFFFH

Special function registers (SFR)

256 × 8 bits

FF20H FF1FH

FF00H FEFFH

256 × 8 bits

FE20H FE1FH

FE00H FDFFH

4000H 3FFFH

Flash memory 16,384 × 8 bits

0000H

Show 7 more labels / short text on this page
SFR addressing · Short direct addressing · Internal high-speed RAM · Direct addressing · Register indirect addressing · Based addressing · Reserved
Page 40 of the NEC switch user manual — Figure 3-6. Configuration of Program Status Word
Page 40 · click to enlarge
Page 40

CHAPTER 3 CPU ARCHITECTURE

3.2 Processor Registers

The µPD789800 Subseries provides the following on-chip processor registers.

3.2.1 Control registers

The control registers contain special functions to control the program sequence, statuses and stack memory. A

program counter, a program status word, and a stack pointer are the control registers.

(1) Program counter (PC)

The program counter is a 16-bit register which holds the address information of the next program to be

executed.

In normal operation, the PC is automatically incremented according to the number of bytes of the instruction to

be fetched. When a branch instruction is executed, immediate data or register contents are set.

RESET input sets the program counter to the reset vector table values at addresses 0000H and 0001H.

Figure 3-5. Configuration of Program Counter

PC15 PC PC14 PC13 PC12 PC11 PC10 PC9 PC8 PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0

(2) Program status word (PSW)

The program status word is an 8-bit register consisting of various flags to be set/reset by instruction execution.

Program status word contents are automatically stacked upon interrupt request generation or PUSH PSW

instruction execution and are automatically restored upon execution of the RETI and POP PSW instructions.

RESET input sets the PSW to 02H.

Figure 3-6. Configuration of Program Status Word

IE Z 0 AC 0 0 1 CY

Page 41 of the NEC switch user manual — (d) Carry flag (CY)
Page 41 · click to enlarge
Page 41

CHAPTER 3 CPU ARCHITECTURE

(a) Interrupt enable flag (IE)

This flag controls interrupt request acknowledgment operations of the CPU.

When 0, the IE flag is set to the interrupt disabled status (DI), and interrupt requests other than non-

maskable interrupts are all disabled.

When 1, the IE flag is set to the interrupt enabled status (EI). Interrupt request acknowledgment enable is

controlled by the interrupt mask flag corresponding to each interrupt source.

The IE flag is reset (0) upon DI instruction execution or interrupt acknowledgment and is set (1) upon EI

instruction execution.

(b) Zero flag (Z)

When the operation result is zero, this flag is set (1). It is reset (0) in all other cases.

(c) Auxiliary carry flag (AC)

If the operation result has a carry from bit 3 or a borrow at bit 3, this flag is set (1). It is reset (0) in all other

cases.

(d) Carry flag (CY)

This flag stores overflow and underflow upon add/subtract instruction execution. It stores the shift-out

value upon rotate instruction execution and functions as a bit accumulator during bit manipulation

instruction execution.

Page 42 of the NEC switch user manual — SP + 1
Page 42 · click to enlarge
Page 42

CHAPTER 3 CPU ARCHITECTURE

(3) Stack pointer (SP)

This is a 16-bit register that holds the start address of the memory stack area. Only the internal high-speed

RAM area can be set as the stack area.

Figure 3-7. Configuration of Stack Pointer

SP15 SP 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 3-8 and 3-9.

instruction execution.

Figure 3-8. Data to Be Saved to Stack Memory

CALL, CALLT instructions PUSH rp instruction

SP SP _ 3

SP SP _ 2

SP SP _ 2

PC7 to PC0 SP _ 3

SP _ 2

PC7 to PC0 Lower half register pairs

SP _ 2

SP _ 2

Upper half register pairs

SP _ 1

SP _ 1

SP _ 1

PSW

SP

SP

SP

Figure 3-9. Data to Be Restored from Stack Memory

RET instruction POP rp instruction

PC7 to PC0 Lower half register pairs

SP PC7 to PC0

SP

SP

Upper half register pairs SP + 1

SP + 1

PC15 to PC8 PC15 to PC8

SP + 1

SP SP + 2

SP SP + 2

SP + 2

PSW

SP SP + 3

Show 4 more labels / short text on this page
Interrupt · PC15 to PC8 · PC15 to PC8 · RETI instruction
Page 43 of the NEC switch user manual — H
Page 43 · click to enlarge
Page 43

CHAPTER 3 CPU ARCHITECTURE

3.2.2 General-purpose registers

The general-purpose registers consist of eight 8-bit registers (X, A, C, B, E, D, L, and H).

In addition that each register can be used as an 8-bit register, two 8-bit registers in pairs can be used as a 16-bit

register (AX, BC, DE, and HL).

They can be described in terms of functional names (X, A, C, B, E, D, L, H, AX, BC, DE, and HL) and absolute

names (R0 to R7 and RP0 to RP3).

Figure 3-10. Configuration of General-Purpose Registers

(a) Absolute names

16-bit processing 8-bit processing

R7

RP3

R6

R5

RP2

R4

R3

RP1

R2

R1

RP0

R0

15 0 7 0

(b) Functional names

16-bit processing 8-bit processing

H

HL

D

DE

E

B

BC

A

AX

15 0 7 0

Page 44 of the NEC switch user manual — CHAPTER 3 CPU ARCHITECTURE
Page 44 · click to enlarge
Page 44

CHAPTER 3 CPU ARCHITECTURE

3.2.3 Special function registers (SFRs)

Unlike general-purpose registers, each special function register has a special function.

The special function registers are allocated in the 256-byte area FF00H to FFFFH.

The special function registers can be manipulated, like the general-purpose registers, with operation, transfer, and

bit manipulation instructions. Manipulatable bit units (1, 8, and 16) differ depending on the special function register

type.

Each manipulation bit can be specified as follows.

  • 1-bit manipulation

Describe the symbol reserved by the assembler for the 1-bit manipulation instruction operand (sfr.bit). This

manipulation can also be specified using address.

  • 8-bit manipulation

Describe the symbol reserved by the assembler for the 8-bit manipulation instruction operand (sfr). This

manipulation can also be specified using an address.

  • 16-bit manipulation

Describe the symbol reserved by the assembler for the 16-bit manipulation instruction operand. When

specifying an address, describe an even address.

Table 3-2 lists the special function registers. The meanings of the symbols in this table are as follows.

  • Symbol

Indicates the address of the implemented special function register. The symbols shown in this column are

reserved words in the assembler, and have already been defined in the header file “sfrbit.h” in the C compiler.

Therefore, these symbols can be used as instruction operands if an assembler or integrated debugger is used.

  • R/W

Indicates whether the special function register in question can be read or written.

R/WRead/write

R: Read only

W: Write only

  • Bit units for manipulation

Indicates the bit units (1, 8, 16) in which the special function register in question can be manipulated.

  • After reset

Indicates the status of the special function register when the RESET signal is input.

Page 45 of the NEC switch user manual — CHAPTER 3 CPU ARCHITECTURE
Page 45 · click to enlarge
Page 45

CHAPTER 3 CPU ARCHITECTURE

Table 3-2. Special Function Register List (1/3)

NEC switch — CHAPTER 3 CPU ARCHITECTURE diagram (page 45)
Fig. 7

Address Special Function Register (SFR) Name Symbol R/W Manipulatable Bit Unit After Reset

FF00H Port 0 P0 R/W √ √ — 00H

FF07H Receive data PID USBRD R — √ —

FF08H Receive data address 0 USBR0 USBR10 — √ √ Undefined

FF0AH Receive data address 2 USBR2 USBR32 — √ √

FF0CH Receive data address 4 USBR4 USBR54 — √ √

FF0EH Receive data address 6 USBR6 USBR76 — √ √

FF10H Transmit/receive shift register 10 SIO10 R/W — √ —

FF20H Port mode register 0 PM0 √ √ — FFH

FF21H Port mode register 1 PM1 √ √ —

FF22H Port mode register 2 PM2 √ √ —

FF24H Port mode register 4 PM4 √ √ —

FF30H Port output mode register 0 POM0 √ √ — 00H

FF31H Port output mode register 1 POM1 √ √ —

FF42H Timer clock select register 2 TCL2 — √ —

FF50H 8-bit compare register 00 CR00 W — √ — Undefined

FF51H 8-bit timer counter 00 TM00 R — √ — 00H

FF53H 8-bit timer mode control register 00 TMC00 R/W √ √ —

FF54H 8-bit compare register 01 CR01 W — √ — Undefined

FF55H 8-bit timer counter 01 TM01 R — √ — 00H

FF57H 8-bit timer mode control register 01 TMC01 R/W √ √ —

FF60H Token PID compare register TIDCMP W — √ —

FF61H Token address compare register ADRCMP — √ —

Page 46 of the NEC switch user manual — URXMOD √ √ —
Page 46 · click to enlarge
Page 46

CHAPTER 3 CPU ARCHITECTURE

Table 3-2. Special Function Register List (2/3)

Address Special Function Register (SFR) Name Symbol R/W Manipulatable Bit Unit After Reset

1 Bit 8 Bits 16 Bits

FF62H Token packet receive result store register TRXRSL R/W √ √ — 00H

FF63H Data/handshake PID compare register DIDCMP W — √ — C3H

FF64H Data/handshake packet receive byte number counter

DRXCON — √ — 18H

FF65H Data/handshake packet receive result store register

DRXRSL R/W √ √ — 00H

FF66H Data/handshake packet receive mode register

URXMOD √ √ —

FF67H Packet receive status register RXSTAT — √ —

FF68H Data packet transmit byte number counter 0 DTXCO0 W — √ — 20H

FF69H Data packet transmit byte number counter 1 DTXCO1 — √ — 30H

FF6AH Remote wakeup control register REMWUP R/W √ √ — 08H

FF6BH Transmit/receive pointer USBPOW R — √ — 00H

FF6CH USB timer start reservation control register USBTCL R/W √ √ — 01H

FF6DH USB receiver enable register USBMOD √ √ — 00H

FF72H Serial operation mode register 10 CSIM10 √ √ —

FFA1H Transmit data PID bank 0 USBTD0 W — √ — Undefined

FFA2H Transmit data bank 0 address 00 USBT00 — √ —

FFA3H Transmit data bank 0 address 01 USBT01 — √ —

FFA4H Transmit data bank 0 address 02 USBT02 — √ —

FFA5H Transmit data bank 0 address 03 USBT03 — √ —

FFA6H Transmit data bank 0 address 04 USBT04 — √ —

FFA7H Transmit data bank 0 address 05 USBT05 — √ —

FFA8H Transmit data bank 0 address 06 USBT06 — √ —

FFA9H Transmit data bank 0 address 07 USBT07 — √ —

FFABH Transmit data PID bank 1 USBTD1 — √ —

FFACH Transmit data bank 1 address 10 USBT10 — √ —

FFADH Transmit data bank 1 address 11 USBT11 — √ —

FFAEH Transmit data bank 1 address 12 USBT12 — √ —

FFAFH Transmit data bank 1 address 13 USBT13 — √ —

FFB0H Transmit data bank 1 address 14 USBT14 — √ —

FFB1H Transmit data bank 1 address 15 USBT15 — √ —

FFB2H Transmit data bank 1 address 16 USBT16 — √ —

FFB3H Transmit data bank 1 address 17 USBT17 — √ —

FFB5H Receive token PID USBRTP R — √ — 00H

FFB6H Receive token address L USBRAL — √ —

FFB7H Receive token address H USBRAH — √ —

FFE0H Interrupt request flag register 0 IF0 R/W √ √ —

FFE1H Interrupt request flag register 1 IF1 √ √ —

FFE4H Interrupt mask flag register 0 MK0 √ √ — FFH

FFE5H Interrupt mask flag register 1 MK1 √ √ —

Page 47 of the NEC switch user manual — CHAPTER 3 CPU ARCHITECTURE
Page 47 · click to enlarge
Page 47

CHAPTER 3 CPU ARCHITECTURE

Table 3-2. Special Function Register List (3/3)

NEC switch — CHAPTER 3 CPU ARCHITECTURE diagram (page 47)
Fig. 8

Address Special Function Register (SFR) Name Symbol R/W Manipulatable Bit Unit After Reset

FFECH External interrupt mode register 0 INTM0 R/W — √ — 00H

FFF5H Key return mode register 00 KRM00 √ √ —

FFF7H Pull-up resistor option register 0 PU0 √ √ —

FFF9H Watchdog timer mode register WDTM √ √ —

FFFAH Oscillation stabilization time select register OSTS — √ — 04H

FFFBH Processor clock control register PCC √ √ — 02H

Page 48 of the NEC switch user manual — PC
Page 48 · click to enlarge
Page 48

CHAPTER 3 CPU ARCHITECTURE

3.3 Instruction Address Addressing

An instruction address is determined by program counter (PC) contents. 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 Instruction User’s

Manual (U11047E)).

3.3.1 Relative addressing

[Function]

The value obtained by adding 8-bit immediate data (displacement value: jdisp8) of an instruction code to the

start address of the following instruction is transferred to the program counter (PC) and branched. The

displacement value is treated as signed two’s complement data (−128 to +127) and bit 7 becomes a sign bit.

This means that information is relatively branched to a location between −128 and +127, from the start address

of the next instruction when relative addressing is used.

This function is carried out when the BR $addr16 instruction or a conditional branch instruction is executed.

[Illustration]

... PC is the start address of the next instruction of a BR instruction.

PC

S

PC

When S = 0, α indicates all bits 0.

When S = 1, α indicates all bits 1.

+ · α · jdisp8

Page 49 of the NEC switch user manual — PC
Page 49 · click to enlarge
Page 49

CHAPTER 3 CPU ARCHITECTURE

3.3.2 Immediate addressing

[Function]

Immediate data in the instruction word is transferred to the program counter (PC) and branched.

This function is carried out when the CALL !addr16 or BR !addr16 instruction is executed.

The CALL !addr16 and BR !addr16 instructions can be branched to any location in the memory space.

[Illustration]

In case of CALL !addr16 and BR !addr16 instructions

Low Addr.

High Addr.

PC

CALL or BR

Page 50 of the NEC switch user manual — [Illustration]
Page 50 · click to enlarge
Page 50

CHAPTER 3 CPU ARCHITECTURE

3.3.3 Table indirect addressing

[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.

This function is carried out when the CALLT [addr5] instruction is executed. The instruction enables a branch

to any location in the memory space by referring to the addresses stored in the memory table at 40H to 7FH.

[Illustration]

7 6 5 1 0

ta4–0 Instruction code

Effective address 0 1 0

Low Addr.

Effective address + 1

High Addr.

PC

3.3.4 Register addressing

[Function]

Register pair (AX) contents to be specified with an instruction word are transferred to the program counter

(PC) and branched.

This function is carried out when the BR AX instruction is executed.

[Illustration]

A X

PC

Memory (Table) · rp

Page 51 of the NEC switch user manual — FEH
Page 51 · click to enlarge
Page 51

CHAPTER 3 CPU ARCHITECTURE

3.4 Operand Address Addressing

The following methods are available to specify the register and memory (addressing) to undergo manipulation

during instruction execution.

3.4.1 Direct addressing

[Function]

The memory indicated by immediate data in an instruction word is directly addressed.

[Operand format]

addr16 Label or 16-bit immediate data

[Description example]

MOV A, !FE00H; When setting !addr16 to FE00H

Instruction code 0 0 1 0 1 0 0 1 Opcode

0

00H

1 0

FEH

[Illustration]

Show 5 more labels / short text on this page
Identifier Description · Opcode · addr16 (Low) · addr16 (High) · Memory
Page 52 of the NEC switch user manual — [Illustration]
Page 52 · click to enlarge
Page 52

CHAPTER 3 CPU ARCHITECTURE

3.4.2 Short direct addressing

[Function]

The memory to be manipulated in the fixed space is directly addressed with 8-bit data in an instruction word.

The fixed space is the 256-byte space FE20H to FF1FH where the addressing is applied. An internal high-

speed RAM and special function registers (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 the whole SFR area.

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. See [Illustration] below.

[Operand format]

saddr Label or FE20H to FF1FH immediate data

saddrp Label or FE20H to FF1FH immediate data (even address only)

[Description example]

MOV FE30H, #50H; When setting saddr to FE30H and the immediate data to 50H

Instruction code 1 0 1 0 1

0 0 1 1 0

0 1 0 1 0

[Illustration]

15 0 Short direct memory

Effective address 1

When 8-bit immediate data is 20H to FFH, α = 0. When 8-bit immediate data is 00H to 1FH, α = 1.

Show 7 more labels / short text on this page
Identifier Description · Opcode · 30H (saddr-offset) · 50H (Immediate data) · Opcode · saddr-offset · α
Page 53 of the NEC switch user manual — [Illustration]
Page 53 · click to enlarge
Page 53

CHAPTER 3 CPU ARCHITECTURE

3.4.3 Special function register (SFR) addressing

[Function]

The memory-mapped special function register (SFR) is addressed with 8-bit immediate data in an instruction

word.

This addressing is applied to the 240-byte spaces FF00H to FFCFH and FFE0H to FFFFH. However, the

SFR mapped at FF00H to FF1FH can be accessed with short direct addressing.

[Operand format]

sfr Special function register name

[Description example]

MOV PM0, A; When selecting PM0 for sfr

Instruction code 1 1 1 0 0 1 1 1

0 0 1 0

[Illustration]

15 0 SFR

Effective Address 1

Identifier Description · Opcode · sfr-offset

Page 54 of the NEC switch user manual — [Description example]
Page 54 · click to enlarge
Page 54

CHAPTER 3 CPU ARCHITECTURE

3.4.4 Register addressing

[Function]

In the register addressing mode, general-purpose registers are accessed as operands. The general-purpose

register to be accessed is specified by the register specification code or function 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]

r X, A, C, B, E, D, L, H

rp AX, BC, DE, HL

r and rp can be described by absolute names (R0 to R7 and RP0 to RP3) as well as function names (X, A, C,

B, E, D, L, H, AX, BC, DE, and HL).

[Description example]

MOV A, C; When selecting the C register for r

Instruction code 0 1 0 1 0

0 0 1 0 0 1 0 1

INCW DE; When selecting the DE register pair for rp

Instruction code 1 0 0 0 1 0 0 0

Identifier Description · Register specification code · Register specification code

Page 55 of the NEC switch user manual — A
Page 55 · click to enlarge
Page 55

CHAPTER 3 CPU ARCHITECTURE

3.4.5 Register indirect addressing

[Function]

In the register indirect addressing mode, memory is manipulated according to the contents of a register pair

specified as an operand. The register pair to be accessed is specified by the register pair specification code

in an instruction code.

This addressing can be carried out for all the memory spaces.

[Operand format]

— [DE], [HL]

[Description example]

MOV A, [DE]; When selecting register pair [DE]

Instruction code 0 0 1 0 1 0 1 1

[Illustration]

DE

D

E

Memory address specified with register pair DE

Addressed memory contents are transferred

A

Identifier Description

Page 56 of the NEC switch user manual — [Description example]
Page 56 · click to enlarge
Page 56

CHAPTER 3 CPU ARCHITECTURE

3.4.6 Based addressing

[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]

[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

3.4.7 Stack addressing

[Function]

The stack area is indirectly addressed with the stack pointer (SP) contents.

This addressing method is automatically employed when the PUSH, POP, subroutine call, and RETURN

instructions are executed or the register is saved/reset upon generation of an interrupt request.

Stack addressing can only be used to address the internal high-speed RAM area.

[Description example]

In the case of PUSH DE

Instruction code 1 0 1 0 1 0 1 0

Identifier Description · — [HL+byte]

Page 57 of the NEC switch user manual — P47
Page 57 · click to enlarge
Page 57

CHAPTER 4 PORT FUNCTIONS

4.1 Port Functions

The µPD789800 Subseries provides the ports shown in Figure 4-1, enabling various methods of control.

Numerous other functions are provided that can be used in addition to the digital I/O port functions. For more

information on these additional functions, see CHAPTER 2 PIN FUNCTIONS.

Figure 4-1. Port Types

P20

P00

P26

P07

P40

P10

Port 4 Port 1

P47

P17

Port 2 · Port 0

Page 58 of the NEC switch user manual — P24 —
Page 58 · click to enlarge
Page 58

CHAPTER 4 PORT FUNCTIONS

Table 4-1. Functions of Ports

Pin Name I/O Function After Reset Alternate

Input/output can be specified in 1-bit units.

When used as an input port, use of on-chip pull-up resistors can be specified by pull-up resistor option register 0 (PU0).

When used as an output port, CMOS output or N-ch open-drain output can be specified in 8-bit units by port output mode register 0 (POM0).

Input/output can be specified in 1-bit units.

When used as an input port, use of on-chip pull-up resistors can be specified by pull-up resistor option register 0 (PU0).

When used as an output port, CMOS output or N-ch open-drain output can be specified in 8-bit units by port output mode register 0 (POM0).

P20 SCK10

P21 SO10

Input/output can be specified in 1-bit units.

P22 SI10

When used as an input port, use of on-chip pull-up resistors can be specified by pull-up resistor option register 0 (PU0).

P23 —

When P25 or P26 is used as an output port, CMOS output or N-ch open-drain output can be specified in 1-bit units by port output mode register 1 (POM1).

P24 —

P25 —

P26

INTP0/TI01/TO01

Input KR00 to KR07

Input/output can be specified in 1-bit units.

When used as an input port, use of on-chip pull-up resistors can be specified by pull-up resistor option register 0 (PU0).

Show 15 more labels / short text on this page
Function · P00 to P07 · I/O Port 0 · Input — · 8-bit I/O port · P10 to P17 · I/O Port 1 · Input — · 8-bit I/O port · I/O Port 2 · Input · 7-bit I/O port · P40 to P47 · I/O Port 4 · 8-bit I/O port
Page 59 of the NEC switch user manual — Table 4-2. Configuration of Port
Page 59 · click to enlarge
Page 59

CHAPTER 4 PORT FUNCTIONS

4.2 Port Configuration

Ports consists the following hardware.

Table 4-2. Configuration of Port

Control registers Port mode register (PMm: m = 0 to 2, 4)

Pull-up resistor option register (PU0)

Port output mode register (POMmm = 0, 1)
Ports Total31 (N-ch open-drain output is specifiable for 18 ports.)
Pull-up resistors Software control31

Parameter Configuration

Page 60 of the NEC switch user manual — WR PM
Page 60 · click to enlarge
Page 60

CHAPTER 4 PORT FUNCTIONS

4.2.1 Port 0

This is an 8-bit I/O port with an output latch. Port 0 can be specified in the input or output mode in 1-bit units by

using port mode register 0 (PM0). When the P00 to P07 pins are used as input port pins, on-chip pull-up resistors

can be connected in 8-bit units by using pull-up resistor option register 0 (PU0). CMOS output or N-ch open-drain

output can also be specified in 8-bit unit by using port output mode register 0 (POM0).

Port 0 is set in the input mode when the RESET signal is input.

Figure 4-2 shows a block diagram of port 0.

Figure 4-2. Block Diagram of P00 to P07

WR POM0

V DD0 POM00

WR PU0

PU00

RD

V DD0

WR PORT

Output latch (P00 to P07)

WR PM

POM0Port output mode register 0
PU0Pull-up resistor option register 0
PMPort mode register
RDPort 0 read signal
WRPort 0 write signal
Show 7 more labels / short text on this page
P-ch · Internal bus · Selector · P00 to P07 · P-ch · N-ch · PM00 to PM07
Page 61 of the NEC switch user manual — WR PM
Page 61 · click to enlarge
Page 61

CHAPTER 4 PORT FUNCTIONS

4.2.2 Port 1

This is an 8-bit I/O port with an output latch. Port 1 can be specified in the input or output mode in 1-bit units by

using port mode register 1 (PM1). When the P10 to P17 pins are used as input port pins, on-chip pull-up resistors

can be connected in 8-bit units by using pull-up resistor option register 0 (PU0). CMOS output or N-ch open-drain

output can also be specified in 8-bit unit by using port output mode register 0 (POM0).

Port 0 is set in the input mode when the RESET signal is input.

Figure 4-3 shows a block diagram of port 1.

Figure 4-3. Block Diagram of P10 to P17

WR POM0

V DD0 POM01

WR PU0

PU01

RD

V DD0

WR PORT

Output latch (P10 to P17)

WR PM

POM0Port output mode register 0
PU0Pull-up resistor option register 0
PMPort mode register
RDPort 1 read signal
WRPort 1 write signal
Show 7 more labels / short text on this page
P-ch · Internal bus · Selector · P10 to P17 · P-ch · N-ch · PM10 to PM17
Page 62 of the NEC switch user manual — Figure 4-4. Block Diagram of P20
Page 62 · click to enlarge
Page 62

CHAPTER 4 PORT FUNCTIONS

4.2.3 Port 2

This is a 7-bit I/O port with an output latch. Port 2 can be specified in the input or output mode in 1-bit units by

using port mode register 2 (PM2). When using the P20 to P26 pins as input port pins, on-chip pull-up resistors can

be connected in 7-bit units by using pull-up resistor option register 0 (PU0).

When P25 or P26 is used, CMOS output or N-ch open-drain output can be specified in 1-bit units by using port

output mode register 1 (POM1).

The port is also used as a data I/O and clock I/O to and from the serial interface, timer I/O, and external interrupt.

This port to set to the input mode when the RESET signal is input.

Figures 4-4 through 4-9 show block diagrams of port 2.

according to the function to be used. For how to set the latches, see Table 9-2.

Figure 4-4. Block Diagram of P20

V DD0

WR PU0

PU02

RD

WR PORT

(P20)

P20/SCK10

WR PM

PM20

PU0Pull-up resistor option register 0
PMPort mode register
RDPort 2 read signal
WRPort 2 write signal
Show 8 more labels / short text on this page
P-ch · Alternate · function · Selector · Internal bus · Output latch · Alternate · function
Page 63 of the NEC switch user manual — CHAPTER 4 PORT FUNCTIONS
Page 63 · click to enlarge
Page 63

CHAPTER 4 PORT FUNCTIONS

Figure 4-5. Block Diagram of P21

V DD0

WR PU0

PU02

RD

WR PORT

(P21)

P21/SO10

WR PM

PM21

PU0Pull-up resistor option register 0
PMPort mode register
RDPort 2 read signal
WRPort 2 write signal
Show 6 more labels / short text on this page
P-ch · Selector · Internal bus · Output latch · Alternate · function
Page 64 of the NEC switch user manual — CHAPTER 4 PORT FUNCTIONS
Page 64 · click to enlarge
Page 64

CHAPTER 4 PORT FUNCTIONS

Figure 4-6. Block Diagram of P22

V DD0

WR PU0

PU02

RD

WR PORT

(P22)

P22/SI10

WR PM

PM22

PU0Pull-up resistor option register 0
PMPort mode register
RDPort 2 read signal
WRPort 2 write signal
Show 6 more labels / short text on this page
P-ch · Alternate · function · Selector · Internal bus · Output latch
Page 65 of the NEC switch user manual — CHAPTER 4 PORT FUNCTIONS
Page 65 · click to enlarge
Page 65

CHAPTER 4 PORT FUNCTIONS

Figure 4-7. Block Diagram of P23 and P24

V DD0

WR PU0

PU02

RD

WR PORT

P23, P24

(P23, P24)

WR PM

PM23, PM24

PU0Pull-up resistor option register 0
PMPort mode register
RDPort 2 read signal
WRPort 2 write signal
Show 4 more labels / short text on this page
P-ch · Selector · Internal bus · Output latch
Page 66 of the NEC switch user manual — CHAPTER 4 PORT FUNCTIONS
Page 66 · click to enlarge
Page 66

CHAPTER 4 PORT FUNCTIONS

Figure 4-8. Block Diagram of P25

WR POM1

V DD0 POM125

WR PU0

PU02

RD

V DD0

P25

WR PORT

(P25)

WR PM

PM25

POM1Port output mode register 1
PU0Pull-up resistor option register 0
PMPort mode register
RDPort 2 read signal
WRPort 2 write signal
Show 6 more labels / short text on this page
P-ch · Internal bus · Selector · P-ch · Output latch · N-ch
Page 67 of the NEC switch user manual — CHAPTER 4 PORT FUNCTIONS
Page 67 · click to enlarge
Page 67

CHAPTER 4 PORT FUNCTIONS

Figure 4-9. Block Diagram of P26

WR POM1

V DD0 POM126

WR PU0

PU02

RD

V DD0

P26

WR PORT

(P26)

WR PM

PM26

POM1Port output mode register 1
PU0Pull-up resistor option register 0
PMPort mode register
RDPort 2 read signal
WRPort 2 write signal
Show 6 more labels / short text on this page
P-ch · Internal bus · Selector · P-ch · Output latch · N-ch
Page 68 of the NEC switch user manual — WR PM
Page 68 · click to enlarge
Page 68

CHAPTER 4 PORT FUNCTIONS

4.2.4 Port 4

This is an 8-bit I/O port with an output latch. Port 4 can be specified in the input or output mode in 1-bit units by

using port mode register 4 (PM4). When using P40 to P47 pins as input port pins, on-chip pull-up resistors can be

connected in 8-bit units by using pull-up resistor option register 0 (PU0).

The port is also used as a key return input.

This port is set in the input mode when the RESET signal is input.

Figure 4-10 shows a block diagram of port 4.

set according to the function to be used. For how to set the register, see Section 11.3 (5) Key

return mode register 00 (KRM00).

Figure 4-10. Block Diagram of P40 to P47

V DD0

WR PU0

PU04

RD

WR KRM

KRM007

WR PORT

Output latch (P40 to P47)

WR PM

KRM00Key return mode register 00
PU0Pull-up resistor option register 0
PMPort mode register
RDPort 4 read signal
WRPort 4 write signal
Show 8 more labels / short text on this page
P-ch · Selector · KRM000 to · Internal bus · P40/KR00 to P47/KR07 · PM40 to PM47 · Alternate · function
Page 69 of the NEC switch user manual — PM2
Page 69 · click to enlarge
Page 69

CHAPTER 4 PORT FUNCTIONS

4.3 Registers Controlling Port Function

The following three types of registers control the ports.

  • Port mode registers (PM0, PM1, PM2, PM4)
  • Pull-up resistor option register (PU0)
  • Port output mode registers (POM0, POM1)

(1) Port mode registers (PM0, PM1, PM2, PM4)

These registers are used to set port input/output in 1-bit units.

The port mode registers are independently set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets registers to FFH.

When port pins are used as alternate-function pins, set the port mode register and output latch according to

Table 4-3.

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.

Figure 4-11. Format of Port Mode Register

7 Symbol Address After reset 6 5 4 3 2 1 0 R/W

PM0

PM07

PM06

PM05

PM04

PM03

PM02

PM01

PM00

FF20H

FFH

R/W

PM17 PM16 PM15 PM14 PM13 PM12 PM11 PM10 PM1 FF21H FFH R/W

PM2

PM26

PM25

PM24

PM23

PM22

PM21

PM20

FF22H

FFH

R/W

PM47 PM46 PM45 PM44 PM43 PM42 PM41 PM40 PM4 FF24H FFH R/W

Pmn pin input/output mode selection

0 Output mode (output buffer on)

Input mode (output buffer off) 1

PMmn

Page 70 of the NEC switch user manual — 0 0 0 PU04 0 PU01 PU00 PU0
Page 70 · click to enlarge
Page 70

CHAPTER 4 PORT FUNCTIONS

Table 4-3. Port Mode Register and Output Latch Settings When Using Alternate Functions

Pxx PMxx Pin Name

P26 TO01 Output 0 0

TI01 Input 1 ×

INTP0 Input 1 ×

KR00 to KR07 Input 1 ×

Key return mode register 00 (KRM00)).

according to its function. For the setting method, see Table 9-2 Settings of Serial interface

10 Operating Mode.

Remark xDon’t care
PMxxPort mode register
PxxPort output latch

(2) Pull-up resistor option register 0 (PU0)

The pull-up resistor option register (PU0) sets whether an on-chip pull-up resistor on each port is used or not.

On the port which is specified to use the on-chip pull-up resistor in the PU0, the pull-up resistor can be internally

used only for the bits set to the input mode. No on-chip pull-up resistors can be used for the bits set in the

output mode regardless of the setting PU0. This applies to the case when using the output pins for alternate

functions.

PU0 is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets PU0 to 00H.

Figure 4-12. Format of Pull-up Resistor Option Register 0

7 6 5 3

Address After reset R/W

0 0 0 PU04 0 PU01 PU00 PU0

PU02

FFF7H 00H R/W

Pm on-chip pull-up resistor selection

(m = 0 to 2, 4)

On-chip pull-up resistor not connected

On-chip pull-up resistor connected

Show 5 more labels / short text on this page
Secondary Function · Name Input/Output · P40 to P47 · Symbol · PU0m
Page 71 of the NEC switch user manual — 0 POM126 POM125 0 0 0 0 POM1
Page 71 · click to enlarge
Page 71

CHAPTER 4 PORT FUNCTIONS

(3) Port output mode registers (POM0 and POM1)

The port output mode registers (POM0 and POM1) are used to switch from CMOS output to N-ch open-drain

output for port 0, port 1, pin P25, and pin P26.

Set POM0 and POM1 with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets P0M0 and POM1 to 00H.

Figure 4-13. Format of Port Output Mode Register 0

7 6 5 4 3 2

Address After reset R/W

0 POM01POM00 POM0

FF30H 00H R/W

Pm output mode selectionNote

(m = 0, 1)

Figure 4-14. Format of Port Output Mode Register 1

7 4 3 2 1 0

Address After reset R/W

0 POM126 POM125 0 POM1

FF31H 00H R/W

Output mode selection for bit n of port 2Note

(n = 5, 6)

Show 8 more labels / short text on this page
Symbol · POM0m · CMOS output · N-ch open-drain output · Symbol · POM12n · CMOS output · N-ch open-drain output
Page 72 of the NEC switch user manual — (2) In input mode
Page 72 · click to enlarge
Page 72

CHAPTER 4 PORT FUNCTIONS

4.4 Port Function Operation

The operation of a port differs depending on whether the port is set to the input or output mode, as described

below.

4.4.1 Writing to I/O port

(1) In output mode

A value can be written to the output latch of a port by using a transfer instruction. The contents of the output

latch can be output from the pins of the port.

The data once written to the output latch is retained until new data is written to the output latch.

(2) In input mode

A value can be written to the output latch by using a transfer instruction. However, the status of the port pin is

not changed because the output buffer is off.

The data once written to the output latch is retained until new data is written to the output latch.

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 to the input mode and not subject to manipulation become

undefined.

4.4.2 Reading from I/O port

(1) In output mode

The status of a pin can be read by using a transfer instruction. The contents of the output latch are not

changed.

(2) In input mode

The status of a pin can be read by using a transfer instruction. The contents of the output latch are not

changed.

4.4.3 Arithmetic operation of I/O port

(1) In output mode

An arithmetic operation can be performed on the contents of the output latch. The result of the operation is

written to the output latch. The contents of the output latch are output from the port pins.

The data once written to the output latch is retained until new data is written to the output latch.

(2) In input mode

The contents of the output latch become undefined. However, the status of the pin is not changed because the

output buffer is off.

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 to the input mode and not subject to manipulation become

undefined.

Page 73 of the NEC switch user manual — PCC1
Page 73 · click to enlarge
Page 73

CHAPTER 5 CLOCK GENERATOR

5.1 Clock Generator Functions

The clock generator generates the clock to be supplied to the CPU and peripheral hardware. The following type

of system clock oscillator is used.

  • System clock oscillator

This circuit oscillates at 6.0 MHz. Oscillation can be stopped by executing the STOP instruction.

5.2 Clock Generator Configuration

The clock generator consists of the following hardware.

Table 5-1. Configuration of Clock Generator

Control register Processor clock control register (PCC)

Oscillator System clock oscillator

Figure 5-1. Block Diagram of Clock Generator

Clock for peripheral hardware

Prescaler System clock oscillator fX

fX 22

Wait controller CPU clock (fCPU) STOP

PCC1

Processor clock control register (PCC)

Show 5 more labels / short text on this page
Item Configuration · Prescaler · Selector · Standby controller · Internal bus
Page 74 of the NEC switch user manual — FFFBH 02H R/W
Page 74 · click to enlarge
Page 74

CHAPTER 5 CLOCK GENERATOR

5.3 Register Controlling Clock Generator

The clock generator is controlled by the following register.

  • Processor clock control register (PCC)

(1) Processor clock control register (PCC)

PCC selects the CPU clock and sets the of division ratio.

PCC is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets the PCC to 02H.

Figure 5-2. Format of Processor Clock Control Register

Symbol Address After reset R/W

7 6 5 4 3 2 1 0

0 PCC1 0 PCC

FFFBH 02H R/W

PCC1

CPU clock (fCPU) selection

Minimum instruction execution time2/f CPU

fX = 6.0 MHz operation

0.33 s

fX/22

1.33 s

Remark f Xsystem clock oscillation frequency

fX · µ · µ

Page 75 of the NEC switch user manual — Figure 5-3. External Circuit of System Clock Oscillator
Page 75 · click to enlarge
Page 75

CHAPTER 5 CLOCK GENERATOR

5.4 System Clock Oscillators

5.4.1 System clock oscillator

The system clock oscillator is oscillated by the crystal resonator (6.0 MHz TYP.) connected across the X1 and X2

pins.

An external clock can also be input to the circuit. In this case, input the clock signal to the X1 pin, and leave the

X2 pin open.

Figure 5-3 shows the external circuit of the system clock oscillator.

Figure 5-3. External Circuit of System Clock Oscillator

(a) Crystal oscillation (b) External clock

V SS0

X2 OPEN

lines in Figure 5-3 to avoid an adverse effect from wiring capacitance.

  • Keep the wiring length as short as possible.
  • Do not cross the wiring with 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 V SS0 . Do not

ground the capacitor to a ground pattern through which a high current flows.

  • Do not fetch signals from the oscillator.

External clock X1 · Crystal resonator

Page 76 of the NEC switch user manual — V SS0 X1 X2
Page 76 · click to enlarge
Page 76

CHAPTER 5 CLOCK GENERATOR

5.4.2 Examples of incorrect resonator connection

Figure 5-4 shows examples of incorrect resonator connection.

Figure 5-4. Examples of Incorrect Resonator Connection (1/2)

(a) Too long wiring (b) Crossed signal line

PORTn (n = 0, 1, 2, 4)

V SS0 X1 X2

V SS0 X1 X2

(c) Wiring near high fluctuating current

(d) Current flowing through ground line of oscillator

(potential at points A, B, and C fluctuates)

V DD0

V SS0 X1 X2

V SS0 X1

A B C

Pmn · High current · High current

Page 77 of the NEC switch user manual — 5.5 Clock Generator Operation
Page 77 · click to enlarge
Page 77

CHAPTER 5 CLOCK GENERATOR

Figure 5-4. Examples of Incorrect Resonator Connection (2/2)

(e) Signals are fetched

V SS0 X1 X2

5.4.3 Frequency divider

The frequency divider divides the output of the system clock oscillator (fX) to generate various clocks.

5.5 Clock Generator Operation

The clock generator generates the following clocks and controls the operation modes of the CPU, such as the

standby mode.

  • System clock f X
  • CPU clock f CPU
  • 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 (1.33 µs: at 6.0 MHz operation) of the system clock is selected when the RESET signal is

generated (PCC = 02H). While a low level is being input to the RESET pin, oscillation of the system clock

is stopped.

(b) Two types of minimum instruction execution time (0.33 µs and 1.33 µs: at 6.0 MHz operation) can be

selected by the PCC setting.

(c) Two standby modes, STOP and HALT, can be used.

(d) The clock pulse for the peripheral hardware is generated by dividing the frequency of the system clock. So,

the other hardware stops when the system clock stops (except for external clock pulses).

Page 78 of the NEC switch user manual — Figure 5-5. Switching of CPU Clock
Page 78 · click to enlarge
Page 78

CHAPTER 5 CLOCK GENERATOR

5.6 Changing Setting of CPU Clock

5.6.1 Time required for switching CPU clock

The CPU clock can be selected by using bit 1 (PCC1) of the processor clock control register (PCC).

Actually, the specified clock is not selected immediately after the setting of PCC has been changed; the old clock

is used for the duration of several instructions after that (see Table 5-2).

Table 5-2. Maximum Time Required for Switching CPU Clock

Set Value Before Switching Set Value After Switching

PCC1 PCC1 PCC1

Remark Before switching, the minimum instruction execution time of the CPU clock is two clocks.

5.6.2 Switching CPU clock

The following figure illustrates how the CPU clock switches.

Figure 5-5. Switching of CPU Clock

V DD

RESET

Wait (5.46 msat 6.0 MHz 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

15/fX) is automatically secured.

which oscillation stabilization (2

After that, the CPU starts instruction execution at the slow speed of the system clock (1.33 µs: at 6.0 MHz

operation).

<2> After the time required for the VDD voltage to rise 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

operation can be selected.

Show 6 more labels / short text on this page
0 4 clocks · 1 2 clocks · CPU clock · Slow operation · Fastest operation · Internal reset operation
Page 79 of the NEC switch user manual — (2) External event counter
Page 79 · click to enlarge
Page 79

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

6.1 Functions of 8-Bit Timer/Event Counters 00 and 01

The 8-bit timer/event counters (TM00 and TM01) have the following functions.

  • Interval timer (TM00 and TM01)
  • External event counter (TM01 only)
  • Square wave output (TM01 only)

The µPD789800 Subseries is provided with a 1-channel (TM01) 8-bit timer/event counter and a 1-channel (TM00)

8-bit timer. When reading the description of TM00, “timer/event counter” should be read as “ timer”.

(1) 8-bit interval timer

When the 8-bit timer/event counter is used as an interval timer, it generates an interrupt at any preset time

interval.

Table 6-1. Interval Time of 8-Bit Timer 00

Minimum Interval Time Maximum Interval Time Resolution

2 6/fX (10.7 µs) 2 14/fX (2.73 ms) 2 6/fX (10.7 µs)

2 9/fX (85.3 µs) 2 17/fX (21.8 ms) 2 9/fX (85.3 µs)

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz.

Table 6-2. Interval Time of 8-Bit Timer/Event Counter 01

Minimum Interval Time Maximum Interval Time Resolution

2 4/fX (2.67 µs) 2 12/fX (682.7 µs) 2 4/fX (2.67 µs)

2 8/fX (42.7 µs) 2 16/fX (10.9 ms) 2 8/fX (42.7 µs)

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz.

(2) External event counter

The number of pulses of an externally input signal can be measured.

Page 80 of the NEC switch user manual — TCE00 TCL000
Page 80 · click to enlarge
Page 80

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

(3) Square wave output

A square wave of arbitrary frequency can be output.

Table 6-3. Square Wave Output Range of 8-Bit Timer/Event Counter 01

Minimum Pulse Width Maximum Pulse Width Resolution

2 4/fX (2.67 µs) 2 12/fX (682.7 µs) 2 4/fX (2.67 µs)

2 8/fX (42.7 µs) 2 16/fX (10.9 ms) 2 8/fX (42.7 µs)

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz

6.2 Configuration of 8-Bit Timer/Event Counters 00 and 01

8-bit timer/event counters 00 and 01 consist of the following hardware.

Table 6-4. Configuration of 8-Bit Timer/Event Counters 00 and 01

Timer counter 8 bits × 2 (TM00 and TM01)

Register Compare register8 bits × 2 (CR00 and CR01)

Timer outputs 1 (TO01)

Control registers 8-bit timer mode control registers 00 and 01 (TMC00 and TMC01) Port mode register 2 (PM2)

Figure 6-1. Block Diagram of 8-Bit Timer 00

8-bit compare register 00 (CR00)

INTTM00

fX/26

8-bit timer counter 00 (TM00)

fX/29

TCE00 TCL000

8-bit timer mode control register 00 (TMC00)

Show 7 more labels / short text on this page
Item Configuration · Internal bus · Match · Selector · Clear · Selector · Internal bus
Page 81 of the NEC switch user manual — (2) 8-bit timer counter 0n (TM0n)
Page 81 · click to enlarge
Page 81

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

Figure 6-2. Block Diagram of 8-Bit Timer/Event Counter 01

8-bit compare register 01 (CR01)

P26 Output latch PM26

INTTM01

fX/24

8-bit timer counter 01 (TM01)

fX/28

F/F

TO01/P26/ INTP0/TI01

TCE01 TCL011 TCL010 TOE01

8-bit timer mode control register 01 (TMC01)

(1) 8-bit compare register 0n (CR0n)

This is an 8-bit register used to compare the value set to CR0n with the 8-bit timer counter 0n (TM0n) count

value, and if they match, generate used an interrupt request (INTTM0n).

CR0n is set with an 8-bit memory manipulation instruction. Values from 00H to FFH can be set.

RESET input sets CR0n undefined.

Remark n = 0 or 1

(2) 8-bit timer counter 0n (TM0n)

This is an 8-bit register used to count pulses.

TM0n is read with an 8-bit memory manipulation instruction.

RESET input sets TMn to 00H.

Remark n = 0 or 1

Show 6 more labels / short text on this page
Internal bus · Match · Selector · Clear · TI01/P26 /INTP0/TO01 Selector · Internal bus
Page 82 of the NEC switch user manual — TCL000
Page 82 · click to enlarge
Page 82

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

6.3 Registers Controlling 8-Bit Timer/Event Counters 00 and 01

The following two types of registers are used to control 8-bit timer/event counters 00 and 01.

  • 8-bit timer mode control registers 00 and 01 (TMC00 and TMC01)
  • Port mode register 2 (PM2)

(1) 8-bit timer mode control register 00 (TMC00)

This register enables/stops operation of 8-bit timer counter 00 (TM00) and sets the counter clock of 8-bit timer

TMC00 is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets TMC00 to 00H.

Figure 6-3. Format of 8-Bit Timer Mode Control Register 00

Symbol Address After reset

6 5 4 3 2 1

R/W

TCE00 TCL000 0 TMC00

FF53H 00H R/W

TCE00

8-bit timer counter 00 operation control

Operation disabled (TM00 cleared to 0)

TCL000

8-bit timer 00 count clock selection

fX/26 (93.8 kHz)

fX/29 (11.7 kHz)

Refer to 6.4 Operation of 8-Bit Timer/Event Counters 00 and 01 for details.

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz.

0 · Operation enabled

Page 83 of the NEC switch user manual — TOE01
Page 83 · click to enlarge
Page 83

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

(2) 8-bit timer mode control register 01 (TMC01)

TMC01 determines whether to enable or disable 8-bit timer counter 01 (TM01), specifies the count clock for the

8-bit timer/event counter, and controls the operation of the output controller.

TMC01 is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets TMC01 to 00H.

Figure 6-4. Format of 8-Bit Timer Mode Control Register 01

Symbol Address After reset R/W

6 5 4 3 2 1

TCE01 0 TCL011TCL010 TOE01 TMC01

FF57H 00H R/W

TCE01

8-bit timer counter 01 operation control

Operation disabled (TM01 is cleared to 0.)

TCL011

8-bit timer/event counter 01 count clock selection TCL010

fX/24

fX/28

(23.4 kHz)

Rising edge of TI01Note

Falling edge of TI01Note

TOE01

8-bit timer/event counter 01 output control

Output disabled (port mode)

Refer to 6.4 Operation of 8-Bit Timer/Event Counters 00 and 01 for details.

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz.

Operation enabled · (375 kHz) · Output enabled

Page 84 of the NEC switch user manual — FF22H FFH
Page 84 · click to enlarge
Page 84

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

(3) Port mode register 2 (PM2)

This register sets port 2 input/output in 1-bit units.

When using the P26/TO01/INTP0/TI01 pin for timer output, set P26 and the output latch of P26 to 0.

When P26/TO01/INTP0/TI01 pin is used as a timer input, set PM26 to 1.

PM2 is set by a 1-bit or 8-bit memory manipulation instruction.

RESET input sets PM2 to FFH.

Figure 6-5. Format of Port Mode Register 2

7 6 5 4 R/W

3 2 1 0

1 PM26 PM25 PM24 PM23 PM22 PM21 PM20 PM2

FF22H FFH

R/W

PM26

P26 pin input/output mode selection

Output mode (output buffer on)

Input mode (output buffer off)

Symbol Address · After reset

Page 85 of the NEC switch user manual — Table 6-6. Interval Time of 8-Bit Timer/Event Counter 01
Page 85 · click to enlarge
Page 85

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

6.4 Operation of 8-Bit Timer/Event Counters 00 and 01

6.4.1 Operation as interval timer

Interval timer repeatedly generates an interrupt at time intervals specified by the count value set to 8-bit compare

registers 00 and 01 (CR00 and CR01) in advance.

To operate the 8-bit timer/event counter as an interval timer, the following settings are required.

Disable operation of the 8-bit timer counter 0n (TM0n) by setting TCE0n (bit 7 of 8-bit timer mode control

register 0n (TMC0n)) to 0.

Set the count clock of the 8-bit timer/event counter (see Tables 6-5 and 6-6).

Set count values to CR0n.

Enable operation of TM0n by setting TCE0n to 1.

When the count value of 8-bit timer counter 0n (TM0n) matches the value set to CR0n, the value of TMn is

cleared to 0 and TM0n continues counting. At the same time, an interrupt request signal (INTTM0n) is generated.

Tables 6-5 and 6-6 show the interval time, and Figures 6-6 and 6-7 show the timing of interval timer operation.

8-bit memory manipulation instruction, an error of more than 1 clock may occur in 1 cycle after

the timer has been started. Therefore, be sure to follow the settings above when the 8-bit

timer/event counter is operating as an interval timer.

Remark n = 0 or 1

Table 6-5. Interval Time of 8-Bit Timer 00

TCL000 Minimum Interval Time Maximum Interval Time Resolution

0 2 6/fX (10.7 µs) 2 14/fX (2.73 µs) 2 6/fX (10.7 µs)

1 2 9/fX (85.3 µs) 2 17/fX (21.8 ms) 2 9/fX (85.3 µs)

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz.

Table 6-6. Interval Time of 8-Bit Timer/Event Counter 01

TCL011 TCL010 Minimum Interval Time Maximum Interval Time Resolution

0 0 2 4/fX (2.67 µs) 2 12/fX (682.7 µs) 2 4/fX (2.67 µs)

0 1 2 8/fX (42.7 µs) 2 16/fX (10.9 ms) 2 8/fX (42.7 µs)

1 0 TI01 input cycle 2 8 × TI01 input cycle TI01 input edge cycle

1 1 TI01 input cycle 2 8 × TI01 input cycle TI01 input edge cycle

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz.
Page 86 of the NEC switch user manual — CR01
Page 86 · click to enlarge
Page 86

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

Figure 6-6. Interval Timer Operation Timing of 8-Bit Timer 00

NEC switch — CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01 diagram (page 86)
Fig. 9

N 01 00 N 01 00 N 00 01

CR00

TCE00

INTTM00

Remark Interval time = (N + 1) × t where N = 00H to FFH

Figure 6-7. Interval Timer Operation Timing of 8-Bit Timer/Event Counter 01

NEC switch — Figure 6-7. Interval Timer Operation Timing of 8-Bit Timer/Event Counter 01 diagram (page 86)
Fig. 10 · Figure 6-7. Interval Timer Operation Timing of 8-Bit…

N 01 00 N 01 00 N 00 01

CR01

TCE01

INTTM01

TO01

Remark Interval time = (N + 1) × t, where N = 00H to FFH

Show 4 more labels / short text on this page
Count clock · TM00 count value · Count clock · TM01 count value
Page 87 of the NEC switch user manual — CR01
Page 87 · click to enlarge
Page 87

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

6.4.2 Operation as external event counter (timer 01 only)

The external event counter counts the number of external clock pulses input to the TI01/P26/INTP0/TO01 pin by

using timer counter 01 (TM01).

To operate the 8-bit timer/event counter as an external event counter, the following settings are required.

Disable operation of 8-bit timer counter 01 (TM01) by setting TCE01 (bit 7 of 8-bit timer mode control

register 01 (TMC01)) to 0.

Specify the rising/falling edge of TI01 (see Table 6-6), and set TO01 to output-disabled (TOE01 (bit 0 of

TMC01) = 0).

Set count values to CR01.

Enable operation of TM01 by setting TCE01 to 1.

Each time the valid edge specified by bit 1 or 2 (TCL011 or TCL010) of TMC01 is input, the value of 8-bit timer

counter 01 (TM01) is incremented.

When the count value of TM01 matches the value set to CR01, the value of TM01 is cleared to 0 and TM01

continues counting. At the same time, an interrupt request signal (INTTM01) is generated.

Figure 6-8 shows the timing of external event counter operation (with rising edge specified).

8-bit memory manipulation instruction, an error of more than 1 clock may occur in 1 cycle after

the timer has been started. Therefore, be sure to follow the settings above when the 8-bit

timer/event counter is operating as an external event counter.

Figure 6-8. Timing of External Event Counter Operation (with Rising Edge Specified)

00 01 02 03 04 05 N – 1 N 00 01 02 03

CR01

N

TCE01

INTTM01

Remark N = 00H to FFH

TI01 pin input · TM01 count value

Page 88 of the NEC switch user manual — Table 6-7. Square-Wave Output Range of 8-Bit Timer/Event Counter 01
Page 88 · click to enlarge
Page 88

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

6.4.3 Operation as square-wave output (timer 01 only)

The 8-bit timer/event counter can generate output square waves of arbitrary frequency at intervals specified by

the count value set to 8-bit compare register 01 (CR01) in advance.

To operate 8-bit timer/event counter 01 as square wave output, the following settings are required.

Set P26 to output mode (PM26 = 0) and the output latch of P26 to 0.

Disable operation of 8-bit timer counter 01 (TM01) by setting TCE01 (bit 7 of 8-bit timer mode control

register 01 (TMC01)) to 0.

Set the count clock of 8-bit timer/event counter 01 (see Table 6-7) and enable output of TO01 by setting

TOE01 (bit 0 of TMC01) to 1

Set count values to CR01.

Enable operation of TM01 by setting TCE01 to 1.

When the count value of 8-bit timer counter 01 (TM01) matches the value set to CR01, the TO01/P26/INTP0/TI01

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 TM01 value is cleared to 0, TM01 resumes counting, and an interrupt request signal

(INTTM01 is generated).

Setting bit 7 of TMC01 (TCE01) to 0 clears the square-wave output to 0.

Table 6-7 lists the square wave output range, and Figure 6-9 shows timing of square wave output.

8-bit memory manipulation instruction, an error of more than 1 clock may occur in 1 cycle after

the timer has been started. Therefore, be sure to follow the settings above when the 8-bit

timer/event counter is operating as square-wave output.

Table 6-7. Square-Wave Output Range of 8-Bit Timer/Event Counter 01

TCL011 TCL010 Minimum Pulse Width Maximum Pulse Width Resolution

0 0 2 4/fX (2.67 µs) 2 12/fX (682.7 µs) 2 4/fX (2.67 µs)

0 1 2 8/fX (42.7 µs) 2 16/fX (10.9 ms) 2 8/fX (42.7 µs)

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz.
Page 89 of the NEC switch user manual — CR01
Page 89 · click to enlarge
Page 89

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

Figure 6-9. Timing of Square-Wave Output

N 01 00 N 01 00 N 00 01

CR01

N N N N

TCE01

INTTM01

Interrupt acknowledged Interrupt acknowledged

Show 5 more labels / short text on this page
Count clock · TM01 count value · Clear Clear · Count start · TO01Note
Page 90 of the NEC switch user manual — Figure 6-11. Timing of External Event Counter Operation
Page 90 · click to enlarge
Page 90

CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01

6.5 Notes on Using 8-Bit Timer/Event Counters 00 and 01

(1) Error on starting timer

An error of up to 1 clock occurs after the timer is started until a match signal is generated. This is because 8-bit

timer counters 00 and 01 (TM00 and TM01) are started asynchronously to the count pulse.

Figure 6-10. Start Timing of 8-Bit Timer Counter

TM00, TM01 count value

00H 01H 02H 03H 04H

(2) Setting of 8-bit compare register

8-bit compare registers 00 and 01 (CR00 and CR01) can be set to 00H.

Therefore, one pulse can be counted when the 8-bit timer/event counter operates as an event counter.

Figure 6-11. Timing of External Event Counter Operation

CR00, CR01 00H

TM00, TM01 count value 00H

Show 4 more labels / short text on this page
Count pulse · Timer starts · TI00, TI01 input · Interrupt request flag
Page 91 of the NEC switch user manual — Table 7-2. Interval Time
Page 91 · click to enlarge
Page 91

CHAPTER 7 WATCHDOG TIMER

7.1 Watchdog Timer Functions

The watchdog timer has the following functions.

  • Watchdog timer
  • Interval timer

register (WDTM).

(1) Watchdog timer

The watchdog timer is used to detect inadvertent program loops. When an inadvertent loop is detected, a non-

maskable interrupt or the RESET signal can be generated.

Table 7-1. Inadvertent Loop Detection Time of Watchdog Timer

Operation at fX = 6.0 MHz

2 11 × 1/fX 341 µs

2 13 × 1/fX 1.37 ms

2 15 × 1/fX 5.46 ms

2 17 × 1/fX 21.8 ms

f XSystem clock oscillation frequency

(2) Interval timer

The interval timer generates an interrupt at arbitrary intervals set in advance.

Table 7-2. Interval Time

Interval Time Operation at fX = 6.0 MHz

2 11 × 1/fX 341 µs

2 13 × 1/fX 1.37 ms

2 15 × 1/fX 5.46 ms

2 17 × 1/fX 21.8 ms

f XSystem clock oscillation frequency

Inadvertent Loop · Detection Time

Page 92 of the NEC switch user manual — TCL22 TCL21 TCL20
Page 92 · click to enlarge
Page 92

CHAPTER 7 WATCHDOG TIMER

7.2 Watchdog Timer Configuration

The watchdog timer consists of the following hardware.

Table 7-3. Configuration of Watchdog Timer

Control register Timer clock select register 2 (TCL2) Watchdog timer mode register (WDTM)

Figure 7-1. Block Diagram of Watchdog Timer

fX 24

TMMK4

fX 26 fX 28 fX 210

INTWDT maskable interrupt request

TMIF4

RESET

INTWDT non-maskable interrupt request

TCL22 TCL21 TCL20

RUN

WDTM4 WDTM3

Timer clock select register 2 (TCL2)

Watchdog timer mode register (WDTM)

Show 8 more labels / short text on this page
Item Configuration · Internal bus · Prescaler · Selector · 7-bit counter · Controller · Clear · Internal bus
Page 93 of the NEC switch user manual — FF42H 00H
Page 93 · click to enlarge
Page 93

CHAPTER 7 WATCHDOG TIMER

7.3 Registers Controlling Watchdog Timer

The following two registers are used to control the watchdog timer.

  • Timer clock select register 2 (TCL2)
  • Watchdog timer mode register (WDTM)

(1) Timer clock select register 2 (TCL2)

This register sets the watchdog timer count clock.

TCL2 is set with an 8-bit memory manipulation instruction.

RESET input sets TCL2 to 00H.

Figure 7-2. Format of Timer Clock Select Register 2

7 6 5 4 3 2 1 0

R/W

0 TCL22 TCL21 TCL20 TCL2

FF42H 00H

R/W

TCL22

TCL21

TCL20

Watchdog timer count clock selection Interval time

fX/24

211/fX

fX/26

213/fX

(1.37 ms)

(93.8 kHz)

fX/28

(23.4 kHz)

215/fX

(5.46 ms)

fX/210

(5.86 kHz)

217/fX

(21.8 ms)

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz.
Show 6 more labels / short text on this page
Symbol Address · After reset · µ (375 kHz) · (341 s) · Other than above · Settings prohibited
Page 94 of the NEC switch user manual — FFF9H 00H R/W
Page 94 · click to enlarge
Page 94

CHAPTER 7 WATCHDOG TIMER

(2) Watchdog timer mode register (WDTM)

This register sets the operation mode of the watchdog timer, and enables/disables counting of the watchdog

timer.

The WDTM is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets the WDTM to 00H.

Figure 7-3. Format of Watchdog Timer Mode Register

Symbol Address After reset R/W

6 5 4 3 2 1 0

RUN 0 0 WDTM4 WDTM3 0 0 0 WDTM

FFF9H 00H R/W

RUN

Selection of operation of watchdog timerNote 1

Clear counter and start counting

WDTM4 Selection of operation mode of watchdog timerNote 2 WDTM3

Interval timer mode (overflow and maskable interrupt occur)Note 3

Watchdog timer mode 1 (overflow and non-maskable interrupt occur)

Watchdog timer mode 2 (overflow occurs and reset operation started)

started, it cannot be stopped by 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.

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 the

interrupt request flag register 0 (IF0)) is set to 0. While TMIF4 is 1, a non-maskable

interrupt is generated upon write completion if watchdog timer mode 1 or 2 is

selected.

Stop counting · Operation disabled

Page 95 of the NEC switch user manual — Table 7-4. Inadvertent Loop Detection Time of Watchdog Timer
Page 95 · click to enlarge
Page 95

CHAPTER 7 WATCHDOG TIMER

7.4 Watchdog Timer Operation

7.4.1 Operation as watchdog timer

The watchdog timer detects an inadvertent program loop when bit 4 (WDTM4) of the watchdog timer mode

register (WDTM) is set to 1.

The count clock (inadvertent loop detection time interval) of the watchdog timer can be selected by bits 0 to 2

(TCL20 to TCL22) of timer clock select register 2 (TCL2). By setting bit 7 (RUN) of WDTM to 1, the watchdog timer

is started. Set RUN to 1 within the set inadvertent loop detection time interval after the watchdog timer has been

started. By setting RUN to 1, the watchdog timer can be cleared and start counting. If RUN is not set to 1, and the

inadvertent loop detection time is exceeded, the system is reset or a non-maskable interrupt is generated by the

value of bit 3 (WDTM3) of WDTM.

The watchdog timer continues operation in the HALT mode, but stops in the STOP mode. Therefore, set RUN to

1 before entering the STOP mode to clear the watchdog timer, and then execute the STOP instruction.

Table 7-4. Inadvertent Loop Detection Time of Watchdog Timer

TCL22 TCL21 TCL20 Inadvertent Loop Detection Time Operation at fX = 6.0 MHz

0 0 0 2 11 × 1/fX 341 µs

0 1 0 2 13 × 1/fX 1.37 ms

1 0 0 2 15 × 1/fX 5.46 ms

1 1 0 2 17 × 1/fX 21.8 ms

f XSystem clock oscillation frequency
Page 96 of the NEC switch user manual — Table 7-5. Interval Time of Interval Timer
Page 96 · click to enlarge
Page 96

CHAPTER 7 WATCHDOG TIMER

7.4.2 Operation as interval timer

When bit 4 (WDTM4) and bit 3 (WDTM3) of the watchdog timer mode register (WDTM) are set to 0 and 1,

respectively, the watchdog timer also operates as an interval timer that repeatedly generates an interrupt at time

intervals specified by a count value set in advance.

Select the count clock (or interval time) by setting bits 0 to 2 (TCL20 to TCL22) of timer clock select register 2

(TCL2). The watchdog timer starts operation as an interval timer when the RUN bit (bit 7 of WDTM) is set to 1.

In the interval timer mode, the interrupt mask flag (TMMK4) is valid, and a maskable interrupt (INTWDT) can be

generated. The priority of INTWDT is set as the highest of all the maskable interrupts.

The interval timer continues operation in the HALT mode, but stops in the STOP mode. Therefore, set RUN to 1

before entering the STOP mode to clear the interval timer, and then execute the STOP instruction.

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.

Table 7-5. Interval Time of Interval Timer

TCL22 TCL21 TCL20 Interval Time Operation at fX = 6.0 MHz

0 0 0 2 11 × 1/fX 341 µs

0 1 0 2 13 × 1/fX 1.37 ms

1 0 0 2 15 × 1/fX 5.46 ms

1 1 0 2 17 × 1/fX 21.8 ms

f XSystem clock oscillation frequency
Page 97 of the NEC switch user manual — Figure 8-1. USB Bus Topology (Desktop Type PC)
Page 97 · click to enlarge
Page 97

CHAPTER 8 USB FUNCTION

8.1 USB Overview

The USB (Universal Serial Bus) is suitable for connecting personal computers and external devices such as audio

equipment, keyboards, pointing devices, and telephones. Two data transfer rates, 12 Mbps and 1.5 Mbps, are

provided.

Plug & Play can also be realized.

Figure 8-1 shows an example of USB connection to a desktop PC. The USB consists of the host controller

installed in the PC, hubs installed for port expansion and connection, and functions installed at bus ends. These

functions are called endpoints and are the data transfer destinations or data transfer sources in the USB.

Figure 8-1. USB Bus Topology (Desktop Type PC)

Function (monitor) Function (modem)

Function (keyboard) Function (mouse)

Function (CD-ROM) Function Function

Show 10 more labels / short text on this page
Host · Host (Root Tier) · RootHub · Tier 1 · Hub · Tier 2 · Hub · Tier 3 · Hub Hub · Tier 4
Page 98 of the NEC switch user manual — Table 8-1. Configuration of USB Function
Page 98 · click to enlarge
Page 98

CHAPTER 8 USB FUNCTION

8.2 USB Function Features

The features of the on-chip USB function provided for the µPD789800 Subseries are described below.

(1) Video display devices and human interface devices are assumed to be the target applications. For this

reason, only Endpoint 0 for control transfer and Endpoint 1 for interrupt transfer are supported.

(2) 1.5 Mbps (low speed) data transfer using a 6.0 MHz system clock is supported.

(3) The following buffers are provided on-chip.

  • Receive token bank: 1 bank (3 bytes)
  • Receive data bank: 1 bank (9 bytes)
  • Transmit data bank: 2 banks (9 bytes × 2)

(4) NRZI (Non Return to Zero Invert) decode/encode function specified by the USB communication protocol, bit

stuffing function, and on-chip CRC (Cyclic Redundancy Check) function are also provided and automatically

executed.

8.3 USB Function Configuration

The USB function consists of the following hardware.

Table 8-1. Configuration of USB Function

Buffer Receive bank switching ID detection buffer (internal buffer)

Registers Transmit/receive pointer (USBPOW) Receive token PID (USBRTP) Receive token address L, H (USBRAL, USBRAH) Receive data PID (USBRD) Receive data address (USBR0 to USBR7) Transmit data PID bank 0 (USBTD0) Transmit data bank 0 address (USBT00 to USBT07) Transmit data PID bank 1 (USBTD1) Transmit data bank 1 address (USBT10 to USBT17) Data/handshake packet receive byte number counter (DRXCON) Data packet transmit byte number counter 0, 1 (DTXCO0, DTXCO1) Token PID compare register (TIDCMP) Token address compare register (ADRCMP) Data/handshake PID compare register (DIDCMP)

Transmit data bank 0

Transmit data bank 1

Control registers USB receiver enable register (USBMOD) Data/handshake packet receive mode register (URXMOD) Packet receive status register (RXSTAT) Data/handshake packet receive result store register (DRXRSL) Token packet receive result store register (TRXRSL) Data packet transmit reservation register (DTXRSV) Handshake packet transmit reservation register (HTXRSV) USB timer start reservation control register (USBTCL) Remote wakeup control register (REMWUP)

Item Configuration · Receive token bank · Receive data bank

Page 99 of the NEC switch user manual — INTUSBTM
Page 99 · click to enlarge
Page 99

CHAPTER 8 USB FUNCTION

Figure 8-2. Block Diagram of USB Function

USB receiver enable register

Data/handshake packet receive mode register (URXMOD)

(USBMOD)

DTXRSV)

(USBPOB, USBPOW) Remote wakeup

(REMWUP)

  • Handshake packet
  • SYNC packet

USBDP

Resume & reset detection control

SYNC detection/ USB clock generator

USBDM

switching ID detection buffer

USB timerNote 4

Compare registerNote 2

INTUSBTM

CRC circuit ENDP detector

USB timer start reservation control

Receive result store registerNote 3

counter 0, 1 (DTXCO0, DTXCO1)

2. Token address compare register (ADRCMP), token PID compare register (TIDCMP), data/handshake

PID compare register (DIDCMP)

3. Token packet receive result store register (TRXRSL), data/handshake packet receive result store
4. See Figure 8-3 for USB timer configuration.
Show 26 more labels / short text on this page
Internal bus · Transmit reservation · Counter Note 1 · register (HTXRSV, · Transmit/receive pointer · control register · EOP generation/detection · NRZI encoder · Output · Transmit buffer · latch · Selector · Receive bank · Receive buffer · fX · USB clock · Bit stuff/bit strip · controller · Overflow · (7-bit counter) · INTUSBRD Start · Packet receive status · register (RXSTAT) · register (USBTCL) · Internal bus · register (DRXRSL)
Page 100 of the NEC switch user manual — DATATX SETORX
Page 100 · click to enlarge
Page 100

CHAPTER 8 USB FUNCTION

Figure 8-3. Block Diagram of USB Timer

INTUSBTM

UWDERR

RESUME RXNote Clear circuit

USBCLK

TX MASTER ENNote

DATATX SETORX

USB timer start reservation control register (USBTCL)

Remark f XSystem clock oscillation frequency
UWDERRBit 7 of packet receive status register (RXSTAT)
Show 10 more labels / short text on this page
In high- speed mode · In low- speed mode · Shift register · fX · Clock controller · JUDGE TXNote · JUDGE TOKENNote · SETRXNote · OUT RXNote · Internal bus
Page 101 of the NEC switch user manual — (2) Transmit/receive pointer (USBPOB and USBPOW)
Page 101 · click to enlarge
Page 101

CHAPTER 8 USB FUNCTION

(1) Receive bank switching ID detection buffer (internal buffer)

This is an internal 2-bit buffer placed before a receive buffer. It detects the lower 2 bits below the packet ID

during packet reception and determines the store bank of a packet.

The following controls are performed depending on the stored 2-bit data. For details, see Section 8.5.3 Receive

bank switching ID detection buffer operation.

If the first 2 bits of the stored bits (lower 2 bits in ID area) are 01B, TOSTAT (bit 0 of the packet receive

status register (RXSTAT)) indicating token packet reception is set and a signal specifying packet store

at the receive token address is output to the transmit/receive pointer.

If the first 2 bits of the stored bits are 11B, DASTAT (bit 1 of RXSTAT) indicating data packet reception

is set and a signal specifying packet store at the receive data address is sent to the transmit/receive

pointer.

If the first 2 bits of the stored bits are 10B, HSSTAT (bit 2 of RXSTAT) indicating handshake packet

reception is set and a signal specifying packet store at the receive data address is output to the

transmit/receive pointer.

(2) Transmit/receive pointer (USBPOB and USBPOW)

The USBPOB is a pointer on the bit side in the transmit/receive buffer and the USBPOW is a pointer on the

word side of the transmit/receive buffer. USBPOB and USBPOW output a control signal to the CRC circuit, etc.

They are reset and started by the packet ID detection signal from the receive bank switching ID detection buffer.

USBPOB is incremented by the USB clock. USBPOW is incremented by USBPOB overflow.

USBPOW is read with an 8-bit memory manipulation instruction. As USBPOB is an internal pointer, control with

software is not possible.

RESET input sets these pointers to 00H.

The value of USBPOW is changed as follows depending on the receive/transmit byte length match signal or

transmit reservation. Moreover, control signals are also output. For details, see Section 8.8.1 Operation of

transmit/receive pointer.

  • If the token packet receive signal is detected by the receive bank switching ID detection buffer, the pointers

are set to 00H.

  • If the data/handshake packet receive signal is detected by the receive bank switching ID detection buffer, the

pointers are set to 10H.

  • If USBPOW is set to 01H, a signal specifying CRC5 (CRC5 bit mode) execution start is output.
  • If USBPOW is set to 11H, 21H, or 31H, a signal specifying CRC16 (CRC16 bit mode) execution start is

output.

  • If USBPOB is set to 02H after USBPOW is set to 02H, a signal specifying CRC5 comparison start is output

and USBPOW is set to 70H.

  • If the value of USBPOW matches that of the data/handshake packet receive byte number counter

(DRXCON), a signal specifying CRC16 comparison start is output when USBPOB overflows, and USBPOW

is set to 70H.

  • If a signal specifying transmit start is received from the transmit controller, USBPOW is set to 7FH. After that,

USBPOW is set to 20H, 30H, 40H, 50H, or 60H depending on the error between the present transmit

reservation and previous receive data, when USBPOB overflows.

  • If the value of USBPOW matches that of data packet transmit byte number counter 0 (DTXCO0) or data

packet transmit byte number counter 1 (DTXCO1), USBPOW is set to 70H when USBPOB overflows (CRC

redundant bits are appended).

  • USBPOW is set to 71H, then a signal specifying EOP transmission is output when USBPOB overflows.
  • When USBPOW is set to 40H, 50H, or 60H, a signal specifying EOP transmission is output if USBPOB

overflows.

Page 102 of the NEC switch user manual — 02H
Page 102 · click to enlarge
Page 102

CHAPTER 8 USB FUNCTION

(3) Receive token bank

(a) Receive token PID (USBRTP)

This is the receive token packet ID area. The data input to the token PID compare register (TIDCMP) is

stored here.

USBRTP is read with an 8-bit memory manipulation instruction.

RESET input sets USBRTP to 00H.

(b) Receive token address L and H (USBRAL and USBRAH)

This stores the token packet to be transferred from the host. USBRAL and USBRAH consist of 16 bits.

Bits 0 to 6 of USBRAL store the data input to the token address compare register (ADRCMP).

Both USBRAL and USBRAH are read with an 8-bit memory manipulation instruction.

RESET input sets these registers to 00H.

Figure 8-4. Configuration of Receive Token Bank

07H 06H 05H 04H 03H 02H 01H 00H

00H

USBRTP

USBRAL

01H

USBRAH

Endpoint area Fixed to 0

02H

Show 6 more labels / short text on this page
USBPOB address · Symbol · USBPOW address · ID area · Address area Endpoint · area
Page 103 of the NEC switch user manual — USBT07
Page 103 · click to enlarge
Page 103

CHAPTER 8 USB FUNCTION

(4) Receive data bank

(a) Receive data PID (USBRD)

This is the receive data packet ID area. The data input to the data/handshake PID compare register

(DIDCMP) is stored here.

USBRD is read with an 8-bit memory manipulation instruction.

RESET input sets USBRD to 00H.

(b) Receive data address (USBR0 to USBR7)

This is an 8-byte register that stores the data/handshake packet transferred from the host.

USBR0 to USBR7 are read with an 8-bit memory manipulation instruction.

If the following combinations are used, they are read with a 16-bit memory manipulation instruction.

  • USBR10: USBR0 and USBR1
  • USBR32: USBR2 and USBR3
  • USBR54: USBR4 and USBR5
  • USBR76: USBR6 and USBR7

RESET input makes USBR0 to USBR7 undefined.

Figure 8-5. Configuration of Receive Data Bank

07H 06H 05H 04H 03H 02H 01H 00H

USBRD

10H

USBR0

11H

USBR1

12H

USBR2

13H

USBR3

Data area (8 bytes)

14H

USBR4

15H

USBR5

16H

USBR6

17H

USBR7

18H

The operation during reception appears as follows.

Packet from host controller

SETUP DATA0

OUT DATA1

ACK

ACK

USBT00

USBT07

USBT07

The data packet from the host controller is stored in the USBT00 to USBT07 registers.

Show 9 more labels / short text on this page
USBPOB address · Symbol · ID area · USBPOW address · Response packet · 1st byte USBT00 · 1st byte · 8th byte · 8th byte
Page 104 of the NEC switch user manual — 24H
Page 104 · click to enlarge
Page 104

CHAPTER 8 USB FUNCTION

(5) Transmit data banks 0 and 1

(a) Transmit data PID banks 0 and 1 (USBTD0 and USBTD1)

USBTD0 and USBTD1 correspond to the transmit buffer 0 ID area and transmit buffer 1 ID area,

respectively. USBTD0 and USBTD1 store DATA0 (C3H) or DATA1 (4BH).

USBTD0 and USBTD1 are set with an 8-bit memory manipulation instruction.

RESET input makes both USBTD0 and USBTD1 undefined.

(b) Transmit data bank 0 address (USBT00 to USBT07) and transmit data bank 1 address (USBT10 to

USBT17)

These are 8-byte registers that store the data to be transferred to the host. USBT00 to USBT07 and

USBT10 to USBT17 correspond to transmit buffer 0 of the data area and transmit buffer 1 of the data area,

respectively. Because CRC redundant bits (16 bits) are always appended to packets sent from these

registers, these registers cannot be used for transmitting handshake packets.

USBT00 to USBT07 and USBT10 to USBT17 are set with an 8-bit memory manipulation instruction.

RESET input makes this area undefined.

Figure 8-6. Configuration of Transmit Data Bank 0 (Buffer 0)

07H 06H 05H 04H 03H 02H 01H 00H

USBTD0

20H

USBT00

21H

USBT01

22H

USBT02

23H

USBT03

Data area (8 bytes)

24H

USBT04

25H

USBT05

26H

USBT06

27H

USBT07

28H

Show 4 more labels / short text on this page
USBPOB address · Symbol · ID area · USBPOW address
Page 105 of the NEC switch user manual — USBT17
Page 105 · click to enlarge
Page 105

CHAPTER 8 USB FUNCTION

Figure 8-7. Configuration of Transmit Data Bank 1 (Buffer 1)

Symbol 07H 06H 05H 04H 03H 02H 01H

00H

USBTD1

30H

USBT10

31H

USBT11

32H

USBT12

33H

USBT13

Data area (8 bytes)

34H

USBT14

35H

USBT15

36H

USBT16

37H

USBT17

38H

The operation during transmission appears as follows.

ACK Packet from host controller

IN

IN

ACK

DATA0

DATA1

USBT00

USBT07

USBT07

USBT10

USBT10

USBT17

USBT17

Data is read according to the data sequence in the control read data stage and is transmitted to the host. In the

DATA0 sequence, the values saved in USBT00 to USBT07 are transmitted in sequence to the host. In the

DATA1 sequence, the values saved in USBT10 to USBT17 are transmitted in sequence to the host.

Show 8 more labels / short text on this page
USBPOB address · ID area · USBPOW address · Response packet · 1st byte USBT00 · 8th byte · 1st byte · 8th byte
Page 106 of the NEC switch user manual — (8) Token PID compare register (TIDCMP)
Page 106 · click to enlarge
Page 106

CHAPTER 8 USB FUNCTION

(6) Data/handshake packet receive byte number counter (DRXCON)

This register sets the number of data of the data/handshake packet to be received. During data/handshake

packet reception, if this register value and the transmit/receive pointer (USBPOW) value match, a match signal

is output from the comparator.

During data packet reception, set the USBPOW address at which the last byte before the appended CRC

redundant bits is stored to DRXCON. When a handshake packet is received, set DRXCON to 10H.

DRXCON is set with an 8-bit memory manipulation instruction.

RESET input sets DRXCON to 18H.

  • Matching of address
  • Endpoint 0 received
  • No error in reception

(7) Data packet transmit byte number counters 0 and 1 (DTXCO0 and DTXCO1)

DTXCO0 sets the data packet data number of transmit data bank 0 and DTXCO1 sets the transmit data number

of transmit data bank 1. During data packet transmission, if these register values and the transmit/receive

pointer (USBPOW) value match, a match signal is output from the comparator.

The value to be set to these registers is the USBPOW address (buffer 0: 20H to 28H, buffer 1: 30H to 38H) at

which the last byte before the appended CRC redundant bits is stored.

DTXCO0 and DTXCO1 are set with an 8-bit memory manipulation instruction.

RESET input sets DTXCO0 to 20H and DTXCO1 to 30H.

(8) Token PID compare register (TIDCMP)

This register sets the token packet ID to be received. If this register value and the value of the receive token

PID (USBRTP) match during token packet reception match, TIDRST (bit 1 of the token packet receive result

store register (TRXRSL)) is set.

TIDCMP is set with an 8-bit memory manipulation instruction.

RESET input sets TIDCMP to 00H.

SETUP reception

Page 107 of the NEC switch user manual — TIDCMP
Page 107 · click to enlarge
Page 107

CHAPTER 8 USB FUNCTION

(9) Token address compare register (ADRCMP)

This register sets the address specified from the host during control transfer. If this register value and the

address area of the receive token bank (bits 0 to 6 of receive token address L (USBRAL)) match during token

packet reception coincide, ADRRST (bit 2 of the token packet receive result store register (TRXRSL)) is set.

00H must be set by software when an USB reset is received.

ADRCMP is set with an 8-bit memory manipulation instruction.

RESET input sets ADRCMP to 00H.

Figure 8-8. Configuration of TIDCMP and ADRCMP

07H 06H 05H 04H 03H 02H 01H 00H

USBRTP

00H

USBRAL

ENDP.0

01H

USBRAH

ENDP.3-1

02H

Match signal (TIDRST) SETUP packet detection signal (SETRX)

0 0 1 0 1 1 0 1

IN packet detection signal (INRX)

ID packet set in TIDCMP

0 1 1 0 1 0 0 1

OUT packet detection signal (OUTRX)

1 1 1 0 1

TIDCMP

ADRCMP

Endpoint 0 detection signal (END0RX)

Endpoint 1 detection signal (END1RX)

Show 4 more labels / short text on this page
USBPOB address · USBPOW address · Receive token bank · Match signal (ADRRST)
Page 108 of the NEC switch user manual — 18H
Page 108 · click to enlarge
Page 108

CHAPTER 8 USB FUNCTION

(10) Data/handshake PID compare register (DIDCMP)

This register sets the data/handshake packet ID to be received. If this register value and the value of the

receive data PID (USBRD) match during data/handshake packet reception coincide, the DIDRST (bit 1 of the

data/handshake packet receive result store register (DRXRSL)) is set.

DIDCMP is set with an 8-bit memory manipulation instruction.

RESET input sets DIDCMP to C3H.

  • Matching of address
  • Endpoint 0 received
  • No error in reception

Figure 8-9. Configuration of DIDCMP

07H 06H 05H 04H 03H 02H 01H 00H

USBRD

00H

11H

Data area (8 bytes)

18H

DIDCMP

Show 5 more labels / short text on this page
SETUP reception · USBPOB address · USBPOW address · Receive data bank · Match signal (DIDRST)
Page 109 of the NEC switch user manual — (2) Data/handshake packet receive mode register (URXMOD)
Page 109 · click to enlarge
Page 109

CHAPTER 8 USB FUNCTION

8.4 Registers Controlling USB Function

The following nine registers are used to control the USB function.

  • USB receiver enable register (USBMOD)
  • Data/handshake packet receive mode register (URXMOD)
  • Packet receive status register (RXSTAT)
  • Data/handshake packet receive result store register (DRXRSL)
  • Token packet receive result store register (TRXRSL)
  • Data packet transmit reservation register (DTXRSV)
  • Handshake packet transmit reservation register (HTXRSV)
  • USB timer start reservation control register (USBTCL)
  • Remote wakeup control register (REMWUP)

(1) USB receiver enable register (USBMOD)

This register controls USB receiver operation and halt.

Because a single-ended receiver does not have an enable flag, regular operation is possible. Thus reception of

the USB reset signal, Resume signal, and EOP signal for bus idle can be performed any time.

USBMOD is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets USBMOD to 00H.

Figure 8-10. Format of USB Receiver Enable Register

Symbol 6 7 5 4 3 2 1

R/W

USBMOD

0 0 0 0 0 0 0 RXEN

FF6DH

00H

R/W

RXEN USB receiver operation control

USB receiver operation is stopped.

USB receiver operation is possible.

(2) Data/handshake packet receive mode register (URXMOD)

This register sets the data/handshake packet receive mode.

Bit 0 (DWRMSK) is set while saving a data packet and prevents an address greater than 11H in the receive

data address from being overwritten when the next packet is received.

Bit 1 (DINTEN) is a flag used to set the receive status synchronous interrupt (to generate the INTUSBRD

interrupt request to perform data packet reception and data save simultaneously).

Bit 2 (RESMOD) is a flag used to switch the detection mode of the USB reset signal between bus idle mode and

bus suspend mode.

URXMOD is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets URXMOD to 00H.

  • Matching of address
  • Endpoint 0 received
  • No error in reception

Address · After reset · SETUP reception

Page 110 of the NEC switch user manual — INTUSBRD (DINTEN = 0)
Page 110 · click to enlarge
Page 110

CHAPTER 8 USB FUNCTION

Figure 8-11. Format of Data/Handshake Packet Receive Mode Register

Symbol 6 7 5 4 3

R/W

URXMOD

0 0 0 0 0 RESMOD DINTEN DWRMSK

FF66H

00H

R/W

RESMOD USB reset signal detection mode setting

Reject USB reset signal less than 3.0 s SE0 (Single-ended 0) period.

Detect transition from J state to SE0 as USB reset signal.

DINTEN Data packet receive status synchronous interrupt enable flag

Do not generate data packet receive status synchronous interrupt.

Generate data packet receive status synchronous interrupt Note 3.

DWRMSK Data/handshake packet write disable setting

Enable write operation to all addresses in data/handshake packet receive buffer.

Disable write operation to addresses greater than 11H in data/handshake packet receive buffer.

idle mode. And do not set data immediately before entering bus suspend mode. Clear

immediately when returning from the bus suspend mode.

2. If the bus is disturbed by noise, the noise is detected as a USB reset signal. Confirm whether the

USB reset signal has been input by checking the URESRX flag (bit 4 of the USB receive status

register (RXSTAT)) more than once by software.

3. The receive status synchronous interrupt occurs at the following timing during data/handshake

packet receive interrupt (INTUSBRD) signal input.

Sync Data0 Data1 DataX CRC16 EOP

INTUSBRD (DINTEN = 0)

INTUSBRD (DINTEN = 1)

Data packet receive status synchronous interrupt

Data/handshake packet receive interrupt

Show 5 more labels / short text on this page
Address · After reset · µ · EOP received · Packet ID detected
Page 111 of the NEC switch user manual — CHAPTER 8 USB FUNCTION
Page 111 · click to enlarge
Page 111

CHAPTER 8 USB FUNCTION

(3) Packet receive status register (RXSTAT)

This register indicates the receive status of each packet.

Bits 0 to 2 (TOSTAT, DASTAT, and HSSTAT) are flags that indicate that a token packet, data packet, or

handshake packet is currently being received. These flags are set upon detection of a packet ID by an ID

detection buffer, and cleared upon reception of EOP.

Bits 3 to 6 (EOPRX, URESRX, SE0RX, RESMRX) are flags that detect bus status transition. These flags are

set immediately after each bus transition is detected. These flags are cleared by software but cannot be set to 1

by software.

Bit 7 (UWDERR) is set if an inadvertent program loop is detected by the USB timer. The flags are cleared by

software. UWDERR cannot be set by software. An inadvertent program loop of the USB timer means a status

in which the USB clock does not stop when EOP cannot be detected in a packet received from the host, or

when noise on the bus was detected as a bus status transition.

RXSTAT is set with an 8-bit memory manipulation instruction.

RESET input sets RXSTAT to 00H.

Page 112 of the NEC switch user manual — R/W
Page 112 · click to enlarge
Page 112

CHAPTER 8 USB FUNCTION

Figure 8-12. Format of Packet Receive Status Register

Symbol 6 7 5 4 3 2 1 0

R/W

RXSTAT

UWDERR RESMRX SE0RX URESRX EOPRX HSSTAT DASTAT TOSTAT

FF67H

00H

R/W

UWDERR USB timer inadvertent program loop detection

No USB timer inadvertent program loop was detected.

USB timer inadvertent program loop (USB clock operation faster than 85.3 s (at 6.0 MHz)) was detected, forcibly terminating USB clock. This flag is also set when USB reset or Resume signal was received.

RESMRX Resume signal receive status

No Resume signal was received.

Received Resume signal (level detection)

SE0RX Single-ended 0 signal detection status

No Single-ended 0 (SE0) signal was detected.

Detected SE0 signal one or more times

URESRX USB reset signal detection status

No USB reset signal was detected.

Detected USB reset signal one or more times

EOPRX EOP detection status

No EOP signal was detected.

Detected EOP one or more times

HSSTAT Handshake packet receive status

No handshake packet was received.

DASTAT Data packet receive status

No data packet was received.

TOSTAT Token packet receive status

No token packet was received.

Show 6 more labels / short text on this page
Address · After reset · µ · Receiving handshake packet · Receiving data packet · Receiving token packet
Page 113 of the NEC switch user manual — (5) Token packet receive result store register (TRXRSL)
Page 113 · click to enlarge
Page 113

CHAPTER 8 USB FUNCTION

Table 8-2 shows the state of each flag after receiving the USB reset signal and the Resume signal during the

bus idle state and bus suspend state.

Table 8-2. Flag of RXSTAT After Reception of USB Reset Signal and Resume Signal

Bus State Device State Received Signal RESMRX SE0RX URESRX

USB reset 0 1 1 Idle Main system clock operation mode Resume 1 1 0

USB reset 0 1 1 Suspend STOP mode

Resume 1 1 0

(4) Data/handshake packet receive result store register (DRXRSL)

This register stores the data/handshake packet reception result.

Register contents are updated upon reception of data/handshake EOP.

DRXRSL is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets DRXRSL to 00H.

Figure 8-13. Format of Data/Handshake Packet Receive Result Store Register

Symbol 4 3 2 0

R/W

DRXRSL

CR16ER DBITER DBYER 0 0 0 DIDRST 0

FF65H

00H

R/W

CR16ER CRC error detection (16-bit mode)

CRC error did not occur in received data packet.

CRC error occurred in received data packet.

DBITER Bit stuffing error detection

Bit stuffing error did not occur in received data/handshake packet.

Bit stuffing error occurred in received data/handshake packet.

DBYER Received data/handshake packet length error detection

Packet length of received data/handshake packet is normal.

Packet length of received data/handshake packet is abnormal.

DIDRST Data/handshake packet ID comparison result

Received data/handshake packet ID and value of data/handshake PID compare register (DIDCMP) do not match.

Received data/handshake packet ID and value of DIDCMP match.

(5) Token packet receive result store register (TRXRSL)

This register stores the token packet reception status.

Register contents are updated upon reception of token packet EOP.

TRXRSL is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets TRXRSL to 00H.

Address · After reset

Page 114 of the NEC switch user manual — R/W
Page 114 · click to enlarge
Page 114

CHAPTER 8 USB FUNCTION

Figure 8-14. Format of Token Packet Receive Result Store Register

Symbol

R/W

TRXRSL

CRC5ER TBITER TBYER END1RX END0RX ADRRST TIDRST SETRX

FF62H

00H

R/W

CRC5ER CRC error detection (5-bit mode)

CRC error did not occur in received token packet.

CRC error occurred in received token packet.

TBITER Bit stuffing error detection

Bit stuffing error did not occur in received token packet.

Bit stuffing error occurred in received token packet.

TBYER Received token packet length error detection

Packet length of received token packet is normal.

Packet length of received token packet is abnormal.

END1RX Endpoint 1 reception detection

No token packet corresponding to Endpoint 1 is received.

Token packet corresponding to Endpoint 1 was received.

END0RX Endpoint 0 reception detection

No token packet corresponding to Endpoint 0 is received.

Token packet corresponding to Endpoint 0 was received.

ADRRST Token packet address compare result

Received token packet address and value of token address compare register (ADRCMP) do not match.

Received token packet address and value of ADRCMP match.

TIDRST Token packet ID compare result detection

Received token packet ID and value of token PID compare register (TIDCMP) do not match.

Received token packet ID and value of TIDCMP match.

SETRX Setup token packet reception detection

Received token packet ID is other than Setup packet.

Received token packet ID is Setup packet Note.

  • Note If SETRX is set to 1, the following occurs.
  • All reservations are cleared
  • DNAEN (bit 1 of the handshake packet transmit reservation register (HTXRSV)) is cleared
  • DWRMSK (bit 0 of the data/handshake packet receive mode register (URXMOD)) is cleared

Address · After reset

Page 115 of the NEC switch user manual — R/W
Page 115 · click to enlarge
Page 115

CHAPTER 8 USB FUNCTION

(6) Data packet transmit reservation register (DTXRSV)

This register sets the bank where the data packet to be transmitted is stored. By setting each flag of this

register, the stored data is transmitted following normal reception of the IN token packet.

DTXRSV is set with a 1-bit or 8-bit memory manipulation instruction. When DTXRSV is used in combination

with the handshake packet transmit reservation register (HTXRSV) as the 16-bit register USBCON, DTXRSV is

set with a 16-bit memory manipulation instruction.

RESET input sets DTXRSV to 00H.

  • Matching of address
  • Endpoint 0 received
  • No error in reception

Figure 8-15. Format of Data Packet Transmit Reservation Register

Symbol 6 7 5 4 3 2 1 0

R/W

DTXRSV

0 0 0 0 DT11EN DT10EN DT01EN DT00EN

FF15H

00H

R/W

DT11EN Transmit reservation flag for transmit bank 1 (Endpoint 1)

No data is transmitted.

Stored data is transmitted when all the following conditions are satisfied in EOP during IN packet reception. Setting is disabled during control read transmission. INRX (Internal signal) = 1, ADRRST = 1, END1RX = 1, TBYER = 0, TBITER = 0, CRC5ER = 0

DT10EN Transmit reservation flag for transmit bank 1 (Endpoint 0)

No data is transmitted.

Stored data is transmitted when all the following conditions are satisfied in EOP during IN packet reception. INRX (internal signal) = 1, TIDRST = 1, ADRRST = 1, END0RX = 1, TBYER = 0, TBITER = 0, CRC5ER = 0

DT01EN Transmit reservation flag for transmit buffer 0 (Endpoint 1)

No data is transmitted.

Stored data is transmitted when all the following conditions are satisfied in EOP during IN packet reception. Setting is disabled during control read transmission. INRX (internal signal) = 1, ADRRST = 1, END1RX = 1, TBYER = 0, TBITER = 0, CRC5ER = 0

DT00EN Transmit reservation flag for transmit buffer 0 (Endpoint 0)

No data is transmitted.

Stored data is transmitted when all the following conditions are satisfied in EOP during IN packet reception. INRX (internal signal) = 1, TIDRST = 1, ADRRST = 1, END0RX = 1, TBYER = 0, TBITER = 0, CRC5ER = 0

SETUP reception · Address · After reset

Page 116 of the NEC switch user manual — DIDRST = 0, DBITER = 0
Page 116 · click to enlarge
Page 116

CHAPTER 8 USB FUNCTION

(7) Handshake packet transmit reservation register (HTXRSV)

This register sets the handshake packet to be transmitted. By setting each flag of this register, a handshake

packet is transmitted following normal reception of an IN packet, or normal or abnormal reception of a data

packet.

Bit 0 corresponds to the ACK packet transmit reservation flag, bits 1 to 3 correspond to the NAK packet transmit

reservation flag, and bits 4 to 7 correspond to the STALL packet transmit reservation flag.

HTXRSV is set with a 1-bit or 8-bit memory manipulation instruction. When HTXRSV is used in combination

with the data packet transmit reservation register (DTXRSV) as the 16-bit register USBCON, HTXRSV is set

with a 16-bit memory manipulation instruction.

RESET input sets HTXRSV to 00H.

  • Matching of address
  • Endpoint 0 received
  • No error in reception

Figure 8-16. Format of Handshake Packet Transmit Reservation Register (1/2)

Symbol 6 7 5 4 3 2 1 0

R/W

HTXRSV

E1STEN E0STEN DSTEN STALEN E1NAEN E0NAEN DNAEN ACKEN

FF14H

00H

R/W

E1STEN STALL packet transmit reservation flag for Endpoint 1 after IN packet

No data is transmitted.

STALL handshake is transmitted when all the following conditions are satisfied in EOP during IN packet reception.

INRX (internal signal) = 1, ADRRST = 1, END1RX = 1, TBYER = 0, TBITER = 0, CRC5ER = 0

E0STEN STALL packet transmit reservation flag for Endpoint 0 after IN packet

No data is transmitted.

STALL handshake is transmitted when all the following conditions are satisfied in EOP during IN packet reception.

INRX (internal signal) = 1, TIDRST = 1, ADRRST = 1, END0RX = 1, TBYER = 0, TBITER = 0, CRC5ER = 0

DSTEN STALL packet transmitted reservation flag for data packet receive byte length error

No data is transmitted.

STALL handshake is transmitted when all the following conditions are satisfied in EOP during data packet reception.

Set this flag to transmit STALL handshake when byte length error has occurred in one data packet during

control write transfer.

DIDRST = 1, DBYER = 1, DBITER = 0

STALEN STALL packet transmit reservation flag after data packet

No data is transmitted.

STALL handshake is transmitted when all the following conditions are satisfied in EOP during data packet reception.

Set this flag when length error of transfer occurs in control write transfer.

DIDRST = 0, DBITER = 0

SETUP reception · Address · After reset

Page 117 of the NEC switch user manual — Table 8-3. Conditions in Transmit Reservation (1/2)
Page 117 · click to enlarge
Page 117

CHAPTER 8 USB FUNCTION

Figure 8-16. Format of Handshake Packet Transmit Reservation Register (2/2)

E1NAEN NAK packet transmit reservation flag for Endpoint 1 after IN packet

No data is transmitted.

NAK handshake is transmitted when all the following conditions are satisfied in EOP during IN packet reception. INRX (internal signal) = 1, ADRRST = 1, END1RX = 1, TBYER = 0, TBITER = 0, CRC5ER = 0

E0NAEN NAK packet transmit reservation flag for Endpoint 0 after IN packet

No data is transmitted.

NAK handshake is transmitted when all the following conditions are satisfied in EOP during IN packet reception. INRX (internal signal) = 1, TIDRST = 1, ADRRST = 1, END0RX = 0, TBYER = 0, TBITER = 0, CRC5ER = 0

DNAEN NAK packet transmit reservation flag after data packet reception

No data is transmitted.

If all the following conditions are met, NAK handshake is transmitted in EOP during data packet reception. Set this flag when saving data from reception data addresses (USBR0 to USBR7). OUTRX (internal signal) = 1, DIDRST = 1, DBYER = 0, DBITER = 0, CR16ER = 0, UWDERR = 0

ACKEN ACK packet transmit reservation flag after data packet reception

No data is transmitted.

ACK handshake is transmitted when all the following conditions are satisfied in EOP during data packet reception. DIDRST = 1, DBYER = 0, DBITER = 0, CR16ER = 0

During transmit reservation, all the conditions listed in Table 8-3 below must be satisfied.

Table 8-3. Conditions in Transmit Reservation (1/2)

(a) Transmit reservation for Endpoint 0 and IN token packet

Type of Reservation DT00EN DT10EN E0STEN E0NAEN

Transmit reservation of data in transmit buffer 0 1 0 0 0

Transmit reservation of data in transmit buffer 1 0 1 0 0

Endpoint 0 STALL transmit reservation (occurrence of length error, or halt status)

0 0 1 0

Endpoint 0 NAK transmit reservation (data creation incomplete)

0 0 0 1

Two or more reservations above Setting prohibited

Page 118 of the NEC switch user manual — (c) Handshake transmit reservation for data packet
Page 118 · click to enlarge
Page 118

CHAPTER 8 USB FUNCTION

Table 8-3. Conditions in Transmit Reservation (2/2)

(b) Transmit reservation for Endpoint1 and IN token packet

NEC switch — CHAPTER 8 USB FUNCTION diagram (page 118)
Fig. 11

Transmit reservation of data in transmit buffer 0 1 0 0 0

Transmit reservation of data in transmit buffer 1 0 1 0 0

(c) Handshake transmit reservation for data packet

NEC switch — (c) Handshake transmit reservation for data packet diagram (page 118)
Fig. 12 · (c) Handshake transmit reservation for data packet
NEC switch — (c) Handshake transmit reservation for data packet diagram (page 118)
Fig. 13 · (c) Handshake transmit reservation for data packet

receive mode register (URXMOD)) at the same time.

Page 119 of the NEC switch user manual — DIDRST
Page 119 · click to enlarge
Page 119

CHAPTER 8 USB FUNCTION

Figure 8-17. Configuration of Handshake Packet Transmit Reservation Register

E1STEN E1NAEN E0NAEN DNAEN ACKEN E0STEN DSTEN STALEN

END1RX

END0RX

TIDRST

ADRRST

TBYER TBITER CRC5ER

TX MASTER ENNote

DIDRST

DBYER DBITER

CR16ER

IN RXNote · JUDGE TOKENNote · JUDGE DATANote

Page 120 of the NEC switch user manual — R/W
Page 120 · click to enlarge
Page 120

CHAPTER 8 USB FUNCTION

(8) USB timer start reservation control register (USBTCL)

This register reserves USB timer start after reception of a SETUP/OUT packet or transmission of a data packet.

USBTCL is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets USBTCL to 01H.

  • Matching of address
  • Endpoint 0 received
  • No error in reception

Figure 8-18. Format of USB Timer Start Reservation Control Register

Symbol 6 7 5 4 3 2 1 0

R/W

USBTCL

0 0 0 0 0 0 DATATX SETORX

FF6CH

01H

R/W

DATATX USB timer start reservation after data packet transmission

Do not start USB timer.

USB timer starts when all the following conditions are satisfied in EOP during data packet transmission. DIDRST = 1, DBYER = 0, DBITER = 0, CR16ER = 0

SETORX USB timer start reservation after SETUP/OUT token packet reception

Do not start USB timer.

USB timer starts when all the following conditions are satisfied in EOP during SETUP/OUT token packet reception.

OUTRX (internal signal) = 1 or SETRX = 1, ADRRST = 1, END0RX = 1, TBYER = 0, TBITER = 0, CRC5ER = 0

SETUP reception · Address · After reset

Page 121 of the NEC switch user manual — R/W
Page 121 · click to enlarge
Page 121

CHAPTER 8 USB FUNCTION

(9) Remote wake-up control register (REMWUP)

This register transmits the Resume signal to perform remote wakeup.

Remote wakeup must be performed after confirming that bus idle has continued longer than 5 ms.

REMWUP is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets REMWUP to 08H.

Figure 8-19. Format of Remote Wakeup Control Register

Symbol 6 7 5 4

R/W

REMWUP

0 0 0 0 PULLDM PULLDP PULLEN WAKEUP

FF6AH

08H

R/W

PULLDM D- lead low/high fixed output setting

D- (TXDM) is fixed to low output.

D- (TXDM) is fixed to high output.

PULLDP D+ lead low/high fixed output setting

D+ (TXDP) is fixed to low output.

D+ (TXDP) is fixed to high output.

PULLEN D+/D- lead fixed output enable

Output from transmit buffer is input to USB driver.

Level set to PULLDP or PULLDM is input to USB driver.

WAKEUP Wakeup signal output

No data is sent.

Pin status set to PULLDP or PULLDM is output.

Address · After reset

Page 122 of the NEC switch user manual — CHAPTER 8 USB FUNCTION
Page 122 · click to enlarge
Page 122

CHAPTER 8 USB FUNCTION

8.5 USB Function Operation

8.5.1 USB timer operation

The USB timer is a 7-bit counter that performs time management during packet transmission and reception and

inadvertent program loop detection of the USB clock.

The USB timer has two modes: high-speed mode (source clock = fX) and low-speed mode (source clock = USB

clock: fX = 1.5 MHz during 6.0 MHz operation). In the high-speed mode, the USB functions as a 6-bit counter.

High-speed mode is used for time management during packet transmission and reception. The timer starts after

EOP reception or data packet EOP transmission. The start condition is set by the USB timer start reservation control

register (USBTCL).

Low-speed mode is used for detecting inadvertent program loops of the USB clock. The timer starts upon

detection of the SYNC signal of a receive packet, or upon reception of the USB reset or Resume signals.

When the USB timer overflows, an interrupt request signal (INTUSBTM) is generated, regardless of whether the

current mode is the high-speed or low-speed mode. When overflow of the USB timer occurs in the low-speed mode,

UWDERR (bit 7 of the packet receive status register (RXSTAT)) is set, allowing detection of an inadvertent loop of

the USB timer. At this time, the USB clock is forcibly stopped.

Figure 8-20 shows the operation flowchart of the USB timer.

Page 123 of the NEC switch user manual — N
Page 123 · click to enlarge
Page 123

CHAPTER 8 USB FUNCTION

Figure 8-20. Flowchart of USB Timer Operation (1/2)

N

2 Y

USB timer start (low-speed mode)

N

Y

N

Y

SETUP/OUT

N

UWDERR set (inadvertent program

Y

N

N

Y

Y

N

Y

N

Y

DATA TX (internal signal)

N

Y

UWDERRBit 7 of packet receive status register (RXSTAT)
Show 17 more labels / short text on this page
Idle state · SYNC detected? · USB timer reset · EOP received? · Low-speed mode overflow? · USB timer reset · INTUSBTM occurred · packet? · loop detection) · SETORX (internal signal) · IN packet? · = 1? · Transmit data · transferring? · Transmit EOP is · output? · = 1?
Page 124 of the NEC switch user manual — N
Page 124 · click to enlarge
Page 124

CHAPTER 8 USB FUNCTION

Figure 8-20. Flowchart of USB Timer Operation (2/2)

USB timer start (high-speed mode)

N

N Y

Y

Show 4 more labels / short text on this page
Next SYNC · detected? · High-speed mode overflow? · INTUSBTM occurred
Page 125 of the NEC switch user manual — PULLEN =0 PULLDP = 0 PULLDM = 1
Page 125 · click to enlarge
Page 125

CHAPTER 8 USB FUNCTION

8.5.2 Remote wakeup control operation

Figure 8-21. Flow Chart of Remote Wakeup Control Operation

N

Y

N Is bus idle duration longer

Did HOST output USB reset or

N

Y

Y

PULLDP = 0 PULLDM = 1

PULLDP = 0 PULLDM = 1

Resume outputNote 1

A ← 00000111B

PULLEN = 1 WAKEUP = 1

REMWUP ← A

N

10 ms to 15 ms elapsed?

Y

WAKEUP = 0

Resume output completionNote 2

PULLEN =0 PULLDP = 0 PULLDM = 1

PULLDPBit 2 of remote wakeup control register (REMWUP)
PULLDMBit 3 of remote wakeup control register (REMWUP)
PULLENBit 1 of remote wakeup control register (REMWUP)
WAKEUPBit 0 of remote wakeup control register (REMWUP)
Show 7 more labels / short text on this page
Idle state · Resume output · started? · than 5 ms? · Resume? · Idle state · Idle state
Page 126 of the NEC switch user manual — PULLDM (REMWUP.3)
Page 126 · click to enlarge
Page 126

CHAPTER 8 USB FUNCTION

SET1 REMWUP.3 ; (PULLDM ← 1)

CLR1 REMWUP.2 ; (PULLDP ← 0)

MOV A, #00000111B ; (A ← 00000111B)

SET1 REMWUP.1 ; (PULLEN ← 1)

SET1 REMWUP.0 ; (WAKEUP ← 1), “J” state output

MOV REMWUP, A ; (REMWUP ← A), “K” state output

2. Be sure to follow the exact instruction sequence to append EOP when terminating Resume output.

CLR1 REMWUP.0 ; (WAKEUP ← 0) , Resume output end

CLR1 REMWUP.1 ; (PULLEN ← 0)

CLR1 REMWUP.2 ; (PULLDP ← 0)

SET1 REMWUP.3 ; (PULLDM ← 1)

Figure 8-22. Configuration of Remote Wakeup Control

<Analog part> <Function part>

WAKEUP (REMWUP.0)

Transmit data (+ side)

PULLDP (REMWUP.2)

Transmit data (- side)

PULLDM (REMWUP.3)

PULLEN (REMWUP.1)

SEP, SEM disable signal TX MASTER ENNote

Show 5 more labels / short text on this page
“J” state generation · “J” state generation · TXENNote · D+ pin (USBDP) · D- pin (USBDM)
Page 127 of the NEC switch user manual — INTUSBRD (DINTEN = 0)
Page 127 · click to enlarge
Page 127

CHAPTER 8 USB FUNCTION

8.6 Interrupt Request from USB Function

8.6.1 Interrupt sources

Interrupt request sources generated by the USB function fall into the following five categories.

Table 8-4. List of Sources of Interrupts from USB Function

Interrupt Source Type of Interrupt Priority

1 INTUSBTM USB timer overflow 0006H

2 INTUSBRT EOP detection when a USB token packet is received 0008H

3 INTUSBRD EOP detection when a USB data/handshake packet is received 000AH

4 INTUSBST EOP detection when a USB data/handshake packet is transmitted 000CH

5 INTUSBRE Detection of transition from J state to K state or SE0 on the USB bus 000EH

(1) Token packet receive interrupt (INTUSBRT)

Upon EOP detection during token packet reception, an interrupt request signal is generated and an interrupt

request flag (USBRTIF) is set. If ADRRST (bit 2 of the token packet receive result store register (TRXRSL)) is

0, no interrupt request is generated because a token packet of another device exists on the bus.

(2) Data/handshake packet receive interrupt (INTUSBRD)

Upon EOP detection during data/handshake packet reception, an interrupt request signal is generated and an

interrupt request flag (USBRDIF) is set regardless of error at reception.

If DINTEN (bit 1 of the data/handshake packet receive mode register (URXMOD)) is set to 1, an interrupt

request (receive status synchronous interrupt) signal is generated when 11B is detected by the ID detection

buffer.

Figure 8-23. Timing of Data/Handshake Packet Receive Interrupt Request Generation

Sync Data0 Data1 DataX CRC16 EOP

INTUSBRD (DINTEN = 0)

INTUSBRD (DINTEN = 1)

Data packet receive status synchronous interrupt

Data/handshake packet receive interrupt

DINTENBit 1 of data/handshake packet receive mode register (URXMOD)
Show 6 more labels / short text on this page
Vector Table · Address · Name Trigger · Maskable · EOP received · Packet ID detected
Page 128 of the NEC switch user manual — D+ (USBDP)
Page 128 · click to enlarge
Page 128

CHAPTER 8 USB FUNCTION

(3) Data/handshake packet transmit interrupt (INTUSBST)

Upon EOP detection during data/handshake packet transmission, an interrupt request signal is generated and

an interrupt request flag (USBSTIF) is set.

(4) USB timer overflow interrupt (INTUSBTM)

If the USB timer overflows, an interrupt request signal is generated and an interrupt request flag (USBTMIF) is

set.

(5) USB reset/Resume detection interrupt (INTUSBRE)

This is an interrupt to release the STOP mode.

If transition from J state (logic 0) to K state (logic 1) is detected on the bus, or transition to SE0 is detected, an

interrupt request signal is generated and an interrupt request flag (USBREIF) is set.

Figure 8-24. Timing of INTUSBRE Generation

(a) Period of RESMOD = 0 and Single-ended 0 (SE0) is 3.0 µs or longer (microcontroller operation)

D+ (USBDP)

D- (USBDM)

3.0 s or longer

INTUSBRE

3.0 s µ

(b) Period of RESMOD = 0 and SE0 is shorter than 3.0 µs (microcontroller operation)

D+ (USBDP)

D- (USBDM)

Shorter than 3.0 s

INTUSBRE

(c) RESMOD = 1

D+ (USBDP)

D- (USBDM)

INTUSBRE

Set irrespective of SE0 period

Remark RESMODBit 2 of data/handshake packet receive mode register (URXMOD)

µ · µ · Not set

Page 129 of the NEC switch user manual — CHAPTER 8 USB FUNCTION
Page 129 · click to enlarge
Page 129

CHAPTER 8 USB FUNCTION

8.6.2 Cautions when using interrupts

Pay attention to the following when using an interrupt request generated by the USB function.

(1) Because USBREIF is set by transition from the J state to the K state on the bus, it is also set during sync

detection or packet reception. Thus, disable the generation of interrupt requests by setting the interrupt mask

flag (USBREMK) during bus idle or control transfer.

(2) Because USBREIF is set by transition from the J state to the SE0 state, or by transition from the K state to

the SE0 state on the bus, it is also set during EOP reception or bus idle retention EOP reception. Thus,

disable the generation of interrupt requests by setting the interrupt mask flag (USBREMK) during bus idle or

control transfer.

(3) When clearing the interrupt mask flag (USBREMK), do so immediately before the transition to bus suspend

mode (immediately before the STOP instruction execution).

(4) When the USB reset signal or the Resume signal is received, the USB clock starts operating. As a

consequence, USBTMIF and UWDERR are set after the elapse of a certain period (85.3 µs: fX = 6.0 MHz

operation) of time from reception start. Therefore, when shifting to bus suspend mode (execution of stop

instruction), set the interrupt mask flag (USBTMMK) and disable the generation of interrupt requests.

Page 130 of the NEC switch user manual — IN
Page 130 · click to enlarge
Page 130

CHAPTER 8 USB FUNCTION

8.7 USB Function Control

8.7.1 Relationship between packets and operation modes

The relationship between packets and operation modes in the USB function is as follows.

(1) Control transfer (OUT) (Transfer byte count: 8 bytes or less)

Packet from host controller

Operation of host controller

Operation of USB function of PD789800

SETUP

DATA0

  • ACK transmission
  • NAK transmission reservation

ACK

OUT

  • NAK transmission reservation clear
  • ACK transmission reservation

DATA1

ACK

  • ACK transmission
  • DATA1 transmission reservation

Status stage IN reception

IN

DATA1

ACK

Show 15 more labels / short text on this page
Packet flow · Packet from PD789800 · µ µ · Setup · ACK transmission reservation · stage · Request · Data stage OUT · OUT packet · reception · IN packet · DATA1 transmission · ACK packet · NAK transmission · reservation
Page 131 of the NEC switch user manual — PD789800
Page 131 · click to enlarge
Page 131

CHAPTER 8 USB FUNCTION

(2) Control transfer (OUT) (Transfer byte count: 9 bytes or more)

Packet from host controller

PD789800

Operation of host controller

Operation of USB function of PD789800

NEC switch — PD789800 diagram (page 131)
Fig. 14
NEC switch — PD789800 diagram (page 131)
Fig. 15
  • NAK transmission reservation clear
  • ACK transmission reservation
  • NAK transmission reservation clear
  • ACK transmission reservation
  • NAK transmission reservation clear
  • ACK transmission reservation
  • NAK transmission reservation clear
  • ACK transmission reservation
Show 9 more labels / short text on this page
Packet flow · Packet from · µ µ · Setup · stage · Data stage OUT · reception · Status stage · IN reception
Page 132 of the NEC switch user manual — ACK
Page 132 · click to enlarge
Page 132

CHAPTER 8 USB FUNCTION

(3) Control transfer (IN) (Transfer byte count: 8 bytes or less)

Packet from host controller

Operation of host controller

Operation of USB function of PD789800

PD789800

SETUP

DATA0

  • ACK transmission
  • DATA1 transmission reservation

ACK

IN

Data stage IN reception

  • DATA1 transmission
  • NAK transmission reservation

DATA1

ACK

OUT

  • ACK transmission
  • USB communication completion timer start

ACK

USB communication completion timer timeoutNote

the OUT receive wait state for a period so that the OUT can be received. Use a normal 8-bit timer for

counting during this period.

Show 20 more labels / short text on this page
Packet flow · Packet from · µ µ · Setup · ACK transmission · stage · reservation · Request · IN packet · NAK transmission · reservation clear · OUT packet · DATA1 ACK transmission · Status stage OUT · reservation · reception · OUT reception · wait · NAK transmission · reservation
Page 133 of the NEC switch user manual — PD789800
Page 133 · click to enlarge
Page 133

CHAPTER 8 USB FUNCTION

(4) Control transfer (IN) (Transfer byte count: 9 bytes or more)

Packet from host controller

Operation of host controller

Operation of USB function of PD789800

PD789800

NEC switch — PD789800 diagram (page 133)
Fig. 16
NEC switch — PD789800 diagram (page 133)
Fig. 17

Data stage IN reception

  • ACK transmission
  • USB communication completion timer start
Show 9 more labels / short text on this page
Packet flow · Packet from · µ µ · Setup · stage · Status stage OUT · reception · OUT reception · wait
Page 134 of the NEC switch user manual — DATA1
Page 134 · click to enlarge
Page 134

CHAPTER 8 USB FUNCTION

(5) No data control

Packet from host controller

Operation of host controller

Operation of USB function of PD789800

PD789800

SETUP

DATA0

ACK

  • ACK transmission
  • DATA1 transmission reservation

DATA1

Show 16 more labels / short text on this page
Packet flow · Packet from · µ µ · Setup · stage · ACK transmission · Request · reservation · Status · stage No data · control IN · IN packet · DATA1 transmission · ACK ACK packet · NAK transmission · reservation
Page 135 of the NEC switch user manual — DATA0
Page 135 · click to enlarge
Page 135

CHAPTER 8 USB FUNCTION

(6) Interrupt transfer

Packet from host controller

Operation of host controller

Operation of USB function of PD789800

PD789800

IN

  • NAK transmission
  • DATA1 transmission reservation

NAK

IN

  • DATA1 transmission
  • NAK transmission reservation

DATA1

ACK

IN

NAK

  • NAK transmission
  • DATA0 transmission reservation

IN

  • DATA0 transmission
  • NAK transmission reservation

DATA0

ACK

IN

NAK

  • NAK transmission
  • NAK transmission reservation
Show 11 more labels / short text on this page
Packet flow · Packet from · µ µ · ACK transmission · reservation · IN packet · NAK transmission · reservation clear · IN packet · IN packet · IN packet
Page 136 of the NEC switch user manual — RETI
Page 136 · click to enlarge
Page 136

CHAPTER 8 USB FUNCTION

8.7.2 Interrupt servicing flow

(1) USB token packet reception interrupt servicing

Receive token is OUT?

Waiting for OUT token?

SETUP?

Receive token is unplanned token?

OUT to ENDPOINT 1?

SETUP token reception processing

OUT token reception processing to ENDPOINT 1

to ENDPOINT 1? IN token reception processing to ENDPOINT 0

OUT token reception processing when status stage IN or data stage IN is received

IN token reception processing to ENDPOINT 1

RETI

Show 22 more labels / short text on this page
INTUSBRT occurrence · Yes · Receive error occurred? · No · Token mismatch · processing · Yes · No · Yes · Yes · Receive token is · No · OUT token reception · processing · No · Yes · No · Yes · No · Yes · IN token reception · No
Page 137 of the NEC switch user manual — RETI
Page 137 · click to enlarge
Page 137

CHAPTER 8 USB FUNCTION

(2) Data/handshake packet reception interrupt servicing

USB_MODE is data stage OUT

Transition processing to status stage OUT reception

USB_MODE is waiting for communication

DATA/ACK reception processing to ENDPOINT 0

RETI

Show 19 more labels / short text on this page
INTUSBRD occurrence · Planned packet · Yes · was received? · No · No · reception? · Yes · Re-transmit data reception · reservation processing · No · request? · No · Yes · USB_MODE is SETUP? · ACK reception processing · to ENDPOINT 1 · Yes · USB request processing
Page 138 of the NEC switch user manual — RETI
Page 138 · click to enlarge
Page 138

CHAPTER 8 USB FUNCTION

(3) USB timer inadvertent program loop detection interrupt servicing

Processing for each operation mode when ACK is not received and for when DATA is not received after receiving OUT

RETI

INTUSBTM occurrence

Page 139 of the NEC switch user manual — REMOTE WAKEUP?
Page 139 · click to enlarge
Page 139

CHAPTER 8 USB FUNCTION

(4) 1 ms timer interrupt servicing

10 ms timer counting

USB communication completion timer processing

Waiting for resume signal

USB reset processing Resume signal completion

REMOTE WAKEUP?

RETI

Show 21 more labels / short text on this page
INTTM00 occurrence · DURATION base · timer processing · Yes · completion? · No · Yes · RESET received? · No · wait processing · No · Communication · operating? · Yes · No · Standby detected? · Yes · Standby processing · No · Yes · RESUME output processing
Page 140 of the NEC switch user manual — Y
Page 140 · click to enlarge
Page 140

CHAPTER 8 USB FUNCTION

8.8 USB Function Internal Circuit Operations

8.8.1 Operation of transmit/receive pointer

Figure 8-25. Flowchart of Transmit/Receive Pointer Operation (1/7)

(1) Token packet reception (1/2)

EOP

Y

Y

Set USBPOW to 00H

Y

Set USBPOB to 00H

N

EOP

N

USBPOB

Y

= 02H?

Y

Y

EOP

N

N

Y

N

USBPOB

N

Y

Set USBPOW to 70H

Set USBPOB to 00H

Y

USBPOW

= 01H?

N

N

USBPOW

= 02H?

Y

TBYERBit 5 of token packet receive result store register (TRXRSL)
Show 25 more labels / short text on this page
Idle state · Transmit/receive · Bit normal write? · signal? · Token reception · Set TBYER flag · Does bit stuffing · signal = 1? · Idle state · USBPOB increment · Bit normal write? · Set TBYER flag · Does bit stuffing · signal = 1? · Idle state · Bit normal write? · USBPOB increment · Set TBYER flag · Does bit stuffing · signal = 1? · Idle state · overflow? · USBPOW increment · Set CRC5 execution · start signal
Page 141 of the NEC switch user manual — CHAPTER 8 USB FUNCTION
Page 141 · click to enlarge
Page 141

CHAPTER 8 USB FUNCTION

Figure 8-25. Flowchart of Transmit/Receive Pointer Operation (2/7)

(1) Token packet reception (2/2)

EOP

Y

Y

N

N

USBPOW

= 05H?

Y

N

Y

TBYERBit 5 of token packet receive result store register (TRXRSL)
Show 10 more labels / short text on this page
Bit normal write? · Set TBYER flag · Does bit stuffing · signal = 1? · Idle state · USBPOB increment · EOP normal receive? · Set TBYER flag · Idle state · Idle state
Page 142 of the NEC switch user manual — N
Page 142 · click to enlarge
Page 142

CHAPTER 8 USB FUNCTION

Figure 8-25. Flowchart of Transmit/Receive Pointer Operation (3/7)

(2) Data/Handshake packet reception (1/2)

EOP

Y

Y

Set USBPOW to 10H

Y

Set USBPOB to 00H

N

Y

DRXCON?

N

USBPOB

N

Y

EOP

Y

HSSTAT = 1?

Y

N

Y

Set USBPOW to 70H

N

N

USBPOB

Y

USBPOW

Y

= 11H?

N

DBYERBit 5 of data/handshake packet receive result store register (DRXRSL)
DRXCONData/handshake packet receive byte number counter
Show 22 more labels / short text on this page
Idle state · Transmit/receive · Bit normal write? · signal? · Data/handshake reception · Set DBYER flag · Does bit stuffing · signal = 1? · Idle state · USBPOB increment · Does USBPOW match · overflow? · Bit normal write? · Set DBYER flag · Does bit stuffing · signal = 1? · Idle state · USBPOB increment · overflow? · USBPOW increment · Set CRC16 execution · start signal
Page 143 of the NEC switch user manual — CHAPTER 8 USB FUNCTION
Page 143 · click to enlarge
Page 143

CHAPTER 8 USB FUNCTION

Figure 8-25. Flowchart of Transmit/Receive Pointer Operation (4/7)

(2) Data/Handshake packet reception (2/2)

EOP

Y

Y

N

N

USBPOB

Y

Y USBPOW

= 71H?

N

N

Y

DBYERBit 5 of data/handshake packet receive result store register (DRXRSL)
Show 13 more labels / short text on this page
Bit normal write? · Set DBYER flag · Does bit stuffing · signal = 1? · Idle state · USBPOB increment · overflow? · USBPOW increment · USBPOB increment · EOP received normally? · Set DBYER flag · Idle state · Idle state
Page 144 of the NEC switch user manual — Y
Page 144 · click to enlarge
Page 144

CHAPTER 8 USB FUNCTION

Figure 8-25. Flowchart of Transmit/Receive Pointer Operation (5/7)

(3) Data packet transmit (1/2)

m = 0send buffer 0 m = 1: send buffer 1

Y

Y

N

Set USBPOW to 7FH

Set USBPOB to 00H

Y

N

Y

N

USBPOB

N

Y

N

USBPOB

Y

USBPOW

Y

Transmit area? (reservation flag

start signal Go to (4)

n = 2Transmit buffer 0 n = 3: Transmit buffer 1

Set USBPOW to n0H

DTXCO0, DTXCO1Data packet transmit byte number counter
Show 22 more labels / short text on this page
Idle state · Does USBPOW match · Transmit/receive · signal? · DTXCOm? · Data/handshake transmission · Bit Read · Does bit stuffing · signal = 1? · Bit read · USBPOB increment · Does bit stuffing · signal = 1? · overflow? · USBPOB increment · USBPOW increment · overflow? · = n1H? · Set CRC16 execution · N Handshake · judgment) · Transmit buffer
Page 145 of the NEC switch user manual — Y
Page 145 · click to enlarge
Page 145

CHAPTER 8 USB FUNCTION

Figure 8-25. Flowchart of Transmit/Receive Pointer Operation (6/7)

(3) Data packet transmit (2/2)

Set EOP transmit signal

Y

N

N

USBPOB

Y

Set USBPOW to 70H

Read CRC redundant bit

Y

N

N USBPOB

Y

Y USBPOW

= 71H?

N

Show 11 more labels / short text on this page
Bit Read · Does bit stuff · Idle state · signal = 1? · USBPOB increment · overflow? · Does bit stuffing · signal = 1? · USBPOB increment · overflow? · USBPOW increment
Page 146 of the NEC switch user manual — N
Page 146 · click to enlarge
Page 146

CHAPTER 8 USB FUNCTION

Figure 8-25. Flowchart of Transmit/Receive Pointer Operation (7/7)

(4) Handshake packet transmission

Y

Y

Set USBPOW to 7FH

N

Set USBPOB to 00H

N

USBPOB

Y

Y

Set EOP transmit signal

N

N

USBPOB

Y

Transmit area? (reservation flag

n = 4ACK n = 5: NAK n = 6: STALL

Set USBPOW to n0H

Show 19 more labels / short text on this page
1 Idle state · Bit read · Transmit/receive · signal? · Data/handshake transmission · Does bit stuffing · signal = 1? · USBPOB increment · Bit read · overflow? · Does bit stuffing · signal = 1? · USBPOB increment · Idle state · overflow? · Transmit buffer · Go to (3) · judgment) · Handshake
Page 147 of the NEC switch user manual — N
Page 147 · click to enlarge
Page 147

CHAPTER 8 USB FUNCTION

8.8.2 Receive bank switching ID detection buffer operation

Figure 8-26. Flowchart of Receive Bank Switching ID Detection Buffer Operation

Y

2-bit store & shift

00B

11B 10B

01B

Set DASTAT Set HSSTAT

Y

1-bit store & shift

N

Y

Set buffer to 00H

TOSTATBit 0 of packet receive status register (RXSTAT)
DASTATBit 1 of packet receive status register (RXSTAT)
HSSTATBit 2 of packet receive status register (RXSTAT)
Show 9 more labels / short text on this page
Idle state · Sync1 detection · signal = 1? · Bit judgment enable · Store bit ? · Set TOSTAT · Bit judgment mask · EOP received? · Idle state
Page 148 of the NEC switch user manual — (RXD)
Page 148 · click to enlarge
Page 148

CHAPTER 8 USB FUNCTION

8.8.3 Sync detection/USBCLK detector operation

This circuit generates the USBCLK signal (1.5 MHz) upon detecting the sync part of the receive packet. In

addition, it contains an NRZI decoder that decodes receive packets and detects the last bit of the sync part.

When the last sync bit is detected, a signal that specifies start of storing in the ID detection buffer is output.

Figure 8-27. Timing of Sync Detection/USBCLK Detector Operation

USBCLK

SYNC last bit detection

SYNC pattern After token packet

Figure 8-28. Timing of Sync Detection/USBCLK Generation Operation

TX MASTER ENNote

USBCLK

1 0 1 0 1 0 1 1 1 0 0

(RXD)

(INTUSBRE)

Remark The USB clock starts operating at the falling edge of fX after transition from the J state to the K state of

the bus. However, this control is masked if TX MASTER EN = 1.

Show 8 more labels / short text on this page
Receive packet · USBCLK generation · NRZI decode · Data after decoding · fX · Receive data · Sync Idle · Resume RXNote
Page 149 of the NEC switch user manual — Y
Page 149 · click to enlarge
Page 149

CHAPTER 8 USB FUNCTION

Figure 8-29. Flowchart of Sync Detection/USBCLK Detector Operation

N

Y

USB clock oscillation start

Output 0 from NRZI decoder

Y

N

Output 1 from NRZI decoder

Detect last Sync bit

Y

N

N

Y

Output 0 from NRZI decoder

Output 1 from NRZI decoder

Show 14 more labels / short text on this page
Idle state · Did state change · to K state? · Sync detection · Receive next bit · Did bus state · change? · Was EOP receive · signal set? · Receive next bit · Did bus state · USB clock stop · change? · Idle state
Page 150 of the NEC switch user manual — N
Page 150 · click to enlarge
Page 150

CHAPTER 8 USB FUNCTION

8.8.4 NRZI encoder operation

This circuit performs NRZI encoding of data to be transmitted.

Figure 8-30. Timing of NRZI Encoder Operation

Sync pattern Data/handshake packet

Figure 8-31. Flow Chart of NRZI Encoder Operation

N

Y

Sync.0 input

N

Input bit = 0?

Y

Maintain previous output level

Was EOP transmit signal

N

Y

Show 12 more labels / short text on this page
Data before encoding · NRZI encoding · Transmit packet · USB clock generation · Idle state · Transmit start? · Reverse output level · (1 output) · Next bit input · Reverse output level · set? · Idle state
Page 151 of the NEC switch user manual — (2) Bit striping
Page 151 · click to enlarge
Page 151

CHAPTER 8 USB FUNCTION

8.8.5 Bit stuffing/strip controller operation

This circuit counts the number of “logic 1” of transmit/receive packets. If six successive logic 1s are detected, it

outputs an increment disable signal to the transmit/receive pointer (USBPOB). During packet transmission, it inserts

“logic 0” simultaneously with the increment disable signal.

Moreover, during bit stripping, if the bit that should be deleted was a “logic 1,” this is detected as a bit stuffing

error.

Figure 8-32. Timing of Bit Stuffing/Strip Controller Operation

(1) Bit stuffing

If “1” occurs six successive times, a “0” is inserted forcibly to shift the level.

Sync pattern Packet data

Idle Bit stuffing data Sync pattern Packet data

Logic 1 × 6 times

Idle NRZI encoding data Sync pattern Packet data

(2) Bit striping

If “1” occurs six successive times, the next bit is deleted as a stuffing bit.

Idle Bit stuffing data (NRZI decoding) Sync pattern Packet data

Logic 1 × 6 times

Idle Bit strip data

Sync pattern Packet data

Idle RAW data · Stuff bit · Stuffing bit

Page 152 of the NEC switch user manual — N
Page 152 · click to enlarge
Page 152

CHAPTER 8 USB FUNCTION

Figure 8-33. Flow Chart of Bit Stuffing Control Operation

N

Y

N

Transmit bit = 1?

Y

Shift bit stuffing register

Reset bit stuffing register

N Bit stuffing register

= 3FH?

Y

Reset bit stuffing register

Disable save of next transmit bit

Was EOP receive signal

N

Y

Show 6 more labels / short text on this page
Idle state · Transmission start? · Transmit bit input · Disable USBPOB increment · set? · Idle state
Page 153 of the NEC switch user manual — N
Page 153 · click to enlarge
Page 153

CHAPTER 8 USB FUNCTION

Figure 8-34. Flow Chart of Bit Strip Control Operation

N

Y

N

Receive bit = 1?

Y

Shift bit stuffing register

Reset bit stuffing register

N Bit stuffing register

= 3FH?

Y

Was EOP receive signal

Y

N

N Receive bit = 1?

Y

Reset bit stuffing register

Bit stuffing error output

Was EOP receive signal

N

Y

Show 8 more labels / short text on this page
Idle state · Reception start? · Receive bit input · Disable USBPOB increment · set? · Receive bit input · set? · Idle state
Page 154 of the NEC switch user manual — (2) 3-wire serial I/O mode (MSB/LSB start bit switchable)
Page 154 · click to enlarge
Page 154

CHAPTER 9 SERIAL INTERFACE 10

9.1 Functions of Serial Interface 10

Serial interface 10 has the following two modes.

  • Operation stop mode
  • 3-wire serial I/O mode

(1) Operation stop mode

This mode is used when serial transfer is not carried out. It enables a reduction in power consumption.

(2) 3-wire serial I/O mode (MSB/LSB start bit switchable)

In this mode, 8-bit data transfer is carried out with three lines: one for the serial clock (SCK10) and two for serial

data (SI10 and SO10).

The 3-wire serial I/O mode supports simultaneous transmit and receive operations, reducing data transfer

processing time.

It is possible to switch the start bit of 8-bit data to be transmitted between the MSB and the LSB, thus allowing

connection to devices with either start bit.

The 3-wire serial I/O mode is effective for connecting display controllers and peripheral I/Os such as the 75XL

Series, 78K Series, and 17K Series that have an internal conventional clocked serial interface.

Page 155 of the NEC switch user manual — (1) Transmit/receive shift register 10 (SIO10)
Page 155 · click to enlarge
Page 155

CHAPTER 9 SERIAL INTERFACE 10

9.2 Configuration of Serial Interface 10

Serial interface 10 consists of the following hardware.

Table 9-1. Configuration of Serial Interface 10

Register Transmit/receive shift register 10 (SIO10)

Control register Serial operating mode register 10 (CSIM10)

(1) Transmit/receive shift register 10 (SIO10)

This is an 8-bit register used for parallel-to-serial conversion and to perform serial data transmission/reception in

synchronization with the serial clock.

SIO10 is set with an 8-bit memory manipulation instruction.

RESET input makes SIO10 undefined.

Item Configuration

Page 156 of the NEC switch user manual — (SIO10)
Page 156 · click to enlarge
Page 156

CHAPTER 9 SERIAL INTERFACE 10

INTCSI10

fX/22

fX/23

Transmit/receive shift register 10

(SIO10)

Figure 9-1. Block Diagram of Serial Interface 10

CSCK10

CSIE10 TPS100 DIR10

SI10/P22

SO10/P21

SCK10/P20

Show 10 more labels / short text on this page
Interrupt · generator · request · Selector · Serial clock counter · Clock controller F/F · Selector · Serial operation mode · register 10 (CSIM10) · Internal bus
Page 157 of the NEC switch user manual — DIR10
Page 157 · click to enlarge
Page 157

CHAPTER 9 SERIAL INTERFACE 10

9.3 Register Controlling Serial Interface 10

The following register is used to control serial interface 10.

  • Serial operation mode register 10 (CSIM10)

(1) Serial operation mode register 10 (CSIM10)

This register is used to control serial interface 10 and set the serial clock and start bit.

CSIM10 is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets CSIM10 to 00H.

Figure 9-2. Format of Serial Operation Mode Register 10

Symbol Address After reset R/W

6 5 4 3 2 1 0

CSIE10 0 0 TPS100 0 DIR10 CSCK10 0 CSIM10

FF72H 00H R/W

CSIE10

Operation control in 3-wire serial I/O mode

TPS100

Count clock selection when operation enabled in 3-wire serial I/O mode

fX/22

fX/23

DIR10

MSB

LSB

CSCK10

Clock selection in 3-wire serial I/O mode

Clock input to SCK10 pin from external

Internal clock selected by TPS100

Operation disabled · Operation enabled · Start bit specification

Page 158 of the NEC switch user manual — CHAPTER 9 SERIAL INTERFACE 10
Page 158 · click to enlarge
Page 158

CHAPTER 9 SERIAL INTERFACE 10

Table 9-2. Operating Mode Settings of Serial Interface 10

(1) Operation stop mode

NEC switch — CHAPTER 9 SERIAL INTERFACE 10 diagram (page 158)
Fig. 18

CSIM10 PM22 P22 PM21 P21 PM20 P20 Start Shift P22/SI10 P21/SO10 P20/SCK10

CSIE10 DIR10 CSCK10 Bit Clock Pin Function Pin Function Pin Function

CSIM10 PM22 P22 PM21 P21 PM20 P20 Start Shift P22/SI10 P21/SO10 P20/SCK10

CSIE10 DIR10 CSCK10 Bit Clock Pin Function Pin Function Pin Function

2. If used only for transmission, can be used as P22 (CMOS input/output).
Remark ×don’t care
Page 159 of the NEC switch user manual — FF72H 00H R/W
Page 159 · click to enlarge
Page 159

CHAPTER 9 SERIAL INTERFACE 10

9.4 Operation of Serial Interface 10

Serial interface 10 provides the following two modes.

  • Operation stop mode
  • 3-wire serial I/O mode

9.4.1 Operation stop mode

In the operation stop mode, serial transfer is not executed; therefore, the power consumption can be reduced.

The P20/SCK10, P21/SO10, and P22/SI10 pins can be used as normal I/O ports.

(1) Register setting

Operation stop mode is set by serial operation mode register 10 (CSIM10).

Serial operation mode register 10 (CSIM10)

CSIM10 is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets CSIM10 to 00H.

Symbol Address After reset R/W

6 5 4 3 2 1 0

CSIE10 0 0 TPS100 0 DIR10 CSCK10 0 CSIM10

FF72H 00H R/W

CSIE10

Operation control in 3-wire serial I/O mode

Operation disabled · Operation enabled

Page 160 of the NEC switch user manual — DIR10
Page 160 · click to enlarge
Page 160

CHAPTER 9 SERIAL INTERFACE 10

9.4.2 3-wire serial I/O mode

The 3-wire serial I/O mode is useful for connection of peripheral I/Os and display controllers, etc., which

incorporate a conventional synchronous serial interface, such as the 75XL Series, 78K Series, 17K Series, etc.

Communication is performed using three lines: the serial clock (SCK10), serial output (SO10), and serial input

(SI10).

(1) Register setting

3-wire serial I/O mode settings are performed using serial operating mode register 10 (CSIM10).

(a) Serial operation mode register 10 (CSIM10)

CSIM10 is set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets CSIM10 to 00H.

Symbol Address After reset R/W

6 5 4 3 2 1 0

CSIE10 0 0 TPS100 0 DIR10 CSCK10 0 CSIM10

FF72H 00H R/W

Operation control in 3-wire serial I/O mode

CSIE10

TPS100

Count clock selection when operation enabled in 3-wire serial I/O mode

fX/22

fX/23

DIR10

MSB

LSB

CSCK10

Clock selection in 3-wire serial I/O mode

Clock input to SCK10 pin from external

Internal clock selected by TPS100

Operation disabled · Operation enabled · Start bit specification

Page 161 of the NEC switch user manual — (3) Transfer start
Page 161 · click to enlarge
Page 161

CHAPTER 9 SERIAL INTERFACE 10

(2) Communication operation

In the 3-wire serial I/O mode, data transmission/reception is performed in 8-bit units. Data is

transmitted/received bit by bit in synchronization with the serial clock.

Transmit/receive shift register 10 (SIO10) shift operations are performed in synchronization with the fall of the

serial clock (SCK10). Then transmit data is held in the SO10 latch and output from the SO10 pin. Also, receive

data input to the SI10 pin is latched in the input bits of SIO10 on the rise of SCK10.

At the end of an 8-bit transfer, the operation of SIO10 stops automatically, and the interrupt request signal

(INTCSI10) is generated.

Figure 9-3. 3-Wire Serial I/O Mode Timing

SCK10

1 2 3 4 5 6 7 8

SI10

DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0

SO10

DO7 DO6 DO5 DO4 DO3 DO2 DO1 DO0

INTCSI10

End of transfer Transfer start at the falling edge of SCK10

data cannot be transmitted or received.

2. When data is written to SIO10 in the serial operation disabled status (CSIE10 = 0) and

then serial operation is enabled (CSIE10 = 1), the data cannot be transmitted or

received.

3. Once data has been written to SIO10 with the serial clock selected (CSCK10 = 0),

overwriting the data does not update the contents of SIO10.

4. When CSIM10 is operated during data transmission/reception, data cannot be

transmitted or received normally.

5. When SIO10 is operated during data transmission/reception, the data cannot be

transmitted or received normally.

(3) Transfer start

Serial transfer is started by setting transfer data to transmit/receive shift register 10 (SIO10) when the following

two conditions are satisfied.

  • Bit 7 (CSIE10) of serial operation mode register 10 (CSIM10) = 1
  • Internal serial clock is stopped or SCK10 is high level after 8-bit serial transfer.

Termination of 8-bit transfer stops the serial transfer automatically and generates the interrupt request signal

(INTCSI10).

Page 162 of the NEC switch user manual — V DD0
Page 162 · click to enlarge
Page 162

CHAPTER 10 REGULATOR

The µPD789800 incorporates a regulator that powers the USB driver/receiver. The features are as follows.

  • Generates V REG (3.3 ± 0.3 V) from V DD0 , V DD1 (4.0 to 5.5 V) and outputs it to the REGC pin.
  • Supports power-saving mode, reducing power consumption in mode.

Figure 10-1. Block Diagram of Regulator and USB Driver/Receiver

PD789800

V DD0

V REG

REGC

22 F

V SS0 V SS

1.5 kΩ

V DD0

RXD

SEP

USBDM

SEM

TXDP

TXDM

TXEN

USBDP

RXEN

V SS0

2. Connect the pull-up resistor (1.5 k Ω ) for the USBDM pin to the REGC pin.
Show 5 more labels / short text on this page
µ · Regulator · µ · USB driver/ receiver · Hub
Page 163 of the NEC switch user manual — 11.2 Interrupt Sources and Configuration
Page 163 · click to enlarge
Page 163

CHAPTER 11 INTERRUPT FUNCTIONS

11.1 Interrupt Function Types

The following two types of interrupt functions are used.

(1) Non-maskable interrupt

This interrupt is acknowledged unconditionally. It does no undergo interrupt priority control and is given top

priority over all other interrupt requests.

A standby release signal is generated.

One interrupt source from the watchdog timer is incorporated as a non-maskable interrupt.

(2) Maskable interrupt

These interrupts undergo mask control. If two or more interrupts with the same priority are simultaneously

generated, each interrupt has a predetermined priority as shown in Table 11-1.

A standby release signal is generated.

Two external and nine internal interrupt sources are incorporated as maskable interrupts.

11.2 Interrupt Sources and Configuration

A total of 12 non-maskable and maskable interrupts are incorporated as interrupt sources (see Table 11-1).

Page 164 of the NEC switch user manual — 0016H
Page 164 · click to enlarge
Page 164

CHAPTER 11 INTERRUPT FUNCTIONS

Table 11-1. Interrupt Source List

Type of Interrupt Priority

Nonmaskable - INTWDT Watchdog timer overflow (when watchdog timer mode 1 is selected)

Maskable 0 INTWDT Watchdog timer overflow (when interval timer mode is selected)

(B)

1 INTUSBTM USB timer overflow 0006H (B)

2 INTUSBRT EOP detection when a USB token packet is received

0008H

3 INTUSBRD EOP detection when a USB data/handshake packet is received

000AH

4 INTUSBST EOP detection when a USB data/ handshake packet is transmitted

000CH

5 INTUSBRE Detection of transition from J state to K state or SE0 on the USB bus

000EH

6 INTP0 Detection of a pin input edge External 0010H (C)

7 INTCSI10 End of three-wire SIO bus interface transmission and reception

8 INTTM00 Generation of the 8-bit timer 00 match signal

0014H

9 INTTM01 Generation of the 8-bit timer/event counter 01 match signal

0016H

10 INTKR00 Detection of the key return signal External 0018H (C)

is the highest priority and 10 is the lowest.

2. Types (A) to (C) in the basic configuration correspond to (A) to (C) in Figure 11-1, respectively.

Remark Only one of the two watchdog timer interrupt (INTWDT) sources, non-maskable or maskable (internal),

can be selected.

Show 8 more labels / short text on this page
Internal/ External · Vector · Basic Configuration · Table Address · Name Trigger · Type · Internal 0004H (A) · Internal 0012H (B)
Page 165 of the NEC switch user manual — IF
Page 165 · click to enlarge
Page 165

CHAPTER 11 INTERRUPT FUNCTIONS

Figure 11-1. Basic Configuration of Interrupt Function

(A) Internal non-maskable interrupt

Interrupt request Vector table address generator

(B) Internal maskable interrupt

MK

IE

Vector table address generator

IF

(C) External maskable interrupt

INTM0, KRM00

MK

IE

Vector table address generator

IF

IFInterrupt request flag
IEInterrupt enable flag
MKInterrupt mask flag
INTM0External interrupt mode register 0
KRM00Key return mode register 00
Show 9 more labels / short text on this page
Internal bus · Standby release signal · Internal bus · Interrupt request · Standby release signal · Internal bus · Interrupt request · Edge detector · Standby release signal
Page 166 of the NEC switch user manual — INTWDT TMIF4 TMMK4
Page 166 · click to enlarge
Page 166

CHAPTER 11 INTERRUPT FUNCTIONS

11.3 Registers Controlling Interrupt Function

The following five registers are used to control the interrupt functions.

  • Interrupt request flag registers 0 and 1 (IF0 and IF1)
  • Interrupt mask flag registers 0 and 1 (MK0 and MK1)
  • External interrupt mode register 0 (INTM0)
  • Program status word (PSW)
  • Key return mode register 00 (KRM00)

Table 11-2 gives a listing of interrupt request flag and interrupt mask flag names corresponding to interrupt

requests.

Table 11-2. Flags Corresponding to Interrupt Request Signals

Interrupt Request Signal Name Interrupt Request Flag Interrupt Mask Flag

INTWDT TMIF4 TMMK4

INTUSBTM USBTMIF USBTMMK

INTUSBRT USBRTIF USBRTMK

INTUSBRD USBRDIF USBRDMK

INTUSBST USBSTIF USBSTMK

INTUSBRE USBREIF USBREMK

INTP0 PIF0 PMK0

INTCSI10 CSIIF10 CSIMK10

INTTM00 TMIF00 TMMK00

INTTM01 TMIF01 TMMK01

INTKR00 KRIF00 KRMK00

Page 167 of the NEC switch user manual — IF1 FFE1H 00H R/W
Page 167 · click to enlarge
Page 167

CHAPTER 11 INTERRUPT FUNCTIONS

(1) Interrupt request flag registers (IF0 and IF1)

The interrupt request flag is set to 1 when the corresponding interrupt request is generated or an instruction is

executed. It is cleared to 0 when an instruction is executed upon acknowledgement of an interrupt request or

upon RESET input.

IF0 and IF1 are set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets IF0 and IF1 to 00H.

Figure 11-2. Format of Interrupt Request Flag Register

Symbol Address After reset 3 2

R/W

TMIF01 TMIF00 CSIIF10 KRIF00 0 0 PIF0 TMIF4 IF0

FFE0H 00H R/W

1 7 0

IF1 FFE1H 00H R/W

0 USBTMIFUSBRTIFUSBRDIFUSBSTIF USBREIF 0 0

XXIFX

No interrupt request signal is generated

Interrupt request signal is generated; interrupt request state

timer. If watchdog timer mode 1 or 2 is used, set the TMIF4 flag to 0.

2. Because port 2 has an alternate function as an external interrupt input, when the

output level is changed by specifying the output mode of the port function, an

interrupt request flag is set. Therefore, the interrupt mask flag should be set to 1

before using the output mode.

3. If an interrupt is acknowledged, an interrupt request flag is automatically cleared and

then the interrupt routine is entered.

Interrupt request flag

Page 168 of the NEC switch user manual — FFECH 00H R/W
Page 168 · click to enlarge
Page 168

CHAPTER 11 INTERRUPT FUNCTIONS

(2) Interrupt mask flag registers (MK0 and MK1)

The interrupt mask flag is used to enable/disable the corresponding maskable interrupt servicing.

MK0 and MK1 are set with a 1-bit or 8-bit memory manipulation instruction.

RESET input sets MK0 and MK1 to FFH.

Figure 11-3. Format of Interrupt Mask Flag Register

Symbol Address After reset 3 2

R/W

TMMK01 TMMK00 CSIMK10 KRMK00 1 1 PMK0 TMMK4 MK0

FFE4H FFH R/W

1 7 0

MK1 FFE5H FFH R/W

0 USBTMMKUSBRTMKUSBRDMKUSBSTMK USBREIF 1 1

XXMKX

or 2, its value becomes undefined.

2. Because port 2 has an alternate function as an external interrupt input, when the

output level is changed by specifying the output mode of the port function, an

interrupt request flag is set. Therefore, the interrupt mask flag should be set to 1

before using the output mode.

(3) External interrupt mode register 0 (INTM0)

This register is used to set the valid edge of INTP0.

INTM0 is set with an 8-bit memory manipulation instruction.

RESET input sets INTM0 to 00H.

Figure 11-4. Format of External Interrupt Mode Register 0

Symbol Address After reset

7 6 5 4 3 2 1 0

R/W

0 ES01 ES00 0 0 INTM0

FFECH 00H R/W

ES00 ES01

INTP0 valid edge selection

Both rising and falling edges

2. Before setting the INTM0 register, be sure to set xxMKx of the relevant interrupt mask

flag to 1 to disable interrupts. After that clear the interrupt mask flag (xxMKx = 0) to

enable interrupts after clearing the interrupt request flag(xxIFx = 0).

Show 6 more labels / short text on this page
Interrupt servicing control · Interrupt servicing enabled · Interrupt servicing disabled · Falling edge · Rising edge · Setting prohibited
Page 169 of the NEC switch user manual — IE
Page 169 · click to enlarge
Page 169

CHAPTER 11 INTERRUPT FUNCTIONS

(4) Program status word (PSW)

The program status word is a register used to hold the instruction execution result and the current status for

interrupt requests. The IE flag to set maskable interrupt enable/disable is mapped here.

Besides 8-bit unit read/write, this register can carry out operations with bit manipulation instructions and

dedicated instructions (EI, DI). When a vectored interrupt is acknowledged, the PSW is automatically saved into

a stack, and the IE flag is reset to 0.

RESET input sets the PSW to 02H.

Figure 11-5. Configuration of Program Status Word

7 6 5 4 3 2 1 0

IE Z 0 AC 0 0 1 CY PSW

02H

Used when normal instruction is executed

IE

Show 4 more labels / short text on this page
Symbol After reset · Interrupt acknowledgment enabled/disabled · Disabled · Enabled
Page 170 of the NEC switch user manual — P40/KR00
Page 170 · click to enlarge
Page 170

CHAPTER 11 INTERRUPT FUNCTIONS

(5) Key return mode register 00 (KRM00)

This register sets the pin that detects a key return signal (rising edge of port 4).

KRM00 is set with a 1-bit an 8-bit memory manipulation instruction.

Bit 0 (KRM000) is set in 4-bit units for the KR00/P40 to KR03/P43 pins. Bits 4 to 7 (KRM004 to KRM007) are

set in 1-bit units for the KR04/P44 to KR07/P47 pins, respectively.

RESET input sets KRM00 to 00H.

Figures 11-6 and 11-7 show the format of key return mode register 00 and the block diagram of the falling edge

detector, respectively.

Figure 11-6. Format of Key Return Mode Register 00

Symbol Address After reset 6 5 4 3 2 1 7 0

R/W

KRM007 KRM006 KRM005 KRM004 0 0 0 KRM000 KRM00

FFF5H 00H R/W

Key return signal detection selection for P4n/KR0n pin (n = 4 to 7)

Detection (detecting falling edge of P4n/KR0n)

KRM000

Key return signal detection selection for P40/KR00 to P43/KR03 pins

Detection (detecting falling edge of P40/KR00 to P43/KR03)

2. When the KRM00 register is set to 1, a pull-up resistor is connected automatically.

However, the pull-up resistor is cut for pins in output mode.

3. Before setting KRM00, always set bit 4 of MK0 (KRMK00 = 1) to disable interrupts in

advance. After setting KRM00, clear bit 4 of MK0 (KRMK00 = 0) after clearing bit 4 of

IF0 (KRIF00 = 0) to enable interrupts.

Figure 11-7. Block Diagram of Falling Edge Detector

Key return mode register 00 (KRM00)Note

P40/KR00

P41/KR01

P42/KR02

P43/KR03

P44/KR04

P45/KR05

KRMK00

P46/KR06

P47/KR07

Show 7 more labels / short text on this page
KRM00n · No detection · No detection · Selector · KRIF00 set signal · Falling edge detector · Standby release signal
Page 171 of the NEC switch user manual — Caution During non-maskable interrupt service program execution, do not input another non-maskable
Page 171 · click to enlarge
Page 171

CHAPTER 11 INTERRUPT FUNCTIONS

11.4 Interrupt Servicing Operation

11.4.1 Non-maskable interrupt acknowledgment operation

The non-maskable interrupt is unconditionally acknowledged even when interrupts are disabled. It is not subject

to interrupt priority control and takes precedence over all other interrupts.

When the non-maskable interrupt request is acknowledged, the PSW and PC are saved to the stack in that order,

the IE flag is reset to 0, the contents of the vector table are loaded to the PC, and then program execution branches.

Caution During 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.

Page 172 of the NEC switch user manual — TMIF4
Page 172 · click to enlarge
Page 172

CHAPTER 11 INTERRUPT FUNCTIONS

Figure 11-8. Flowchart of Non-Maskable Interrupt Request Acknowledgment

WDTM4 = 1 (watchdog timer mode

WDTM3 = 0 (non-maskable interrupt

Interrupt request is generated

Interrupt servicing is started

WDTMWatchdog timer mode register
WDTWatchdog timer

Figure 11-9. Timing of Non-Maskable Interrupt Request Acknowledgment

Instruction Instruction Save PSW and PC, and jump to interrupt servicing Interrupt servicing program CPU processing

TMIF4

Figure 11-10. Acknowledging Non-Maskable Interrupt Request

NMI request (second) NMI request (first)

Show 15 more labels / short text on this page
Start · No · is selected) · Interval timer · Yes · WDT overflows · No · Yes · No · is selected) · Reset processing · Yes · Main routine · First interrupt servicing · Second interrupt servicing
Page 173 of the NEC switch user manual — IE = 1 ?
Page 173 · click to enlarge
Page 173

CHAPTER 11 INTERRUPT FUNCTIONS

11.4.2 Maskable interrupt acknowledgment operation

A maskable interrupt can be acknowledged when the interrupt request flag is set to 1 and the corresponding

interrupt mask flag is cleared to 0. A vectored interrupt is acknowledged in the interrupt enabled status (when the IE

flag is set to 1).

The time required to start the interrupt servicing after a maskable interrupt request has been generated is as

follows.

Table 11-3. Time from Generation of Maskable Interrupt Request to Servicing

Minimum Time Maximum Time

8 clocks 19 clocks

instruction.

Remark 1 clock(f CPU : CPU clock)

When two or more maskable interrupt requests are generated at the same time, they are acknowledged starting

from the one assigned the highest priority.

A pending interrupt is acknowledged when the status in which it can be acknowledged is set.

Figure 11-11 shows the algorithm of acknowledging interrupts.

When a maskable interrupt request is acknowledged, the PSW and PC are saved to the stack in that order, the IE

flag is reset to 0, the data in the vector table determined for each interrupt request is loaded to the PC, and

execution branches.

To return from interrupt servicing, use the RETI instruction.

Figure 11-11. Interrupt Acknowledgment Program Algorithm

xxIF = 1 ?

Yes (interrupt request generated)

xxMK = 0 ?

IE = 1 ?

Show 11 more labels / short text on this page
fCPU · Start · No · No · Yes · Interrupt request pending · No · Yes · Interrupt request pending · Vectored interrupt · servicing
Page 174 of the NEC switch user manual — Figure 11-13. Timing of Interrupt Request Acknowledgment
Page 174 · click to enlarge
Page 174

CHAPTER 11 INTERRUPT FUNCTIONS

Figure 11-12. Timing of Interrupt Request Acknowledgment (Example of MOV A,r)

Saving PSW and PC, and jump to interrupt handling

When an interrupt request flag (xxIF) is generated before clock n (n = 4 to 10) of the instruction being executed

turns to n - 1, the interrupt is acknowledged after the instruction has been executed. Figure 11-12 shows an

example for 8-bit data transfer instruction MOV A,r. It takes 4 clocks for this instruction to be executed. So, when an

interrupt occurs within 3 clocks after the instruction execution started, the interrupt is acknowledged after MOV A,r

has been executed.

Figure 11-13. Timing of Interrupt Request Acknowledgment

(When Interrupt Request Flag Is Generated at Last Clock of Instruction Execution)

CPU NOP MOV A,r Save PSW and PC, and jump to interrupt servicing

When an interrupt request flag (xxIF) is generated at the last clock for instruction execution, after the next

instruction has been executed, the interrupt acknowledgment servicing starts.

Figure 11-13 shows an example when an interrupt request flag is generated at the second clock for NOP (2-clock

instruction). In this case, the interrupt is acknowledged after MOV A,r has been executed after the NOP instruction

execution.

IF1) or interrupt mask flag registers 0, 1 (MK0, MK1).

Show 9 more labels / short text on this page
8 clocks · Clock · CPU MOV A,r · Interrupt servicing program · Interrupt · 8 clocks · Clock · Interrupt servicing program · Interrupt
Page 175 of the NEC switch user manual — CHAPTER 11 INTERRUPT FUNCTIONS
Page 175 · click to enlarge
Page 175

CHAPTER 11 INTERRUPT FUNCTIONS

11.4.3 Multiplexed interrupt servicing

Servicing in which another interrupt is acknowledged while an interrupt is being processed is called multiplexed

interrupt servicing.

Multiplexed interrupt is not performed unless interrupt requests are enabled (IE = 1) (except the non-maskable

interrupt request). Other interrupt requests are disabled (IE = 0) as soon as an interrupt request is acknowledged.

Therefore, it is necessary to set (1) the IE flag to realize the interrupt enable state using the EI instruction during

interrupt request servicing in order to enable multiplexed interrupt servicing.

Page 176 of the NEC switch user manual — RETI
Page 176 · click to enlarge
Page 176

CHAPTER 11 INTERRUPT FUNCTIONS

Figure 11-14. Example of Multiplexed Interrupt Servicing

Example 1. Acknowledging multiplexed interrupts

INTyy processing INTxx processing

IE = 0

IE = 0

EI

EI

RETI

RETI

The interrupt request INTyy is acknowledged and multiplexed interrupt servicing is performed during the interrupt

INTxx servicing. Before each interrupt is acknowledged, the IE instruction is issued and interrupt requests are

enabled.

Example 2. Multiplexed interrupts are not performed because interrupts are disabled.

INTyy processing INTxx processing

IE = 0

INTyy is held pending

RETI

IE = 0

RETI

Interrupt requests are disabled (EI instruction is not issued) in the interrupt INTxx servicing. The interrupt request

INTyy is not acknowledged and multiplexed interrupt servicing is not performed. INTyy is held pending and is

acknowledged after INTxx servicing is completed.

IE = 0: Interrupt request acknowledgment disabled.

Show 6 more labels / short text on this page
Main processing · INTxx · INTyy · Main processing · INTyy EI · INTxx
Page 177 of the NEC switch user manual — CHAPTER 11 INTERRUPT FUNCTIONS
Page 177 · click to enlarge
Page 177

CHAPTER 11 INTERRUPT FUNCTIONS

11.4.4 Interrupt request hold

If an interrupt (such as a maskable, non-maskable, or external interrupt) is requested when a certain type of

instruction is being executed, the interrupt request will not be acknowledged until the instruction is completed. Such

instructions include:

  • Instructions that manipulate interrupt request flag registers 0 and 1 (IF0 and IF1)
  • Instructions that manipulate interrupt mask flag registers 0 and 1 (MK0 and MK1)
Page 178 of the NEC switch user manual — (2) STOP mode
Page 178 · click to enlarge
Page 178

CHAPTER 12 STANDBY FUNCTION

12.1 Standby Function and Configuration

12.1.1 Standby function

The standby function is used to reduce the power consumption of the system and can be effected in the following

two modes.

(1) HALT mode

This mode is set when the HALT instruction is executed. The HALT mode stops the operation clock of the CPU.

The system clock oscillator continues oscillating. This mode does not reduce the power consumption as much

as the STOP mode, but is useful for resuming processing immediately when an interrupt request is generated,

or for intermittent operations.

(2) STOP mode

This mode is set when the STOP instruction is executed. The STOP mode stops the system clock oscillator

and stops the entire system. The power consumption of the CPU can be substantially reduced in this mode.

The STOP mode can be released by an interrupt request, so that this mode can be used for intermittent

operations. However, some time is required until the system clock oscillator stabilizes after the STOP mode has

been released. If processing must be resumed immediately by using an interrupt request, therefore, use the

HALT mode.

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 latches of the I/O ports and output buffers are also retained.

execute the STOP instruction.

Page 179 of the NEC switch user manual — FFFAH 04H R/W
Page 179 · click to enlarge
Page 179

CHAPTER 12 STANDBY FUNCTION

12.1.2 Register controlling standby function

The wait time after the STOP mode is released upon interrupt request until oscillation stabilizes is controlled with

the oscillation stabilization time select register (OSTS).

OSTS is set with an 8-bit memory manipulation instruction.

15/fX until oscillation stabilizes after RESET input.

RESET input sets OSTS to 04H. However, it takes 2

Figure 12-1. Format of Oscillation Stabilization Time Select Register

Symbol Address After reset

7 6 5 4 3 2 1 0

R/W

0 OSTS2 OSTS1 OSTS0 OSTS

FFFAH 04H R/W

OSTS2

OSTS1

OSTS0

Oscillation stabilization time selection

212/fX

215/fX

(5.46 ms)

217/fX

(21.8 ms)

release to clock oscillation start (“a” in the figure below), regardless of release by RESET input

or by interrupt generation.

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz.
Show 8 more labels / short text on this page
(683 s) · µ · Other than above · Setting prohibited · STOP mode release · X1 pin voltage · waveform · a
Page 180 of the NEC switch user manual — Table 12-1. HALT Mode Operation Status
Page 180 · click to enlarge
Page 180

CHAPTER 12 STANDBY FUNCTION

12.2 Standby Function Operation

12.2.1 HALT mode

(1) HALT mode

The HALT mode is set by executing the HALT instruction.

The operation status in the HALT mode is shown in the following table.

Table 12-1. HALT Mode Operation Status

Item HALT Mode Operation Status

Clock generator Oscillation enabled

Port (output latch) Remains in the state before the selection of HALT mode.

8-bit timer 00 (TM00) Operation enabled

8-bit timer/event counter 01 (TM01) Operation enabled

Watchdog timer Operation enabled

USB function Operation enabled

Serial interface Operation enabled

Key return Operation enabled

External interrupt Operation enabled

2. Maskable interrupt that is not masked

CPU Operation disabled

Page 181 of the NEC switch user manual — (b) Releasing by non-maskable interrupt request
Page 181 · click to enlarge
Page 181

CHAPTER 12 STANDBY FUNCTION

(2) Releasing HALT mode

The HALT mode can be released by the following three sources.

(a) Releasing by unmasked interrupt request

The HALT mode is released by an unmasked interrupt request. In this case, if interrupts are enabled to be

acknowledged, vectored interrupt servicing is performed. If interrupts are disabled, the instruction at the

next address is executed.

Figure 12-2. Releasing HALT Mode by Interrupt

Wait HALT mode Operation

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.
  • When vectored interrupt servicing is performed: 9 to 10 clocks
  • When vectored interrupt servicing is not performed: 1 to 2 clocks

(b) Releasing by non-maskable interrupt request

The HALT mode is released regardless of whether interrupts are enabled or disabled, and vectored

interrupt servicing is performed.

Show 5 more labels / short text on this page
HALT instruction · Wait · Standby release signal · mode Operation mode · Clock Oscillation
Page 182 of the NEC switch user manual — Table 12-2. Operation After Release of HALT Mode
Page 182 · click to enlarge
Page 182

CHAPTER 12 STANDBY FUNCTION

(c) Releasing by RESET input

When the HALT mode is released by the RESET signal, execution branches to the reset vector address in

the same manner as the ordinary reset operation, and program execution is started.

Figure 12-3. Releasing HALT Mode by RESET Input

Wait (2 15 /f X5.46 ms)

RESET

Reset period HALT mode Operation

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at f X = 6.0 MHz.

Table 12-2. Operation After Release of HALT Mode

Releasing Source MKxx IE Operation

Maskable interrupt request 0 0 Executes next address instruction

0 1 Executes interrupt servicing

1 × Retains HALT mode

Non-maskable interrupt request — × Executes interrupt servicing

RESET input — — Reset processing

×don’t care
Show 10 more labels / short text on this page
HALT instruction · signal · Oscillation stabilization · Operation · wait status · mode · mode · Oscillation · Clock · stops Oscillation Oscillation
Page 183 of the NEC switch user manual — Table 12-3. STOP Mode Operation Status
Page 183 · click to enlarge
Page 183

CHAPTER 12 STANDBY FUNCTION

12.2.2 STOP mode

(1) Setting and operation status of STOP mode

The STOP mode is set by executing the STOP instruction.

current leakage of the crystal oscillator block. Therefore, do not use the STOP mode

in a system where an 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 the operation mode is set.

The operation status in the STOP mode is shown in the following table.

Table 12-3. STOP Mode Operation Status

Item STOP Mode Operation Status

Clock generator Oscillation disabled

Port (output latch) Remains in the state before the selection of STOP mode.

8-bit timer 00 (TM00) Operation disabled

8-bit timer/event counter 01 (TM01) Operation enabled

Watchdog timer Operation disabled

USB function Operation enabled

Serial interface 10 Operation enabled

Key return Operation enabled

External interrupt Operation enabled

2. Operation is enabled only when the USB reset or Resume signal is received.
3. Operation is enabled only when an external clock is selected.
4. Operation is enabled only for pins set in key return mode register 00 (KRM00).
5. Maskable interrupt that is not masked

CPU Operation disabled

Page 184 of the NEC switch user manual — Figure 12-4. Releasing STOP Mode by Interrupt
Page 184 · click to enlarge
Page 184

CHAPTER 12 STANDBY FUNCTION

(2) Releasing STOP mode

The STOP mode can be released by the following two sources.

(a) Releasing by unmasked interrupt request

The STOP mode can be released by an unmasked interrupt request. In this case, if interrupts are enabled

to be acknowledged, vectored interrupt servicing is performed, after the oscillation stabilization time has

elapsed. If interrupt acknowledgement is disabled, the instruction at the next address is executed.

Figure 12-4. Releasing STOP Mode by Interrupt

Wait ( set time by OSTS)

Remark The broken lines indicate the case where the interrupt request that has released the standby

mode is acknowledged.

Show 11 more labels / short text on this page
STOP instruction · Standby release signal · Oscillation stabilization · STOP mode Operation · Operation · mode · wait status · mode · Oscillation · stops Oscillation Oscillation · Clock
Page 185 of the NEC switch user manual — <Control method>
Page 185 · click to enlarge
Page 185

CHAPTER 12 STANDBY FUNCTION

(b) Releasing by RESET input

When the STOP mode is released by the RESET signal, the reset operation is performed after the

oscillation stabilization time has elapsed.

Figure 12-5. Releasing STOP Mode by RESET Input

Wait (2 15 /f X5.46 ms)

RESET

Remarks 1. f XSystem clock oscillation frequency
2. The parenthesized values apply to operation at 6.0 MHz.

Table 12-4. Operation After Release of STOP Mode

Releasing Source MKxx IE Operation

Maskable interrupt request 0 0 Executes next address instruction

0 1 Executes interrupt servicing

1 × Retains STOP mode

RESET input — — Reset processing

×don’t care

(3) Cautions an executing STOP instruction

After the STOP instruction is executed in the SE0 state (USBDM = 0, USBDP = 0), the STOP mode cannot be

released by a USB reset/Resume detection interrupt (INTUSBRE).

Therefore, the following control should be performed.

<Control method>

Do not execute the STOP instruction in the SE0 state.

In addition, when executing the STOP instruction in the suspend mode, execute both the following two

software countermeasures.

  • Do not clear the USB reset/Resume detection interrupt request flag (USBREIF) between when the

suspend state is detected and when the STOP instruction is executed.

  • Clear the USB reset/Resume detection interrupt request flag (USBREIF) when the 8-bit timer that is used

as the 3 ms timer for suspend state detection is reset.

Show 12 more labels / short text on this page
STOP instruction · signal · Oscillation stabilization · STOP mode Operation · Reset period · Operation · wait status · mode · mode · Oscillation · Clock · stops Oscillation Oscillation
Page 186 of the NEC switch user manual — Figure 13-1. Block Diagram of Reset Function
Page 186 · click to enlarge
Page 186

CHAPTER 13 RESET FUNCTION

The following two operations are available to generate reset signals.

(1) External reset input via RESET pin

(2) Internal reset by inadvertent program loop time detected by watchdog timer

External and internal reset have no functional differences. In both cases, program execution starts at the address

at 0000H and 0001H by RESET input.

When a low level is input to the RESET pin or the watchdog timer overflows, a reset is applied and each of the

hardware is set to the status shown in Table 13-1. Each pin is high impedance during reset input or during the

oscillation stabilization time just after reset release.

When a high level is input to the RESET pin, the reset is released and program execution is started after the

oscillation stabilization time (2

15/fx) has elapsed. The reset applied by watchdog timer overflow is automatically

released after reset, and program execution is started after the oscillation stabilization time (2

15/fx) has elapsed (see

Figures 13-2 through 13-4.)

2. When the STOP mode is released by reset, the STOP mode contents are held during reset

input. However, the port pins become high impedance.

Figure 13-1. Block Diagram of Reset Function

RESET

Interrupt function Count clock

Show 5 more labels / short text on this page
Reset signal · Reset controller · Over- flow · Watchdog timer · Stop
Page 187 of the NEC switch user manual — RESET
Page 187 · click to enlarge
Page 187

CHAPTER 13 RESET FUNCTION

Figure 13-2. Reset Timing by RESET Input

Oscillation stabilization time wait

Reset period (oscillation stops)

Normal operation (reset processing)

RESET

Figure 13-3. Reset Timing by Overflow in Watchdog Timer

Oscillation stabilization time wait

Reset period (oscillation stops)

Normal operation (reset processing)

Overflow in watchdog timer

Figure 13-4. Reset Timing by RESET Input in STOP Mode

STOP instruction execution During normal operation

Oscillation stabilization time wait

Reset period (oscillation stops) Stop status (oscillation stops)

Normal operation (reset processing)

RESET

Show 13 more labels / short text on this page
During normal operation · Internal reset signal · Delay Delay · Hi-Z · Port pin · During normal operation · Internal reset signal · Hi-Z · Port pin · Internal reset signal · Delay Delay · Hi-Z · Port pin
Page 188 of the NEC switch user manual — CHAPTER 13 RESET FUNCTION
Page 188 · click to enlarge
Page 188

CHAPTER 13 RESET FUNCTION

Table 13-1. Hardware Status After Reset (1/2)

NEC switch — CHAPTER 13 RESET FUNCTION diagram (page 188)
Fig. 19

Transmit data bank address (USBT00 to USBT07, USBT10 to USBT17)

statuses become undefined.

All other hardware remains unchanged after reset.

2. The post-reset values are retained in the standby mode.
Page 189 of the NEC switch user manual — CHAPTER 13 RESET FUNCTION
Page 189 · click to enlarge
Page 189

CHAPTER 13 RESET FUNCTION

Table 13-1. Hardware Status After Reset (2/2)

NEC switch — CHAPTER 13 RESET FUNCTION diagram (page 189)
Fig. 20

USB function Data packet transmit byte number counter 0 (DTXCO0) 20H

Data packet transmit byte number counter 1 (DTXCO1) 30H

Page 190 of the NEC switch user manual — CHAPTER 14 uPD78F9801
Page 190 · click to enlarge
Page 190

CHAPTER 14 µPD78F9801

The µPD78F9801 is a product that substitutes flash memory for the internal ROM of the mask ROM version. The

differences between the µPD78F9801 and the mask ROM versions are shown in Table 14-1.

Table 14-1. Differences Between µPD78F9801 and Mask ROM Versions

Item Flash Memory Version Mask ROM Version

µPD78F9801 µPD789800

Internal memory ROM 16 KB (Flash memory) 8 KB

High-speed RAM 256 bytes

IC pin Not provided Provided

VPP pin Provided Not provided

Electrical specifications Refer to CHAPTER 16 ELECTRICAL SPECIFICATIONS.

mask ROM versions. When pre-producing an application set with the flash memory version

and then mass-producing it with the mask ROM version, be sure to conduct sufficient

evaluations for the commercial samples (not engineering samples) of the mask ROM version.

Page 191 of the NEC switch user manual — Figure 14-1. Environment for Writing Program to Flash Memory
Page 191 · click to enlarge
Page 191

CHAPTER 14 µPD78F9801

14.1 Flash Memory Characteristics

Flash memory programming is performed by connecting a dedicated flash programmer (Flashpro III (part no. FL-

PR3, PG-FP3)/Flashpro IV (part no. FL-PR4, PG-FP4)) to the target system with the µPD78F9801 mounted on the

target system (on-board). A flash memory program adapter (FA adapter), which is a target board used exclusively for

programming, is also provided.

Remark FL-PR3, FL-PR4, and the program adapter are products made by Naito Densei Machida Mfg. Co., Ltd.

(TEL +81-45-475-4191).

Programming using flash memory has the following advantages.

  • Software can be modified after the microcontroller is solder-mounted on the target system.
  • Distinguishing software facilities small-quantity, varied model production
  • Easy data adjustment when starting mass production

14.1.1 Programming environment

The following shows the environment required for µPD78F9801 flash memory programming.

When Flashpro III (part no. FL-PR3, PG-FP3) or Flashpro IV (part no. FL-PR4, PG-FP4) is used as a dedicated

flash programmer, a host machine is required to control the dedicated flash programmer. Communication between

the host machine and flash programmer is performed via RS-232C/USB (Rev. 1.1).

For details, refer the manuals for Flashpro III/Flashpro IV.

Remark USB is supported by Flashpro IV only.

Figure 14-1. Environment for Writing Program to Flash Memory

NEC switch — Figure 14-1. Environment for Writing Program to Flash Memory diagram (page 191)
Fig. 21 · Figure 14-1. Environment for Writing Program to Flas…

programmer · Host machine

Page 192 of the NEC switch user manual — Figure 14-2. Communication Mode Selection Format
Page 192 · click to enlarge
Page 192

CHAPTER 14 µPD78F9801

14.1.2 Communication mode

Use the communication mode shown in Table 14-2 to perform communication between the dedicated flash

programmer and µPD78F9801.

Table 14-2. Communication Mode List

Pins Used Number of VPP Pulses

Mode COMM PORT SIO Clock CPU Clock Flash Clock Multiple Rate

Optional 1 to 5 MHz Note 2 1.0 SI10/P22 SO10/P21 SCK10/P20

SIO ch-0 (3-wire, sync.)

100 Hz to 1.25 MHz Note 2

100 Hz to 1 kHz Optional 1 to 5 MHz Note 2 1.0 P10 (serial clock input) P11 (serial data output) P12 (serial data input)

Pseudo-3-wire Port A (pseudo- 3-wire)

PG-FP3)/Flashpro IV (part no. FL-PR4, PG-FP4)).

2. The possible setting range differs depending on the voltage. For details, refer to CHAPTER 16

ELECTRICAL SPECIFICATIONS.

Figure 14-2. Communication Mode Selection Format

V DD V PP

V SS

V DD

V SS RESET

Show 4 more labels / short text on this page
TYPE Setting · 3-wire serial I/O · 1 2 n · VPP pulses
Page 193 of the NEC switch user manual — Figure 14-3. Example of Connection with Dedicated Flash Programmer
Page 193 · click to enlarge
Page 193

CHAPTER 14 µPD78F9801

Figure 14-3. Example of Connection with Dedicated Flash Programmer

(a) 3-wire serial I/O

VPP1

V PP

VDD

V DD0 , V DD1

RESET

RESET

SCK

SCK10

SO

SI10

SI

SO10

GND

V SS0 , V SS1

(b) Pseudo-3-wire

VPP1

V PP

VDD

V DD0 , V DD1

RESET

RESET

SCK

P10

SO

P12

SI

P11

GND

V SS0 , V SS1

already connected to the X1 pin, the CLK pin does not need to be connected.

dedicated flash programmer. When using the power supply connected to the VDD pin, supply

voltage before starting programming.

Show 6 more labels / short text on this page
Dedicated flash programmer · PD78F9801 µ · CLKNote · Dedicated flash programmer · PD78F9801 µ · CLKNote X1
Page 194 of the NEC switch user manual — 14.1.2 Communication mode
Page 194 · click to enlarge
Page 194

CHAPTER 14 µPD78F9801

If Flashpro III (part no. FL-PR3, PG-FP3)/Flashpro IV is used as a dedicated flash programmer, the following

signals are generated for the µPD78F9801. For details, refer to the manual of Flashpro III/Flashpro IV.

Table 14-3. Pin Connection List

NEC switch — 14.1.2 Communication mode diagram (page 194)
Fig. 22 · 14.1.2 Communication mode

Signal Name I/O Pin Function Pin Name 3-Wire Serial I/O Pseudo-3-Wire

VDD I/O VDD voltage generation/voltage monitoring VDD0, VDD1

Remark : Pin must be connected.

: If the signal is supplied on the target board, pin does not need to be connected.

×: Pin does not need to be connected.

Page 195 of the NEC switch user manual — V PP
Page 195 · click to enlarge
Page 195

CHAPTER 14 µPD78F9801

14.1.3 On-board pin processing

When performing programming on the target system, provide a connector on the target system to connect the

dedicated flash programmer.

An on-board function that allows switching between normal operation mode and flash memory programming mode

may be required in some cases.

In normal operation mode, input 0 V to the VPP pin. In flash memory programming mode, a write voltage of 10.0 V

(TYP.) is supplied to the VPP pin, so perform either of the following.

(1) Connect a pull-down resistor (RVPP = 10 kΩ) to the VPP pin.

(2) Use the jumper on the board to switch the VPP pin input to either the writer or directly to GND.

A VPP pin connection example is shown below.

Figure 14-4. V PP Pin Connection Example

PD78F9801

Connection pin of dedicated flash programmer

V PP

Pull-down resistor (RVPP)

The following shows the pins used by the serial interface.

Serial Interface Pins Used

3-wire serial I/O SI10, SO10, SCK10

Pseudo-3-wire P12, P11, P10

When connecting the dedicated flash programmer to a serial interface pin that is connected to another device on-

board, signal conflict or abnormal operation of the other device may occur. Care must therefore be taken with

such connections.

· µ ·

Page 196 of the NEC switch user manual — PD78F9801
Page 196 · click to enlarge
Page 196

CHAPTER 14 µPD78F9801

(1) Signal conflict

If the dedicated flash programmer (output) is connected to a serial interface pin (input) that is connected to

another device (output), a signal conflict occurs. To prevent this, isolate the connection with the other

device or set the other device to the output high impedance status.

Figure 14-5. Signal Conflict (Input Pin of Serial Interface)

Connection pin of dedicated flash programmer

In the flash memory programming mode, the signal output by another device and the signal sent by the dedicated flash programmer conflict; therefore, isolate the signal of the other device.

(2) Abnormal operation of other device

If the dedicated flash programmer (output or input) is connected to a serial interface pin (input or output)

that is connected to another device (input), a signal is output to the device, and this may cause an abnormal

operation. To prevent this abnormal operation, isolate the connection with the other device or set so that the

input signals to the other device are ignored.

Figure 14-6. Abnormal Operation of Other Device

PD78F9801

Connection pin of dedicated flash programmer

If the signal output by the PD78F9801 affects another device in the flash memory programming mode, isolate the signals of the other device.

PD78F9801

Connection pin of dedicated flash programmer

If the signal output by the dedicated flash programmer affects another device in the flash memory programming mode, isolate the signals of the other device.

Show 14 more labels / short text on this page
PD78F9801 µ · Signal conflict · Input pin · Other device · Output pin · µ · Pin · Other device · Input pin · µ · µ · Pin · Other device · Input pin
Page 197 of the NEC switch user manual — RESET
Page 197 · click to enlarge
Page 197

CHAPTER 14 µPD78F9801

If the reset signal of the dedicated flash programmer is connected to the RESET pin connected to the reset signal

generator on-board, a signal conflict occurs. To prevent this, isolate the connection with the reset signal

generator.

If the reset signal is input from the user system in the flash memory programming mode, a normal programming

operation cannot be performed. Therefore, do not input reset signals from other than the dedicated flash

programmer.

Figure 14-7. Signal Conflict (RESET Pin)

Connection pin of dedicated flash programmer

RESET

The signal output by the reset signal generator and the signal output from the dedicated flash programmer conflict in the flash memory programming mode, so isolate the signal of the reset signal generator.

When the µPD78F9801 enters the flash memory programming mode, all the pins other than those that

communicate with flash programmer are in the same status as immediately after reset.

If the external device does not recognize initial statuses such as the output high impedance status, therefore,

connect the external device to VDD0, VDD1, VSS0, or VSS1 via a resistor.

When using the on-board clock, connect X1 and X2 as required in the normal operation mode.

When using the clock output of the flash programmer, connect it directly to X1, disconnecting the main resonator

on-board, and leave the X2 pin open.

To use the power output from the flash programmer, connect the VDD0 and VDD1 pins to VDD of the flash

programmer, and the VSS0 and VSS1 pins to GND of the flash programmer.

To use the on-board power supply, make connections in accordance with the normal operation mode. However,

because the voltage is monitored by the flash programmer, be sure to connect VDD of the flash programmer.

Process the other pins (USBDP, USBDM, REGC) in the same manner as in the normal operation mode.

Show 9 more labels / short text on this page
<RESET pin> · PD78F9801 µ · Signal conflict · Reset signal generator · Output pin · <Port pins> · <Resonator> · <Power supply> · <Other pins>
Page 198 of the NEC switch user manual — SI SO SCK CLKOUT RESET VPP RESERVE/HS
Page 198 · click to enlarge
Page 198

CHAPTER 14 µPD78F9801

14.1.4 Connection of adapter for flash writing

The following figure shows an example of recommended connection when the adapter for flash writing is used.

Figure 14-8. Wiring Example for Flash Writing Adapter with 3-Wire Serial I/O

VDD (4.0 to 5.5 V)

GND

VDD2(LVDD)

GND VDD

44 43 42 41 40 39 38 37 36 35 34

PD78F9801

12 13 14 15 16 17 18 19 20 21 22 23

SI SO SCK CLKOUT RESET VPP RESERVE/HS

WRITER INTERFACE FRASH

µ

Page 199 of the NEC switch user manual — SI SO SCK CLKOUT RESET VPP RESERVE/HS
Page 199 · click to enlarge
Page 199

CHAPTER 14 µPD78F9801

Figure 14-9. Wiring Example for Flash Writing Adapter with Pseudo-3-Wire Method

VDD (4.0 to 5.5 V)

GND

VDD2(LVDD)

GND VDD

44 43 42 41 40 39 38 37 36 35 34

PD78F9801

12 13 14 15 16 17 18 19 20 21 22 23

SI SO SCK CLKOUT RESET VPP RESERVE/HS

WRITER INTERFACE FRASH

µ

Page 200 of the NEC switch user manual — Table 15-1. Operand Identifiers and Description Methods
Page 200 · click to enlarge
Page 200

CHAPTER 15 INSTRUCTION SET

This chapter lists the instruction set of the µPD789800 Subseries. For details of the operation and machine

language (instruction code) of each instruction, refer to 78K/0S Series Instruction User’s Manual (U11047E).

15.1 Operation

15.1.1 Operand identifiers and description methods

Operands are described in the “Operands” column of each instruction in accordance with the description method

of the instruction operand identifier (see the assembler specifications for details). When there are two or more

description methods, select one of them. Uppercase letters and the symbols #, !, $, and [ ] are keywords and are

described as they are. Each symbol has the following meaning.

  • #: Immediate data specification
  • $: Relative address specification
  • !: Absolute address specification
  • [ ]: Indirect address specification

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

parentheses in the table below: R0, R1, R2, etc.) can be used for description.

Table 15-1. Operand Identifiers and Description Methods

X (R0), A (R1), C (R2), B (R3), E (R4), D (R5), L (R6), H (R7) AX (RP0), BC (RP1), DE (RP2), HL (RP3) Special-function register symbol

FE20H to FF1FH Immediate data or label FE20H to FF1FH Immediate data or label (even addresses only)

0000H to FFFFH Immediate data or label (only even addresses for 16-bit data transfer instructions) 0040H to 007FH Immediate data or label (even addresses only)

16-bit immediate data or label 8-bit immediate data or label 3-bit immediate data or label

Remark See Table 3-2 Special Function Register List for symbols of special function registers.

Show 5 more labels / short text on this page
Identifier Description Method · r rp sfr · saddr saddrp · addr16 addr5 · word byte bit
Page 201 of the NEC switch user manual — 15.1.3 Description of “flag operation” column
Page 201 · click to enlarge
Page 201

CHAPTER 15 INSTRUCTION SET

15.1.2 Description of “operation” column

A: A register; 8-bit accumulator

X: X register

B: B register

C: C register

D: D register

E: E register

H: H register

L: L register

AXAX register pair; 16-bit accumulator
BCBC register pair
DEDE register pair
HLHL register pair
PCProgram counter
SPStack pointer
PSWProgram status word
CYCarry flag
ACAuxiliary carry flag

Z: Zero flag

IEInterrupt request enable flag
NMISFlag indicating non-maskable interrupt servicing in progress
( )Memory contents indicated by address or register contents in parenthesis
x H , x LHigher 8 bits and lower 8 bits of 16-bit register
∧Logical product (AND)
∨Logical sum (OR)

V: Exclusive logical sum (exclusive OR)

: Inverted data

addr1616-bit immediate data or label
jdisp8Signed 8-bit data (displacement value)

15.1.3 Description of “flag operation” column

(Blank)Unchanged
0. Cleared to 0
1. Set to 1

x: Set/cleared according to the result

R: Previously saved value is restored

Page 202 of the NEC switch user manual — CHAPTER 15 INSTRUCTION SET
Page 202 · click to enlarge
Page 202

CHAPTER 15 INSTRUCTION SET

15.2 Operation List

NEC switch — CHAPTER 15 INSTRUCTION SET diagram (page 202)
Fig. 23

PSW,#byte 3 6 PSW ← byte × × ×

PSW,A 2 4 PSW ← 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).

Page 203 of the NEC switch user manual — CHAPTER 15 INSTRUCTION SET
Page 203 · click to enlarge
Page 203

CHAPTER 15 INSTRUCTION SET

NEC switch — CHAPTER 15 INSTRUCTION SET diagram (page 203)
Fig. 24

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 × × ×

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 × × ×

SUB 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) × × ×

Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control

register (PCC).

Page 204 of the NEC switch user manual — CHAPTER 15 INSTRUCTION SET
Page 204 · click to enlarge
Page 204

CHAPTER 15 INSTRUCTION SET

NEC switch — CHAPTER 15 INSTRUCTION SET diagram (page 204)
Fig. 25

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 ×

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) ×

Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control

register (PCC).

Page 205 of the NEC switch user manual — CHAPTER 15 INSTRUCTION SET
Page 205 · click to enlarge
Page 205

CHAPTER 15 INSTRUCTION SET

NEC switch — CHAPTER 15 INSTRUCTION SET diagram (page 205)
Fig. 26

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 × ×

DEC r 2 4 r ← r−1 × ×

saddr 2 4 (saddr) ← (saddr)−1 × ×

DECW rp 1 4 rp ← rp−1

ROR A,1 1 2 (CY,A7 ← A0, Am−1 ← Am)×1 ×

ROL A,1 1 2 (CY,A0 ← A7, Am+1 ← Am)×1 ×

RORC A,1 1 2 (CY ← A0, A7 ← CY, Am−1 ← Am)×1 ×

ROLC A,1 1 2 (CY ← A7, A0 ← CY, Am+1 ← Am)×1 ×

PSW.bit 3 6 PSW.bit ← 1 × × ×

PSW.bit 3 6 PSW.bit ← 0 × × ×

Remark One instruction clock cycle is one CPU clock cycle (fCPU) selected by the processor clock control

register (PCC).

Page 206 of the NEC switch user manual — MOVW SP, AX 2 8 SP ← AX
Page 206 · click to enlarge
Page 206

CHAPTER 15 INSTRUCTION SET

Mnemonic Operands Bytes Clocks Operation Flag

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), PSW ← (SP+2), SP ← SP+3, NMIS ← 0

R R R

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 $saddr16 2 6 PC ← PC+2+jdisp8 if CY=1

BNC $saddr16 2 6 PC ← PC+2+jdisp8 if CY=0

BZ $saddr16 2 6 PC ← PC+2+jdisp8 if Z=1

BNZ $saddr16 2 6 PC ← PC+2+jdisp8 if Z=0

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).

Page 207 of the NEC switch user manual — POP, DBNZ
Page 207 · click to enlarge
Page 207

CHAPTER 15 INSTRUCTION SET

15.3 Instructions Listed by Addressing Type

(1) 8-bit instructions

MOV, XCH, ADD, ADDC, SUB, SUBC, AND, OR, XOR, CMP, INC, DEC, ROR, ROL, RORC, ROLC, PUSH,

POP, DBNZ

NEC switch — POP, DBNZ diagram (page 207)
Fig. 27

#byte A r sfr saddr !addr16 PSW [DE] [HL] [HL+byte] $addr16 1 None

A ADD ADDC SUB SUBC AND OR XOR CMP

MOV XCH ADD ADDC SUB SUBC AND OR XOR CMP

MOV XCH ADD ADDC SUB SUBC AND OR XOR CMP

MOV XCH ADD ADDC SUB SUBC AND OR XOR CMP

saddr MOV ADD ADDC SUB SUBC AND OR XOR CMP

Page 208 of the NEC switch user manual — CHAPTER 15 INSTRUCTION SET
Page 208 · click to enlarge
Page 208

CHAPTER 15 INSTRUCTION SET

(2) 16-bit instructions

MOVW, XCHW, ADDW, SUBW, CMPW, PUSH, POP, INCW, DECW

NEC switch — CHAPTER 15 INSTRUCTION SET diagram (page 208)
Fig. 28
Page 209 of the NEC switch user manual — CALLT BR BC BNC BZ BNZ
Page 209 · click to enlarge
Page 209

CHAPTER 15 INSTRUCTION SET

(4) Call instructions/branch instructions

CALL, CALLT, BR, BC, BNC, BZ, BNZ, DBNZ

AX !addr16 [addr5] $addr16

Basic Instructions BR CALL BR

CALLT BR BC BNC BZ BNZ

(5) Other instructions

RET, RETI, NOP, EI, DI, HALT, STOP

2nd Operand · 1st Operand · Compound Instructions DBNZ

Page 210 of the NEC switch user manual — 4.0 V V DD
Page 210 · click to enlarge
Page 210

CHAPTER 16 ELECTRICAL SPECIFICATIONS

Absolute Maximum Ratings (T A = 25 ° C)

NEC switch — CHAPTER 16 ELECTRICAL SPECIFICATIONS diagram (page 210)
Fig. 29

VDD −0.3 to +6.5 V Supply voltage

Input voltage VI −0.3 to VDD + 0.3

Output voltage VO −0.3 to VDD + 0.3

Per pin −10 mA Output current, high IOH

Per pin 30 mA Output current, low IOL

In normal operation mode −40 to +85 °C Operating ambient temperature TA

During flash memory programming 10 to 40 °C

Mask ROM version −65 to +150 °C Storage temperature Tstg

flash memory is written.

  • When supply voltage rises

VPP must exceed VDD 10 µs or more after VDD has reached the lower-limit value (4.0 V) of the

operating voltage range (see a in the figure below).

  • When supply voltage drops

VDD must be lowered 10 µs or more after VPP falls below the lower-limit value (4.0 V) of the operating

voltage range of VDD (see b in the figure below).

NEC switch — CHAPTER 16 ELECTRICAL SPECIFICATIONS diagram (page 210)
Fig. 30

4.0 V V DD

V PP

2. Must be 6.5 V or lower

any parameter. That is, the absolute maximum ratings are rated values at which the product is

on the verge of suffering physical damage, and therefore the product must be used under

conditions that ensure that the absolute maximum ratings are not exceeded.

Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port

pins.

Page 211 of the NEC switch user manual — CHAPTER 16 ELECTRICAL SPECIFICATIONS
Page 211 · click to enlarge
Page 211

CHAPTER 16 ELECTRICAL SPECIFICATIONS

System Clock Oscillation Circuit Characteristics (TA = −40 to +85°C, VDD = 4.0 to 5.5 V)

NEC switch — CHAPTER 16 ELECTRICAL SPECIFICATIONS diagram (page 211)
Fig. 31

Resonator Recommended Circuit Parameter Conditions MIN. TYP. MAX. Unit

X1 input high-low-level width (tXH, tXL)

time.

2. Time required to oscillation after reset or STOP mode release. Use a resonator that can stabilize

oscillation before the oscillation stabilization time elapses.

in the above figure to avoid an adverse effect from wiring capacitance.

  • Keep the wiring length as short as possible.
  • Do not cross the wiring with 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 V SS0 .
  • Do not ground the capacitor to a ground pattern through which a high current flows.
  • Do not fetch signals from the oscillator.

Remark For the resonator selection and oscillator constant, customers are required to either evaluate the

oscillation themselves or apply to the resonator manufacturer for evaluation.

Flash Memory Write/Erase Characteristics (TA = 10 to 40°C, VDD = 4.0 to 5.5 V) (µPD78F9801 only)

NEC switch — CHAPTER 16 ELECTRICAL SPECIFICATIONS diagram (page 211)
Fig. 32

Write current (VDD pin) IDDW When VPP supply voltage = VPP1 (in 6.0 MHz operation mode)

Write current (VPP pin) IPPW When VPP supply voltage = VPP1 7.5 mA

Erase current (VDD pin) IDDE When VPP supply voltage = VPP1 (in 6.0 MHz operation mode)

Erase current (VPP pin) IPPE When VPP supply voltage = VPP1 100 mA

Unit erase time ter 1 1 1 s

Write count Erase/write are regarded as 1 cycle. 1 Times

VPP0 In normal operation 0 0.2VDD V VPP supply voltage

VPP1 During flash memory programming 9.7 10.0 10.3 V

included.

Page 212 of the NEC switch user manual — V IL3 X1 0 0.1 V
Page 212 · click to enlarge
Page 212

CHAPTER 16 ELECTRICAL SPECIFICATIONS

DC Characteristics (TA = −40 to +85°C, VDD = 4.0 to 5.5 V) (1/2)

Parameter Symbol Conditions MIN. TYP. MAX. Unit

Per pin −1 mA Output current, high IOH

Total for all pins −15 mA

Per pin 10 mA Output current, low IOL

Total for all pins 80 mA

VIH1 P00 to P07, P10 to P17 0.7VDD VDD V

VIH2 RESET, P20 to P26, P40 to P47 0.8VDD VDD V

VIH3 X1 VDD − 0.1 VDD V

VIH4 USBDM, USBDP TA = 0 to +70°C 2.0 3.6 V

VIL1 P00 to P07, P10 to P17 0 0.3VDD V

VIL2 RESET, P20, P22, P40 to P47 0 0.2VDD V

V IL3 X1 0 0.1 V

VIL4 USBDM, USBDP TA = 0 to +70°C 0 0.8 V

IO = −1 mA VDD − 1.0 V Output voltage, high

VOH1 Pins other than USBDM and USBDP

VOH2 USBDM, USBDP TA = 0 to +70°C, RL = 15 kΩ (connected to VSS)

IO = 10 mA 1.0 V Output voltage, low

VOL1 Pins other than USBDM and USBDP

VOL2 USBDM, USBDP TA = 0 to +70°C, RL = 15 kΩ (connected to VDD)

Input leakage current, high

ILIH1 Pins other than X1, X2, USBDM, and USBDP

VI = VDD 3 µA

ILIH2 X1, X2 VI = VDD 20 µA

ILIH3 USBDM, USBDP TA = 0 to +70°C

0 V ≤ VI ≤ VREG 10 µA

Input leakage current, low

ILIL1 Pins other than X1, X2, USBDM, and USBDP

VI = 0 V −3 µA

ILIL2 X1, X2 VI = 0 V −20 µA

ILIL3 USBDM, USBDP TA = 0 to +70°C

0 V ≤ VI ≤ VREG −10 µA

Output leakage current, high ILOH VO = 0 V 3 µA

Output leakage current, low ILOL VO = 0 V −3 µA

Software pull-up resistance R VI = 0 V 50 100 200 kΩ

Regulator output voltage VREG IO = 0 to −3 mA 3.0 3.3 3.6 V

Remark Unless specified otherwise, the characteristics of alternate-function pins are the same as those of port

pins.

Input voltage, high · Input voltage, low

Page 213 of the NEC switch user manual — 00H)
Page 213 · click to enlarge
Page 213

CHAPTER 16 ELECTRICAL SPECIFICATIONS

DC Characteristics (TA = −40 to +85°C, VDD = 4.0 to 5.5 V) (2/2)

Parameter Symbol Conditions MIN. TYP. MAX. Unit

IDD1 6.0 MHz crystal oscillation (operating mode)

1.5 3.0 mA

IDD2 6.0 MHz crystal oscillation (HALT mode)

0.5 1.1 mA

IDD3 STOP mode

When the USB function is disabled

10 30 µA

When the USB function is enabled (TA = 0 to +70°C)

50 100 µA

IDD1 6.0 MHz crystal oscillation (operating mode)

5.0 10.0 mA

IDD2 6.0 MHz crystal oscillation (HALT mode)

1.5 3.5 mA

IDD3 STOP mode

When the USB function is disabled

10 30 µA

When the USB function is enabled (TA = 0 to +70°C)

50 100 µA

2. During high-speed mode operation (when the processor clock control register (PCC) is cleared to

00H)

Show 4 more labels / short text on this page
Supply current · (Mask ROM Version) · Supply current · (µPD78F9801)
Page 214 of the NEC switch user manual — (2) Serial interface
Page 214 · click to enlarge
Page 214

CHAPTER 16 ELECTRICAL SPECIFICATIONS

AC Characteristics

(1) Basic operations (TA = −40 to +85°C, VDD = 4.0 to 5.5 V)

NEC switch — CHAPTER 16 ELECTRICAL SPECIFICATIONS diagram (page 214)
Fig. 33

When PCC = 00H (fX = 6.0 MHz) 0.333 0.333 0.333 µs Cycle time (minimum instruction execution time)

When PCC = 02H (fX = 6.0 MHz) 1.333 1.333 1.333 µs

tINTH, tINTL INTP0 10 µs

RESET input low-level width tRSL 10 µs

(2) Serial interface

(a) USB function (TA = 0 to +70°C, VDD = 4.0 to 5.5 V)

NEC switch — (2) Serial interface diagram (page 214)
Fig. 34 · (2) Serial interface

tR and tF matching tRFM tR/tF 80 120 %

Data transfer rate tDRATE When the microcontroller operates at the system clock (fX) of 6.0 MHz

tUDJ1 Upon transferring the next bit −95 0 95 ns Transmission differential signal jitter tUDJ2 Upon transferring the bit following the next bit −150 0 150 ns

Transmission EOP width tEOPT1 1.25 1.33 1.50 µs

tEOPR1 EOP width to be eliminated 300 µs Reception EOP width

tEOPR2 EOP width to be detected 675 µs

tURES1 USB reset width to be eliminated 2.5 µs Reception USB reset width

tURES2 USB reset width to be detected 5.5 µs

Page 215 of the NEC switch user manual — (ii) SCK10 ...External clock output
Page 215 · click to enlarge
Page 215

CHAPTER 16 ELECTRICAL SPECIFICATIONS

(b) 3-wire serial I/O mode (TA = −40 to +85°C, VDD = 4.0 to 5.5 V)

(i) SCK10 ...Internal clock output (when f X = 6.0 MHz)

NEC switch — (i) SCK10 ...Internal clock output (when f X = 6.0 MHz) diagram (page 215)
Fig. 35 · (i) SCK10 ...Internal clock output (when f X = 6.0 M…

SI10 setup time tSIK1 To SCK10 ↑ 150 ns

SO10 output delay tKSO1 From SCK10 ↓, CL = 100 pF

2. CL is the capacitance of the SO output line.

(ii) SCK10 ...External clock output

NEC switch — (ii) SCK10 ...External clock output diagram (page 215)
Fig. 36 · (ii) SCK10 ...External clock output

SO10 output delay tKSO2 From SCK10 ↓, CL = 100 pF

Page 216 of the NEC switch user manual — INTP0
Page 216 · click to enlarge
Page 216

CHAPTER 16 ELECTRICAL SPECIFICATIONS

AC Timing Measurement Points (Except X1 Input and USB Function)

0.8V DD

0.8V DD

0.2V DD

0.2V DD

Clock timing

tXL tXH

V IH3 (MIN.)

V IL3 (MAX.)

TI Timing

tTIL tTIH

TI01

Interrupt Input Timing

tINTL tINTH

INTP0

RESET Input Timing

RESET

Show 5 more labels / short text on this page
Measurement points · 1/fX · X1 input · 1/fTI · tRSL
Page 217 of the NEC switch user manual — SI10
Page 217 · click to enlarge
Page 217

CHAPTER 16 ELECTRICAL SPECIFICATIONS

Serial Transfer Timing

USB function:

USBDM and USBDP rise/fall time

0.9V DD

USBDM, USBDP

0.1V DD

Transmission differential signal jitter

Next bit Bit following the next bit

USBDM, USBDP

tUDJ1 tUDJ2

Differential output signal cross-over point, transmission EOP width, reception EOP width, and reception

USB reset width

USBDM, USBDP V CRS

tEOPT1, tEOPRm, tURESm

m = 1, 2

3-wire serial I/O mode:

tKLm tKHm

0.8V DD

SCK10

0.2V DD

tSIKm tKSIm

SI10

SO10

m = 1, 2

Show 8 more labels / short text on this page
tR · tF · 1,333 ns · 667 ns · tKCYm · Input data · tKSOm · Output data
Page 218 of the NEC switch user manual — Data Hold timing (STOP Mode Release by RESET )
Page 218 · click to enlarge
Page 218

CHAPTER 16 ELECTRICAL SPECIFICATIONS

Data Memory STOP Mode Low Supply Voltage Data Retention Characteristics (TA = −40 to +85°C)

Item Symbol Conditions MIN. TYP. MAX. Unit

Data hold supply voltage VDDDR 4.0 5.5 V

Release signal set time tSREL 0 µs

Release by RESET 2 15/fX ms Oscillation stabilization time

Release by interrupt request Note 2 ms

unstable upon the start of oscillation.

2. 2 12 /f X , 2 15 /f X , or 2 17 /f X can be selected according to the setting of bits 0 to 2 (OSTS0 to OSTS2) of the

oscillation stabilization time selection register.

Remark f XSystem clock oscillation frequency

Data Hold timing (STOP Mode Release by RESET )

V DD

V DDDR

RESET

Data Hold Timing (Standby Release Signal: STOP Mode Release by Interrupt Signal)

V DD

V DDDR

Standby release signal (interrupt request)

Show 16 more labels / short text on this page
tWAIT · Internal reset operation · HALT mode · STOP mode · Operating mode · Data hold mode · tSREL · STOP instruction execution · tWAIT · HALT mode · STOP mode · Operating mode · Data hold mode · tSREL · STOP instruction execution · tWAIT
Page 219 of the NEC switch user manual — S44GB-80-8ES-2
Page 219 · click to enlarge
Page 219

CHAPTER 17 PACKAGE DRAWINGS

44 PIN PLASTIC LQFP (10x10)

A

B

detail of lead end

S

P

T

C D

R

44 1 12 11

U

Q

F

J

G

I H

M

K

M

N

S S

ITEM MILLIMETERS

NOTE

A 12.0 ± 0.2

Each lead centerline is located within 0.20 mm of its true position (T.P.) at maximum material condition.

B 10.0 ± 0.2

C 10.0 ± 0.2

D 12.0 ± 0.2

F

G

+0.08 −0.07

H

J

0.8 (T.P.)

K

1.0±0.2

+0.03 −0.06

M 0.17

N

P 1.4 ± 0.05

Q 0.1 ± 0.05

R 3 °

+4° −3°

S

1.6 MAX.

T

0.25 (T.P.)

U

0.6±0.15

S44GB-80-8ES-2

33 34 22

Page 220 of the NEC switch user manual — WS60-00-1
Page 220 · click to enlarge
Page 220

CHAPTER 18 RECOMMENDED SOLDERING CONDITIONS

The µPD789800 Subseries should be soldered and mounted under the following recommended conditions.

For details of the recommended soldering conditions, refer to the document Semiconductor Device Mounting

Technology Manual (C10535E).

For soldering methods and conditions other than those recommended below, contact an NEC Electronics sales

representative.

Table 18-1. Surface Mounting Type Soldering Conditions

µPD789800GB-×××-8ES: 44-pin plastic LQFP (10 × 10)

µ PD78F9801GB-8ES44-pin plastic LQFP (10 × 10)

Soldering Method Soldering Conditions Symbol

Infrared reflow Package peak temperature235°C, Time: 30 seconds max. (at 210°C or higher), Count: Twice or less

IR35-00-2

VPS Package peak temperature215°C, Time: 40 seconds max. (at 200 °C or higher), Count: Twice or less

VP15-00-2

Wave soldering Solder bath temperature: 260°C max., Time: 10 seconds max., Count: Once, Preheating temperature: 120°C max. (package surface temperature)

WS60-00-1

Partial heating method Pin temperature300°C max. Time: 3 seconds max. (per pin row) −
Page 221 of the NEC switch user manual — APPENDIX A DEVELOPMENT TOOLS
Page 221 · click to enlarge
Page 221

APPENDIX A DEVELOPMENT TOOLS

The following development tools are available for development of systems using the µPD789800 Subseries.

Figure A-1 shows the development tools.

  • Support of the PC98-NX series

Unless otherwise stated, the µPD789800 Subseries, which is supported by IBM PC/AT™ and compatibles, can

be used for the PC98-NX series. When using the PC98-NX series, refer to the descriptions of IBM PC/AT and

compatibles.

  • Windows

Unless otherwise stated, “Windows” indicates the following OSs.

  • Windows 3.1
  • Windows 95, 98, 2000
  • Windows NT

TM Ver.4.0

Page 222 of the NEC switch user manual — · Integrated debugger · System simulator
Page 222 · click to enlarge
Page 222

APPENDIX A DEVELOPMENT TOOLS

Figure A-1. Development Tools

· Software package

· Assembler package · C compiler package · Device file · C library source fileNote 1

· Integrated debugger · System simulator

Control software · Project Manager

(Windows version only)Note 2

Flash memory writing environment

Flash memory writing adapter

Conversion socket or conversion adapter

2. Project Manager is included in the assembler package.

Project Manager is used only in the Windows environment.

Show 13 more labels / short text on this page
Software package · Language processing software · Debugging software · Host machine · (PC or EWS) · Interface adapter · Power supply unit · In-circuit emulator · Flash programmer · Emulation board · Flash memory · Emulation probe · Target system
Page 223 of the NEC switch user manual — CC78K0S-L
Page 223 · click to enlarge
Page 223

APPENDIX A DEVELOPMENT TOOLS

A.1 Software Package

Software tools for development of the 78K/0S Series are combined in this package. The following tools are included. RA78K0S, CC78K0S, ID78K0S-NS, SM78K0S, and device files

Part numberµ S ×××× SP78K0S

Remark ×××× in the part number differs depending on the OS used.

µS××××SP78K0S

×××× Host Machine OS Supply Medium

AB17 Japanese Windows CD-ROM

PC-9800 series, IBM PC/AT compatibles English Windows

BB17

A.2 Language Processing Software

Program that converts a program written in mnemonic into object codes that can be executed by a microcontroller. In addition, automatic functions to generate a symbol table and optimize branch instructions are also provided. Used in combination with a device file (DF789801) (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 C compiler package

Program that converts a program written in C language into object codes that can be executed by a microcontroller. Used in combination with an assembler package (RA78K0S) and device file (DF789801) (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

DF789801

File containing information inherent to the device. Used in combination with the RA78K0S, CC78K0S, ID78K0S-NS, and SM78K0S (all sold separately).

Part numberµ S ×××× DF789801

CC78K0S-L

Source file of functions for generating the object library included in the C compiler package. Necessary for changing the object library included in the C compiler package according to the customer’s specifications. Since this is a source file, its working environment does not depend on any particular operating system.

C library source file

Part numberµ S ×××× CC78K0S-L
2. CC78K0S-L is not included in the software package (SP78K0S).

SP78K0S Software package · RA78K0S Assembler package · Device file

Page 224 of the NEC switch user manual — A.4 Flash Memory Writing Tools
Page 224 · click to enlarge
Page 224

APPENDIX A DEVELOPMENT TOOLS

Remark ×××× in the part number differs depending on the host machine and operating system to be used.

µS××××RA78K0S

µS××××CC78K0S

NEC switch — APPENDIX A DEVELOPMENT TOOLS diagram (page 224)
Fig. 37

µS××××DF789801

µS××××CC78K0S-L

NEC switch — APPENDIX A DEVELOPMENT TOOLS diagram (page 224)
Fig. 38

A.3 Control Software

NEC switch — A.3 Control Software diagram (page 224)
Fig. 39 · A.3 Control Software

Project Manager Control software created for efficient development of the user program in the Windows environment. User program development operations such as editor startup, build, and debugger startup can be performed from the Project Manager.

The Project Manager is included in the assembler package (RA78K0S).

The Project Manager is used only in the Windows environment.

A.4 Flash Memory Writing Tools

NEC switch — A.4 Flash Memory Writing Tools diagram (page 224)
Fig. 40 · A.4 Flash Memory Writing Tools

Flashpro III (FL-PR3, PG-FP3) Flashpro IV (FL-PR4, PG-FP4) Flash programmer

Adapter for writing to flash memory and connected to Flashpro III or Flashpro IV. FA-44GB-8ES: For 44-pin plastic LQFP (GB-8ES type)

Remark The FL-PR3, FL-PR4 and FA-44GB-8ES are products made by Naito Densei Machida Mfg. Co., Ltd.

(TEL +81-45-475-4191).

Page 225 of the NEC switch user manual — APPENDIX A DEVELOPMENT TOOLS
Page 225 · click to enlarge
Page 225

APPENDIX A DEVELOPMENT TOOLS

A.5 Debugging Tools (Hardware)

In-circuit emulator for debugging hardware and software of an application system using the 78K/0S Series. Supports a integrated debugger (ID78K0S-NS). Used in combination with an AC adapter, emulation probe, and interface adapter for connecting the host machine.

The IE-78K0S-NS-A provides a coverage function in addition to the IE-78K0S-NS functions, thus enhancing the debug functions, including the tracer and timer functions.

Adapter for supplying power from an AC 100 to 240 V outlet.

Adapter necessary when using PC-9800 series PC (except notebook type) as host machine (C bus supported)

IE-70000-CD-IF-A PC card interface

PC card and interface cable necessary when using notebook PC as host machine (PCMCIA socket supported)

Interface adapter necessary when using IBM PC/AT compatible as host machine (ISA bus supported)

Adapter necessary when using personal computer incorporating PCI bus as host machine

Board for emulating the peripheral hardware inherent to the device. Used in combination with an in-circuit emulator.

NP-44GB-TQ NP-H44GB-TQ Emulation probe

Cable to connect the in-circuit emulator and target system. Used in combination with the TGB-044SAP.

Conversion adapter to connect the NP-44GB-TQ or NP-H44GB-TQ and a target system board on which a 44-pin plastic LQFP (GB-8ES type) can be mounted

Remarks 1. The NP-44GB-TQ and NP-H44GB-TQ are products made by Naito Densei Machida Mfg. Co., Ltd.

(TEL +81-45-475-4191).

2. The TGB-044SAP is a product made by TOKYO ELETECH CORPORATION.

For further information, contact: Daimaru Kogyo, Ltd.

Tokyo Electronics Department (TEL +81-3-3820-7112)

Osaka Electronics Department (TEL +81-6-6244-6672)

Show 8 more labels / short text on this page
IE-78K0S-NS In-circuit emulator · IE-78K0S-NS-A In-circuit emulator · IE-70000-MC-PS-B AC adapter · IE-70000-98-IF-C Interface adapter · IE-70000-PC-IF-C Interface adapter · IE-70000-PCI-IF-A Interface adapter · IE-789801-NS-EM1 Emulation board · TGB-044SAP Conversion adapter
Page 226 of the NEC switch user manual — 3.5" 2HD FD
Page 226 · click to enlarge
Page 226

APPENDIX A DEVELOPMENT TOOLS

A.6 Debugging Tools (Software)

This debugger supports the in-circuit emulators IE-78K0S-NS and IE-78K0S-NS-A for the 78K/0S Series. The ID78K0S-NS is Windows-based software. It has improved C-compatible debugging functions and can display the results of tracing with the source program using an integrating window function that associates the source program, disassemble display, and memory display with the trace result. Used in combination with a device file (DF789801) (sold separately).

Part numberµ S ×××× ID78K0S-NS

This is a system simulator for the 78K/0S Series. The SM78K0S is Windows-based software. It can be used to debug the target system at C source level or assembler level while simulating the operation of the target system on the host machine. Using SM78K0S, the logic and performance of the application can be verified independently of hardware development. Therefore, the development efficiency can be enhanced and the software quality can be improved. Used in combination with a device file (DF789801) (sold separately).

Part numberµ S ×××× SM78K0S

DF789801

File containing information inherent to the device. Used in combination with the RA78K0S, CC78K0S, ID78K0S-NS, and SM78K0S (sold separately).

Part numberµ S ×××× DF789801

Remark ×××× in the part number differs depending on the operating system and supply medium to be used.

µS××××ID78K0S-NS

µS××××SM78K0S

×××× Host Machine OS Supply Medium

PC-9800 series IBM PC/AT compatibles

3.5" 2HD FD

CD-ROM

BB17

Show 7 more labels / short text on this page
ID78K0S-NS Integrated debugger · SM78K0S System simulator · Device file · AB13 Japanese Windows · BB13 English Windows · AB17 Japanese Windows · English Windows
Page 227 of the NEC switch user manual — TGB-044SAP
Page 227 · click to enlarge
Page 227

APPENDIX A DEVELOPMENT TOOLS

A.7 Notes on Target System Design

Figures A-2 and A-3 show the conditions when connecting the emulation probe to the conversion adapter. Follow

the configuration below and consider the shape of parts to be mounted on the target system when designing a

system.

Figure A-2. Distance Between In-Circuit Emulator and Conversion Adapter

In-circuit emulator IE-78K0S-NS or IE-78K0S-NS-A

CN1

Emulation probe NP-44GB-TQ, NP-H44GB-TQ

Conversion adapter:

TGB-044SAP

Remarks 1. NP-44GB-TQ and NP-H44GB-TQ are products of Naito Densei Machida Mfg. Co., Ltd.

2. TGB-044SAP is a product of TOKYO ELETECH CORPORATION.

Target system · Emulation board IE-789801-NS-EM1 · 170 mmNote

Page 228 of the NEC switch user manual — APPENDIX A DEVELOPMENT TOOLS
Page 228 · click to enlarge
Page 228

APPENDIX A DEVELOPMENT TOOLS

Figure A-3. Connection Condition of Target System (NP-H44GB-TQ)

NEC switch — APPENDIX A DEVELOPMENT TOOLS diagram (page 228)
Fig. 41

Remarks 1. NP-H44GB-TQ is a product of Naito Densei Machida Mfg. Co., Ltd.

2. TGB-044SAP is a product of TOKYO ELETECH CORPORATION.

Emulation board IE-789801-NS-EM1 · Target system

Page 229 of the NEC switch user manual — Table of contents
Page 229 · click to enlarge
Page 229

Table of contents

COVERp.1Major Revisions in This Editionp.6INTRODUCTIONp.7CHAPTER 1 GENERALp.211.1 Featuresp.211.2 Applicationsp.211.3 Ordering Informationp.211.4 Pin Configuration (Top View)p.221.5 78K/0S Series Lineupp.231.6 Block Diagramp.261.7 Functionsp.27CHAPTER 2 PIN FUNCTIONSp.282.1 List of Pin Functionsp.282.2 Pin Functionsp.302.2.1 P00 to P07 (Port 0)p.302.2.2 P10 to P17 (Port 1)p.302.2.3 P20 to P26 (Port 2)p.302.2.4 P40 to P47 (Port 4)p.312.2.5 RESET#p.312.2.6 X1, X2p.312.2.7 REGCp.312.2.8 USBDMp.312.2.9 USBDPp.312.2.10 VDD0, VDD1p.312.2.11 VSS0, VSS1p.312.2.12 VPP (uPD78F9801 only)p.322.2.13 IC (mask ROM version only)p.322.3 Pin I/O Circuits and Recommended Connection of Unused Pinsp.33CHAPTER 3 CPU ARCHITECTUREp.353.1 Memory Spacep.353.1.1 Internal program memory spacep.373.1.2 Internal data memory (internal high-speed RAM) spacep.373.1.3 Special function register (SFR) areap.373.1.4 Data memory addressingp.383.2 Processor Registersp.403.2.1 Control registersp.403.2.2 General-purpose registersp.433.2.3 Special function registers (SFRs)p.443.3 Instruction Address Addressingp.483.3.1 Relative addressingp.483.3.2 Immediate addressingp.493.3.3 Table indirect addressingp.503.3.4 Register addressingp.503.4 Operand Address Addressingp.513.4.1 Direct addressingp.513.4.2 Short direct addressingp.523.4.3 Special function register (SFR) addressingp.533.4.4 Register addressingp.543.4.5 Register indirect addressingp.553.4.6 Based addressingp.563.4.7 Stack addressingp.56CHAPTER 4 PORT FUNCTIONSp.574.1 Port Functionsp.574.2 Port Configurationp.594.2.1 Port 0p.604.2.2 Port 1p.614.2.3 Port 2p.624.2.4 Port 4p.684.3 Registers Controlling Port Functionp.694.4 Port Function Operationp.724.4.1 Writing to I/O portp.724.4.2 Reading from I/O portp.724.4.3 Arithmetic operation of I/O portp.72CHAPTER 5 CLOCK GENERATORp.735.1 Clock Generator Functionsp.735.2 Clock Generator Configurationp.735.3 Register Controlling Clock Generatorp.745.4 System Clock Oscillatorsp.755.4.1 System clock oscillatorp.755.4.2 Examples of incorrect resonator connectionp.765.4.3 Frequency dividerp.775.5 Clock Generator Operationp.775.6 Changing Setting of CPU Clockp.785.6.1 Time required for switching CPU clockp.785.6.2 Switching CPU clockp.78CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01p.796.1 Functions of 8-Bit Timer/Event Counters 00 and 01p.796.2 Configuration of 8-Bit Timer/Event Counters 00 and 01p.806.3 Registers Controlling 8-Bit Timer/Event Counters 00 and 01p.826.4 Operation of 8-Bit Timer/Event Counters 00 and 01p.856.4.1 Operation as interval timerp.856.4.2 Operation as external event counter (timer 01 only)p.876.4.3 Operation as square-wave output (timer 01 only)p.886.5 Notes on Using 8-Bit Timer/Event Counters 00 and 01p.90CHAPTER 7 WATCHDOG TIMERp.917.1 Watchdog Timer Functionsp.917.2 Watchdog Timer Configurationp.927.3 Registers Controlling Watchdog Timerp.937.4 Watchdog Timer Operationp.957.4.1 Operation as watchdog timerp.957.4.2 Operation as interval timerp.96CHAPTER 8 USB FUNCTIONp.978.1 USB Overviewp.978.2 USB Function Featuresp.988.3 USB Function Configurationp.988.4 Registers Controlling USB Functionp.1098.5 USB Function Operationp.1228.5.1 USB timer operationp.1228.5.2 Remote wakeup control operationp.1258.6 Interrupt Request from USB Functionp.1278.6.1 Interrupt sourcesp.1278.6.2 Cautions when using interruptsp.1298.7 USB Function Controlp.1308.7.1 Relationship between packets and operation modesp.1308.7.2 Interrupt servicing flowp.1368.8 USB Function Internal Circuit Operationsp.1408.8.1 Operation of transmit/receive pointerp.1408.8.2 Receive bank switching ID detection buffer operationp.1478.8.3 Sync detection/USBCLK detector operationp.1488.8.4 NRZI encoder operationp.1508.8.5 Bit stuffing/strip controller operationp.151CHAPTER 9 SERIAL INTERFACE 10p.1549.1 Functions of Serial Interface 10p.1549.2 Configuration of Serial Interface 10p.1559.3 Register Controlling Serial Interface 10p.1579.4 Operation of Serial Interface 10p.1599.4.1 Operation stop modep.1599.4.2 3-wire serial I/O modep.160CHAPTER 10 REGULATORp.162CHAPTER 11 INTERRUPT FUNCTIONSp.16311.1 Interrupt Function Typesp.16311.2 Interrupt Sources and Configurationp.16311.3 Registers Controlling Interrupt Functionp.16611.4 Interrupt Servicing Operationp.17111.4.1 Non-maskable interrupt acknowledgment operationp.17111.4.2 Maskable interrupt acknowledgment operationp.17311.4.3 Multiplexed interrupt servicingp.17511.4.4 Interrupt request holdp.177CHAPTER 12 STANDBY FUNCTIONp.17812.1 Standby Function and Configurationp.17812.1.1 Standby functionp.17812.1.2 Register controlling standby functionp.17912.2 Standby Function Operationp.18012.2.1 HALT modep.18012.2.2 STOP modep.183CHAPTER 13 RESET FUNCTIONp.186CHAPTER 14 uPD78F9801p.19014.1 Flash Memory Characteristicsp.19114.1.1 Programming environmentp.19114.1.2 Communication modep.19214.1.3 On-board pin processingp.19514.1.4 Connection of adapter for flash writingp.198CHAPTER 15 INSTRUCTION SETp.20015.1 Operationp.20015.1.1 Operand identifiers and description methodsp.20015.1.2 Description of “operation” columnp.20115.1.3 Description of “flag operation” columnp.20115.2 Operation Listp.20215.3 Instructions Listed by Addressing Typep.207CHAPTER 16 ELECTRICAL SPECIFICATIONSp.210CHAPTER 17 PACKAGE DRAWINGSp.219CHAPTER 18 RECOMMENDED SOLDERING CONDITIONSp.220A.1 Software Packagep.223A.2 Language Processing Softwarep.223A.3 Control Softwarep.224A.4 Flash Memory Writing Toolsp.224A.5 Debugging Tools (Hardware)p.225A.6 Debugging Tools (Software)p.226A.7 Notes on Target System Designp.227APPENDIX A DEVELOPMENT TOOLSp.221APPENDIX B REGISTER INDEXp.229B.1 Register Index (Alphabetic Order of Register Name)p.229B.2 Register Index (Alphabetic Order of Register Symbol)p.231APPENDIX C REVISION HISTORYp.233
Page 230 of the NEC switch user manual — Table of contents
Page 230 · click to enlarge
Page 230

Table of contents

COVERp.1Major Revisions in This Editionp.6INTRODUCTIONp.7CHAPTER 1 GENERALp.211.1 Featuresp.211.2 Applicationsp.211.3 Ordering Informationp.211.4 Pin Configuration (Top View)p.221.5 78K/0S Series Lineupp.231.6 Block Diagramp.261.7 Functionsp.27CHAPTER 2 PIN FUNCTIONSp.282.1 List of Pin Functionsp.282.2 Pin Functionsp.302.2.1 P00 to P07 (Port 0)p.302.2.2 P10 to P17 (Port 1)p.302.2.3 P20 to P26 (Port 2)p.302.2.4 P40 to P47 (Port 4)p.312.2.5 RESET#p.312.2.6 X1, X2p.312.2.7 REGCp.312.2.8 USBDMp.312.2.9 USBDPp.312.2.10 VDD0, VDD1p.312.2.11 VSS0, VSS1p.312.2.12 VPP (uPD78F9801 only)p.322.2.13 IC (mask ROM version only)p.322.3 Pin I/O Circuits and Recommended Connection of Unused Pinsp.33CHAPTER 3 CPU ARCHITECTUREp.353.1 Memory Spacep.353.1.1 Internal program memory spacep.373.1.2 Internal data memory (internal high-speed RAM) spacep.373.1.3 Special function register (SFR) areap.373.1.4 Data memory addressingp.383.2 Processor Registersp.403.2.1 Control registersp.403.2.2 General-purpose registersp.433.2.3 Special function registers (SFRs)p.443.3 Instruction Address Addressingp.483.3.1 Relative addressingp.483.3.2 Immediate addressingp.493.3.3 Table indirect addressingp.503.3.4 Register addressingp.503.4 Operand Address Addressingp.513.4.1 Direct addressingp.513.4.2 Short direct addressingp.523.4.3 Special function register (SFR) addressingp.533.4.4 Register addressingp.543.4.5 Register indirect addressingp.553.4.6 Based addressingp.563.4.7 Stack addressingp.56CHAPTER 4 PORT FUNCTIONSp.574.1 Port Functionsp.574.2 Port Configurationp.594.2.1 Port 0p.604.2.2 Port 1p.614.2.3 Port 2p.624.2.4 Port 4p.684.3 Registers Controlling Port Functionp.694.4 Port Function Operationp.724.4.1 Writing to I/O portp.724.4.2 Reading from I/O portp.724.4.3 Arithmetic operation of I/O portp.72CHAPTER 5 CLOCK GENERATORp.735.1 Clock Generator Functionsp.735.2 Clock Generator Configurationp.735.3 Register Controlling Clock Generatorp.745.4 System Clock Oscillatorsp.755.4.1 System clock oscillatorp.755.4.2 Examples of incorrect resonator connectionp.765.4.3 Frequency dividerp.775.5 Clock Generator Operationp.775.6 Changing Setting of CPU Clockp.785.6.1 Time required for switching CPU clockp.785.6.2 Switching CPU clockp.78CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 00 AND 01p.796.1 Functions of 8-Bit Timer/Event Counters 00 and 01p.796.2 Configuration of 8-Bit Timer/Event Counters 00 and 01p.806.3 Registers Controlling 8-Bit Timer/Event Counters 00 and 01p.826.4 Operation of 8-Bit Timer/Event Counters 00 and 01p.856.4.1 Operation as interval timerp.856.4.2 Operation as external event counter (timer 01 only)p.876.4.3 Operation as square-wave output (timer 01 only)p.886.5 Notes on Using 8-Bit Timer/Event Counters 00 and 01p.90CHAPTER 7 WATCHDOG TIMERp.917.1 Watchdog Timer Functionsp.917.2 Watchdog Timer Configurationp.927.3 Registers Controlling Watchdog Timerp.937.4 Watchdog Timer Operationp.957.4.1 Operation as watchdog timerp.957.4.2 Operation as interval timerp.96CHAPTER 8 USB FUNCTIONp.978.1 USB Overviewp.978.2 USB Function Featuresp.988.3 USB Function Configurationp.988.4 Registers Controlling USB Functionp.1098.5 USB Function Operationp.1228.5.1 USB timer operationp.1228.5.2 Remote wakeup control operationp.1258.6 Interrupt Request from USB Functionp.1278.6.1 Interrupt sourcesp.1278.6.2 Cautions when using interruptsp.1298.7 USB Function Controlp.1308.7.1 Relationship between packets and operation modesp.1308.7.2 Interrupt servicing flowp.1368.8 USB Function Internal Circuit Operationsp.1408.8.1 Operation of transmit/receive pointerp.1408.8.2 Receive bank switching ID detection buffer operationp.1478.8.3 Sync detection/USBCLK detector operationp.1488.8.4 NRZI encoder operationp.1508.8.5 Bit stuffing/strip controller operationp.151CHAPTER 9 SERIAL INTERFACE 10p.1549.1 Functions of Serial Interface 10p.1549.2 Configuration of Serial Interface 10p.1559.3 Register Controlling Serial Interface 10p.1579.4 Operation of Serial Interface 10p.1599.4.1 Operation stop modep.1599.4.2 3-wire serial I/O modep.160CHAPTER 10 REGULATORp.162CHAPTER 11 INTERRUPT FUNCTIONSp.16311.1 Interrupt Function Typesp.16311.2 Interrupt Sources and Configurationp.16311.3 Registers Controlling Interrupt Functionp.16611.4 Interrupt Servicing Operationp.17111.4.1 Non-maskable interrupt acknowledgment operationp.17111.4.2 Maskable interrupt acknowledgment operationp.17311.4.3 Multiplexed interrupt servicingp.17511.4.4 Interrupt request holdp.177CHAPTER 12 STANDBY FUNCTIONp.17812.1 Standby Function and Configurationp.17812.1.1 Standby functionp.17812.1.2 Register controlling standby functionp.17912.2 Standby Function Operationp.18012.2.1 HALT modep.18012.2.2 STOP modep.183CHAPTER 13 RESET FUNCTIONp.186CHAPTER 14 uPD78F9801p.19014.1 Flash Memory Characteristicsp.19114.1.1 Programming environmentp.19114.1.2 Communication modep.19214.1.3 On-board pin processingp.19514.1.4 Connection of adapter for flash writingp.198CHAPTER 15 INSTRUCTION SETp.20015.1 Operationp.20015.1.1 Operand identifiers and description methodsp.20015.1.2 Description of “operation” columnp.20115.1.3 Description of “flag operation” columnp.20115.2 Operation Listp.20215.3 Instructions Listed by Addressing Typep.207CHAPTER 16 ELECTRICAL SPECIFICATIONSp.210CHAPTER 17 PACKAGE DRAWINGSp.219CHAPTER 18 RECOMMENDED SOLDERING CONDITIONSp.220A.1 Software Packagep.223A.2 Language Processing Softwarep.223A.3 Control Softwarep.224A.4 Flash Memory Writing Toolsp.224A.5 Debugging Tools (Hardware)p.225A.6 Debugging Tools (Software)p.226A.7 Notes on Target System Designp.227APPENDIX A DEVELOPMENT TOOLSp.221APPENDIX B REGISTER INDEXp.229B.1 Register Index (Alphabetic Order of Register Name)p.229B.2 Register Index (Alphabetic Order of Register Symbol)p.231APPENDIX C REVISION HISTORYp.233
Page 231 of the NEC switch user manual — [P]
Page 231 · click to enlarge
Page 231

APPENDIX B REGISTER INDEX

B.2 Register Index (Alphabetic Order of Register Symbol)

[A]

ADRCMPToken address compare register...................................................................................... 107

[C]

CR00: 8-bit compare register 00 81

CR01: 8-bit compare register 01 81

CSIM10Serial operation mode register 10.................................................................................... 157

[D]

DIDCMPData/handshake PID compare register............................................................................ 108
DRXCONData/handshake packet receive byte number counter .................................................... 106
DRXRSLData/handshake packet receive result store register....................................................... 113
DTXCO0, DTXCO1Data packet transmit byte number counter...................................................................... 106
DTXRSVData packet transmit reservation register........................................................................ 115

[H]

HTXRSVHandshake packet transmit reservation register ............................................................. 116

[I]

IF0: Interrupt request flag register 0 167

IF1: Interrupt request flag register 1 167

INTM0: External interrupt mode register 0 168

[K]

KRM00: Key return mode register 00 170

[M]

MK0: Interrupt mask flag register 0 168

MK1: Interrupt mask flag register 1 168

[O]

OSTS: Oscillation settling time select register 179

[P]

P0: Port 0 60

P1: Port 1 61

P2: Port 2 62

P4: Port 4 68

PCC: Processor clock control register 74

PM0: Port mode register 0 69

PM1: Port mode register 1 69

PM2: Port mode register 2 69

PM4: Port mode register 4 69

POM0: Port output mode register 0 71

POM1: Port output mode register 1 71

Page 232 of the NEC switch user manual — [W]
Page 232 · click to enlarge
Page 232

APPENDIX B REGISTER INDEX

PU0: Pull-up resistor option register 0 70

[R]

REMWUPRemote wake-up control register ..................................................................................... 121

RXSTAT: Packet receive status register 111

[S]

SIO10: Transmit/receive shift register 10 155

[T]

TCL2: Timer clock select register 2 93

TIDCMP: Token PID compare register 106

TM00: 8-bit timer counter 00 81

TM01: 8-bit timer counter 01 81

TMC00: 8-bit timer mode control register 00 82

TMC01: 8-bit timer mode control register 01 83

TRXRSLToken packet receive result store register ....................................................................... 113

[U]

URXMODData/handshake packet receive mode register................................................................ 109

USBMOD: USB receiver enable register 109

USBPOB, USBPOW: Transmit/receive pointer 101

USBR0 to USBR7: Receive data address 103

USBRAL, USBRAH: Receive token address 102

USBRD: Receive data PID 103

USBRTP: Receive token PID 102

USBTCLUSB timer start reservation control register ..................................................................... 120

USBT00 to USBT07: Transmit data bank 0 address 104

USBT10 to USBT17: Transmit data bank 1 address 104

USBTD0: Transmit data PID bank 0 104

USBTD1: Transmit data PID bank 1 104

[W]

WDTM: Watchdog timer mode register 94

Page 233 of the NEC switch user manual — CHAPTER 1 GENERAL
Page 233 · click to enlarge
Page 233

APPENDIX C REVISION HISTORY

The revision history is described below. The “Applied to” column indicates the chapters in each edition.

Edition Major Revisions from Previous Edition Applied to:

Deletion of description “under development” for µPD789800, since it has been developed

Addition of GB-8ES type package

Modification of recommended connection of unused pins in type of input/output circuit for each pin

CHAPTER 2 PIN FUNCTIONS

Addition of illustration in direct addressing CHAPTER 3 CPU ARCHITECTURE

Addition of caution regarding operation of 8-bit compare register n (CR0n)

CHAPTER 6 8-BIT TIMER/EVENT COUNTER

Addition to setting method in description of operation as interval timer

Addition to setting method in description of operation as external event counter

Addition to setting method in description of operation as square wave output

Addition of the value of each register when SETUP received

CHAPTER 8 USB FUNCTION

Deletion of setting RXSTAT with a 1-bit memory manipulation instruction in description of packet receive status register (RXSTAT)

Modification of each bit of RXSTAT from reserved words to non-reserved words in packet receive status register format

Modification of note in Format of Packet Receive Status Register

Modification of flag names in Conditions in Transmit Reservation

Modification of contents in block diagram of regulator and USB driver/receiver CHAPTER 10 REGULATOR

Addition of caution regarding replacement of flash memory version with mask ROM version

CHAPTER 14 µPD78F9801

Modification of description from Flashpro II to Flashpro III in µPD78F9801

Addition of restrictions to pins used when pseudo 3-wire mode is selected as communication mode

Addition of setting example when Flashpro III (PG-FP3) is used

Whole appendix revised for supporting IE-78K0S-NS APPENDIX A DEVELOPMENT TOOLS

Addition of ordering information of MX78K0S in embedded software APPENDIX B EMBEDDED SOFTWARE

Deletion of CU-type and GB-3BS type packages

Deletion of indication “under development” for µPD78F9801

Modification of operating ambient temperature when flash memory is written in 1.1 Features

CHAPTER 1 GENERAL

Addition of outline of timer in 1.7 Functions

Modification of handling of REGC and VPP pins CHAPTER 2 PIN FUNCTIONS

Show 5 more labels / short text on this page
(1/2) · 2nd edition · Throughout · 3rd · Throughout
Page 234 of the NEC switch user manual — APPENDIX C REVISION HISTORY
Page 234 · click to enlarge
Page 234

APPENDIX C REVISION HISTORY

Edition Major Revisions from Previous Edition Applied to:

Correction of address values in Figure 3-1 Memory Map (µPD789800) and Figure 3-2 Memory Map (µPD78F9801)

CHAPTER 3 CPU ARCHITECTURE

Modification of Figure 5-3 External Circuit of System Clock Oscillator (b) External clock

CHAPTER 5 CLOCK GENERATOR

  • Modification of chapter composition
  • Standardization of buffer name indications as receive token bank, receive data bank, and transmit data banks 0 and 1
  • Addition of image diagrams for reception and transmission
  • Addition of register value for SETUP reception
  • Modification of description on data handshake packet receive mode register (URXMOD)
  • Addition of description on packet receive status register (RXSTAT) and modification of read-only bit
  • Addition of Note for token packet receive result store register (TRXRSL)
  • Addition of Caution for data packet transmit reservation register (DTXRSV)
  • Modification of description of bit 1 (DNAEN) of handshake packet transmit reservation register (HTXRSV)
  • Change of contents of 8.5.2 Remote wakeup control operation
  • Addition of Table 8-4 List of Sources of Interrupts from USB Function
  • Correction of incorrect flag name in 8.6 Interrupt Request from USB Function
  • Addition of description on USB reset/Resume detection interrupt (INTUSBRE)
  • Addition of 8.7 USB Function Control

CHAPTER 8 USB FUNCTION

Modification of Figure 10-1 Block Diagram of Regulator and USB Driver/Receiver and Cautions

CHAPTER 10 REGULATOR

Addition of Remark in Table 11-1 Interrupt Source List

CHAPTER 11 INTERRUPT FUNCTIONS

Addition of Caution 3 on watchdog timer interrupt to Figure 11-2 Format of Interrupt Request Flag Register

Addition of 12.2.2 STOP mode (3) Cautions on STOP instruction execution

CHAPTER 12 STANDBY FUNCTION

Revision of contents of flash memory programming as 14.1 Flash Memory Characteristics

CHAPTER 14 µPD78F9801

Addition of CHAPTER 16 ELECTRICAL SPECIFICATIONS CHAPTER 16 ELECTRICAL SPECIFICATIONS

Addition of CHAPTER 17 PACKAGE DRAWING CHAPTER 17 PACKAGE DRAWING

Addition of CHAPTER 18 RECOMMENDED SOLDERING CONDITIONS CHAPTER 18 RECOMMENDED SOLDERING CONDITIONS

Revision of APPENDIX A DEVELOPMENT TOOLS Deletion of embedded software and addition of notes on target system design

APPENDIX A DEVELOPMENT TOOLS

Addition of the revision contents in 3rd edition in APPENDIX C REVISION HISTORY

APPENDIX C REVISION HISTORY

(2/2) · 3rd

Ask about the NEC switch

Owners and our team usually reply within a day — and your question helps the next person too.

Add your email to get notified when it’s answered — no spam, ever.

0 questions
No questions yet about the NEC switch

Be the first to ask — other owners or our team will answer.

Original document

NEC switch manual PDF

234 pages·1.9 MB·Network Card·PDF
Click any page above to open it here
Page 1 / …
100%
Loading pages…