EN
Fujitsu logo
Official user manual

Fujitsu MB89202

436 pages·5.1 MB·Computer Hardware·PDF·ENDEFRITNLJA
Fujitsu MB89202
Table of Contents 232 sections CHAPTER 1 OVERVIEW · 1.1 Features of MB89202/F202RA Series · 1.2 MB89202/F202RA Series Product Lineup · 1.3 Differences between Models · … ShowHide
CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 1 of the Fujitsu MB89202 user manual — FUJITSU SEMICONDUCTOR CONTROLLER MANUAL
Page 1 · click to enlarge
Page 1

FUJITSU SEMICONDUCTOR CONTROLLER MANUAL

CM25-10153-2E

F 2 MC-8L

8-BIT MICROCONTROLLER MB89202/F202RA Series

HARDWARE MANUAL

Fujitsu MB89202 — FUJITSU SEMICONDUCTOR CONTROLLER MANUAL diagram (page 1)
Fig. 1
Page 2 of the Fujitsu MB89202 user manual
Page 2 · click to enlarge
Page 2
Page 2 of the Fujitsu MB89202 user manual
Page 3 of the Fujitsu MB89202 user manual — FUJITSU LIMITED
Page 3 · click to enlarge
Page 3

F 2 MC-8L

8-BIT MICROCONTROLLER MB89202/F202RA Series

HARDWARE MANUAL

Be sure to refer to the “Check Sheet” for the latest cautions on development.

“Check Sheet” is seen at the following support page

URL:http://www.fujitsu.com/global/services/microelectronics/product/micom/support/index.html

“Check Sheet” lists the minimal requirement items to be checked to prevent problems beforehand in system development.

FUJITSU LIMITED

Page 4 of the Fujitsu MB89202 user manual
Page 4 · click to enlarge
Page 4
Page 4 of the Fujitsu MB89202 user manual
Page 5 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 5 · click to enlarge
Page 5

PREFACE

  • Purpose of This Manual and Intended Reader

The MB89202/F202RA series was developed as one of the general-purpose products of the F2MC-8L family, which contains original 8-bit one-chip microcontrollers for use with ASICs (application specific ICs). The MB89202/F202RA series can be used in a wide range of products from consumer products to industrial products.

This manual explains the functions and operations of the MB89202/F202RA series for product development.

The F2MC-8L Programming Manual contains details of the programming instructions.

FUJITSU LIMITED.

  • Trademark

The company names and brand names herein are the trademarks or registered trademarks of their respective owners.

  • Structure of This Manual

This manual consists of the following 17 chapters and appendix.

CHAPTER 1 OVERVIEW

This chapter describes the features and basic specification of the MB89202/F202RA series.

CHAPTER 2 HANDLING DEVICES

This chapter describes the precautions to be taken when handling the MB89202/F202RA series.

CHAPTER 3 CPU

This chapter describes the functions and operation of the CPU.

CHAPTER 4 I/O PORTS

This chapter describes the functions and operation of the I/O ports.

CHAPTER 5 TIME-BASE TIMER

This chapter describes the functions and operation of the time-base timer.

CHAPTER 6 WATCHDOG TIMER

This chapter describes the functions and operation of the watchdog timer.

CHAPTER 7 8-BIT PWM TIMER

This chapter describes the functions and operation of the 8-bit PWM timer.

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

This chapter describes the functions and operation of the 8/16-bit capture timer/counter.

CHAPTER 9 12-BIT PPG TIMER

This chapter describes the functions and operation of the 12-bit PPG timer.

Page 6 of the Fujitsu MB89202 user manual — APPENDIX
Page 6 · click to enlarge
Page 6

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

This chapter describes the functions and operation of external interrupt circuit 1 (edge).

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

This chapter describes the functions and operation of external interrupt circuit 2 (level).

CHAPTER 12 A/D CONVERTER

This chapter describes the functions and operation of the A/D converter.

CHAPTER 13 UART

This chapter describes the functions and operation of UART.

CHAPTER 14 8-BIT SERIAL I/O

This chapter describes the functions and operation of the 8-bit serial I/O.

CHAPTER 15 BUZZER OUTPUT

This chapter describes the functions and operation of the buzzer output.

CHAPTER 16 WILD REGISTER FUNCTIONS

This chapter describes the functions and operation of the wild registers.

CHAPTER 17 FLASH MEMORY

This chapter describes the functions and operation of the flash memory.

APPENDIX

This appendix shows the I/O map and instructions list.

Page 7 of the Fujitsu MB89202 user manual
Page 7 · click to enlarge
Page 7
  • The contents of this document are subject to change without notice. Customers are advised to consult with sales representatives before ordering.
  • The information, such as descriptions of function and application circuit examples, in this document are presented solely for the purpose of reference to show examples of operations and uses of FUJITSU semiconductor device; FUJITSU does not warrant proper operation of the device with respect to use based on such information. When you develop equipment incorporating the device based on such information, you must assume any responsibility arising out of such use of the information. FUJITSU assumes no liability for any damages whatsoever arising out of the use of the information.
  • Any information in this document, including descriptions of function and schematic diagrams, shall not be construed as license of the use or exercise of any intellectual property right, such as patent right or copyright, or any other right of FUJITSU or any third party or does FUJITSU warrant non-infringement of any third-party's intellectual property right or other right by using such information. FUJITSU assumes no liability for any infringement of the intellectual property rights or other rights of third parties which would result from the use of information contained herein.
  • The products described in this document are designed, developed and manufactured as contemplated for general use, including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed and manufactured as contemplated (1) for use accompanying fatal risks or dangers that, unless extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for use requiring extremely high reliability (i.e., submersible repeater and artificial satellite). Please note that FUJITSU will not be liable against you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products.
  • Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and prevention of over-current levels and other abnormal operating conditions.
  • Exportation/release of any products described in this document may require necessary procedures in accordance with the regulations of the Foreign Exchange and Foreign Trade Control Law of Japan and/or US export control laws.
  • The company names and brand names herein are the trademarks or registered trademarks of their respective owners.

Copyright© 2005-2008 FUJITSU LIMITED All rights reserved

Page 8 of the Fujitsu MB89202 user manual — READING THIS MANUAL
Page 8 · click to enlarge
Page 8

READING THIS MANUAL

  • Example Notation of Register Names and Pin Names

❍Example notation of register names and bit names

By writing 1 into the sleep bit of the standby control register (STBC : SLP), ...

Register name Bit name

Prohibit the output of interrupt request of the time-base timer (TBTC : TBIE = 0).

If interrupt enabled (CCR : I = 1) is specified, the interrupt is accepted.

❍Example notation of multi-use pins

Some pins can switch functions according to a setting made by a program or other method. These pins are called multi-use pins. For multi-use pins, the names corresponding to functions are listed and divided by /.

Show 9 more labels / short text on this page
Bit abbreviation · Register abbreviation · Setting data · Bit abbreviation · Register abbreviation · Current state · Bit abbreviation · Register abbreviation · P33/EC pin
Page 9 of the Fujitsu MB89202 user manual — CONTENTS
Page 9 · click to enlarge
Page 9

CONTENTS

CHAPTER 1 OVERVIEW 1 1.1 Features of MB89202/F202RA Series 2 1.2 MB89202/F202RA Series Product Lineup 4 1.3 Differences between Models 6 1.4 Block Diagram of MB89202/F202RA Series 7 1.5 Pin Assignment 8 1.6 Package Dimensions 10 1.7 Pin Functions Description 12 1.8 I/O Circuit Types 14

CHAPTER 2 HANDLING DEVICES 17 2.1 Precautions on Handling Devices 18

CHAPTER 3 CPU 21 3.1 Memory Space 22 3.1.1 Specific-purpose Areas 24 3.1.2 Location of 16-bit Data on Memory 26 3.2 Dedicated Register 27 3.2.1 Condition Code Register (CCR) 29 3.2.2 Register Bank Pointer (RP) 31 3.3 General-Purpose Registers 32 3.4 Interrupts 34 3.4.1 Interrupt Level Setting Registers (ILR1 to ILR4) 36 3.4.2 Steps in the Interrupt Operation 37 3.4.3 Multiple Interrupts 39 3.4.4 Interrupt Processing Time 40 3.4.5 Stack Operation at Interrupt Processing 41 3.4.6 Stack Area for Interrupt Processing 42 3.5 Reset 43 3.5.1 Reset Flag Register (RSFR) 45 3.5.2 External Reset Pin 47 3.5.3 Reset Operation 48 3.5.4 State of Each Pin at Reset 50 3.6 Clock 51 3.6.1 Clock Generator 53 3.6.2 Clock Controller 54 3.6.3 System Clock Control Register (SYCC) 56 3.6.4 Clock Mode 58 3.6.5 Oscillation Stabilization Wait Time 60 3.7 Standby Mode (Low-Power Consumption Mode) 62 3.7.1 Operations in Standby Mode 63 3.7.2 Sleep Mode 64 3.7.3 Stop Mode 65

Page 10 of the Fujitsu MB89202 user manual
Page 10 · click to enlarge
Page 10

3.7.4 Standby Control Register (STBC) 66 3.7.5 Diagram for State Transition in Standby Mode 68 3.7.6 Notes on Standby Mode 70 3.8 Memory Access Mode 72

CHAPTER 4 I/O PORTS 75 4.1 Overview of I/O Ports 76 4.2 Port 0 78 4.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0) 80 4.2.2 Operations of Port 0 Functions 82 4.3 Port 3 84 4.3.1 Registers of Port 3 (PDR3, DDR3, PUL3) 86 4.3.2 Operations of Port 3 Functions 88 4.4 Port 4 90 4.4.1 Registers of Port 4 (PDR4) 92 4.4.2 Operations of Port 4 Functions 93 4.5 Port 5 94 4.5.1 Registers of Port 5 (PDR5, DDR5, PUL5) 96 4.5.2 Operations of Port 5 Functions 98 4.6 Port 6 100 4.6.1 Registers of Port 6 (PDR6, DDR6, PUL6) 103 4.6.2 Operations of Port 6 Functions 105 4.7 Port 7 107 4.7.1 Registers of Port 7 (PDR7, DDR7, PUL7) 109 4.7.2 Operations of Port 7 Functions 111 4.8 Programming Example of I/O Port 113

CHAPTER 5 TIME-BASE TIMER 115 5.1 Overview of Time-base Timer 116 5.2 Configuration of Time-base Timer 118 5.3 Time-base Timer Control Register (TBTC) 119 5.4 Interrupt of Time-base Timer 121 5.5 Operations of Time-base Timer Functions 122 5.6 Notes on Using Time-base Timer 124 5.7 Program Example for Time-base Timer 125

CHAPTER 6 WATCHDOG TIMER 127 6.1 Overview of Watchdog Timer 128 6.2 Configuration of Watchdog Timer 129 6.3 Watchdog Control Register (WDTC) 130 6.4 Operations of Watchdog Timer Functions 131 6.5 Notes on Using Watchdog Timer 132 6.6 Program Example for Watchdog Timer 133

Page 11 of the Fujitsu MB89202 user manual
Page 11 · click to enlarge
Page 11

CHAPTER 7 8-BIT PWM TIMER 135 7.1 Overview of 8-bit PWM Timer 136 7.2 Configuration of 8-bit PWM Timer 139 7.3 Pin of 8-bit PWM Timer 141 7.4 Registers of 8-bit PWM Timer 142 7.4.1 PWM Control Register (CNTR) 143 7.4.2 PWM Compare Register (COMR) 145 7.5 Interrupt of 8-bit PWM Timer 147 7.6 Operations of the Interval Timer Functions 148 7.7 Operations of the 8-bit PWM Timer Functions 150 7.8 States in Each Mode During Operation 152 7.9 Notes on Using 8-bit PWM Timer 155 7.10 Program Example for PWM Timer 157

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER 161 8.1 Overview of 8/16-bit Capture Timer/Counter 162 8.2 Configuration of 8/16-bit Capture Timer/Counter 166 8.3 Pins of 8/16-bit Capture Timer/Counter 168 8.4 Registers of 8/16-bit Capture Timer/Counter 170 8.4.1 Capture Control Register (TCCR) 171 8.4.2 Timer 0 Control Register (TCR0) 173 8.4.3 Timer 1 Control Register (TCR1) 175 8.4.4 Timer Output Control Register (TCR2) 177 8.4.5 Timer 0 Data Register (TDR0) 178 8.4.6 Timer 1 Data Register (TDR1) 180 8.4.7 Capture Data Registers H and L (TCPH and TCPL) 182 8.5 8/16-bit Capture Timer/Counter of Interrupts 183 8.6 Explanation of Operations of Interval Timer Functions 185 8.7 Operation of Counter Functions 189 8.8 Functions of Operations of Capture Functions 193 8.9 8/16-bit Capture Timer/Counter Operation in Each Mode 197 8.10 Notes on Using 8/16-bit Capture Timer/Counter 198 8.11 Program Example for 8/16-bit Capture Timer/Counter 200

CHAPTER 9 12-BIT PPG TIMER 205 9.1 Overview of 12-bit PPG Timer 206 9.2 Configuration of 12-bit PPG Timer Circuit 209 9.3 Pin of 12-bit PPG Timer 211 9.4 Registers of 12-bit PPG Timer 213 9.4.1 12-bit PPG Control Register 1 (RCR21) 214 9.4.2 12-bit PPG Control Register 2 (RCR22) 215 9.4.3 12-bit PPG Control Register 3 (RCR23) 216 9.4.4 12-bit PPG Control Register 4 (RCR24) 218 9.5 Operations of 12-bit PPG Timer Functions 219 9.6 Notes on Using 12-bit PPG Timer 221 9.7 Program Example for 12-bit PPG Timer 223

Page 12 of the Fujitsu MB89202 user manual
Page 12 · click to enlarge
Page 12

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE) 225 10.1 Overview of External Interrupt Circuit 1 226 10.2 Configuration of External Interrupt Circuit 1 227 10.3 Pins of External Interrupt Circuit 1 229 10.4 Registers of External Interrupt Circuit 1 231 10.4.1 External Interrupt Control Register 1 (EIC1) 232 10.4.2 External Interrupt Control Register 2 (EIC2) 235 10.5 Interrupt of External Interrupt Circuit 1 237 10.6 Operations of External Interrupt Circuit 1 239 10.7 Program Example for External Interrupt Circuit 1 241

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL) 243 11.1 Overview of External Interrupt Circuit 2 244 11.2 Configuration of External Interrupt Circuit 2 245 11.3 Pins of External Interrupt Circuit 2 246 11.4 Registers of External Interrupt Circuit 2 249 11.4.1 External Interrupt 2 Control Register (EIE2) 250 11.4.2 External Interrupt 2 Flag Register (EIF2) 252 11.5 Interrupt of External Interrupt Circuit 2 253 11.6 Operations of External Interrupt Circuit 2 254 11.7 Program Example for External Interrupt Circuit 2 256

CHAPTER 12 A/D CONVERTER 259 12.1 Overview of A/D Converter 260 12.2 Configuration of A/D Converter 261 12.3 Pins of A/D Converter 263 12.4 Registers of A/D Converter 265 12.4.1 A/D Control Register 1 (ADC1) 266 12.4.2 A/D Control Register 2 (ADC2) 268 12.4.3 A/D Data Register (ADDH and ADDL) 270 12.4.4 A/D Enable Register (ADEN) 271 12.5 Interrupt of A/D Converter 272 12.6 Operations of A/D Converter Functions 273 12.7 Notes on Using A/D Converter 275 12.8 Program Example for A/D Converter 277

CHAPTER 13 UART 279 13.1 Overview of UART 280 13.2 Configuration of UART 284 13.3 Pins of UART 287 13.4 Registers of UART 289 13.4.1 Serial Mode Control Register (SMC) 290 13.4.2 Serial Rate Control Register (SRC) 292 13.4.3 Serial Status and Data Register (SSD) 294 13.4.4 Serial Input Data Register (SIDR) 297 13.4.5 Serial Output Data Register (SODR) 298 13.4.6 Clock Divider Selection Register (UPC) 299

Page 13 of the Fujitsu MB89202 user manual
Page 13 · click to enlarge
Page 13

13.4.7 Serial Switch Register (SSEL) 301 13.5 Interrupt of UART 303 13.6 Operations of UART Functions 304 13.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3) 306 13.6.2 Reception Operations (Operating Mode 0, 1, or 3) 307 13.6.3 Reception Operations (Operating Mode 2 Only) 309 13.7 Program Example for UART 311

CHAPTER 14 8-BIT SERIAL I/O 313 14.1 Overview of 8-Bit Serial I/O 314 14.2 Configuration of 8-Bit Serial I/O 315 14.3 Pins of 8-Bit Serial I/O 317 14.4 Registers of 8-Bit Serial I/O 319 14.4.1 Serial Mode Register (SMR) 320 14.4.2 Serial Data Register (SDR) 323 14.5 Interrupt of 8-Bit Serial I/O 324 14.6 Operations of Serial Output Functions 325 14.7 Operations of Serial Input Functions 327 14.8 8-Bit Serial I/O Operation in Each Mode 329 14.9 Notes on Using 8-Bit Serial I/O 333 14.10 Example of 8-Bit Serial I/O Connection 334 14.11 Program Example for 8-Bit Serial I/O 336

CHAPTER 15 BUZZER OUTPUT 339 15.1 Overview of the Buzzer Output 340 15.2 Configuration of the Buzzer Output 341 15.3 Pin of the Buzzer Output 342 15.4 Buzzer Register (BZCR) 343 15.5 Program Example for Buzzer Output 345

CHAPTER 16 WILD REGISTER FUNCTION 347 16.1 Overview of the Wild Register Function 348 16.2 Configuration of the Wild Register Function 349 16.3 Registers of the Wild Register Function 350 16.3.1 Data Setting Registers (WRDR0 and WRDR1) 351 16.3.2 Higher Address Set Registers (WRARH0 and WRARH1) 352 16.3.3 Lower Address Set Registers (WRARL0 and WRARL1) 353 16.3.4 Address Comparison EN Register (WREN) 354 16.3.5 Data Test Set Register (WROR) 355 16.4 Operations of the Wild Register Functions 356

Page 14 of the Fujitsu MB89202 user manual — Table of contents
Page 14 · click to enlarge
Page 14

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 15 of the Fujitsu MB89202 user manual — Main changes in this edition
Page 15 · click to enlarge
Page 15

Main changes in this edition

Page Changes (For details, refer to main body.)

- - The followings product name is changed. (MB89202 → MB89202/F202RA)

The followings term is changed. (source oscillation → oscillation frequency)

6 1.3 Differences between Models

"Notes:" is changed. (The followings sentence is deleted. "• At turning on the power, when the device is used without inputting the external reset, select "reset output supported" and "power-on reset supported" by mask option.")

The followings package is changed in Table 1.3-1. (FPT-34P-M03 → FPT-32P-M03)

12 1.7 Pin Functions RST pin in Table 1.7-1 is changed.

19 2.1 Precautions on Handling Devices

"● External pull-up for the External Reset Pin (RST) of MB89F202/F202RA" is changed.

24 3.1.1 Specific-purpose Areas

The summary is changed.

"■ General-purpose Register Area (address: 0100H to 01FFH)" is changed.

"■ Vector Table Area (Address: FFC0H to FFFFH)" is changed.

44 3.5 Reset "● Power-on reset" is changed.

"Note:" is deleted.

56 3.6.3 System Clock Control Register (SYCC)

Figure 3.6-5 is changed.

57 Table 3.6-1 is changed.

130 6.3 Watchdog Control Register (WDTC)

Figure 6.3-1 is changed.

186 8.6 Explanation of Operations of Interval Timer Functions

"● 8-bit mode"is changed. (The followings sentence is deleted. "The initial value of the square wave output is "L" level. The square wave output is initialized by writing "0" to the TSTR bit of the timer control register (TCR).")

264 12.3 Pins of A/D Converter

"■ Block Diagram of the Pins Related to the A/D Converter" is changed. ("Note:" is deleted.)

308 13.6.2 Reception Operations (Operating Mode 0, 1, or 3)

"■ Reception Operations (Operating Mode 0, 1, or 3)" is changed. ("Note:" is changed.)

Page 16 of the Fujitsu MB89202 user manual
Page 16 · click to enlarge
Page 16

Page Changes (For details, refer to main body.)

310 13.6.3 Reception Operations (Operating Mode 2 Only)

"■ Reception Operations (Operating Mode 2 Only)" is changed. ("Note:" is changed.)

358 17.1 Overview of Flash Memory

"■ High voltage supply on RST pin (applicable to MB89F202RA only)" is added.

370 17.5.2 Writing Data Figure 17.5-1 is changed. (F555 → F554)

394 B.4 F2MC-8L Instructions List

Table B.4-2 is changed. ("No.22 DECW A" is changed.)

The vertical lines marked in the left side of the page show the changes.

Page 17 of the Fujitsu MB89202 user manual — CHAPTER 1
Page 17 · click to enlarge
Page 17

CHAPTER 1

OVERVIEW

This chapter describes the features and basic specification of the MB89202/F202RA series.

1.1 Features of MB89202/F202RA Series

1.2 MB89202/F202RA Series Product Lineup

1.3 Differences between Models

1.4 Block Diagram of MB89202/F202RA Series

1.5 Pin Assignment

1.6 Package Dimensions

1.7 Pin Functions Description

1.8 I/O Circuit Types

Page 18 of the Fujitsu MB89202 user manual — CHAPTER 1 OVERVIEW
Page 18 · click to enlarge
Page 18

CHAPTER 1 OVERVIEW

1.1 Features of MB89202/F202RA Series

The MB89202/F202RA series contains general-purpose single-chip microcontrollers that incorporate a full range of peripheral functions such as A/D converter, UART, PWM timer, PPG, capture timer/counter and external interrupts as well as a compact instruction set.

  • Features of MB89202/F202RA Series
  • F 2 MC-8L CPU core
  • Instruction set most suitable for controllers
  • Multiplication and division instruction
  • 16-bit operation
  • Branch instruction by bit test
  • Bit operation instruction, and others
  • 4-system timers
  • 8/16-bit capture timer/counter (8-bit capture timer/counter + 8-bit timer or 16-bit capture timer/counter)
  • 8-bit PWM timer (also available as an interval timer)
  • 21-bit time-base timer
  • Watchdog timer
  • 10-bit A/D converter
  • 10-bit A/D × 8 channels
  • Activation by 8/16-bit capture timer/counter output is possible.
  • Programmable pulse generator (PPG)
  • Pulse width and cycle are software selectable (12-bit PPG).
  • UART
  • 6, 7, or 8 transfer data length
  • 8-bit serial I/O
  • Available when switched from UART
  • LSB first/MSB first selectability
  • External interrupts
  • External interrupt 1 (edge detection × 3 pins) has three independent inputs and can be used for wake-up from low-power consumption mode. (The edge detection can be selected from rising-edge, falling-edge, and both-edge modes.)
Page 19 of the Fujitsu MB89202 user manual — CHAPTER 1 OVERVIEW
Page 19 · click to enlarge
Page 19

CHAPTER 1 OVERVIEW

  • External interrupt 2 (level detection × 8 pins, 1 channel) has eight independent inputs and can be used for wake-up from low-power consumption mode. (L level detection function is supported.)
  • Low-power consumption modes (standby modes)
  • Stop mode (The oscillation is stopped so that current consumption is minimal.)
  • Sleep mode (The CPU is stopped so that the current consumption is reduced by one-third of normal consumption.)
  • Up to 26 pins of I/O ports
  • General-purpose I/O ports (CMOS): 26 pins (4 of which can be used as N-ch open-drain I/O ports.)
  • Wild registers
  • 2-byte data at two addresses are available.
  • When a specific address or data is used on a wild register, the data in the ROM area is changed.
  • 16 KB Flash with read protection
  • Once the protection code is written in the specified address, the FLASH content cannot be read by parallel/serial programmer.
Page 20 of the Fujitsu MB89202 user manual — MB89201 MB89F202/F202RA MB89V201
Page 20 · click to enlarge
Page 20

CHAPTER 1 OVERVIEW

1.2 MB89202/F202RA Series Product Lineup

Four MB89202 series models are available. Table 1.2-1 shows the models and Table 1.2- 2 shows the CPU and peripheral functions.

  • MB89202/F202RA Series Models

Table 1.2-1 MB89202/F202RA Series Models

MB89201 MB89F202/F202RA MB89V201

Classification Evaluation product (for development)

Flash memory product (read protection)

ROM size 32K × 8 bits (External EPROM*2)

16K × 8 bits (Internal Flash)

16K × 8 bits (Internal mask ROM)

RAM size 512 × 8 bits

Sleep mode and stop mode

Operating voltage*1 2.7V to 5.5V 3.5V to 5.5V 2.2V to 5.5V

*1: The minimum operating voltage varies with conditions such as operating frequency, functions, and connecting ICE. *2: MBM27C256A is used as the external ROM.

Show 4 more labels / short text on this page
Mask ROM product · Low-power consumption · (standby mode) · Process CMOS
Page 21 of the Fujitsu MB89202 user manual — CHAPTER 1 OVERVIEW
Page 21 · click to enlarge
Page 21

CHAPTER 1 OVERVIEW

Table 1.2-2 CPU and Peripheral Functions of MB89202/F202RA Series

Number of basic instructions: 136 instructions Instruction bit length: 8 bits Instruction length: 1 to 3 bytes Data bit length: 1, 8, or 16 bits Minimum instruction execution time: 0.32 to 5.1 µs (at 12.5 MHz) Interrupt processing time: 2.88 to 46.1 µs (at 12.5 MHz)

Port General-purpose I/O port: 26 pins (Also serve as peripherals. 4 of which can be used as N-ch open-drain I/O ports.)

21 bits Interrupt cycle0.66 ms, 2.64 ms, 21 ms, or 335.5 ms with 12.5MHz main clock
Reset occurrence cycleWhen the main clock is at 12.5 MHz (minimum 335.5 ms)

8-bit interval timer operation (Square wave output is supported. Operating clock cycle: 1 tINST, 16 tINST, 64 tINST, and 8/16-bit capture timer/counter output) 8-bit resolution PWM operation (Conversion cycle: 256 tINST, 4096 tINST, 16384 tINST and 256 times 8/16-bit capture timer/counter output)

8/16-bit capture timer/ counter

8-bit capture timer/counter × 1 channel + 8-bit timer or 16-bit capture timer/counter × 1 channel When timer 0 or a 16-bit counter is operating, event-counting operation by external clock input and square wave output are supported.

UART Transfer data length6, 7, or 8 bits

8 bits length, LSB first/MSB first selectability One clock selectable from four operation clocks (one external shift clock, three internal shift clocks: 2 tINST, 8 tINST, 32 tINST)

Output frequency: Pulse width and cycle are selectable.

External interrupt 1 (wake-up)

3 channels (interrupt vector, request flag, and request output enable) Edge selectability (selectable from rising edge, falling edge, and both-edge modes) Also available for wake-up from stop or sleep (Edge detection is also available in stop mode.)

External interrupt 2 (wake-up)

8 inputs 1 channel (L level interrupt and input enable are independent.) Also available for wake-up from stop or sleep (Level detection is also available in stop mode.)

10-bit resolution × 8 channels A/D conversion function (Conversion time: 38 tINST) Continuous activation by 8/16-bit capture timer/counter output or time-base timer output.

The oscillation is 12.5 MHz unless another condition such as the main clock maximum speed, the clock cycle value, or conversion time is stated.

Show 11 more labels / short text on this page
Item Specification · CPU function · 21-bit time-base timer · Watchdog timer · 8-bit PWM timer · Periphera l function · 8-bit serial I/O · 12-bit PPG timer · 10-bit A/D converter · Wild register · 8-bit × 2
Page 22 of the Fujitsu MB89202 user manual — DIP-32P-M06
Page 22 · click to enlarge
Page 22

CHAPTER 1 OVERVIEW

1.3 Differences between Models

This section describes the precautions to be taken when selecting a MB89202/F202RA series model.

  • Precautions when Selecting a Model

Table 1.3-1 Differences between Models

Package MB89201 MB89F202/F202RA MB89V202

DIP-32P-M06

FPT-32P-M03

FPT-64P-M03

  • Current consumption
  • When operated at a low speed, the current consumption of a model with a flash is greater than that of a model with a mask ROM, though the current consumption in sleep or stop mode is the same.
  • For details on each package, see Section "1.6 Package Dimensions ".
  • For details on current consumption and electrical characteristics of A/D converter, see the electrical characteristics in the Data Sheet.
Page 23 of the Fujitsu MB89202 user manual — CHAPTER 1 OVERVIEW
Page 23 · click to enlarge
Page 23

CHAPTER 1 OVERVIEW

1.4 Block Diagram of MB89202/F202RA Series

Fujitsu MB89202 — CHAPTER 1 OVERVIEW diagram (page 23)
Fig. 2

Figure 1.4-1 shows the block diagram of the MB89202/F202RA series.

  • Block Diagram of MB89202/F202RA Series

Figure 1.4-1 Block Diagram of MB89202/F202RA Series

Fujitsu MB89202 — CHAPTER 1 OVERVIEW diagram (page 23)
Fig. 3

Serial function switching

P32 / UI / SI P31 / UO / SO P30 / UCK / SCK

External interrupt2 (wake-up)

P02 / INT22 / AN6, P03 / INT23 / AN7

8. b it s eri a l I/O

P00 / INT20 / AN4, P01 / INT21 / AN5

8/16-bit capture timer/

*1P40 / AN0 to *1P43 / AN3

P35 / INT11 P36 / INT12

*1: Large-current drive type *2 : Check section "3.1 Memory Space"

Page 24 of the Fujitsu MB89202 user manual — P04/INT24
Page 24 · click to enlarge
Page 24

CHAPTER 1 OVERVIEW

1.5 Pin Assignment

Figure 1.5-1 and Figure 1.5-2 show the pin assignment of the MB89202/F202RA series.

  • Pin Assignment of DIP-32P-M06

Figure 1.5-1 Pin Assignment of DIP-32P-M06

P04/INT24

P05/INT25

P0 3 /INT2 3 /AN7

P06/INT26

P02/INT22/AN6

P07/INT27

P01/INT21/AN5

P60

P00/INT20/AN4

P61

P4 3 /AN 3 *

R S T

P42/AN2*

P41/AN1*

P40/AN0*

V SS

P72*

P 3 7/BZ/PPG

P71*

P 3 6/INT12

P70*

P 3 5/INT11

P50/PWM

P 3 4/TO/INT10

P 3 0/UCK/ S CK

P 33 /EC

P 3 1/UO/ S O

P 3 2/UI/ S I

*L a rge-c u rrent drive type
Page 25 of the Fujitsu MB89202 user manual — P 3 1/UO/ S O
Page 25 · click to enlarge
Page 25

CHAPTER 1 OVERVIEW

  • Pin Assignment of FPT-34P-M03

Figure 1.5-2 Pin Assignment of FPT-34P-M03

P04/INT24

P05/INT25

P0 3 /INT2 3 /AN7

P06/INT26

P02/INT22/AN6

P07/INT27

P01/INT21/AN5

P60

P00/INT20/AN4

P61

P4 3 /AN 3 *

P42/AN2 *

R S T

P41/AN1 *

P40/AN0 *

V SS

P72 *

P 3 7/BZ/PPG

P71 *

P 3 6/INT12

P70 *

P 3 5/INT11

N.C.

P 3 4/TO/INT10

P50/PWM

P 33 /EC

P 3 0/UCK/ S CK

N.C.

P 3 1/UO/ S O

P 3 2/UI/ S I

*L a rge-c u rrent drive type
Page 26 of the Fujitsu MB89202 user manual — 0~15˚ M 0.25(.010) .019
Page 26 · click to enlarge
Page 26

CHAPTER 1 OVERVIEW

1.6 Package Dimensions

Two different packages are available for MB89202/F202RA series. Figure 1.6-1 and Figure 1.6-2 show package dimensions.

  • Package Dimension of DIP-32P-M06

Figure 1.6-1 Package Dimension of DIP-32P-M06

32-pin plastic SH-DIP Lead pitch 1.778 mm

Low space 10.16 mm

Sealing method Plastic mold

(DIP3 2P-M06)

32-pin plastic SH-DIP (DIP-32P-M06)

*28.00

+0.20 –0.30

–.012 +.008

INDEX

*8.89±0.25

(.350±.010)

+0.30

–.008 +.012

+0.70 –0.20

MIN. 0.51(.020)

–.008 +.028

3. 3 0

+0.20 –0.30

–.012 +.008

–0.07 +.001

+0.03

1.778(.070) 1.27(.050) 10.16(.400)

.011–.003

0.48 +0.08

0~15˚ M 0.25(.010) .019

MAX.

+.003 –.005

Dimensions in mm (inches).

C 2003 FUJITSU LIMITED D32018S-c-1-1

Please confirm the latest Package dimension by following URL. http://edevice.fujitsu.com/fj/DATASHEET/ef-ovpklv.html

Page 27 of the Fujitsu MB89202 user manual — "A"
Page 27 · click to enlarge
Page 27

CHAPTER 1 OVERVIEW

  • Package Dimension of FPT-34P-M03

Figure 1.6-2 Package Dimension of FPT-34P-M03

34-pin plastic SSOP Lead pitch 0.65 mm

Package width ×

package length 6.10 × 11.00 mm

Lead shape Gullwing

Sealing method Plastic mold

Mounting height 1.45 mm MAX

Code (Reference) P-SSOP34-6.1×11-0.65

(FPT3 4P-M0 3 )

34-pin plastic SSOP (FPT-34P-M03)

Note 1) *1 : Resin protrusion. (Each side : +0.15 (.006) Max). Note 2) *2 : These dimensions do not include resin protrusion. Note 3) Pins width and pins thickness include plating thickness. Note 4) Pins width do not include tie bar cutting remainder.

11.00±0.10(.433±.004)

0.17±0.03

34 18

(.007±.001)

6.10±0.10 8.10±0.20 (.240±.004) (.319±.008)

Details of "A" part

INDEX

(Mounting height) 1.25 +0.20 –0.10

–.004 +.008 .049

0.25(.010)

0.65(.0265)

+.003 –0.07 +0.08 0.24

"A"

0.10(.004) M

.009 –.003

0.50±0.20 (.020±.008)

0.10±0.10 (.004±.004)

0.60±0.15 (.024±.006)

(Stand off)

0.10(.004) 0.10(.004)

Dimensions in mm (inches).

C 2003 FUJITSU LIMITED F34003S-c-2-3

Please confirm the latest Package dimension by following URL. http://edevice.fujitsu.com/fj/DATASHEET/ef-ovpklv.html

*1 · *2 · 0~8˚

Page 28 of the Fujitsu MB89202 user manual — 18 19 P31/ UO/SO
Page 28 · click to enlarge
Page 28

CHAPTER 1 OVERVIEW

1.7 Pin Functions Description

Table 1.7-1 describes the I/O pins and functions. The letters in the circuit type column shown in Table 1.7-1 correspond to the letters in the Circuit Type column shown in Table 1.8-1 .

  • Pin Functions Description

Table 1.7-1 Pin Functions Description (1/2)

Pin No. Pin name

SHDIP32 * 1 SSOP34 * 2

8 8 X0 A Pins for connecting the crystal for the main clock. To use an external clock, input the signal to X0 and leave X1 open. 9 9 X1

5, 6 5, 6 P60, P61

H / E General-purpose CMOS input port.

7 7 RST C Reset I/O pin. This pin serves as an N-ch open-drain reset output and a reset input as well. The reset is a hysteresis input. It outputs the "L" signal in response to an internal reset request. Also, it initializes the internal circuit upon input of the "L" signal.

28, 29 30, 31 P00/ INT20/ AN4, P01/ INT21/ AN5

G General-purpose CMOS I/O ports. These pins also serve as an input (wake-up input) of external interrupt 2 or as an 10-bit A/D converter analog input. The input of external interrupt 2 is a hysteresis input.

30, 31 32, 33 P02/ INT22/ AN6, P03/ INT23/ AN7

G General-purpose CMOS I/O ports. These pins also serve as an input (wake-up input) of external interrupt 2 or as an 10-bit A/D converter analog input. The input of external interrupt 2 is a hysteresis input.

1 to 4 1 to 4 P04/ INT24 to P07/ INT27

D General-purpose CMOS I/O ports. These pins also serve as an input (wake-up input) of external interrupt 2. The input of external interrupt 2 is a hysteresis input.

19 20 P30/ UCK/ SCK

B General-purpose CMOS I/O ports. This pin also serves as the clock I/O pin for the UART or 8-bit serial I/O. The resource is a hysteresis input.

18 19 P31/ UO/SO

E General-purpose CMOS I/O ports. This pin also serves as the data output pin for the UART or 8-bit serial I/O.

Circuit · type Function

Page 29 of the Fujitsu MB89202 user manual — *1 : DIP-32P-M06 *2 : FPT-34P-M03
Page 29 · click to enlarge
Page 29

CHAPTER 1 OVERVIEW

Table 1.7-1 Pin Functions Description (2/2)

Pin No. Pin name

SHDIP32 * 1 SSOP34 * 2

17 18 P32/UI/ SI

B General-purpose CMOS I/O ports. This pin also serves as the data input pin for the UART or 8-bit serial I/O. The resource is a hysteresis input.

15 15 P33/EC B General-purpose CMOS I/O ports. This pin also serves as the external clock input pin for the 8/16-bit capture timer/counter. The resource is a hysteresis input.

14 14 P34/ TO/ INT10

B General-purpose CMOS I/O ports. This pin also serves as the output pin for the 8/16-bit capture timer/ counter or as the input pin for external interrupt 1. The resource is a hysteresis input.

13 13 P35/ INT11

B General-purpose CMOS I/O ports. These pins also serve as the input pin for external interrupt 1. The resource is a hysteresis input.

12 12 P36/ INT12

B General-purpose CMOS I/O ports. These pins also serve as the input pin for external interrupt 1. The resource is a hysteresis input.

11 11 P37/ BZ/ PPG

E General-purpose CMOS I/O ports. This pin also serves as the buzzer output pin or the 12-bit PPG output pin.

20 21 P50/ PWM

E General-purpose CMOS I/O ports. This pin also serves as the 8-bit PWM timer output pin.

24 to 27 26 to 29 P40/ AN0 to P43/ AN3

F General-purpose CMOS I/O ports. These pins can also be used as N-ch open-drain ports. These pins also serve as 10-bit A/D converter analog input pins.

21 to 23 23 to 25 P70 to P72

E General-purpose CMOS I/O ports.

32 34 VCC -- Power supply pin

10 10 VSS -- Power (GND) pin

16 17 C -- MB89F202/F202RA:

Capacitance pin for regulating the power supply. Connect an external ceramic capacitor of about 0.1µF. MB89202:

This pin is not internally connected. It is unnecessary to connect a capacitor.

-- 16, 22 N.C. -- Internally connected pins Be sure to leave it open.

*1 : DIP-32P-M06 *2 : FPT-34P-M03

Circuit · type Function

Page 30 of the Fujitsu MB89202 user manual — CHAPTER 1 OVERVIEW
Page 30 · click to enlarge
Page 30

CHAPTER 1 OVERVIEW

1.8 I/O Circuit Types

Table 1.8-1 describes the I/O circuit types. The letters in the circuit column shown in Table 1.8-1 correspond to the letters in the circuit type column shown in Table 1.7-1 .

  • I/O Circuit Types

Table 1.8-1 I/O Circuit Types (1/2)

A At an oscillation feedback resistance of approximately 500 kΩ

B CMOS output Hysteresis input Pull-up resistor optional

Input enable Port / Resource

C At an output pull-up resistor (P-ch) of approximately 50 kΩ/5.0 V (not available for MB89F202/F202RA) N-ch open-drain reset output Hysteresis input High voltage input tolerable in MB90F202RA

P-ch with pull-up, not available for MB89F202/F202RA

Show 7 more labels / short text on this page
Types Circuit Remarks · Standby control signal · P-ch · P-ch · N-ch · N-ch · Reset
Page 31 of the Fujitsu MB89202 user manual — CHAPTER 1 OVERVIEW
Page 31 · click to enlarge
Page 31

CHAPTER 1 OVERVIEW

Table 1.8-1 I/O Circuit Types (2/2)

Fujitsu MB89202 — CHAPTER 1 OVERVIEW diagram (page 31)
Fig. 4

D CMOS output CMOS input Hysteresis input (Resource input) Pull-up resistor optional

E CMOS output CMOS input Pull-up resistor optional P70 to P72 are large current drive type

F CMOS output CMOS input Analog input N-ch open-drain output available P40 to P43 are large current drive type

G CMOS output CMOS input Hysteresis input (Resource input) Analog input

Page 32 of the Fujitsu MB89202 user manual — CHAPTER 1 OVERVIEW
Page 32 · click to enlarge
Page 32

CHAPTER 1 OVERVIEW

Page 33 of the Fujitsu MB89202 user manual — CHAPTER 2 HANDLING DEVICES
Page 33 · click to enlarge
Page 33

CHAPTER 2 HANDLING DEVICES

This chapter describes the precautions to be taken when handling general-purpose one-chip microcontrollers.

2.1 Precautions on Handling Devices

Page 34 of the Fujitsu MB89202 user manual — CHAPTER 2 HANDLING DEVICES
Page 34 · click to enlarge
Page 34

CHAPTER 2 HANDLING DEVICES

2.1 Precautions on Handling Devices

This section describes the precautions to be taken when handling the power supply voltage, pins, and other device items.

  • Precautions on Handling Devices
  • Ensure that the voltage does not exceed the maximum ratings. (Preventing latch-up)

A latch-up may occur if a voltage higher than Vcc or lower than Vss is applied to input or output pins other than middle- or high-level resistant pins, or if voltage exceeding the rated value is applied between Vcc and Vss.

When a latch-up occurs, the supply current increases rapidly, occasionally resulting in overheating. Therefore, ensure that the voltage does not exceed the maximum ratings when using the microcontrollers.

  • Stabilize the supply voltage as much as possible

Although the specified Vcc supply voltage operating range is assured, a sudden change in the supply

voltage within the specified range may result in a malfunction.

The following stabilization guidelines are recommended: The Vcc ripple (P-P value) at the supply frequency (50 Hz to 60 Hz) should be less than 10% of the typical Vcc value, and the transient fluctuation rate should be less than 0.1 V/ms at the time of momentary fluctuation when switching the power supply.

  • Handling unused input pins

Leaving unused input pins open may result in a malfunction or equipment damage due to a latch-up. Therefore, set these pins to pull-up or pull-down via resistors of 2 kΩ or higher.

  • Handling the N.C. pins

Ensure that the N.C. (internally connected) pins are opened before using.

  • Precautions on using an external clock

When an external clock is used, the oscillation stabilization wait time is also provided for power-on reset and stop mode release.

  • Wild register function

Because wild registers cannot be debugged on MB89V201, check operation on an actual MB89F202/ F202RA.

  • Program execution on RAM

When MB89V201 is used, a program cannot be executed on RAM.

Page 35 of the Fujitsu MB89202 user manual — CHAPTER 2 HANDLING DEVICES
Page 35 · click to enlarge
Page 35

CHAPTER 2 HANDLING DEVICES

  • Note to Noise in the External Reset Pin (RST)

If the reset pulse applied to the external reset pin (RST) does not meet the specifications, it may cause malfunctions. Use caution so that the reset pulse less than the specifications will not be fed to the external reset pin (RST).

  • External pull-up for the External Reset Pin (RST) of MB89F202/F202RA

Internal pull-up control for RST is not available for MB89F202/F202RA. To ensure proper external reset control in MB89F202/F202RA, an external pull-up (recommend 100 kΩ) for RST pin must be required.

For MB89F202RA only, high voltage must be applied to RST during flash memory program / erase. The typical high voltage is 10 V.

  • Step-down circuit stabilization time

The MB89202/F202RA series consists of the products listed in Table 2.1-1 "Pin Processing for the Products with and without a Step-down Circuit". The operation characteristic depends on whether a product contains a step-down circuit.

Table 2.1-1 Pin Processing for the Products with and without a Step-down Circuit

Product name Operating voltage Step-down circuit

MB89V201 2.7 V to 5.5 V Not contained

MB89202 2.2 V to 5.5 V Not contained

MB89F202/F202RA 3.5 V to 5.5 V Contained

These products use the same internal resources. However, the operation sequence after power-on reset depends on whether a product contains a step-down circuit. Figure 2.1-1 shows the sequence of operations after the power-on reset for each model.

Page 36 of the Fujitsu MB89202 user manual — CHAPTER 2 HANDLING DEVICES
Page 36 · click to enlarge
Page 36

CHAPTER 2 HANDLING DEVICES

Figure 2.1-1 Operation Sequences after Power-on Reset between Product Types

Power supply (VCC) Step-down circuit stabilization time (217/FCH) + Oscillation stabilization wait time (218/FCH)

CPU operation of product with a step-down circuit (MB89F202/F202RA)

Oscillation stabilization wait time (218/FCH)

CPU operation of product without a step-down circuit (MB89202 and MB89V201)

Start of CPU operation of product without a step-down circuit (reset vector)

Start of the CPU operation of product with a step-down circuit (reset vector)

F CHM a in o s cill a tion fre qu ency

As shown in Figure 2.1-1 , the start of CPU operation of a product with a step-down circuit is slower than that of the product without a step-down circuit. This is because time is required for the step-down circuit to stabilize prior to normal operation of the step-down circuit.

Page 37 of the Fujitsu MB89202 user manual — CHAPTER 3
Page 37 · click to enlarge
Page 37

CHAPTER 3

CPU

This chapter describes the functions and operations of the CPU.

3.1 Memory Space

3.2 Dedicated Register

3.3 General-Purpose Registers

3.4 Interrupts

3.5 Reset

3.6 Clock

3.7 Standby Mode (Low-Power Consumption Mode)

3.8 Memory Access Mode

Page 38 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 38 · click to enlarge
Page 38

CHAPTER 3 CPU

3.1 Memory Space

The MB89202/F202RA series has 64-KB memory space that consists of the I/O area, RAM area, ROM area, and external area. Part of the memory space is applied for specific use such as general-purpose registers or a vector table.

  • Configuration of Memory Space
  • I/O area (address: 0000 H to 007F H )

The control registers and data registers for built-in peripheral functions are assigned.

The I/O area is assigned as part of the memory space, thus access to the I/O area can be obtained in the same manner as access to memory. Also, direct addressing provides high-speed access.

  • RAM area

Static RAM is equipped as the internal data area.

The size of internal RAM depends on the model.

Direct addressing allows high-speed access to an area from 80H to FFH. (Some models restrict the usable

range of the area.)

100H to 1FFH can be used as the general-purpose register area.

If a reset occurs while data is being written into RAM, the data being written cannot be guaranteed.

  • ROM area

ROM is equipped as the internal program area.

The size of internal ROM depends on the model.

FFC0H to FFFFH are usable as a vector table or another feature.

Page 39 of the Fujitsu MB89202 user manual — FFFF H
Page 39 · click to enlarge
Page 39

CHAPTER 3 CPU

  • Memory Map

Figure 3.1-1 Memory Map

MB89V201 MB89202 MB89F202/F202RA

0000 H

0000 H

0000 H

I/O

I/O I/O

00 8 0 H

00 8 0 H

00 8 0 H

RAM 512 bytes

RAM 512 bytes RAM 512 bytes

0100 H

0100 H

0100 H

0200 H

0200 H

0200 H

02 8 0 H

02 8 0 H

02 8 0 H

Not available

Not available Not available

8 000 H

C000 H

C000 H

External EPROM

3 2 KB

ROM 16 KB Flash 16 KB

FFFF H

FFFF H

FFFF H

Register · Register · Register

Page 40 of the Fujitsu MB89202 user manual — CALLV #0 FFC0 H FFC1 H
Page 40 · click to enlarge
Page 40

CHAPTER 3 CPU

3.1.1 Specific-purpose Areas

In addition to the I/O area, the general-purpose register area and vector table area are available as areas for specific applications.

  • General-purpose Register Area (Address: 0100 H to 01FF H )
  • This area is used for 8-bit arithmetic operations and transfer. Supplementary registers are provided.
  • Since this area is allocated to a part of the RAM area, it can also be used as normal RAM.
  • When this area is used as a general-purpose register, it can be accessed faster using shorter instructions by general-purpose register addressing.

For details, see Section "3.2.2 Register Bank Pointer (RP) " and Section "3.3 General-Purpose Registers ".

  • Vector Table Area (Address: FFC0 H to FFFF H )
  • This area is used as vector tables of the vector call instructions, interrupts, and reset.
  • This area is allocated to the highest ranges of the ROM area, and the start address of the corresponding processing routine is set to the address of each vector table.

Table 3.1-1 provides the reference addresses in the vector table that correspond to the vector instructions, interrupts, and reset.

For details, see Section "3.4 Interrupts ", Section "3.5 Reset ", and "CALLV #vct" in APPENDIX "B.2 Special Instructions ".

Table 3.1-1 Vector Table (1/2)

Address in the vector table

Upper digits Lower digits

CALLV #0 FFC0 H FFC1 H

CALLV #1 FFC2 H FFC3 H

CALLV #2 FFC4 H FFC5 H

CALLV #3 FFC6 H FFC7 H

CALLV #4 FFC8 H FFC9 H

CALLV #5 FFCA H FFCB H

CALLV #6 FFCC H FFCD H

CALLV #7 FFCE H FFCF H

IRQF FFDC H FFDD H

IRQE FFDE H FFDF H

IRQD FFE0 H FFE1 H

IRQC FFE2 H FFE3 H

Vector call instruction

Page 41 of the Fujitsu MB89202 user manual — IRQB FFE4 H FFE5 H
Page 41 · click to enlarge
Page 41

CHAPTER 3 CPU

Table 3.1-1 Vector Table (2/2)

Address in the vector table

Upper digits Lower digits

IRQB FFE4 H FFE5 H

IRQA FFE6 H FFE7 H

IRQ9 FFE8 H FFE9 H

IRQ8 FFEA H FFEB H

IRQ7 FFEC H FFED H

IRQ6 FFEE H FFEF H

IRQ5 FFF0 H FFF1 H

IRQ4 FFF2 H FFF3 H

IRQ3 FFF4 H FFF5 H

IRQ2 FFF6 H FFF7 H

IRQ1 FFF8 H FFF9 H

IRQ0 FFFA H FFFB H

Mode data - * FFFDH

Reset vector FFFEH FFFFH

*: For MB89202 / MB89V201, FFFCH is prohibited. (Use "FFH".) For MB89F202/F202RA, write "01H" to FFFCH to activate read protection, otherwise write "FFH".

Vector call instruction

Page 42 of the Fujitsu MB89202 user manual — 00 8 0 H
Page 42 · click to enlarge
Page 42

CHAPTER 3 CPU

3.1.2 Location of 16-bit Data on Memory

Upper digits of 16-bit data and stack data are stored in lower addresses on memory.

  • 16-bit Data Storage State on RAM

When 16-bit data is written into RAM, the upper byte of the data is stored with a lower address and the lower byte of the data is stored with the next address. 16-bit data is read in the same manner.

Figure 3.1-2 shows the location of 16-bit data on RAM.

Figure 3.1-2 Location of 16-bit Data on RAM

MOVW 0081H, A 0080H

00 8 0 H

12 3 4 H A 12 H

A 00 8 1 H

12 3 4 H

00 8 1 H

00 8 2 H

3 4 H

00 8 2 H

00 83 H

00 83 H

  • 16-bit Operand Storage State

When 16 bits are specified for operands in instructions, upper bytes are also stored in addresses close to operation codes (instructions) and lower bytes are stored in the following addresses.

Operands that indicate memory addresses and 16-bit immediate data are handled in the same manner as stated above.

Figure 3.1-3 shows the locations of 16-bit data in instructions.

Figure 3.1-3 Location of 16-bit Data in Instructions

[Example] MOV A, 5678H MOV W A, #1234H

; Extend address ; 16-bit immediate data

Processed through assembler

XXX0H XX XX XXX2H 60 56 78 ; Extend address ; 16-bit immediate data XXX5H E4 12 34 XXX8H XX

  • 16-bit Data Storage State in Stack

The upper byte of data for a 16-bit register put in the stack due to an interrupt is also stored with a lower address.

Before written · After written Memory · Memory

Page 43 of the Fujitsu MB89202 user manual — PS
Page 43 · click to enlarge
Page 43

CHAPTER 3 CPU

3.2 Dedicated Register

The dedicated register in the CPU consists of a program counter (PC), two arithmetic operation registers (A and T), three address pointers (IX, EP, and SP), and program status (PS) register. The size of each register is 16 bits.

  • Dedicated Register Configuration

The dedicated register in the CPU consists of seven 16-bit registers. Some registers allow only the lower 8 bits to be used.

Figure 3.2-1 shows the configuration of the dedicated register.

Figure 3.2-1 Configuration of Dedicated Register

FFFD H

PC

:

Indicates the current instruction stored position.

A :

Temporary register that handles arithmetic operations and data transfer. Temporary accumulator

T :

Handles arithmetic operations together with the accumulator.

IX :

Indicates index address.

EP :

Indicates memory address.

SP :

Indicates the current position in the stack.

RP CCR :

Stores the register bank pointer and condition code. Flag I = 0 IL1 and IL0 = 11 The other bits are undefined.

PS

  • Functions of the Dedicated Register
  • Program counter (PC)

The size of the program counter is 16 bits. It indicates the memory address at which the CPU is currently handling an instruction. The program counter is updated with an instruction executed, interrupt, or reset. The initial value specified after the reset operation is the mode data read address (FFFDH).

  • Accumulator (A)

The accumulator is a 16-bit arithmetic operation register. It handles arithmetic operations or data transfer using data on memory or data in another register such as temporary accumulator (T). The accumulator allows data in it to be used as a word (16 bits) or bytes (8 bits). When arithmetic operations or data transfer is handled in the unit of a byte, only the lower 8 bits (AL) of the accumulator are used; the upper 8 bits (AH) remain unchanged. The initial value specified after the reset operation is undefined.

Show 13 more labels / short text on this page
16 bits · Initial value · Program counter · Undefined · Accumulator · Undefined · Undefined · Index register · Undefined · Extra-pointer · Undefined · Stack pointer · Program status register
Page 44 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 44 · click to enlarge
Page 44

CHAPTER 3 CPU

  • Temporary Accumulator (T)

The temporary accumulator is an auxiliary 16-bit arithmetic operation register. It handles arithmetic operations using data in the accumulator (A). When arithmetic operations in the accumulator (A) are handled in word units (16 bits), data in the temporary accumulator is handled in word units. Otherwise, it is handled in byte units (8 bits). When arithmetic operations are handled in byte units, only the lower 8 bits (TL) in the temporary accumulator are used; the upper 8 bits (TH) are not used.

When an MOV instruction is used to transfer data into the accumulator (A), data stored in the accumulator is automatically transferred to the temporary accumulator before it is transferred. For data transfer in byte units, the upper 8 bits of the temporary accumulator (TH) does not change. The initial value of the temporary accumulator specified after the reset operation is undefined.

  • Index register (IX)

The index register is a 16-bit register that stores an index address. The index register is used together with a 1-byte offset (-128 to +127). It generates a memory address for accessing data by adding a sign-extended offset to the index address. The initial value of the index register specified after the reset operation is undefined.

  • Extra-pointer (EP)

The extra-pointer is a 16-bit register. Data in the extra-pointer is handled as the memory address for accessing data. The initial value of the extra-pointer specified after the reset operation is undefined.

  • Stack pointer (SP)

The stack pointer is a 16-bit register that stores an address that is used to call an interrupt or subroutine, or to which a stack/recovery instruction makes a reference. While a program is being executed, the value of the stack pointer indicates the address of the latest data put in the stack. The initial value of the stack pointer specified after the reset operation is undefined.

  • Program status (PS) register

The program status is a 16-bit control register. The upper 8 bits of the program status register is the register bank pointer (RP) used to indicate the address of a general-purpose register bank.

The lower 8 bits are the condition code register (CCR) that composes flags for indicating the CPU status. Because these 8-bit registers comprise the program status register, they cannot be accessed. (Only instructions MOVW A, PS and MOVW PS, A access the program status register.)

For details on how to use the dedicated register, see the F2MC-8L MB89600 Series Programming Manual.

Page 45 of the Fujitsu MB89202 user manual — RP CCR
Page 45 · click to enlarge
Page 45

CHAPTER 3 CPU

3.2.1 Condition Code Register (CCR)

The condition code register (CCR) is the lower 8 bits of the program status register (PS). The condition code register consists of bits (C, V, Z, N, and H) for indicating the results of arithmetic operations or data to be transferred and control bits (I, IL1, and IL0) for controlling the acceptance of interrupt requests.

  • Configuration of the Condition Code Register (CCR)

Figure 3.2-2 Configuration of Condition Code Register

RP CCR

bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 CCR initial value PS R4 R3 R2 R1 R0 - - - H I IL1 IL0 N Z V C X011XXXXB

X: Undefined

  • Bits for Indicating Arithmetic Operation Results
  • Half carry flag (H)

When a carry from bit3 to bit4 or a borrow from bit4 to bit3 occurs as a result of an arithmetic operation, the half carry flag is set to "1". Otherwise, the half carry flag is cleared with "0". The half carry flag is intended only for decimal adjustment instructions, and thus should not be used for operations other than addition or subtraction.

  • Negative flag (N)

When the highest bit becomes "1" as a result of an arithmetic operation, the negative flag is set to "1". When it becomes "0", it is cleared with "0".

  • Zero flag (Z)

When the result of an arithmetic operation is "0", the zero flag is set to "1". Otherwise, the zero flag is cleared with "0".

  • Overflow flag (V)

When a complement on 2 overflow occurs as a result of an arithmetic operation, the overflow flag is set to "1". Otherwise, the overflow flag is cleared with "0".

  • Carry flag (C)

When a carry from bit7 or a borrow to bit7 occurs as a result of an arithmetic operation, the carry flag is set to "1". Otherwise, the carry flag is cleared with "0". The shift instruction causes the value to be shifted out.

Show 7 more labels / short text on this page
Half carry flag · Interrupt enable flag · Interrupt level bits · Negative flag · Zero flag · Overflow flag · Carry flag
Page 46 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 46 · click to enlarge
Page 46

CHAPTER 3 CPU

Figure 3.2-3 shows how the shift commands change the carry flag.

Figure 3.2-3 Change of the Carrier Flag by the Shift Commands

- Shift to the left (ROLC) - Shift to the right (RORC)

bit7 bit0 bit7 bit0

The condition code register is part of the program status register (PS), and thus is not allowed to access only the condition code register.

It is uncommon to fetch and use only some of the flag bits directly. Normally, branch instructions (such as BNZ) or decimal adjustment instructions (such as DAA and DAS) use them indirectly. The initial values of these flags specified after the reset operation are undefined.

  • Bits for Controlling Acceptance of Interrupts
  • Interrupt enable flag (I)

When this flag is "1", interrupts are allowed and the CPU accepts interrupts.

When this flag is "0", interrupts are prohibited and the CPU does not accept interrupts.

The initial value of the interrupt enable flag after the reset operation is "0".

Normally, the SETI instruction sets the interrupt enable flag to "1", and the CLRI instruction sets it to "0" to clear.

  • Interrupt level bits (IL1 and IL0)

These bits indicate the level of an interrupt the CPU is accepting, then it is compared with the values in the interrupt level setting registers (ILR1 to 4) which is specified as the level of interrupt requests of peripheral functions (IRQ0 to IRQF).

When the interrupt enable flag is turned on (I = 1), and if an interrupt is requested with an interrupt level value lower than that of these bits, the CPU accepts the interrupt. Table 3.2-1 provides interrupt level intensities. The initial value of the interrupt level specified after the reset operation is 11B.

Table 3.2-1 Interrupt Levels

IL1 IL0 Interrupt level Intensity

0 0 1 High

Low (no interrupts allowed)

When the CPU is not handling an interrupt (handling the main program), the interrupt level bits (IL1 and IL0) are normally set to 11B.

For details on interrupts, see Section "3.4 Interrupts ".

Page 47 of the Fujitsu MB89202 user manual — RP CCR
Page 47 · click to enlarge
Page 47

CHAPTER 3 CPU

3.2.2 Register Bank Pointer (RP)

The register bank pointer (RP) is the upper 8 bits of the program status register (PS). The register bank pointer indicates the general-purpose register bank address being used, and the address is converted to the actual address in general-purpose register addressing.

  • Configuration of the Register Bank Pointer (RP)

Figure 3.2-4 shows the configuration of the register bank pointer.

Figure 3.2-4 Configuration of Register Bank Pointer

RP CCR

bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

PS R4 R3 R2 R1 R0 - - - H I IL1 IL0 N Z V C XXXXXXXXB

X: Undefined

The register bank pointer indicates the address of the register bank being used. Figure 3.2-5 shows the rule of conversion from the register bank pointer bits to the actual address.

Figure 3.2-5 Rule of Conversion from the RP Bits to the Actual Address

RP upper bits Lower bits of operation code

R4 R3 R2 R1 R0 b2 b1 b0

"0" "1"

A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0

The register bank pointer specifies a memory block (register bank) used as a general-purpose register in the RAM area. There are 32 register banks. Setting a value (from 0 to 31) in the upper five bits of the register bank pointer specifies a register bank. One register bank contains eight 8-bit general-purpose registers that are selected with the lower 3 bits of an operation code.

The register bank pointer allows a range of 0100H to 01FFH (maximum) to be used as the general-purpose

register area. However, some models restrict the usable range when only internal RAM is used. The initial value of the register bank pointer specified after the reset operation is undefined.

Be sure to set up the register bank pointer (RP) before using general-purpose registers.

The register bank pointer is part of the program status register (PS), and thus is not allowed to access only the register bank pointer.

RP initial value · "0" · Address generated

Page 48 of the Fujitsu MB89202 user manual — (RP=11111--- B )
Page 48 · click to enlarge
Page 48

CHAPTER 3 CPU

3.3 General-Purpose Registers

The general-purpose registers are memory blocks. Eight 8-bits comprise a bank. The register bank pointer (RP) specifies a register bank. Although up to 32 banks can be used, some banks can be expanded onto external RAM if the capacity of internal RAM is not sufficient for all 32 banks. The general-purpose registers are effective for processing interrupts, vector calls, or subroutine calls.

  • Configuration of the General-purpose Registers
  • Each general-purpose register consists of 8 bits. The general-purpose registers are placed in the register banks at the general-purpose register area (on RAM).
  • One bank contains eight registers (R0 to R7), and up to 32 banks can be used. However, some models restrict the number of usable banks when only internal RAM is used.
  • The register bank pointer (RP) specifies the register bank being used. The lower three bits of an operation code indicate general-purpose register 0 (R0) to general-purpose register 7 (R7).

Figure 3.3-1 shows the configuration of the register banks.

Figure 3.3-1 Configuration of Register Bank

100H* R0 000 R1 001 R2 010 R3 011 R4 100 R5 101 R6 110 R7 111 R0 000 R1 001

Bank 0

(RP=00000--- B )

10 8 H *

32 banks (on the RAM area) The number of usable banks is dependent on the size of the usable RAM area.

Bank 1

(RP=00001--- B )

R7 111

Bank 2

to Bank 30

1F 8 H *

R0 000

Ban 31

(RP=11111--- B )

1FF H *

R7 111

*: Address at the top of the register banks = 0100H + 8 × (upper 5 bits of RP)

For details on the general-purpose register area on each model, see Section "3.1.1 Specific-purpose Areas ".

Page 49 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 49 · click to enlarge
Page 49

CHAPTER 3 CPU

  • Features of the General-purpose Registers

The general-purpose registers have the following features:

  • High-speed access with short instructions (general-purpose register addressing)
  • Register banks (in blocks) that allow data to be easily conserved and partitioned in the unit of function

The general-purpose registers allow specific register banks to be statically assigned with the interrupt processing routine or vector call (CALLV #0 to #7) processing routine. For example, it can be used such that the fourth register bank is always used for the second interrupt.

For interrupts, unless data in a specific register bank that corresponds to an interrupt processing is incorrectly overwritten by another routine, simply specifying the specific register bank at the beginning of the interrupt processing routine stores the data contained in the general-purpose registers before interruption. This feature allows data in general-purpose registers to avoid being put in the stack and allows interrupts to be handled efficiently at high speed.

For subroutine calls, in addition to conservation of data in general-purpose registers, the register banks can implement re-entrant programs (reloadable programs with variable addresses unfixed) that are usually created using the index register (IX) or another function.

A program must be created so that the values of the interrupt level bits in the condition code register (CCR: IL1 and IL0) do not change when the register bank pointer (RP) is rewritten to specify a register bank in the interrupt processing routine.

Page 50 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 50 · click to enlarge
Page 50

CHAPTER 3 CPU

3.4 Interrupts

The MB89202/F202RA series supports 12 interrupt request inputs corresponding to peripheral functions and allows an interrupt level to be assigned to each of the inputs. The interrupt controller compares levels of interrupts generated by peripheral functions when output of interrupt requests is allowed for peripheral functions. The CPU performs the interrupt operation according to its interrupt acceptance settings. The CPU cancels standby mode on reception of an interrupt request, then returns to the interrupt operation or normal operation.

  • Interrupt Requests from Peripheral Functions

Table 3.4-1 lists the interrupt requests that correspond to peripheral functions. When the CPU accepts an interrupt, the CPU takes a branch to the interrupt processing routine using the address in the interrupt vector table corresponding to the interrupt request as the branch address.

The interrupt level setting registers (ILR1, 2, 3, and 4) allow one of four interrupt processing intensities to be assigned to each interrupt request.

Interrupt requests with levels equal to or less than that of an interrupt request being handled in the interrupt processing routine are usually handled after the current interrupt processing routine ends. If interrupt requests with the same assigned level are generated simultaneously, IRQ0 has priority.

Table 3.4-1 Interrupt Requests and Interrupt Vectors (1/2)

Priority at identical level (at simultaneous occurrence) Upper

vector table Names of bits in the interrupt level setting registers

IRQ0 (External interrupt INT10) FFFAH FFFBH L01, L00 High

IRQ1 (External interrupt INT11) FFF8H FFF9H L11, L10

IRQ2 (External interrupt INT12) FFF6H FFF7H L21, L20

IRQ3 (8/16-bit capture timer/counter’s timer) FFF4H FFF5H L31, L30

IRQ4 (8/16-bit capture timer/counter’s capture) FFF2H FFF3H L41, L40

IRQ5 (Transmission with UART) FFF0H FFF1H L51, L50

IRQ6 (Reception with UART) FFEEH FFEFH L61, L60

IRQ7 (Time-base timer) FFECH FFEDH L71, L70

IRQ8 (A/D converter) FFEAH FFEBH L81, L80

IRQ9 (8-bit PWM) FFE8H FFE9H L91, L90

IRQA (External interrupt 2) FFE6H FFE7H LA1, LA0

Show 6 more labels / short text on this page
Address in the · Interrupt request · Lower · digits · digits · Low
Page 51 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 51 · click to enlarge
Page 51

CHAPTER 3 CPU

Table 3.4-1 Interrupt Requests and Interrupt Vectors (2/2)

Priority at identical level (at simultaneous occurrence) Upper

vector table Names of bits in the interrupt level setting registers

IRQB (Flash interface) FFE4H FFE5H LB1, LB0 High

IRQC (8-bit serial I/O) FFE2H FFE3H LC1, LC0

IRQD (Unused) FFE0H FFE1H LD1, LD0

IRQE (Unused) FFDEH FFDFH LE1, LE0

IRQF (Unused) FFDCH FFDDH LF1, LF0

Show 6 more labels / short text on this page
Address in the · Interrupt request · Lower · digits · digits · Low
Page 52 of the Fujitsu MB89202 user manual — (W) (W) (W) (W) (W) (W) (W) (W)
Page 52 · click to enlarge
Page 52

CHAPTER 3 CPU

3.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)

For the interrupt level setting registers (ILR1, 2, 3, and 4), 16 two-bit data items corresponding to interrupt requests sent from peripheral functions are assigned. Interrupt levels can be specified in these 2-bits (interrupt level setting bits).

  • Configuration of the Interrupt Level Setting Registers (ILR1 to ILR4)

Figure 3.4-1 Configuration of Interrupt Level Setting Register

Register Address (Initial value)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

ILR1 007BH L31 L30 L21 L20 L11 L10 L01 L00 1111 1111B

(W)

ILR2 007CH L71 L70 L61 L60 L51 L50 L41 L40 1111 1111B

(W)

ILR3 007DH LB1 LB0 LA1 LA0 L91 L90 L81 L80 1111 1111B

(W)

ILR4 007EH LF1 LF0 LE1 LE0 LD1 LD0 LC1 LC0 1111 1111B

(W)

W: Write only

For each interrupt request, 2 bits of the interrupt level setting registers are assigned. The values specified in the interrupt level setting registers are the intensities for processing the interrupts (interrupt levels 1 to 3).

Interrupt level setting bits are compared with interrupt level bits in the condition code register (CCR: IL1 and IL0).

When interrupt level 3 is specified, the CPU does not accept interrupt requests.

Table 3.4-2 provides the relationship between interrupt level setting bits and interrupt levels.

Table 3.4-2 Relationship between Interrupt Level Setting Bits and Interrupt Levels

L01 to LF1 L00 to LF0 Requested interrupt level Priority

0 0 1 High

  • When the main program is being executed, the interrupt level bits in the condition code register

(CCR: IL1 and IL0) are normally set to 11B.

  • The ILR1 to ILR4 registers are write-only enabled, and thus the bit manipulation instructions (SETB

and CLRB) cannot be used.

Low (no interrupt)

Page 53 of the Fujitsu MB89202 user manual — RETI
Page 53 · click to enlarge
Page 53

CHAPTER 3 CPU

3.4.2 Steps in the Interrupt Operation

When an interrupt request is generated in a peripheral function, the interrupt controller notifies the CPU of its interrupt level. If the CPU can accept an interrupt, the CPU temporarily stops the program that is handling and starts the interrupt processing routine.

  • Steps in the Interrupt Operation

The steps for processing an interrupt are: occurrence of a source of an interrupt in a peripheral function, designation of the interrupt request flag bit (request F/F), check on the interrupt request enable bit (enable F/F), check on the interrupt level (ILR1, 2, 3, or 4, and CCR: IL1 and IL0), check on another request with the same level, and check on the interrupt enable flag (CCR: I).

Figure 3.4-2 shows the steps in the interrupt operation.

Figure 3.4-2 Steps in the Interrupt Operation

Interrupt processing routine Update of IL

IL I PS

Cancellation of a reset

PC and PS saved Request cleared

MB89202 CPU

Level check Interrupt processing

Initial setting for interrupt

RAM

PC and PS restored

Execution of main program

Enable F/F Source F/F

RETI

AND

PC and PS restored

➀After a reset, all interrupt requests are prohibited.

Initialize the peripheral functions that generate interrupts using a initialization program for peripheral functions, specify interrupt levels in the interrupt level setting registers (ILR1 to ILR4) concerned, then start up the peripheral functions.

Interrupt levels 1, 2, and 3 can be specified. Level 1 is the highest level, and level 2 is the second highest level. Level 3 prohibits interrupts from the peripheral functions to which it is assigned. ➁Run the main program. (For a multiple-interrupt, run the interrupt processing routine.) ➂When a peripheral function generates a source of an interrupt, the interrupt request flag bit for

peripheral function (request F/F) is set to "1". If the interrupt request enable bit for a peripheral function is turned on (enable F/F = 1) at that time, an interrupt request is output to the interrupt controller.

Show 9 more labels / short text on this page
Main program · Internal bus · Operation · Unit · Check Com- parator · Level comparator · Interrupt controller · Occur- rence of interrupt · Peripheral
Page 54 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 54 · click to enlarge
Page 54

CHAPTER 3 CPU

➃The interrupt controller is always monitoring interrupt requests from peripheral functions. The interrupt

controller notifies the CPU of the highest interrupt level interrupt among levels corresponding to interrupt requests currently generated. If different requests are made with the same interrupt level, the interrupt controller also determines their priorities.

➄The CPU checks the value in the interrupt enable flag (CCR: I) when the priority of the interrupt level

that is received is higher (the level value is lower) than the level specified in the interrupt level bits in the condition code register (CCR: IL1 and IL0). The CPU then accepts the interrupt when the enable flag is turned on (CCR: I = 1).

➅Put the values in the program counter (PC) and program status (PS) in the stack, fetch the start address

of the interrupt processing routine from the interrupt vector table concerned, change the value of the interrupt level bits in the condition code register (CCR: IL1 and IL0) to the value of the interrupt level accepted, and then start the interrupt processing routine.

➆Finally, restore the values of the program counter (PC) and program status (PS) put into the stack with

the RETI instruction, then execute an instruction following the instruction executed immediately before the interruption.

Standby mode (low-power consumption mode) is cancelled by an interrupt. For details, see Section "3.7 Standby Mode (Low-Power Consumption Mode) ".

  • An interrupt request flag bit for a peripheral function is not automatically cleared even if the interrupt request is accepted. Therefore, it is necessary to clear the bit using a program in the interrupt processing routine (by writing "0" into the interrupt request flag bit normally).
  • Clearing an interrupt request flag bit at the beginning of the interrupt processing routine allows the peripheral function that generated the interrupt to re-generate an interrupt (set an interrupt request flag bit again) while the interrupt processing routine is being executed. However, the re-generated interrupt is normally accepted after the interrupt processing routine ends its current cycle.
Page 55 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 55 · click to enlarge
Page 55

CHAPTER 3 CPU

3.4.3 Multiple Interrupts

Multiple interrupts are allowed by setting different levels into the interrupt level setting registers (ILR1 to ILR4) for multiple interrupt requests from peripheral functions.

  • Multiple Interrupts

When an interrupt request with a higher interrupt level is generated while the interrupt processing routine is operating, the current interrupt processing cycle is stopped to accept the higher-level interrupt request. Interrupt levels 1, 2, and 3 can be specified. Level 3 prohibits the CPU from accepting interrupts.

  • Example of multiple interrupts

As an example of multiple-interrupt processing, suppose a case in which a timer interrupt has precedence using the A/D interrupt, and the A/D interrupt level is set to level 2 and the timer interrupt level is set to level 1. Figure 3.4-3 shows the sequence performed when an external interrupt is generated while an A/D interrupt is being processed.

Figure 3.4-3 Example of Multiple Interrupts

Timer interrupt generated Stop process- ing

Return from timer interrupt processing

Return from A/D interrupt processing

  • In the A/D interrupt processing, the interrupt level bits in the condition code register (CCR: IL1 and IL0) are set to the same value as the value in the interrupt level setting register corresponding to the A/ D interrupt (ILR1, 2, 3, or 4) (i.e., 2 in this example). If an interrupt request with a higher interrupt level specified is generated (1 in this example), processing for the higher interrupt level is effected first.
  • To temporarily prohibit multiple interrupts in the A/D interrupt processing, turn off the interrupt enable flag (CCR: I = 0) in the condition code register, or set 00 B to the interrupt level bits (IL1 and IL0).
  • Executing the return instruction (RETI) after interrupt processing restores the values of the program counter (PC) and program status (PS) and ensures resumption of the interrupted program.
  • The value in the condition code register (CCR) is returned to the value used before interruption when the program status (PS) value is restored.
Show 11 more labels / short text on this page
Main program · A/D interrupt processing · Timer interrupt processing · Interrupt level 1 · Initializes peripherals · Interrupt level 2 · Timer interrupt processed · A/D interrupt generated · Resumes processing · A/D interrupt processed · Main program restarts
Page 56 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 56 · click to enlarge
Page 56

CHAPTER 3 CPU

3.4.4 Interrupt Processing Time

From when an interrupt request is generated to when control is transferred to the interrupt processing routine, both the time to quit the instruction being executed and the time to manage the interrupt (required to prepare interrupt processing) are required. The total time must be within 30 instruction cycles.

  • Interrupt Processing Time

From when an interrupt request is generated and accepted to when the interrupt processing routine starts, sufficient time is required to wait for an interrupt request sample and to manage the interrupt.

  • Interrupt request sample wait time

Generation of an interrupt request is checked by sampling an interrupt request at the last cycle of each instruction. Therefore, the CPU cannot identify an interrupt request while it is executing an instruction. The wait time becomes maximum when an interrupt request is generated immediately after the CPU executes the DIVU instruction (21 instruction cycles) with the longest instruction cycle.

  • Interrupt handling time

After accepting an interrupt, the CPU needs 9 instruction cycles for interrupt processing preparation to:

  • Save the values in the program counter (PC) and program status (PS)
  • Set the address at the beginning of the interrupt processing routine (interrupt vector) into the PC
  • Update the interrupt level bits (PS: CCR: IL1 and IL0) in the program status (PS).

Figure 3.4-4 shows the interrupt processing time.

Figure 3.4-4 Interrupt Processing Time

Execution of general instruction

Interrupt request sample wait time

Interrupt handling time (9 instruction cycles)

Interrupt request is generated

: Last instruction in which an interrupt is sampled

When an interrupt request is generated immediately after the DIVU instruction having the longest instruction cycle (21 instruction cycles), 30 instruction cycles (21 instructions + 9 instructions) are required for the interrupt processing time. However, if the DIVU instruction and MULU instruction are not used in the program, a maximum of 15 (6 instructions + 9 instructions) instructions are required for the instruction processing time.

An instruction cycle is changed by clock speed switching (gears). For details, see Section "3.6 Clock ".

Show 4 more labels / short text on this page
Interrupt processing routine · CPU performs · Interrupt handling · Interrupt wait time
Page 57 of the Fujitsu MB89202 user manual — 0870 H PS
Page 57 · click to enlarge
Page 57

CHAPTER 3 CPU

3.4.5 Stack Operation at Interrupt Processing

This section describes how values in registers are saved and restored at interrupt processing.

  • Stack Operation at the Beginning of Interrupt Processing

After accepting an interrupt, the CPU automatically saves the values in the program counter (PC) and program status (PS) in the stack.

Figure 3.4-5 shows the stack operation at the beginning of interrupt processing.

Figure 3.4-5 Stack Operation at the Beginning of Interrupt Processing

Address Memory Address Memory

027CH XXH 027DH XXH 027EH XXH 027FH XXH 0280H XXH 0281H XXH

027C H SP PS

027CH 08H 027DH 70H 027EH E0H 027FH 00H 0280H XXH 0281H XXH

0870 H PS

E000 H PC

0870 H PS

PC

0280 H SP E000 H PC

  • Stack Operation at the End of Interrupt Processing

When the return instruction (RETI) is executed at the end of interrupt processing, the values in the program status (PS) and the program counter (PC) are restored from the stack in that order (which is opposite to that at the beginning of interrupt processing). This operation restores the values in the PS and PC to those values used before interruption.

Values in the accumulator (A) and temporary accumulator (T) are not automatically saved in the stack. Therefore, save and restore the values using the PUSHW and POPW instructions.

Immediately before interruption · Immediately after interruption

Page 58 of the Fujitsu MB89202 user manual — 0280 H
Page 58 · click to enlarge
Page 58

CHAPTER 3 CPU

3.4.6 Stack Area for Interrupt Processing

A stack area on RAM is used for interrupt processing. The value in the stack pointer (SP) is used as the start address of the stack area.

  • Stack Area for Interrupt Processing

The stack area is used to save/restore the value in the program counter (PC) when executing the subroutine call instruction (CALL) or vector call instruction (CALLV) or temporarily save and restore values in registers or other storage with the PUSHW and POPW instruction.

  • Locate the stack area on RAM together with the data area.
  • It is recommended that the initial settings be specified such that the stack pointer (SP) indicates the highest address of RAM and that the data area be set up from the lowest address of RAM.

Figure 3.4-6 is an example showing the stack area.

Figure 3.4-6 Stack Area for Interrupt Processing

0000 H I/O

0080 H RAM

Value recommended for SP (When the highest RAM address is 027FH)

0280 H

ROM

FFFF H

For the stack area, interrupts, subroutine calls, or PUSHW instruction use addresses in descending order, and the return instructions (RETI and RET) or the POPW instruction releases addresses in the stack area in ascending order. When a lower address is used in the stack area due to multiple interrupts or subroutine calls, make arrangements so that the stack area does not overlap with the data area and general-purpose register area containing other data.

Show 4 more labels / short text on this page
Data area · General- purpose register · Stack area · Access prohibited
Page 59 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 59 · click to enlarge
Page 59

CHAPTER 3 CPU

3.5 Reset

  • There are four sources of reset:
  • External reset
  • Software reset
  • Watchdog reset
  • Power-on reset Oscillation stabilization wait time is not applied in some operating modes when a reset occurs or in some option settings.
  • Reset Sources

Table 3.5-1 Reset Sources

Reset source Reset condition

External reset The external reset pin is "L" level.

Software reset "0" is written into the software reset bit in the standby control register (STBC: RST).

Watchdog reset The watchdog timer overflows.

Power-on reset Power is turned on.

  • External reset

External reset occurs when "L" level is input to the external reset pin (RST). When the reset pin becomes "H" level, the external reset is cancelled.

For external reset when power is turned on or in stop mode, the reset operation is performed after oscillation stabilization wait time is up or the external reset is cancelled.

The external reset pin functions as the reset output pin in accordance with option settings.

  • Software reset

Software reset generates a 4-instruction cycle reset by writing "0" into the software reset bit in the standby control register (STBC: RST). Software reset does not wait until oscillation stabilization wait time has expired.

  • Watchdog reset

Watchdog reset generates a 4-instruction cycle reset when no data is written into the watchdog control register (WDTC) within a specified time after the watchdog timer is activated. Watchdog reset does not wait until oscillation stabilization wait time is up.

Page 60 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 60 · click to enlarge
Page 60

CHAPTER 3 CPU

  • Power-on reset

Power-on reset occurs when power is turned on. Power-on reset occurs after oscillation stabilization wait time has expired.

Power-on reset requires an external reset circuit.

  • Reset Sources and Oscillation Stabilization Wait Time

Operations in oscillation stabilization wait time depend on the operating mode used when a reset occurs.

After a reset, active mode is set regardless of the operating mode applied before the reset (standby mode) and reset source. Therefore, if a reset occurs while oscillation is being stopped or within the oscillation stabilization wait time, the oscillation stabilization wait reset mode is set.

Software reset and watchdog reset do not apply oscillation stabilization wait time.

Table 3.5-2 shows the relationship between reset sources, oscillation stabilization wait time, and the reset operation (mode fetch).

Table 3.5-2 Relationship between the Reset Sources and Oscillation Stabilization Wait Time

Reset source Operating mode Reset operation and oscillation stabilization wait time

When power is turned on or stop mode

The reset operation is performed when external reset is cancelled after oscillation stabilization wait time has expired.

Software reset and watchdog reset Active mode The reset operation is performed following the generation of a 4- instruction cycle reset.

Power-on reset When power is turned on

The reset operation is performed after power is turned on and oscillation stabilization wait time has expired.

* External reset in active mode does not apply oscillation stabilization wait time. The reset operation is performed after cancellation of external reset.

External reset*

Page 61 of the Fujitsu MB89202 user manual — PONR
Page 61 · click to enlarge
Page 61

CHAPTER 3 CPU

3.5.1 Reset Flag Register (RSFR)

The reset flag register (RSFR) allows confirmation of the source for a generated reset.

  • Configuration of the Reset Flag Register (RSFR)

Figure 3.5-1 Configuration of Reset Flag Register (RSFR)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 000EH PONR ERST WDOG SFTR XXXX B R

SFTR

Software reset flag bit When read

Does not affect operations

The source is software reset.

Watchdog reset flag bit

WDOG

Does not affect operations

The source is watchdog reset.

External reset flag bit

ERST

Does not affect operations

The source is external reset.

Power-on reset flag bit

PONR

When read When written

Does not affect operations

The source is power-on reset.

RRead only

: Unused X : Undefined

Show 6 more labels / short text on this page
Address Initial value · When written · When read · When written · When read · When written
Page 62 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 62 · click to enlarge
Page 62

CHAPTER 3 CPU

Table 3.5-3 Explanation of Functions of Each Bit in the Reset Flag Register (RSFR)

"1" is set to this bit when power-on reset occurs. "1" is set to this bit after power is turned on. This bit is cleared with "0" after being read. Writing a value to this bit has no significance.

PONRPower-on reset flag bit

"1" is set to this bit when external reset occurs. "1" is set to this bit while other reset flags are maintained when all other reset flags have been set before the external reset flag is set. This bit is cleared with "0" after being read. Writing a value to this bit has no significance.

bit6 ERSTExternal reset flag bit

"1" is set to this bit when watchdog reset occurs. "1" is set to this bit while other reset flags are maintained when all other reset flags have been set before the watchdog reset flag is set. This bit is cleared with "0" after being read. Writing a value to this bit has no significance.

WDOGWatchdog reset flag bit

"1" is set to this bit when software reset occurs. "1" is set to this bit while other reset flags are maintained when all other reset flags have been set before the software reset flag is set. This bit is cleared with "0" after being read. Writing a value to this bit has no significance.

SFTRSoftware reset flag bit

Unused bits The values read out are undefined. Writing data to these bits does not affect operations.

A reset source flag is set when a reset source is generated. When the reset source flag register is read, all bits in the reset source flag register are cleared. Therefore, to determine the source of a reset, read this register using the initial value setting routine after the reset.

Show 6 more labels / short text on this page
Bit name Description · bit7 · bit5 · bit4 · bit3 · to bit0
Page 63 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 63 · click to enlarge
Page 63

CHAPTER 3 CPU

3.5.2 External Reset Pin

The external reset pin generates a reset by "L" level input. When an option setting for enabling reset output is selected, the "L" level signal is output depending on the internal reset source.

  • Block Diagram of External Reset Pin

The external reset pin (RST) on models with supported reset output has hysteresis input and pull-up N-ch open drain output.

The external reset pin on models without supported reset output is used only as the pin dedicated to reset input.

Figure 3.5-2 is a block diagram of the external reset pin.

Figure 3.5-2 Block Diagram of External Reset Pin

Pull-up resistor Approx. 50kΩ for 5 V (Not available for MB89F202)

Pin Internal reset source

  • Function of the External Reset Pin

The external reset pin (RST) generates an internal reset signal by making use of "L" level input.

The RST outputs the "L" level signal according to the internal reset source and oscillation stabilization wait time applied following a reset. The internal reset source may be software reset, watchdog reset, or power- on reset.

External reset input is accepted asynchronously regardless of the internal clock.

Initialization of the internal circuits requires a clock. In particular, for operations with an external clock, the clock must be input when a reset signal is input.

Internal pull-up control for RST is not available for MB89F202/F202RA. To ensure proper external reset control in MB89F202/F202RA, an external pull-up (recommend 100 kΩ) for RST pin must be required.

P-ch · N-ch RST · Internal reset signal

Page 64 of the Fujitsu MB89202 user manual — NO
Page 64 · click to enlarge
Page 64

CHAPTER 3 CPU

3.5.3 Reset Operation

The CPU reads the mode data (mode fetch) and reset vector from internal ROM according to the mode pin settings following the cancellation of a reset. For a return triggered by a reset when power is turned on and in stop mode, the CPU fetches the mode after oscillation stabilization wait time has expired. When a reset occurs, the contents in RAM cannot be guaranteed.

  • Overview of the Reset Operation

Figure 3.5-3 Reset Operation Flow

Software reset Watchdog reset

External reset input Power-on reset

YES

NO

When power is turned on or in stop

YES

State of reset wait- ing for stabilization of oscillation

State of reset wait- ing for stabilization of oscillation

State of reset wait- ing for stabilization of oscillation

External reset state cancelled?

NO

YES

Mode fetch (reset operation)

Normal operation (RUN mode)

Instruction code fetched from the address that indicates the reset vector; the instruction is then executed.

Show 5 more labels / short text on this page
Power-on reset selected? · Being reset · mode? · Mode data fetch · Reset vector fetch
Page 65 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 65 · click to enlarge
Page 65

CHAPTER 3 CPU

  • Mode Fetch

The CPU reads the mode data and reset vector from internal ROM following the cancellation of the reset.

  • Mode data (address: FFFD H )

Set single-chip mode (00H) to the mode data.

  • Reset vector (address: FFFE H (highest)/FFFF H (lowest))

Specify the address at which execution is to be started after the reset operation is completed. The CPU starts executing instructions from the specified address.

  • State of Reset Waiting for Stabilization of Oscillation

The CPU performs a reset operation for a reset when power is turned on or an external reset in stop mode when the oscillation stabilization wait time specified with option settings has expired. In this case, if the external reset input is not cancelled, the CPU performs the reset operation following cancellation of the external reset.

When an external clock is used, oscillation stabilization wait time is applied, and thus input of an external clock is required at a reset.

The time-base timer generates oscillation stabilization wait time.

  • Influence from a Reset of Contents in RAM

When reset conditions occur, the CPU stops handling the current instruction, then enters the reset state. The contents in RAM does not change even after a reset. However, if a reset occurs while 16-bit data is being written, the upper byte (only) is written; the lower byte may be unwritten. If a reset occurs immediately after, immediately before, or while data is written, the contents in the address to which data is written at that time is not guaranteed.

Page 66 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 66 · click to enlarge
Page 66

CHAPTER 3 CPU

3.5.4 State of Each Pin at Reset

The state of each pin is initialized by a reset.

  • States of Pins during Reset

When a reset occurs, most I/O pins (resource pins) become Hi-Z, and the CPU reads the mode data from internal ROM.

  • States of Pins after the CPU Reads the Mode Data

Most of the I/O pins remain Hi-Z immediately after the CPU reads the mode data.

For pin states established by something other than a reset, see "APPENDIX E Pin State of the MB89202/ F202RA Series " for details.

For pins that are Hi-Z when a reset source is generated, set up the devices connected with the pins such that they do not malfunction.

Page 67 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 67 · click to enlarge
Page 67

CHAPTER 3 CPU

3.6 Clock

The clock generator includes the oscillation circuit. A high-speed clock is generated by connecting an external resonator for oscillation frequency. Alternatively, when the clock is supplied from an external source, a clock signal can be connected to the clock input pin. The clock controller manages the speed and supply of the clock in active mode and standby mode.

  • Clock Supply Map

The clock controller manages oscillation of the clock and provision of the clock to the CPU and peripheral circuits (peripheral functions). Thus, the operating clock for the CPU or peripheral circuits is affected by clock speed switching (gears) and setting in standby mode (sleep/stop).

To peripheral functions, a divided frequency output of the free-run counter operating with the clock for peripheral circuits is provided.

However, the divided frequency output of the time-base timer operating with 1/2 frequency of the oscillation frequency is not affected by the gear.

Figure 3.6-1 shows the clock supply map.

Page 68 of the Fujitsu MB89202 user manual — UART
Page 68 · click to enlarge
Page 68

CHAPTER 3 CPU

Figure 3.6-1 Clock Supply Map

Watchdog timer

F CH

8/16-bit capture timer/counter

Oscillation circuit

1/2 frequency Time-base timer

8. b it PWM timer PWM pin

1/4 frequency

Gears

A/D converter AN pin Continuous conversion Continuous conversion Conversion/ comparison

Oscillation control

1/8 frequency

1/16 frequency 1/64 frequency

UART prescaler

UART

Serial switch

Sleep, stop, oscillation stabilization wait

UCK/SCK pin

U0/S0 pin

Supplied to CPU

UI/SI pin 8-bit serial I/O

1tINST

Buzzer BZ pin

Supplied to peripheral circuits

12-bit PPG PPG pin

1tINST

External interrupt 1 INT1 pin

Free-run counter

External interrupt 2 INT2 pin

Oscillation stabilization wait time

FCH : Oscillation frequency tINST *1 *2 *3 *4

: Instruction cycle : Not affected by the gear. : The gear affects the operating speed or other settings. : The time-base timer stops when the oscillation frequency clock halts. : Output of the time-base timer is selectable when the A/D converter is activated continuously.

Other operations are affected by the gear.

Show 20 more labels / short text on this page
(*1) · X0 pin · (*3) · (*2) · EC pin · T0 pin · X1 pin · (*2) · Stop mode · Clock controller · (*4) · (*2) · (*2) 3 · (*1) · Stop · (*2) · (*2) · (*2) · (*2) · (*1)
Page 69 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 69 · click to enlarge
Page 69

CHAPTER 3 CPU

3.6.1 Clock Generator

The clock generator enables oscillation in active mode and disables oscillation in stop mode.

  • Clock Generator
  • For a crystal resonator or ceramic resonator

Connect it as shown in Figure 3.6-2 .

Figure 3.6-2 Example of Connecting a Crystal Resonator or Ceramic Resonator

MB89202/F202RA series

Oscillation circuit

  • For an external clock

Connect it to the X0 pin and open the X1 pin as shown in Figure 3.6-3 .

Figure 3.6-3 Example of Connecting an External Clock

MB89202/F202RA series

Oscillation circuit

Open

Page 70 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 70 · click to enlarge
Page 70

CHAPTER 3 CPU

3.6.2 Clock Controller

  • The clock controller consists of the following six blocks:
  • Oscillation circuit
  • System clock selector
  • Clock controller
  • Oscillation stabilization wait time selector
  • System clock control register (SYCC)
  • Standby control register (STBC)
  • Block Diagram of Clock Controller

Figure 3.6-4 is a block diagram of the clock controller.

Figure 3.6-4 Block Diagram of Clock Controller

Standby control register (STBC)

STP SLP SPL RST

Pin control Stop Sleep Clock for time-base timer 1/2 frequency

System clock selector

Pre-scaler 1/4 frequency 1/8 frequency 1/16 frequency 1/64 frequency

Supplied to the CPU

Clock control circuit

Clock generator

1tINST

Supplied to peripheral circuits

1tINST

Oscillation stabilization wait time selector

214/FCH 217/FCH 218/FCH

From the time-base timer

SCM WT1 WT0 CS1 CS0

System clock control register (SYCC)

FCH tINST

: Oscillation frequency : Instruction cycle

Selector

Page 71 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 71 · click to enlarge
Page 71

CHAPTER 3 CPU

  • Oscillator

Oscillation circuit that halts oscillation in stop mode.

  • System clock selector

Selects one of four frequency-divided source clocks to be supplied to the clock control circuit.

  • Clock controller

Controls the operating clock supplied to the CPU and peripheral circuits according to the active (RUN) mode and standby mode (sleep, stop).

It also stops supply of the clock to the CPU until the clock supply stop signal for the oscillation stabilization wait time selector is cancelled.

  • Oscillation stabilization wait time selector

Selects one of three oscillation stabilization wait time periods generated by the time-base timer according to the standby mode or a reset, then outputs the clock supply stop signal to the CPU by using the selected time period.

  • System clock control register (SYCC)

Selects the clock speed and oscillation stabilization wait time setting, then checks the clock state.

  • Standby control register (STBC)

Controls transition from active (RUN) mode to standby mode, pin state settings at stop mode, and software reset.

Page 72 of the Fujitsu MB89202 user manual — S CM
Page 72 · click to enlarge
Page 72

CHAPTER 3 CPU

3.6.3 System Clock Control Register (SYCC)

The system clock control register (SYCC) manages clock settings such as selection of the clock speed and oscillation stabilization wait time.

  • Configuration of the System Clock Control Register (SYCC)

Figure 3.6-5 Configuration of System Clock Control Register (SYCC)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0007H WT1 SCM WT0 CS1 CS0 1--MM-00B R/W R R/W R/W R/W

Clock speed selection bits

C S 1 C S 0

Instruction cycle (when FCH is 12.5 MHz)

0 0 64/FCH (5.12 µs)

0 1 16/FCH (1.28 µs)

1 0 8/FCH (0.64 µs)

1 1 4/FCH (0.32 µs)

Oscillation stabilization wait time selection bits

WT1 WT0

Oscillation stabilization wait time according to output of the time-base timer (when FCH is 12.5 MHz)

Setting prohibited Approx. 214/FCH (approx. 1.31 ms) Approx. 217/FCH (approx. 10.5 ms) Approx. 218/FCH (approx. 21.0 ms)

S CM

System clock monitor bit Clock stopping or waiting for stabilization of oscillation Active mode

RRe a d only R/W : Re a d ab le/Writ ab le

: Unused M : Mask option : Initial value

Page 73 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 73 · click to enlarge
Page 73

CHAPTER 3 CPU

Table 3.6-1 Explanation of Functions of Each Bit in the System Clock Control Register (SYCC)

Used to check the current clock mode. When this bit is 0, the clock is stopping or waiting for stabilization of oscillation. When this bit is 1, operations are performed in active mode. Note:

bit7 SCMSystem clock monitor bit

This bit is read-only enabled. Writing a value to this bit does not affect operation.

bit5 Unused bits Values in these bits are undefined when read. Writing values into these bits does not affect operation.

Used to select an oscillation stabilization wait time setting. When external interrupt causes a return from stop mode to active mode, the oscillation stabilization wait time setting selected by these bits is applied. The initial values of these bits are determined by options. Therefore, when an oscillation stabilization wait time setting is to be applied for a reset, it is selected by options. Note:

WT1, WT0Oscillation stabilization wait time selection bits

Change values in these bits after confirming that the clock is not waiting for stabilization of oscillation using the SCM bit.

This bit is always "1" when read. Note:

Specify "1".

Used to select the clock speed in active mode. One of four operating clock speeds (gears) can be specified for the CPU and peripheral functions. However, these bits do not affect the operating clock for the time-base timer.

CS1, CS0Clock speed selection bits
  • Instruction Cycle (t INST )

For instruction cycles (minimum instruction run time), a 1/4, 1/8, 1/16, or 1/64 frequency can be selected using the clock speed selection bits (CS1 and CS0).

In active mode, when the oscillation frequency (FCH) is 12.5 MHz, the instruction cycle for the maximum

speed (SYCC: CS1 and CS0 = 11B) is 4/FCH (= about 0.32 µs).

Show 7 more labels / short text on this page
Bit name Description · bit6, · bit4, · bit3 · bit2 Unused bit · bit1, · bit0
Page 74 of the Fujitsu MB89202 user manual — F CH /64
Page 74 · click to enlarge
Page 74

CHAPTER 3 CPU

3.6.4 Clock Mode

The clock speed is switched by selecting one of four frequency-divided source clocks (gears).

  • Operations in Each Clock Mode

Table 3.6-2 Operations in Each Clock Mode

Operating clock in each block

Cause that cancels standby mode (excepting reset) SYCC register

(SYCC: CS1

RUN

F CH /4

F CH /2 F CH /4

Stopped Stop Stopped Stopped Stopped External interrupt

RUN

F CH /8

F CH /2 F CH /8

Stopped Stop Stopped Stopped Stopped External interrupt

RUN

F CH /16

F CH /2 F CH /16

Stopped Stop Stopped Stopped Stopped External interrupt

F CH /64

RUN

F CH /2 F CH /64

Stopped Stop Stopped Stopped Stopped External interrupt

Each clock mode allows transition to a corresponding standby (sleep/stop) mode. For details of standby mode, see Section "3.7 Standby Mode (Low-Power Consumption Mode) ".

  • Gears (Clock Speed Switching Function)

Writing one of 00B to 11B into the clock speed selection bits (SYCC: CS1 and CS0) in the system clock

control register selects one of four clock speeds.

The CPU and peripheral circuits operate using the clock speed selected. However, the gear does not affect the time-base timer.

Power consumption can be reduced by lowering the clock speed.

Show 26 more labels / short text on this page
Clock speed · Standby · mode Clock · CPU time-base · Peripheral · timer · function · and CS0) · Interrupt request · High speed · Generated · (1, 1) · Sleep · Interrupt request · Generated · (1, 0) · Sleep · Interrupt request · Generated · (0, 1) · Sleep · Interrupt request · Generated · (0, 0) · Low speed · Sleep
Page 75 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 75 · click to enlarge
Page 75

CHAPTER 3 CPU

  • Operations in Active Mode

In active (RUN) mode, the oscillator is generating a clock. The CPU, time-base timer, and other peripheral circuits operate using the clock.

In active mode, all clock speeds except the time-base timer clock speed can be changed (using gears). In active mode, specifying standby mode results in a transition to sleep mode or stop mode.

Operations always start in RUN mode after a reset (any type). (Operating modes are cancelled by a reset.)

Do not rewrite the values in the oscillation stabilization wait time selection bits (SYCC: WT1 and WT0) while the clock is waiting for stabilization of oscillation. Using the system clock monitor bits, change the values in these bits after checking that SYCC: SCM is "1".

Page 76 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 76 · click to enlarge
Page 76

CHAPTER 3 CPU

3.6.5 Oscillation Stabilization Wait Time

Oscillation stabilization wait time is to be applied when power is turned on to start the clock in RUN mode while the clock is stopped in stop mode.

  • Oscillation Stabilization Wait Time

A ceramic or crystal resonator normally requires several or several tens of milli-seconds from oscillation start to oscillation stabilization at a specific cycle (oscillation frequency).

Thus, CPU operation must be prohibited immediately after the start of oscillation, and the clock is to be supplied to the CPU when oscillation is stable following the expiration of oscillation stabilization wait time.

The period during which oscillation becomes stable is dependent on the type of oscillator (such as crystal or ceramic) connected to the oscillation circuit (clock generator). Therefore, an oscillation stabilization wait time setting appropriate to the oscillator used must be selected.

Figure 3.6-6 shows changes in a frequency generated by an resonator from generation to stabilization.

Figure 3.6-6 Changes of a Frequency after Generation

Duration required for a resonator starts oscillation

Oscillation stabilization wait time

Return from stop mode or reset operation

Start of oscillation Oscillation stabilizes

  • Oscillation Stabilization Wait Time

Oscillation stabilization wait time is to be applied to start the clock in active mode while the clock is stopped.

Oscillation stabilization wait time is the duration from when the counter of the time-base timer is cleared to when the specified bits overflow.

  • Oscillation stabilization wait time during operation

For oscillation stabilization wait time applied for a return from stop mode to active (RUN) mode due to external interrupt, one of three oscillation stabilization wait time settings can be selected using the oscillation stabilization wait time selection bits in the system clock control register (SYCC: WT1 and WT0).

Normal operation

Page 77 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 77 · click to enlarge
Page 77

CHAPTER 3 CPU

  • Oscillation stabilization wait time at a reset

Option settings specify oscillation stabilization wait time at a reset (initial values of WT1 and WT0).

Cancellation of stop mode by external reset also applies oscillation stabilization wait time.

Table 3.6-3 shows the relationship between the active mode operation start conditions and oscillation stabilization wait time.

Table 3.6-3 Active Mode Operation Start Conditions and Oscillation Stabilization Wait Time

Cancellation of stop mode

Active mode operation start

When power is turned

External reset External interrupt

Selection of oscillation stabilization wait time Option settings SYCC: WT1, WT0

condition · on

Page 78 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 78 · click to enlarge
Page 78

CHAPTER 3 CPU

3.7 Standby Mode (Low-Power Consumption Mode)

The MB89202/F202RA series supports sleep mode and stop mode in standby mode. Transition to standby mode is controlled by the standby control register (STBC) settings. In active mode, transition to sleep mode or stop mode is allowed. In standby mode, operation of the CPU and peripheral functions is stopped to reduce power consumption. This section describes the relationship between standby mode and clock mode and explains block operations in standby mode.

  • Standby Mode

In active mode, power consumption is reduced by lowering the speed of the operating clock for the CPU and peripheral circuits using clock speed switching (gears). However, in standby mode, the clock controller stops supply of the clock to the CPU (sleep mode) or stops oscillation of the source (stop mode) to reduce power consumption.

  • Sleep mode

In sleep mode, the CPU and watchdog timer are stopped. Peripheral functions operate using the normal clock.

  • Stop mode

In stop mode, the CPU and peripheral functions are stopped, and the clock does not oscillate. All the functions except for external interrupt halt.

Page 79 of the Fujitsu MB89202 user manual — CPU
Page 79 · click to enlarge
Page 79

CHAPTER 3 CPU

3.7.1 Operations in Standby Mode

This section describes CPU and peripheral function operation in standby mode.

  • Operations in Standby Mode

Table 3.7-1 Operations of the CPU and Peripheral Functions in Standby Mode

Function RUN Sleep Stop (SPL=0)

Clock Active Active Stopped Stopped

Instruction Active Stopped Stopped Stopped

CPU

ROM

Active Holding Holding Holding RAM

I/O port Active Holding Holding Hi-Z

Time-base timer Active Active Stopped Stopped

Watchdog timer Active Stopped Stopped Stopped

8-bit PWM timer/counter Active Active Stopped Stopped

8/16-bit capture timer/counter Active Active Stopped Stopped

UART Active Active Stopped Stopped

8-bit serial I/O Active Active Stopped Stopped

12-bit PPG Active Active Stopped Stopped

Buzzer Active Active Stopped Stopped

External interrupt 1 and 2 Active

A/D converter Active Active Stopped Stopped

  • State of pins in standby mode

The state of most I/O pins can remain the same as those set immediately before transition to stop mode or set to Hi-Z using the pin state setting bit in the standby control register (STBC: SPL), regardless of clock mode.

For details on pin states in standby mode, see "APPENDIX E Pin State of the MB89202/F202RA Series ".

Stop (SPL=1) · Peripheral · function

Page 80 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 80 · click to enlarge
Page 80

CHAPTER 3 CPU

3.7.2 Sleep Mode

This section describes sleep mode.

  • Operations Relating to Sleep Mode
  • Transition to sleep mode

In sleep mode, the operating clock for CPU is stopped. Although the CPU stops storing data in the registers and RAM used immediately before transition to sleep mode, peripheral functions, excepting the watchdog timer, continue to operate.

Writing "1" to the sleep bit in the standby control register (STBC: SLP) results in a transition to sleep mode. Any attempt to write "1" into the SLP bit while an interrupt request is being generated fails, transition to sleep mode cannot be made, and instructions are processed continuously. (Even after the interrupt is processed completely, transition to sleep mode is not possible.)

  • Cancellation of sleep mode

Sleep mode is cancelled by a reset or interrupt from a peripheral function.

Pin states are initialized by the reset operation.

When an interrupt request with an interrupt level higher than 11B is generated in a peripheral function or

external interrupt circuit in sleep mode, sleep mode is cancelled regardless of the CPU interrupt enable flag (CCR: I) or interrupt level bits (CCR: IL1 and IL0).

When sleep mode is cancelled, a normal interrupt operation is performed, and if interrupts are acceptable, interrupt processing is performed. Otherwise, if interrupts are unacceptable, the processing resumes starting from an instruction next to the instruction which was issued immediately before transition to sleep mode.

Page 81 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 81 · click to enlarge
Page 81

CHAPTER 3 CPU

3.7.3 Stop Mode

This section describes the stop mode.

  • Operations Relating to Stop Mode
  • Transition to stop mode

In stop mode, the oscillation frequency is stopped. Most functions stop storing data in the registers and RAM used immediately before transition to stop mode.

The clock circuit stops oscillating, the peripheral functions and CPU stop operating, but the external interrupt circuit continues to operate.

Writing "1" to the stop bit in the standby control register (STBC: STP) causes a transition to stop mode. At that time, if the pin state setting bit (STBC: SPL) is "0", the states of the external pins are maintained. If the pin state setting bit is "1", the states of the external pins are set to Hi-Z (the states of pins for which a pull- up resistor is specified in the pull-up setting resistor are set to level "H").

An attempt to write "1" into the STP bit while an interrupt request is being generated fails, transition to stop mode cannot made, and instructions are processed continuously. (Even after the interrupt is processed completely, transition to stop mode is not made.)

For a transition to stop mode, prohibit the time-base timer interrupt request output (TBTC: TBIE = 0) when necessary.

  • Cancellation of stop mode

Stop mode is cancelled by a reset or external interrupt.

When a reset occurs in stop mode, the reset operation is performed after oscillation stabilization wait time.

pin states are initialized by the reset operation.

When an interrupt request with an interrupt level higher than 11B is generated in an external interrupt

circuit in stop mode, stop mode is cancelled regardless of the CPU interrupt enable flag (CCR: I) or interrupt level bits (CCR: IL1 and IL0).

When stop mode is cancelled and oscillation stabilization wait time has expired, a normal interrupt operation is performed. Then, if interrupts are acceptable, interrupt processing is performed. Otherwise, an instruction following the instruction immediately before transition to stop mode is managed.

When an external interrupt cancels stop mode, part of the peripheral functions are restarted with data stored before the beginning of sleep mode. Therefore, the initial interval of the interval timer and other similar settings are rendered unknown. The peripheral functions must be initialized after returning from stop mode.

Among interrupts, only an interrupt request from the external interrupt circuit cancels the stop mode.

Page 82 of the Fujitsu MB89202 user manual — R
Page 82 · click to enlarge
Page 82

CHAPTER 3 CPU

3.7.4 Standby Control Register (STBC)

The standby control register (STBC) controls transition to sleep /stop modes, pin state settings in stop mode, and software reset.

  • Standby Control Register (STBC)

Figure 3.7-1 Standby Control Register (STBC)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0008H STP SLP SPL RST RESV 00010---B R/W R

Reserved bit When read

RESV

Does not affect operations

RST

4-instruction reset signal generated.

Always "1" Does not affect operations

SPL

Pin state setting bit

Pin states applied are maintained in stop mode.

Pin states are set to Hi-Z in stop mode.

SLP

Always "0" Does not affect operations

Transition to sleep mode

STP

Always "0" Does not affect operations

Transition to stop mode

R/W

: Readable/Writable

R

: Read only : Unused : Initial value

Show 12 more labels / short text on this page
Address Initial value · When written · Always "0" · Software reset bit · When read · When written · Sleep bit · When read · When written · Stop bit · When read · When written
Page 83 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 83 · click to enlarge
Page 83

CHAPTER 3 CPU

Table 3.7-2 Explanation of Functions of Each Bit in the Standby Control Register (STBC)

This bit specifies transition to stop mode. Writing "1" into this bit allows transition to stop mode. Writing "0" into this bit does not affect operations. This bit is always read with the value of "0".

bit7 STPStop bit

This bit specifies transition to sleep mode. Writing "1" into this bit allows transition to sleep mode. Writing "0" into this bit does not affect operations. This bit is always read with the value of "0".

bit6 SLPSleep bit

This bit specifies external pin states in stop mode. Writing "0" into this bit maintains states (levels) of the external pins at transition to stop mode. Writing "1" into this bit sets states of the external pins to Hi-Z (states of pins for which a pull-up resistor is specified are set to level "H"). This bit becomes "0" after a reset.

bit5 SPLpin state setting bit

This bit specifies software reset. Writing "0" into this bit generates a source of 4-instruction cycle internal reset. Writing "1" into this bit does not affect operations. This bit is always read with the value of "1".

bit4 RSTSoftware reset bit
bit3 RESVReserved bit

This bit is always read with the value of "0". Writing a value into this bit does not affect operations.

bit2 to bit0 Unused bits Values read out of these bits are undefined. Writing values into these bits does not affect operations.

Bit name Description

Page 84 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 84 · click to enlarge
Page 84

CHAPTER 3 CPU

3.7.5 Diagram for State Transition in Standby Mode

Figure 3.7-2 shows the state transition diagram in standby mode.

  • Diagram for State Transition in Standby Mode

Figure 3.7-2 State Transition Diagram

Power turned on

Power-on reset

Oscillation stabilization wait

Reset mode

reset mode

RUN mode Sleep mode

Oscillation stabilization wait Stop mode

(1)C a ncell a tion of re s et inp u t (2)

: Reset sources (multiple) : Transition to sleep mode by the standby control register (STBC: SLP = 1) : External reset input

(3) (4)

: Transition to stop mode by the standby control register (STBC: STP = 1)

: Interrupt request

(7) (8) (9) (10) (11)

: External interrupt request

: Time-base timer overflow (end of oscillation stabilization wait time)

: External reset input

Show 10 more labels / short text on this page
(9) · (4) (1) (2) · (3) · (11) · (10) · (8) · (6) (5) · (7) · (5) · (6)
Page 85 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 85 · click to enlarge
Page 85

CHAPTER 3 CPU

  • Transition to and cancellation of clock mode (non-standby mode)

Table 3.7-3 Transition to and Cancellation of Clock Mode

State transition Transition conditions

Transition to active mode after power-on reset

(9) End of oscillation stabilization wait time (output of time-base timer) (1) Cancellation of reset input

Reset in RUN mode (2) External reset, software reset, or watchdog reset

  • Transition to and cancellation of standby mode

Table 3.7-4 Transition to and Cancellation of Standby Mode

State transition Transition conditions

Transition to sleep mode (3) STBC: SLP=1

Cancellation of sleep mode (6) Interrupt (each type) (4) External reset

Transition to stop mode (5) STBC: STP=1

(7) External interrupt (8) End of oscillation stabilization wait time (output of the time-base timer) (10) External reset (11) External reset (during oscillation stabilization wait)

Cancellation of stop mode

In standby mode, the CPU and watchdog timer stop. Thus, software and watchdog resets do not occur.

Page 86 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 86 · click to enlarge
Page 86

CHAPTER 3 CPU

3.7.6 Notes on Standby Mode

Even if the standby control register (STBC) sets standby mode, transition to standby mode is not allowed when a peripheral function generates an interrupt request. When an interrupt causes a return from standby mode to active mode, subsequent operations depend on whether interrupt requests are acceptable.

  • Transition to Standby Mode and Interrupt

When an interrupt request with an interrupt level higher than 11B is generated in a peripheral function to

the CPU, an attempt to write "1" into the stop bit (STBC: STP) or sleep bit (SLP) in the standby control register is ignored. Therefore, any attempt at transition to standby mode fails. (Even after the interrupt is processed, transition to standby mode is not allowed.)

This type of rejection does not depend on whether the CPU can accept interrupts.

Even if the CPU is processing an interrupt, transition to standby mode is allowed when the request flag bit for the interrupt has been cleared and there are no other interrupt requests to be processed.

  • Cancellation of Standby Mode by an Interrupt

When an interrupt request with an interrupt level higher than 11B is generated in a peripheral function or

another component in sleep mode or stop mode, standby mode is cancelled. This operation does not depend on whether the CPU can accept interrupts.

After cancellation of standby mode, the CPU normally takes a branch to the interrupt processing routine if the priority of the interrupt level setting register (ILR1 to ILR4) corresponding to the interrupt request is higher than the level specified in the interrupt level bits (CCR: IL1 and IL0) in the condition code register and if the interrupt enable flag is turned on (CCR: I = 1). Otherwise, an instruction is managed following the instruction causing standby mode to be set.

To prohibit a branch to the interrupt processing routine immediately after return, interrupts must be prohibited before standby mode is set.

  • Notes on Setting Standby Mode

For setting standby mode using the standby control register (STBC), use the settings specified in Table 3.7- 5 . When 1 is set to both bits at the same time, stop mode has precedence over sleep mode. However, it is recommended that "1" not be set to the bits at the same time.

Table 3.7-5 Low-power Consumption Mode Established using the Standby Control

Show 6 more labels / short text on this page
Register (STBC) · STBC register · Mode STP(bit7) SLP(bit6) · 0 0 Active · 0 1 Sleep · 1 0 Stop
Page 87 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 87 · click to enlarge
Page 87

CHAPTER 3 CPU

  • Oscillation Stabilization Wait Time

The oscillator for oscillation frequency stops in stop mode, thus oscillation stabilization wait time must be applied after the oscillator is activated.

Use one of three clock oscillation stabilization wait time settings generated by the time-base timer.

If the interval selected for the time-base timer is shorter than the oscillation stabilization wait time, an interval timer interrupt request is generated during oscillation stabilization wait time. To prevent this from occurring, disable output of time-base timer interrupt requests (TBTC: TBIE = 0) before transition to stop mode when necessary.

Page 88 of the Fujitsu MB89202 user manual — FFFD H
Page 88 · click to enlarge
Page 88

CHAPTER 3 CPU

3.8 Memory Access Mode

The MB89202/F202RA series supports only single-chip mode for access to memory.

  • Single-chip Mode

In single-chip mode, only internal RAM and ROM are used. The CPU can access only the internal I/O area, RAM area, and ROM area.

  • Mode Data

Set 00H into the mode data in internal ROM to select single-chip mode.

Figure 3.8-1 Configuration of Mode Data

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

FFFD H

00 H

Selects single-chip mode.

Other than 00H Reserved. Do not specify this value.

  • Operations for Selecting Memory Access Mode

Only single-chip mode is selectable.

Table 3.8-1 provides the settings for the mode pins and mode data.

Table 3.8-1 Settings for Mode Data

Memory access mode Mode data

Single-chip mode 00H

Figure 3.8-2 shows the operations for selecting memory access.

Address · Value Operation · Other modes Prohibited

Page 89 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 89 · click to enlarge
Page 89

CHAPTER 3 CPU

Figure 3.8-2 Operations for Selecting Memory Access

Source of a reset is generated.

I/O pins are high impedance.

Wait for cancellation of the reset source (external reset or oscillation stabilization wait time)

Mode data and reset vector are fetched from internal ROM.

Check of the mode data

Single-chip mode (00H)

Setup of I/O pin functions at execution of program (RUN mode)

I/O settings for each I/O pin using the port direction register (DDR) and other measures

I/O pins are available as ports.

Show 4 more labels / short text on this page
Being reset · Mode fetch · Other settings Prohibited · Mode data
Page 90 of the Fujitsu MB89202 user manual — CHAPTER 3 CPU
Page 90 · click to enlarge
Page 90

CHAPTER 3 CPU

Page 91 of the Fujitsu MB89202 user manual — CHAPTER 4
Page 91 · click to enlarge
Page 91

CHAPTER 4

I/O PORTS

This chapter describes the functions and operations of I/O ports.

4.1 Overview of I/O Ports

4.2 Port 0

4.3 Port 3

4.4 Port 4

4.5 Port 5

4.6 Port 6

4.7 Port 7

4.8 Programming Example of I/O Port

Page 92 of the Fujitsu MB89202 user manual — P61
Page 92 · click to enlarge
Page 92

CHAPTER 4 I/O PORTS

4.1 Overview of I/O Ports

Six I/O ports (comprising 26 pins) are available as general-purpose I/O ports (parallel I/O ports). These ports also serve peripherals (as I/O pins for specific peripheral functions).

  • Functions of I/O Ports

The I/O ports function to output data from the CPU to I/O pins via their port data register (PDR) and send signals input to I/O pins to the CPU. For some ports, the I/O direction of I/O pins can be set by optionally setting the bits of the port data direction register (DDR), with the bits corresponding to the pins.

The functions of the ports and peripherals for which the ports may serve are summarized below.

  • Port 0:General-purpose I/O port may also serve peripherals (external interrupt 2 and analog input pins)
  • Port 3:General-purpose I/O port may also serve peripherals (12-bit PPG, external interrupt 1, UART, 8-

bit serial I/O, 8/16-bit timers, and buzzer output pin)

  • Port 4:General-purpose I/O port of a type switched between CMOS push-pull and N-ch open-drain may

also serve peripherals (analog input pins)

  • Port 5:General-purpose I/O port may also serve peripherals (8-bit PWM pin)
  • Port 6:General-purpose I/O port (for MB89F202/F202RA, P61, P60 are input port)
  • Port 7:General-purpose I/O port

Table 4.1-1 lists the functions of the ports, and Table 4.1-2 lists the register of ports.

Table 4.1-1 Functions of Ports

Port name Pin name Input

form bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

P07 P06 P05 P04 P03 P02 P01 P00

P00/INT20/

CMOS

AN7 AN6 AN5 AN4

INT27 INT26 INT25 INT24

INT23 INT22 INT21 INT20

P37 P36 P35 P34 P33 P32 P31 P30

P30/UCK/SCK

BZ/ PPG INT12 INT11 TO/ INT10 EC UI/SI UO/SO UCK/

SCK

CMOS push-pull or N-ch open-drain

P43 P42 P41 P40

P40/AN0

CMOS

-

AN3 AN2 AN1 AN0

Port 5 P50/PWM CMOS hysteresis

CMOS push-pull -

P50

PWM

CMOS push-pull or N-ch open-drain

P61 P60

-

P61

CMOS CMOS - P72 P71 P70

Show 16 more labels / short text on this page
Output · form · Hysteresis · Port 0 · AN4 to P07/INT27 · analog CMOS push-pull · Port 3 · to P37/BZ/PPG · CMOS hysteresis · Port 4 · to P43/AN3 · analog · Port 6 P60, · CMOS hysteresis · Port 7 P70 · to P72
Page 93 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 93 · click to enlarge
Page 93

CHAPTER 4 I/O PORTS

Table 4.1-2 Registers of Ports

Register name Read/Write Address Initial value

Port 0 data register (PDR0) R/W 0000H XXXXXXXXB

Port 0 data direction register (DDR0) W *1 0001H 00000000B

Port 0 pull-up setting register (PUL0) R/W 0070H 00000000B

Port 3 data register (PDR3) R/W 000CH XXXXXXXXB

Port 3 data direction register (DDR3) W *1 000DH 00000000B

Port 3 pull-up setting register (PUL3) R/W 0071H 00000000B

Port 4 data register (PDR4) R/W 000FH XXXXB

Port 4 data direction register (DDR4) R/W 0010H 0000B

Port 4 output form setting register (OUT4) R/W 0011H 0000B

Port 5 data register (PDR5) R/W 0012H XB

Port 5 data direction register (DDR5) R/W 0013H 0B

Port 5 pull-up setting register (PUL5) R/W 0072H 0B

Port 6 data register (PDR6) R/W 0060H XXB

Port 6 data direction register *2 (DDR6) R/W 0061H 00B

Port 6 pull-up setting register (PUL6) R/W 0062H 00B

Port 7 data register (PDR7) R/W 0063H XXXB

Port 7 data direction register (DDR7) R/W 0064H 000B

Port 7 pull-up setting register (PUL7) R/W 0065H 000B

R/W : Readable and Writable W : Write only X : Undefined *1 : DDR0 and DDR3 cannot be used for bit manipulation instructions. *2 : DDR6 is not used in MB89F202/F202RA.

Page 94 of the Fujitsu MB89202 user manual — CMOS
Page 94 · click to enlarge
Page 94

CHAPTER 4 I/O PORTS

4.2 Port 0

Port 0 is a general-purpose I/O port and may also serve as peripheral inputs. The pins of this port can be used for peripherals or normal port function that can be selected according to the setting of a bit corresponding to the pin on a specific register. This section mainly explains the general-purpose I/O function of the port. This section also describes the structure, pins, and associated registers of port 0 and provides a block diagram of pins.

  • Structure of Port 0

Port 0 comprises the following four elements:

  • General-purpose I/O pins, external interrupt 2, and analog input pins (P00/INT20/AN4 to P07/INT27)
  • Port 0 data register (PDR0)
  • Port 0 data direction register (DDR0)
  • Port 0 pull-up setting register (PUL0)
  • Pins of Port 0

Port 0 has eight general-purpose I/O pins. When used as input pins at the same time, these pins can be also used as external interrupt input pins.

Table 4.2-1 lists the pins of port 0.

Table 4.2-1 Pins of Port 0

Port name Pin name Function Peripherals for which a pin

Input and output form Circuit

INT20external interrupt input 20 AN4 : analog input 4
INT21external interrupt input 21 AN5 : analog input 5

G

INT22external interrupt input 22 AN6 : analog input 6
INT23external interrupt input 23 AN7 : analog input 7

CMOS

purpose I/O INT24external interrupt input 24
purpose I/O INT25external interrupt input 25
purpose I/O INT26external interrupt input 26
purpose I/O INT27external interrupt input 27

For circuit type, see Section "1.7 Pin Functions Description " and "1.8 I/O Circuit Types ".

For pin operation when used as analog input, see "CHAPTER 12 A/D CONVERTER ".

Show 18 more labels / short text on this page
may serve · type Input Output · P00/INT20/AN4 P00 general- · purpose I/O · P01/INT21/AN5 P01 general- · purpose I/O · Analog CMOS · hysteresis · P02/INT22/AN6 P02 general- · purpose I/O · P03/INT23/AN7 P03 general- · purpose I/O · Port 0 · P04/INT24 P04 general- · P05/INT25 P05 general- · CMOS hysteresis D · P06/INT26 P06 general- · P07/INT27 P07 general-
Page 95 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 95 · click to enlarge
Page 95

CHAPTER 4 I/O PORTS

  • Block Diagram of Port 0

Figure 4.2-1 Block Diagram of Port 0

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 95)
Fig. 5

A/D converter enable bit A/D input occurring To A/D converter's analog input

SPLPin status setting bit of standby control register (STBC)

When the A/D converter is used, deselect pull-up action for pins P03/INT23/AN7 to P00/INT20/AN4.

Pins set to be used as analog input pins must not be used as an output port.

  • Registers PDR0, DDR0, and PUL0 of Port 0

Registers PDR0, DDR0, and PUL0 are associated with port 0.

The bits of these registers correspond to the pins of port 0 in one-to-one correspondence.

Table 4.2-2 tabulates the correspondence between the pins and the bits of the port 0 registers.

Table 4.2-2 Correspondence between the Pins and the Bits of the Port 0 Registers

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 95)
Fig. 6

Port name Bits of associated registers and corresponding pins

PDR0, DDR0, PUL0 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

Pin corresponding to bit P07 P06 P05 P04 P03 P02 P01 P00

Page 96 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 96 · click to enlarge
Page 96

CHAPTER 4 I/O PORTS

4.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)

This section describes the registers associated with port 0.

  • Functions of Port 0 Registers
  • Port 0 data register (PDR0)

The PDR0 register indicates the state of the output latch. For a pin set to function as an output port, the same value ("0" or "1") as the value state of the output pin can be read from this register. If the pin is set to function as an input port, however, its output latch value cannot be read from the register.

When a bit manipulation instruction (SETB, CLRB) is executed, the output latch values, not the value states of the pins, are read; thus, output latch values, other than those for bits to be manipulated, do not change.

  • Port 0 data direction register (DDR0)

The DDR0 register sets the I/O direction of each pin per bit.

When a bit of the DDR0 register corresponding to a pin of port 0 is set to "1", the pin functions as an output port. When the bit is set to "0", the pin functions as an input port.

Because the DDR0 register is write only, bit manipulation instructions (SETB, CLRB) do not apply.

  • Setting a port pin to serve external interrupt inputs

If a pin of port 0 is used as an external interrupt input pin, enable the external interrupt circuit operation and set the pin to function as an input port. When the pin is set in this mode, its output latch value has no significance.

  • Setting a port pin to serve analog inputs

If a pin of port 0 is used as an analog input pin, write "0" for the bit corresponding to the pin on the DDR0 register. The output transistor is then set to OFF and the pin is set in the Hi-Z state.

Set the bit of the ADEN register of the A/D converter to "1", the bit corresponding to the analog input pin in use.

  • Setting the input to a peripheral enable

If a peripheral with an input pin is used, set the pin of port 0 for the input to the peripheral to function as an input port. In this mode, the corresponding output latch value has no significance.

Page 97 of the Fujitsu MB89202 user manual — R/W
Page 97 · click to enlarge
Page 97

CHAPTER 4 I/O PORTS

Table 4.2-3 lists the functions of the port 0 registers.

Table 4.2-3 Functions of Port 0 Registers

name Data When being

read When being written Read/

Write Address Initial value

Output latch of "0" is set and "L" level is output to the pin in output port mode.

0 Pin state is "L" level.

Port 0 data register (PDR0)

R/W 0000 H XXXXXXXX B

Output latch of "1" is set and "H" level is output to the pin in output port mode.

1 Pin state is "H" level.

Output transistor operation is disabled and the pin is set to serve as an input pin.

0 Read prohibited (write only)

Port 0 data direction register (DDR0)

W 0001 H 00000000 B

1 Output transistor operation is enabled and the pin is set to serve as output pin.

R/WReadable/Writable W : Write only X : Undefined
  • Port 0 pull-up setting register (PUL0)

The bits of the pull-up setting register correspond to the pins of port 0 in one-to-one correspondence. When the pull-up resistor is selected by using the pull-up setting register, the pin will be at "H" level (pull-up state) instead of Hi-Z during stop (SPL = 1). During a reset, however, the pull-up is invalid and the pin remains at Hi-Z.

Figure 4.2-2 shows the pull-up resistor settings assigned to the values of the bits of the port 0 pull-up register.

Figure 4.2-2 Pull-up Resistor Settings (PUL0)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0070H PUL07 PUL06 PUL05 PUL04 PUL03 PUL02 PUL01 PUL00 00000000B

R/W

PUL03 PUL02 PUL01 PUL00 0

P03 pull-up OFF P02 pull-up OFF P01 pull-up OFF P00 pull-up OFF

P03 pull-up ON P02 pull-up ON P01 pull-up ON P00 pull-up ON

PUL07 PUL06 PUL05 PUL04

P07 pull-up OFF P06 pull-up OFF P05 pull-up OFF P04 pull-up OFF

P07 pull-up ON P06 pull-up ON P05 pull-up ON P04 pull-up ON

R/W

: Readable/Writable

: Initial value

Register · Address Initial value

Page 98 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 98 · click to enlarge
Page 98

CHAPTER 4 I/O PORTS

4.2.2 Operations of Port 0 Functions

This section describes the operation of port 0.

  • Operation of Port 0
  • Operation in output port mode

When "1" is written to a bit of the DDR0 register, the bit corresponding to a pin of port 0, the pin functions as an output port.

In output port mode, the output transistor operation is enabled and the output latch data is output to the pin.

Once data has been written into the PDR0 register, the written data is held in the output latch and output to the pin as it is.

The value state of the pin can be read by reading the PDR0 register.

  • Operation in input port mode

When "0" is written to a bit of the DDR0 register, the bit corresponding to a pin of port 0, the pin functions as an input port.

In input port mode, the output transistor is OFF and the pin status is Hi-Z.

Once data has been written into the PDR0 register, the written data is held in the output latch but is not output to the pin.

The value state of the pin can be read by reading the PDR0 register.

  • Operation in external interrupt input mode

Set a bit of the DDR0 register to "0", the bit corresponding to a pin of port 0 that is to serve as an external interrupt input pin, to set the pin to function as an input port.

The value state of the pin can be read by reading the PDR0 register regardless of whether external interrupt inputs or interrupt request outputs are enabled or disabled.

  • Operation in analog input mode

To use a pin of port 0 as analog input and to inhibit output transistor operation, set the bit corresponding to the analog input pin to "0" on the DDR0 register. The value state of the pin can be read by reading the PDR0 register.

Set the bit of the ADEN register of the A/D converter to "1", the bit corresponding to the analog input pin in use.

  • Operation when a reset is performed

When the CPU is reset, the bits of the DDR0 register are initialized to "0". Thus, all output transistors become OFF and the pins become Hi-Z.

However, CPU resets do not initialize the PDR0 register. If a pin is used as an output port after the reset, reinitialize the PDR0 register to contain new output data in the bit position corresponding to the pin and then set the corresponding bit of the DDR0 register so that the pin will function as an output port.

Page 99 of the Fujitsu MB89202 user manual — P00/INT20/AN4
Page 99 · click to enlarge
Page 99

CHAPTER 4 I/O PORTS

  • Operation in stop mode

When the pin state setting bit of the standby control register (STBC: SPL) is "1" and when the stop mode is entered, the output transistor is turned OFF and the pin becomes Hi-Z because the output transistor is forcibly turned OFF without respect to the value existing on the DDR0 register in the bit position corresponding to the pin.

Input remains fixed to prevent leaks by input open.

Table 4.2-4 summarizes the operating modes of the pins of port 0.

Table 4.2-4 Operating Modes of Pins of Port 0

Pin name Normal operation, sleep, stop (SPL = 0) Stop (SPL = 1) At a reset

P00/INT20/AN4

General-purpose I/O port may also serve external interrupt inputs or analog inputs

Hi-Z (External interrupt input) Hi-Z P04/INT24

General-purpose I/O port may also serve external interrupt inputs

SPLPin state setting bit of standby control register (STBC: SPL) Hi-Z: High impedance

When the pull-up resistor is selected by using the pull-up setting register, the pin state will be "H" level instead of Hi-Z in stop mode (SPL = 1). During a reset, however, the pull-up is invalid with the pin remaining at Hi-Z.

to P03/INT23/AN7 · to P07/INT27

Page 100 of the Fujitsu MB89202 user manual — BZ PPG
Page 100 · click to enlarge
Page 100

CHAPTER 4 I/O PORTS

4.3 Port 3

Port 3 is a general-purpose I/O port and may also serve as input pins for external interrupts as well as input and output pins for peripherals. This section mainly explains the general-purpose I/O function of the port. This section also describes port 3 concerning to the structure, pins, a block diagram of pins, and associated registers.

  • Structure of Port 3

Port 3 comprises the following four elements:

  • General-purpose I/O pins, external interrupt 1 input pins, and input/output pins for peripherals (P30/ UCK/SCK to P37/BZ/PPG)
  • Port 3 data register (PDR3)
  • Port 3 data direction register (DDR3)
  • Port 3 pull-up setting register (PUL3)
  • Pins of Port 3

Port 3 has eight CMOS I/O pins. These pins can be used as both input pins and external interrupt input pins at the same time. These pins cannot be used as a general-purpose I/O port when being used for peripherals.

Table 4.3-1 lists the pins of port 3.

Table 4.3-1 Pins of Port 3

Input and output form Circuit type Input Output

Port name Pin name Function Peripherals for which the pin may serve

P30/UCK/SCK P30 general-purpose I/O

UCK SCK

UART clock I/O 8-bit serial I/O clock I/O CMOS hysteresis

B

P31/UO/SO P31 general-purpose I/O

UO SO

UART data output 8-bit serial I/O data output CMOS E

P32/UI/SI P32 general-purpose I/O

UI SI

UART data input 8-bit serial I/O data input CMOS hysteresis

P33/EC P33 general-purpose I/O EC 8/16-bit timer and counter clock inputs

CMOS

P34/TO/INT10 P34 general-purpose I/O

TO INT10

8/16-bit timer and counter timer outputs External interrupt input 10

B

P35/INT11 P35 general-purpose I/O INT11 External interrupt input 11

P36/INT12 P36 general-purpose I/O INT12 External interrupt input 12

P37/BZ/PPG P37 general-purpose I/O

BZ PPG

Buzzer output 12-bit PPG output CMOS E

For circuit type, see "1.7 Pin Functions Description ".

Port 3 · CMOS hysteresis

Page 101 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 101 · click to enlarge
Page 101

CHAPTER 4 I/O PORTS

  • Block Diagram of Port 3

Figure 4.3-1 Block Diagram of Port 3

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 101)
Fig. 7

External interrupt enable External interrupt occurring

Hysteresis input

Output from peripheral

Output from peripheral enable

Pull-up resistor

Output occurring from peripheral

PDR read (when read-modify-write is performed)

Because the value states of the pins are always input to the external interrupt circuit, when a pin is used as a normal I/O port, the operation of the external interrupt circuit corresponding to the pin must be inhibited. See "CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE) ".

  • Registers PDR3, DDR3, and PUL3 of Port 3

The registers PDR3, DDR3, and PUL3 are associated with port 3.

The bits of these registers correspond to the pins of port 3 in one-to-one correspondence.

Table 4.3-2 tabulates the correspondence between the pins and the bits of port 3 registers.

Table 4.3-2 Correspondence between the Pins and the Bits of Port 3 Registers

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 101)
Fig. 8

Port name Bits of associated registers and corresponding pins

PDR3, DDR3, PUL3 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

Pin corresponding to bit P37 P36 P35 P34 P33 P32 P31 P30

Page 102 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 102 · click to enlarge
Page 102

CHAPTER 4 I/O PORTS

4.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)

This section describes the registers associated with port 3.

  • Functions of Port 3 Registers
  • Port 3 data register (PDR3)

The PDR3 register indicates the state of the pins. For a pin set to function as an output port, the same value ("0" or "1") as held by the output latch can be read from this register. If the pin is set to function as an input port, however, its output latch value cannot be read from the register.

When a bit manipulation instruction (SETB, CLRB) is executed, the output latch values, not the value states of the pins, are read; thus, output latch values, excepting those for bits to be manipulated, do not change.

  • Port 3 data direction register (DDR3)

The DDR3 register sets the I/O direction of each pin per bit.

When a bit of the DDR3 corresponding to a pin of port 3 is set to "1", the pin functions as an output port. When the bit is set to "0", the pin functions as an input port.

Because the DDR3 register is write only, bit manipulation instructions (SETB, CLRB) do not apply.

  • Setting a port pin to serve external interrupts

If a pin of port 3 is used as an external interrupt input pin, enable the external interrupt circuit operation and set the pin to function as an input port.

When the pin is set in this mode, its output latch value has no significance.

  • Setting the output from a peripheral enable

If a peripheral with an output pin is used, set the output enable bit of the peripheral enable.

Because the output from the peripheral has priority, the values set on the PDR3 and DDR3 registers in the bit position corresponding to the output pin for the peripheral have no significance, regardless of the value output from the peripheral and the output enabled.

  • Setting the input to a peripheral enable

If a peripheral with an input pin is used, set the pin of port 3 for the input to the peripheral to function as an input port. In this mode, the corresponding output latch value has no significance.

Page 103 of the Fujitsu MB89202 user manual — PUL37 PUL36 PUL35 PUL34 0
Page 103 · click to enlarge
Page 103

CHAPTER 4 I/O PORTS

Table 4.3-3 lists the functions of port 3 registers.

Table 4.3-3 Functions of Port 3 Registers

name Data When being

read When being written Read/

Write Address Initial value

Output latch of "0" is set and "L" level is output to the pin in output port mode.

0 Pin state is "L" level.

Port 3 data register (PDR3)

R/W 000C H XXXXXXXX B

Output latch of "1" is set and "H" level is output to the pin in output port mode.

1 Pin state is "H" level.

Output transistor operation is disabled and the pin is set to serve as an input pin.

0 Read prohibited (write only)

Port 3 data direction register (DDR3)

W 000D H 00000000 B

1 Output transistor operation is enabled and the pin is set to serve as an output pin.

R/WReadable and Writable W : Write only X : Undefined
  • Port 3 pull-up setting register (PUL3)

The bits of the pull-up setting register correspond to the pins of port 3 in one-to-one correspondence. When the pull-up resistor is selected by using the pull-up setting register, the pin state will be "H" level (pull-up state) instead of Hi-Z during stop (SPL = 1). During a reset, however, the pull-up is invalid and the pin remains at Hi-Z.

Figure 4.3-2 shows the pull-up resistor settings assigned to the values of the bits of the port 3 pull-up register.

Figure 4.3-2 Pull-up Setting Register (PUL3)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0071H PUL37 PUL36 PUL35 PUL34 PUL33 PUL32 PUL31 PUL30 00000000B R/W

PUL33 PUL32 PUL31 PUL30 0

P33 pull-up OFF P32 pull-up OFF P31 pull-up OFF P30 pull-up OFF

P33 pull-up ON P32 pull-up ON P31 pull-up ON P30 pull-up ON

PUL37 PUL36 PUL35 PUL34 0

P37 pull-up OFF P36 pull-up OFF P35 pull-up OFF P34 pull-up OFF

P37 pull-up ON P36 pull-up ON P35 pull-up ON P34 pull-up ON

R/WReadable and Writable

: Initial value

Register · Address Initial value

Page 104 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 104 · click to enlarge
Page 104

CHAPTER 4 I/O PORTS

4.3.2 Operations of Port 3 Functions

This section describes the operation of port 3.

  • Operation of Port 3
  • Operation in output port mode

When "1" is written for a bit of the DDR3 register, the bit corresponding to a pin of port 3, the pin functions as an output port.

In output port mode, output transistor operation is enabled and output latch data is output to the pin.

Once data has been written into the PDR3 register, the written data is held in the output latch and output to the pin as it is.

The value state of the pin can be read by reading the PDR3 register.

  • Operation in input port mode

When "0" is written for a bit of the DDR3 register, the bit corresponding to a pin of port 3, the pin functions as an input port.

In input port mode, the output transistor is OFF and the pin state is Hi-Z.

Once data has been written into the PDR3 register, the written data is held in the output latch but is not output to the pin.

The value state of the pin can be read by reading the PDR3 register.

  • Operation in external interrupt input mode

Set a bit of the DDR3 register to "0", the bit corresponding to a pin of port 3 that is to serve as an external interrupt input pin, to set the pin to function as an input port.

The value state of the pin can be read by reading the PDR3 register regardless of whether or not the external interrupt inputs or interrupt request outputs are enabled.

  • Operation in mode enabling the output from a peripheral

When the output enable bit for a peripheral is set to enable, the corresponding pin is set to serve the output from the peripheral.

Because the value state of the pin can be read from the PDR3 register even when the output from the peripheral is enabled, the value output from the peripheral can be read.

  • Operation in mode enabling the input to a peripheral

Set a bit of the DDR3 register to "0", the bit corresponding to the pin of port 3 assigned for the input to the desired peripheral, for the pin to function as an input port.

The value state of the pin is always input to the peripheral (except during stop mode).

The value state of the pin can be read by reading the PDR3 register regardless of whether or not the peripheral is using the input pin.

Page 105 of the Fujitsu MB89202 user manual — P30/UCK/SCK
Page 105 · click to enlarge
Page 105

CHAPTER 4 I/O PORTS

  • Operation when a reset is performed

When the CPU is reset, the bits of the DDR3 register are initialized to "0", at which time the output transistors become OFF (input port mode) and the pins become Hi-Z.

However, CPU resets do not initialize the PDR3 register. If a pin is used as an output port after the reset, reinitialize the PDR3 register to contain new output data in the bit position corresponding to the pin and then set the corresponding bit of the DDR3 register so that the pin will function as an output port.

  • Operation in stop mode

When the pin state setting bit of the standby control register (STBC: SPL) is set to "1" and when the stop mode is entered, the pin becomes Hi-Z because the output transistor is turned OFF regardless of the value existing on the DDR3 register in the bit position corresponding to the pin.

Table 4.3-4 summarizes the operating modes of the pins of port 3.

Table 4.3-4 Operating Modes of Pins of Port 3

Pin name Normal operation, sleep, stop

(SPL = 0) Stop (SPL = 1) At a reset

P30/UCK/SCK

General-purpose I/O port may also serve I/O for peripherals Hi-Z

General-purpose I/O port may also serve outputs from peripherals and external interrupt inputs

Hi-Z (External interrupt input)

SPLPin state setting bit of standby control register (STBC: SPL) Hi-Z: High impedance

When the pull-up resistor is selected by using the pull-up setting register, the pin state will be "H" level instead of Hi-Z in stop mode (SPL = 1). During a reset, however, the pull-up is invalid with the pin remaining at Hi-Z.

to P33/EC, P37/BZ/PPG · Hi-Z P34/TO/INT10 · to P36/INT12

Page 106 of the Fujitsu MB89202 user manual — CMOS
Page 106 · click to enlarge
Page 106

CHAPTER 4 I/O PORTS

4.4 Port 4

Port 4 is a type of I/O port that is switched between CMOS push-pull and N-ch open- drain and may also serve analog inputs. Each pin of this port can be used for peripherals or normal port function that can be selected according to the setting of the bit corresponding to the pin on a specific register. This section explains the I/O port function of CMOS push-pull/ N-ch open-drain type. This section also describes port 4 concerning to the structure, pins, a block diagram of pins, and associated registers.

  • Structure of Port 4

Port 4 comprises the following four elements:

  • Type of I/O pins that are switched between CMOS push-pull and N-ch open-drain and analog input pins (P40/AN0 to P43/AN3)
  • Port 4 data register (PDR4)
  • Port 4 data direction register (DDR4)
  • Port 4 output format setting register (OUT4)
  • Pins of Port 4

Port 4 has four I/O pins of CMOS push-pull/N-ch open-drain.

These pins can also be used as analog input pins.

Those pins that are used for analog inputs cannot be used as a general-purpose I/O port. Table 4.4-1 lists the pins of port 4.

Table 4.4-1 Pins of Port 4

Input and output form Circuit

P40/AN0 P40 I/O AN0 analog input 0

F P41/AN1 P41 I/O AN1 analog input 1

CMOS

P42/AN2 P42 I/O AN2 analog input 2

P43/AN3 P43 I/O AN3 analog input 3

For circuit type, see Section "1.7 Pin Functions Description " and "1.8 I/O Circuit Types ".

Show 10 more labels / short text on this page
Peripherals for · Port name · Pin name Function · which the pin · type Input Output · may serve · CMOS push- pull/N-ch open- · Port 4 · analog · drain
Page 107 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 107 · click to enlarge
Page 107

CHAPTER 4 I/O PORTS

  • Block Diagram of Port 4

Figure 4.4-1 Block Diagram of Port 4

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 107)
Fig. 9

A/D converter channel select To A/D converter's analog input

PDR read (when read-modify-write is performed)

Output latch PDR write

  • Registers of Port 4

The registers PDR4, DDR4, and OUT4 are associated with port 4.

The bits of these registers correspond to the pins of port 4 in one-to-one correspondence.

Table 4.4-2 tabulates the correspondence between the pins and the bits of the port 4 registers.

Table 4.4-2 Correspondence between the Pins and the Bits of the Port 4 Register

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 107)
Fig. 10

Port name Bits of associated registers and corresponding pins

PDR4, DDR4, OUT4 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

Pin corresponding to bit - P43 P42 P41 P40

Page 108 of the Fujitsu MB89202 user manual — R/W 0010 H ----0000 B
Page 108 · click to enlarge
Page 108

CHAPTER 4 I/O PORTS

4.4.1 Registers of Port 4 (PDR4)

This section describes the registers associated with port 4.

  • Functions of Port 4 Registers
  • Port 4 data register (PDR4)

The PDR4 register indicates the state of the pins. For a pin set to function as an output port, the same value ("0"or "1") as held by the output latch can be read from this register. If the pin is set to function as an input port, however, its output latch value cannot be read from the register.

When a bit manipulation instruction (SETB, CLRB) is executed, the output latch values, not the value states of the pins, are read; thus, output latch values, excepting those for bits to be manipulated, do not change.

Table 4.4-3 lists the functions of the port 4 registers.

Table 4.4-3 Functions of Port 4 Registers

name Data When being read When being written Read/

Write Address Initial value

Output latch of "0" is set and "L" level is output to the pin in output port mode.

0 Pin state is "L" level.

Port 4 data register (PDR4)

Output latch of "1" is set and the pin in output port mode is set at Hi-Z.

R/W 000F H XXXX B

1 Pin state is "H" level.

Output latch of "1" is set and "H" level is output to the pin in output port mode.

The pin is set to function as input pin with output transistor operation disabled.

Port 4 data direction register (DDR4)

0 Input port pin

R/W 0010 H 0000 B

The pin is set to function as output pin with output transistor operation enabled.

1 Output port pin

Port 4 output format setting register (OUT4)

0 N-ch open-drain type Output format of the pin is set to N-ch open-drain type.

R/W 0011H 0000B 1 CMOS push-pull type

Output format of the pin is set to CMOS push-pull type.

R/WReadable and Writable X : Undefined

Register · N-ch open- drain type · CMOS push-pull type

Page 109 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 109 · click to enlarge
Page 109

CHAPTER 4 I/O PORTS

4.4.2 Operations of Port 4 Functions

This section describes the operation of port 4.

  • Operation of Port 4
  • Operation in output port mode

When "1" is written for a bit of the DDR4 register, the bit corresponding to a pin of port 4, the pin functions as an output port.

In output port mode, the output transistor operation is enabled and output latch data is output to the pin.

By setting the bit corresponding to the pin on the OUT4 register, N-ch open-drain or CMOS push-pull type can be selected as the output format of the pin.

Once data has been written into the PDR4 register, the written data is held in the output latch and output to the pin as it is.

The value state of the pin can be read by reading the PDR4 register.

  • Analog input mode setting

Set a bit of the DDR4 register to "0", the bit corresponding to a pin of port 4 assigned for desired analog input, so that its output transistor is set to OFF and the pin is set at Hi-Z.

Its output latch value can be read by reading the PDR4 register.

Set the bit of the ADEN register of the A/D converter to "1", the bit corresponding to the analog input pin in use.

  • Operation when a reset is performed

When the CPU is reset, the bits of the PDR4 register are initialized to "1". Thus, the output transistors become OFF (input port mode) and the pins become Hi-Z.

  • Operation in stop mode

When the pin state setting bit of the standby control register (STBC: SPL) is set to "1" and when the stop mode is entered, the pin becomes Hi-Z because the output transistor is turned OFF regardless of the value existing on the DDR4 register in the bit position corresponding to the pin. Input remains fixed to prevent leaks by input open.

Table 4.4-4 summarizes the operating modes of the pins of port 4.

Table 4.4-4 Operating Modes of Pins of Port 4

Pin name Normal operation, sleep, stop (SPL = 0) Stop (SPL = 1) At a reset

P40/AN0 to P43/AN3 General-purpose I/O port may also serve I/O for peripherals Hi-Z Hi-Z

SPLPin state setting bit of standby control register (STBC: SPL) Hi-Z: High impedance
Page 110 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 110 · click to enlarge
Page 110

CHAPTER 4 I/O PORTS

4.5 Port 5

Port 5 is a general-purpose I/O port and may also serve the input/output for peripherals. The pins of this port can be used for peripherals or normal port function that can be selected according to the setting of the bit corresponding to the pin on a specific register. This section explains the general-purpose I/O function of the port. This section also describes port 5 concerning to the structure, pins, a block diagram of pins, and associated registers.

  • Structure of Port 5

Port 5 comprises the following four elements:

  • General-purpose I/O pins (P50/PWM)
  • Port 5 data register (PDR5)
  • Port 5 data direction register (DDR5)
  • Port 5 pull-up setting register (PUL5)
  • Pins of Port 5

Port 5 has one CMOS I/O pin.

Table 4.5-1 provides information on the pin of port 5.

Table 4.5-1 Pin of Port 5

Port name Pin name Function Peripherals for which the

Port 5 P50/PWM P50 general-

output) CMOS CMOS E

For circuit type, see Section "1.7 Pin Functions Description " and "1.8 I/O Circuit Types ".

Show 6 more labels / short text on this page
Input and output · form Circuit · pin may serve · type Input Output · PWM (8-bit PWM/timer · purpose I/O
Page 111 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 111 · click to enlarge
Page 111

CHAPTER 4 I/O PORTS

  • Block Diagram of Port 5

Figure 4.5-1 Block Diagram of Port 5

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 111)
Fig. 11

Pull-up resistor

Output from peripheral Output enable from peripheral

PDR read (when read-modify-write is performed)

  • Registers of Port 5

The registers PDR5, DDR5, and PUL5 are associated with port 5.

One of the bits of these registers corresponds to one pin of port 5.

Table 4.5-2 tabulates the correspondence between the pin and a bit of the port 5 registers.

Table 4.5-2 Correspondence between the Pin and a Bit of the Port 5 Registers

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 111)
Fig. 12

Port name Bits of associated registers and corresponding pins

PDR5, DDR5, PUL5 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

Pin corresponding to bit - P50

Page 112 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 112 · click to enlarge
Page 112

CHAPTER 4 I/O PORTS

4.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)

This section describes the registers associated with port 5.

  • Functions of Port 5 Registers
  • Port 5 data register (PDR5)

The PDR5 register indicates the state of pins. For a pin set to function as an output port, the same value ("0" or "1") as held by the output latch can be read from this register. If the pin is set to function as an input port, however, its output latch value cannot be read from the register.

When a bit manipulation instruction (SETB, CLRB) is executed, the output latch values, not the value states of the pins, are read; thus, output latch values, excepting those for bits to be manipulated, do not change.

  • Port 5 data direction register (DDR5)

A bit of the DDR5 register sets the I/O direction of the pin corresponding to the bit.

When the bit of the DDR5 register is set to "1", the pin functions as an output port. When the bit is set to "0", the pin functions as an input port.

  • Setting the output from a peripheral enable

If a peripheral with an output pin is used, set the output enable bit of the peripheral enable.

As it is apparent from the block diagram, the pin in this mode serves output from the peripheral, thereby superseding its general-purpose port function.

Because the output from the peripheral has priority, the values set on the PDR5 and DDR5 registers for the output pin used for the peripheral have no significance, regardless of the value output from the peripheral and the output enabled.

Table 4.5-3 lists the functions of the port 5 registers.

Page 113 of the Fujitsu MB89202 user manual — PUL50 0 1
Page 113 · click to enlarge
Page 113

CHAPTER 4 I/O PORTS

Table 4.5-3 Functions of Port 5 Registers

name Data When being

written Read/Write Address Initial value

Output latch of "0" is set and "L" level is output to the pin in output port mode.

0 Pin state is "L" level.

Port 5 data register (PDR5)

R/W 00012 H X B

Output latch of "1" is set and the pin in output port mode is set at Hi-Z.

1 Pin state is "H" level.

The pin is set to function as an input pin with output transistor operation disabled.

0 Input port pin

Port 5 data direction register (DDR5)

R/W 0013 H 0 B

The pin is set to function as an output pin with output transistor operation enabled.

1 Output port pin

R/WReadable/Writable X : Undefined
  • Port 5 pull-up setting register (PUL5)

When the ON setting of the pull-up resistor is selected by using the pull-up setting register, the pin state will be "H" level (pull-up state) instead of Hi-Z during stop (SPL = 1). During a reset, however, the pull-up is invalid and the pin remains at Hi-Z.

Figure 4.5-2 Pull-up Setting Register (PUL5)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0072H PUL50 0B R/W

PUL50 0 1

R/WReadable/Writable

P50 pull-up OFF P50 pull-up ON

: Unused : Initial value

Show 4 more labels / short text on this page
Register · When being · read · Address Initial value
Page 114 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 114 · click to enlarge
Page 114

CHAPTER 4 I/O PORTS

4.5.2 Operations of Port 5 Functions

This section describes the operation of port 5.

  • Operation of Port 5
  • Operation in output port mode

When "1" is written for a bit of the DDR5 register, the bit corresponding to the pin of port 5, the pin functions as an output port.

In output port mode, the output transistor operation is enabled and the output latch data is output to the pin.

Once data has been written into the PDR5 register, the written data is held in the output latch and output to the pin as it is.

The value state of the pin can be read by reading the PDR5 register.

  • Operation in input port mode

When "0" is written for a bit of the DDR5 register, the bit corresponding to the pin of port 5, the pin functions as an input port.

In input port mode, the output transistor is OFF and the pin state is Hi-Z.

Once data has been written into the DDR5 register, the written data is held in the output latch but is not output to the pin.

The value state of the pin can be read by reading the PDR5 register.

  • Operation in mode enabling the output from a peripheral

When the output enable bit for a peripheral is set enable, the corresponding pin is set to serve the output from the peripheral.

Because the value state of the pin can be read from the PDR5 register even when the output from the peripheral is enabled, the value output from the peripheral can be read.

  • Operation when a reset is performed

When the CPU is reset, the bits of the DDR5 register are initialized to "0". Thus, the output transistor becomes OFF (input port mode) and the pin becomes Hi-Z.

However, CPU resets do not initialize the PDR5 register. If the pin is used as an output port after the reset, reinitialize the PDR5 register to contain new output data in the bit position corresponding to the pin and then set the corresponding bit of the DDR5 register so that the pin will function as an output port.

  • Operation in stop mode

When the pin state setting bit of the standby control register (STBC: SPL) is set to "1" and when the stop mode is entered, the pin becomes Hi-Z because the output transistor is turned OFF regardless of the value existing on the DDR5 register in the bit position corresponding to the pin. Input remains fixed to prevent leaks by input open.

Page 115 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 115 · click to enlarge
Page 115

CHAPTER 4 I/O PORTS

Table 4.5-4 summarizes the operating modes of the pin of port 5.

Table 4.5-4 Operating Modes of Pin of Port 5

Pin name Normal operation, sleep, stop (SPL = 0) Stop (SPL = 1) At a reset

P50/PWM General-purpose I/O port further may serve I/O for peripherals Hi-Z Hi-Z

SPLPin state setting bit of standby control register (STBC: SPL) Hi-Z: High impedance

If the pull-up resistor is selected by using the pull-up setting register, the pin state will be "H" level (pull-up state) instead of Hi-Z in stop mode (SPL = 1). During a reset, however, the pull-up is invalid with the pin remaining at Hi-Z.

Page 116 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 116 · click to enlarge
Page 116

CHAPTER 4 I/O PORTS

4.6 Port 6

Port 6 is a general-purpose I/O port. This section describes the port function when operating as general-purpose I/O port. This section also describes the structure, pins, the block diagram of pins, and associated registers of port 6.

  • Structure of Port 6

Port 6 comprises the following four elements:

  • General-purpose I/O pins (input pins P61-P60 for MB89F202/F202RA)
  • Port 6 data register (PDR6)
  • Port 6 data direction register (DDR6, not used in MB89F202/F202RA)
  • Port 6 pull-up setting register (PUL6)
  • Pins of Port 6

Port 6 has 2 I/O pins of CMOS input type (they are input only pins for MB89F202/F202RA).

Table 4.6-1 lists the pins of port 6.

Table 4.6-1 Pins of Port 6

Peripherals for which a pin may

Input and output form Circuit

Port name Pin name Function

P60 P60 general- purpose I/O* - CMOS - H / E

P61 P61 general- purpose I/O* - CMOS - H / E

*: P61 and P60 are general-purpose input port for MB89F202/F202RA.

For circuit type, see Section "1.7 Pin Functions Description " and "1.8 I/O Circuit Types ".

type Input Output · serve · Port 6

Page 117 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 117 · click to enlarge
Page 117

CHAPTER 4 I/O PORTS

  • Block Diagram of Port 6

Figure 4.6-1 Block Diagram of Port6

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 117)
Fig. 13

Pull-up resistor

PDR read (when read-modify-write is performed)

SPL: Pin state setting bit of standby control register (STBC: SPL)

Pin Stop mode (SPL = 1)

PDR read (when read-modify-write is performed)

SPL: Pin state setting bit of standby control register (STBC: SPL)

Page 118 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 118 · click to enlarge
Page 118

CHAPTER 4 I/O PORTS

  • Registers PDR6, DDR6, and PUL6 of Port 6

Registers PDR6, DDR6, and PUL6 are associated with port 6.

The bits of these registers correspond to the pins of port 6 in one-to-one correspondence.

Table 4.6-2 tabulates the correspondence between the pins and the bits of the port 6 registers.

Table 4.6-2 Correspondence between the Pins and the Bits of Port 6 Registers

Port name Bits of associated registers and corresponding pins

PDR6, DDR6, PUL6 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

Pin corresponding to bit - P61* P60*

*: DDR control is not used for this bit in MB89F202/F202RA.

Port 6

Page 119 of the Fujitsu MB89202 user manual — R/W 0061 H ------00 B
Page 119 · click to enlarge
Page 119

CHAPTER 4 I/O PORTS

4.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)

This section describes the registers associated with port 6.

  • Functions of Port 6 Registers
  • Port 6 data register

The PDR6 register indicates the state of the output latch. For a pin set to function as an output port, the same value ("0" or "1") as the value state of the output pin can be read from this register. If the pin is set to function as an input port, however, its output latch value cannot be read from the register.

When a bit manipulation instruction (SETB, CLRB) is executed, the output latch values, not the value states of the pins, are read; thus, output latch values, other than those for bits to be manipulated, do not change.

  • Port 6 data direction register (DDR6 for P60, P61)

The DDR6 register sets the I/O direction of each pin per bit.

When a bit of the DDR6 corresponding to a pin of port 6 is set to "1", the pin functions as an output port. When the bit is set to "0", the pin functions as an input port.

Table 4.6-3 lists the functions of the port 6 registers.

Table 4.6-3 Functions of Port 6 Registers

name Data When being

read When being written Read/

Write Address Initial value

Output latch of "0" is set and "L" level is output to the pin in output port mode.

0 Pin state is "L" level.

Port 6 data register (PDR6)

R/W 0060 H XX B

Output latch of "1" is set and "H" level is output to the pin in output port mode.

1 Pin state is "H" level.

Output transistor operation is disabled and the pin is set to serve as an input pin.

Port 6 data direction register (DDR6)

R/W 0061 H 00 B

Output transistor operation is enabled and the pin is set to serve as output pin.

R/WReadable/Writable X : Undefined

Register · 0 Input port · 1 Output port

Page 120 of the Fujitsu MB89202 user manual — PUL61 PUL60 0
Page 120 · click to enlarge
Page 120

CHAPTER 4 I/O PORTS

  • Port 6 pull-up setting register (PUL6)

The bits of the pull-up setting register correspond to the pins of port 6 in one-to-one correspondence. When the pull-up resistor is selected by using the pull-up setting register, the pin will be at "H" level (pull-up state) instead of Hi-Z during stop (SPL = 1). During a reset, however, the pull-up is invalid and the pin remains at Hi-Z.

Figure 4.6-2 shows the pull-up resistor settings assigned to the values of the bits of the port 6 pull-up setting register.

Figure 4.6-2 Pull-up Resistor Settings (PUL6)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0062H - PUL61 PUL60 00B - R/W R/W

PUL61 PUL60 0

R/W

P61 pull-up ON P60 pull-up ON : Readable/Writable

P61 pull-up OFF P60 pull-up OFF

: Initial value

Address Initial value

Page 121 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 121 · click to enlarge
Page 121

CHAPTER 4 I/O PORTS

4.6.2 Operations of Port 6 Functions

This section describes the operation of port 6.

  • Operation of Port 6
  • Operation in output port mode

When "1" is written for a bit of the DDR6 register, the bit corresponding to a pin of port 6, the pin functions as an output port.

In output port mode, the output transistor operation is enabled and the output latch data is output to the pin.

Once data has been written into the PDR6 register, the written data is held in the output latch and output to the pin as it is.

The value state of the pin can be read by reading the PDR6 register.

  • Operation in input port mode

When "0" is written for a bit of the DDR6 register, the bit corresponding to a pin of port 6, the pin functions as an input port.

In input port mode, the output transistor is OFF and the pin status is Hi-Z.

Once data has been written into the PDR6 register, the written data is held in the output latch but is not output to the pin.

The value state of the pin can be read by reading the PDR6 register.

  • Operation when a reset is performed

When the CPU is reset, the bits of the DDR6 register are initialized to "0". Thus, all output transistors become OFF and the pins become Hi-Z.

However, CPU resets do not initialize the PDR6 register. If a pin is used as an output port after the reset, reinitialize the PDR6 register to contain new output data in the bit position corresponding to the pin and then set the corresponding bit of the DDR6 register so that the pin will function as an output port.

  • Operation in stop mode

When the pin state setting bit of the standby control register (STBC: SPL) is "1" and when the stop mode is entered, the output transistor is turned OFF and the pin becomes Hi-Z because the output transistor is forcibly turned OFF without respect to the value existing on the DDR6 register in the bit position corresponding to the pin.

Input remains fixed to prevent leaks by input open.

Table 4.6-4 summarizes the operating modes of the pins of port 6.

Page 122 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 122 · click to enlarge
Page 122

CHAPTER 4 I/O PORTS

Table 4.6-4 Operating Modes of Pins of Port 6

Pin name Normal operation, sleep, stop (SPL = 0) Stop (SPL = 1) At a reset

P60, P61 General-purpose I/O port Hi-Z Hi-Z

When the pull-up resistor is selected by using the pull-up setting register, the pin state will be "H" level instead of Hi-Z in stop mode (SPL = 1). During a reset, however, the pull-up is invalid with the pin remaining at Hi-Z.

Page 123 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 123 · click to enlarge
Page 123

CHAPTER 4 I/O PORTS

4.7 Port 7

Port 7 is a general-purpose I/O port. This section describes the port function when operating as general-purpose I/O port. This section also describes the port structure, pins, the pin block diagram associated registers of port 7.

  • Structure of Port 7

Port 7 comprises the following four elements:

  • General-purpose I/O pin (P70 to P72)
  • Port 7 data register (PDR7)
  • Port 7 data direction register (DDR7)
  • Port 7 pull-up setting register (PUL7)
  • Pins of Port 7

Port 7 has 3 CMOS I/O pin.

Table 4.7-1 lists the pins of port 7.

Table 4.7-1 Pins of Port 7

Input and output form Circuit

Port name Pin name Function

Port 7 P70 to P72 General-purpose I/O CMOS CMOS E

For circuit type, see Section "1.7 Pin Functions Description " and "1.8 I/O Circuit Types ".

type Input Output

Page 124 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 124 · click to enlarge
Page 124

CHAPTER 4 I/O PORTS

  • Block Diagram of Port 7

Figure 4.7-1 Block Diagram of Port 7

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 124)
Fig. 14

Pull-up resistor

PDR read (when read-modify-write is performed)

  • Registers PDR7, DDR7, and PUL7 of Port 7

Registers PDR7, DDR7, and PUL7 are associated with port 7.

The bits of these registers correspond to the pins of port 7 in one-to-one correspondence.

Table 4.7-2 tabulates the correspondence between the pins and the bits of the port 7 registers.

Table 4.7-2 Correspondence between the Pins and the Bits of the Port 7 Registers

Fujitsu MB89202 — CHAPTER 4 I/O PORTS diagram (page 124)
Fig. 15

Port name Bits of associated registers and corresponding pins

PDR7, DDR7, PUL7 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

Pin corresponding to bit - P72 P71 P70

Page 125 of the Fujitsu MB89202 user manual — R/W 0064 H -----000 B
Page 125 · click to enlarge
Page 125

CHAPTER 4 I/O PORTS

4.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)

This section describes the registers associated with port 7.

  • Functions of Port 7 Registers
  • Port 7 data register (PDR7)

The PDR7 register indicates the state of the output latch. For a pin set to function as an output port, the same value ("0" or "1") as the value state of the output pin can be read from this register. If the pin is set to function as an input port, however, its output latch value cannot be read from the register.

When a bit manipulation instruction (SETB, CLRB) is executed, the output latch values, not the value states of the pins, are read; thus, output latch values, other than those for bits to be manipulated, do not change.

  • Port 7 data direction register (DDR7)

The DDR7 register sets the I/O direction of each pin per bit.

When a bit of the DDR7 corresponding to a pin of port 7 is set to "1", the pin functions as an output port. When the bit is set to "0", the pin functions as an input port.

Table 4.7-3 lists the functions of the port 7 registers.

Table 4.7-3 Functions of Port 7 Registers

name Data When being

read When being written Read/

Write Address Initial value

Output latch of "0" is set and "L" level is output to the pin in output port mode.

0 Pin state is "L" level.

Port 7 data register (PDR7)

R/W 0063 H XXX B

Output latch of "1" is set and "H" level is output to the pin in output port mode.

1 Pin state is "H" level.

Output transistor operation is disabled and the pin is set to serve as an input pin.

Port 7 data direction register (DDR7)

R/W 0064 H 000 B

Output transistor operation is enabled and the pin is set to serve as output pin.

R/WReadable and Writable X : Undefined

Register · 0 Input port · 1 Output port

Page 126 of the Fujitsu MB89202 user manual — PUL72 PUL71 PUL70 0
Page 126 · click to enlarge
Page 126

CHAPTER 4 I/O PORTS

  • Port 7 pull-up setting register (PUL7)

The bits of the pull-up setting register correspond to the pins of port 7 in one-to-one correspondence. When the pull-up resistor is selected by using the pull-up setting register, the pin will be at "H" level (pull-up state) instead of Hi-Z during stop (SPL = 1). During a reset, however, the pull-up is invalid and the pin remains at Hi-Z.

Figure 4.7-2 shows the pull-up resistor settings assigned to the values of the bits of the port 7 pull-up register.

Figure 4.7-2 Pull-up Resistor Settings (PUL7)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0065H - PUL72 PUL71 PUL70 000B - R/W R/W R/W

PUL72 PUL71 PUL70 0

R/W

P72 pull-up ON P71 pull-up ON P70 pull-up ON : Readable/Writable

P72 pull-up OFF P71 pull-up OFF P70 pull-up OFF

: Initial value

Address Initial value

Page 127 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 127 · click to enlarge
Page 127

CHAPTER 4 I/O PORTS

4.7.2 Operations of Port 7 Functions

This section describes the operation of port 7.

  • Operation of Port 7
  • Operation in output port mode

When "1" is written for a bit of the DDR7 register, the bit corresponding to a pin of port 7, the pin functions as an output port.

In output port mode, the output transistor operation is enabled and the output latch data is output to the pin.

Once data has been written into the PDR7 register, the written data is held in the output latch and output to the pin as it is.

The value state of the pin can be read by reading the PDR7 register.

  • Operation in input port mode

When "0" is written for a bit of the DDR7 register, the bit corresponding to a pin of port 7, the pin functions as an input port.

In input port mode, the output transistor is OFF and the pin status is Hi-Z.

Once data has been written into the PDR7 register, the written data is held in the output latch but is not output to the pin.

The value state of the pin can be read by reading the PDR7 register.

  • Operation when a reset is performed

When the CPU is reset, the bits of the DDR7 register are initialized to "0". Thus, all output transistors become OFF and the pins become Hi-Z.

However, CPU resets do not initialize the PDR7 register. If a pin is used as an output port after the reset, reinitialize the PDR7 register to contain new output data in the bit position corresponding to the pin and then set the corresponding bit of the DDR7 register so that the pin will function as an output port.

  • Operation in stop mode

When the pin state setting bit of the standby control register (STBC: SPL) is "1" and when the stop mode is entered, the output transistor is turned OFF and the pin becomes Hi-Z because the output transistor is forcibly turned OFF without respect to the value existing on the DDR7 register in the bit position corresponding to the pin.

Input remains fixed to prevent leaks by input open.

Page 128 of the Fujitsu MB89202 user manual — CHAPTER 4 I/O PORTS
Page 128 · click to enlarge
Page 128

CHAPTER 4 I/O PORTS

Table 4.7-4 summarizes the operating modes of the pins of port 7.

Table 4.7-4 Operating Modes of Pins of Port 7

Pin name Normal operation, sleep, stop (SPL = 0) Stop (SPL = 1) At a reset

P70 to P72 General-purpose I/O port Hi-Z Hi-Z

When the pull-up resistor is selected by using the pull-up setting register, the pin state will be "H" level instead of Hi-Z in stop mode (SPL = 1). During a reset, however, the pull-up is invalid with the pin remaining at Hi-Z.

Page 129 of the Fujitsu MB89202 user manual — MB 8 9202/V201/F202/F202RA
Page 129 · click to enlarge
Page 129

CHAPTER 4 I/O PORTS

4.8 Programming Example of I/O Port

This section provides an example of programming with I/O ports.

  • I/O Port Programming Example
  • Processing specification

Ports 0 and 3 are used to light all seven segments of LED (eight segments if the decimal point is included).

Pin P00 is connected to the anode common pin of LED and pins P30 to P37 are connected to the pins of the segments.

Figure 4.8-1 provides an example of the pins and the 8-segment LED connected.

Figure 4.8-1 Example of the Pins and the 8-segment LED Connected

MB 8 9202/V201/F202/F202RA

P00

P 3 7

P 3 6

P 3 0

Page 130 of the Fujitsu MB89202 user manual — END
Page 130 · click to enlarge
Page 130

CHAPTER 4 I/O PORTS

  • Coding example

PDR0 EQU 0000H ; Address of port 0 data register DDR0 EQU 0001H ; Address of port 0 data direction register PDR3 EQU 000CH ; Address of port 3 data register DDR3 EQU 000DH ; Address of port 3 data direction register ; Main program

CSEG ; [CODE SEGMENT] : CLRB PDR0:0 ; Set P00 at "L" level. MOV PDR3,#11111111B ; Set all pins of port 3 at "H" level. MOV DDR0,#11111111B ; Set P00 to function as an output port by coding #XXXXXXX1B. MOV DDR3,#11111111B ; Set all bits of DDR3 such that all pins of port 3 function as an output port. : ENDS ;

END

Page 131 of the Fujitsu MB89202 user manual — CHAPTER 5 TIME-BASE TIMER
Page 131 · click to enlarge
Page 131

CHAPTER 5 TIME-BASE TIMER

This chapter describes the functions and operations of the time-base timer.

5.1 Overview of Time-base Timer

5.2 Configuration of Time-base Timer

5.3 Time-base Timer Control Register (TBTC)

5.4 Interrupt of Time-base Timer

5.5 Operations of Time-base Timer Functions

5.6 Notes on Using Time-base Timer

5.7 Program Example for Time-base Timer

Page 132 of the Fujitsu MB89202 user manual — CHAPTER 5 TIME-BASE TIMER
Page 132 · click to enlarge
Page 132

CHAPTER 5 TIME-BASE TIMER

5.1 Overview of Time-base Timer

The time-base timer functions as an interval timer. The time-base timer is a 21-bit free- run counter that counts up in synchronization with the internal count clock (at the oscillation frequency divided by 2). The timer also has an interval timer function to select one of four time intervals. In addition, it provides timer output for oscillation stabilization time and an operation clock for the watchdog timer. The time-base timer stops operating in modes in which oscillation stops.

  • Interval Timer Function

The interval timer function is used to continuously generate interrupts at specified intervals.

  • An interrupt occurs when the interval timer bits of the time-base timer counter overflow.
  • One of four time intervals can be selected by setting the interval timer bits.

Table 5.1-1 lists the time intervals for the time-base timer.

Table 5.1-1 Time Intervals for Time-base Timer

Internal count clock cycle Time interval

213/FCH (Approximately 0.66 ms)

215/FCH (Approximately 2.6 ms)

2/FCH (0.16 µs)

218/FCH (Approximately 21.0 ms)

222/FCH (Approximately 335.5 ms)

FCH: Oscillation frequency The values enclosed in parentheses are time intervals when the oscillation frequency is 12.5 MHz.

  • Clock Supply Function

The clock supply function is used to provide one of three timer outputs for the oscillation stabilization wait time and the operation clock for the resource function.

Table 5.1-2 lists cycles of the clock that the time-base timer supplies to peripherals.

Table 5.1-2 Clock Cycles Supplied by Time-base Timer (1/2)

Clock supplied to Clock cycle Remarks

214/FCH (Approximately 1.31 ms) Selected by the oscillation stabilization time selection bits (SYCC: WT1, WT0) of the clock control section system clock control register. 217/FCH (Approximately 10.49 ms)

218/FCH (Approximately 20.97 ms)

Oscillation stabilization time

Page 133 of the Fujitsu MB89202 user manual — CHAPTER 5 TIME-BASE TIMER
Page 133 · click to enlarge
Page 133

CHAPTER 5 TIME-BASE TIMER

Table 5.1-2 Clock Cycles Supplied by Time-base Timer (2/2)

Clock supplied to Clock cycle Remarks

Watchdog timer 222/FCH (Approximately 335.5 ms) Watchdog timer count up clock

A/D converter 28/FCH (Approximately 20.5 µs) Continuous activation clock

FCH: Oscillation frequency The values enclosed in parentheses are time intervals when the oscillation frequency is 12.5 MHz.

Because oscillation cycles vary immediately after oscillation starts, the oscillation stabilization wait time is listed for reference.

Page 134 of the Fujitsu MB89202 user manual — CHAPTER 5 TIME-BASE TIMER
Page 134 · click to enlarge
Page 134

CHAPTER 5 TIME-BASE TIMER

5.2 Configuration of Time-base Timer

  • The time-base timer consists of the following four function blocks.
  • Time-base counter
  • Counter clear circuit
  • Interval timer selector
  • Time-base timer control register (TBTC)
  • Block Diagram of Time-base Timer

Figure 5.2-1 Block Diagram of Time-base Timer

Fujitsu MB89202 — CHAPTER 5 TIME-BASE TIMER diagram (page 134)
Fig. 16

X22 X23 X26 X27 X28 X29 X210 X211 X212X213 X214 X215 X216 X217 X220 X221

Clearing counter To clock control section oscillation stabilization time selector

Counter clear circuit

Starting stop mode (in normal mode)

F CHO s cill a tion fre qu ency
  • Time-base timer counter

A 21-bit up counter that accepts the oscillation frequency divided by two as the count clock and stops operating when oscillation stops.

  • Counter clear circuit

Clears the counter when the TBTC register is set (TBR = 0), stop mode is entered (STBC: STP = 1), or a power-on reset occurs.

  • Interval timer selector

Selects 1 bit for the interval timer from four bits in the time-base counter. When the specified bit overflows, an interrupt occurs.

  • Time-base timer control register (TBTC)

Selects a time interval, clears the counter, controls interrupts, or checks the status.

Page 135 of the Fujitsu MB89202 user manual — TBOF
Page 135 · click to enlarge
Page 135

CHAPTER 5 TIME-BASE TIMER

5.3 Time-base Timer Control Register (TBTC)

The time-base timer control register (TBTC) selects a time interval, clears the counter, controls interrupts, or checks the status.

  • Time-base Timer Control Register (TBTC)

Figure 5.3-1 Time-base Timer Control Register (TBTC)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 000AH TBOF TBIE TBC1 TBC0 TBR 00---000B R/W

Address Initial value

Time-base timer initialization bit Read

TBR

The time-base timer counter is cleared.

"1" is always read. Nothing is changed and affected.

TBC1 TBC0

Time interval selection bits

0 0 213/FCH 0 1 1 0 1 1

215/FCH 218/FCH 222/FCH

F CHO s cill a tion fre qu ency

TBIE

Interrupt request enable bit

The interrupt request output is disabled. The interrupt request output is enabled.

Overflow interrupt request flag bit

TBOF

Read Write

The specified bit has not overflowed. This bit is cleared. The specified bit has overflowed. Nothing is changed and affected.

R/WRe a d ab le/Writ ab le

: Unused

: Initial value

Write

Page 136 of the Fujitsu MB89202 user manual — CHAPTER 5 TIME-BASE TIMER
Page 136 · click to enlarge
Page 136

CHAPTER 5 TIME-BASE TIMER

Table 5.3-1 Explanation of Functions of Each Bit in Time-base Timer Control Register (TBTC)

  • This bit is set to "1" when the specified bit of the time-base timer counter overflows.
  • An interrupt request is sent when this bit and the interrupt request enable bit (TBIE) are both "1".
  • While this bit is written, it is cleared when "0" is specified, and nothing is changed and affected when "1" is specified.
TBOFOverflow interrupt request flag bit

This bit enables or disables an interrupt request to be output to the CPU. An interrupt request is output when this bit and the overflow interrupt request flag bit (TBOF) are both "1".

bit6 TBIEInterrupt request enable bit
  • Unused bits
  • These bits are undefined when they are read.
  • Nothing is affected when they are written.
  • These bits specify a time interval for the interval timer.
  • The interval timer bits of the time-base timer counter are specified.
  • One of four time intervals can be selected.
TBC1, TBC0Time interval selection bits
  • This bit clears the time-base timer counter.
  • The counter is cleared to 000000 H when "0" is written to this bit, nothing is changed and affected when "1" is written. Note:
TBRTime-base timer initialization bit

This bit is always "1" at the beginning of reading.

Show 7 more labels / short text on this page
Bit name Description · bit7 · bit5 · to bit3 · bit2, · bit1 · bit0
Page 137 of the Fujitsu MB89202 user manual — CHAPTER 5 TIME-BASE TIMER
Page 137 · click to enlarge
Page 137

CHAPTER 5 TIME-BASE TIMER

5.4 Interrupt of Time-base Timer

The time-base timer counter generates an interrupt when the specified bit of the counter overflows (interval timer function).

  • Interrupts when the Interval Timer Function is Enabled

The counter counts up with the internal count clock. When the specified interval timer bit overflows, the overflow interrupt request flag bit (TBTC: TBOF) is set to "1". Then if the interrupt request enable bit is enabled (TBTC: TBIE = 1), an interrupt request (IRQ7) is sent to the CPU. When this occurs, use the interrupt handling routine and set the TBOF bit to "0" to clear the interrupt request. The TBOF bit is set to "1" when the specified bit overflows regardless of the value of the TBIE bit.

When the interrupt request is allowed to be output (TBIE = 1) after a reset is released, clear the TBOF bit (TBOF = 0) at the same time.

  • An interrupt request is generated immediately after the TBIE bit is set from 0 (disable) to 1 (enable) if the TBOF bit is "1".
  • When the counter is cleared (TBTC: TBR = 0) and the specified bit overflows at the same time, the TBOF bit is not set.
  • Oscillation Stabilization Time and Time-base Timer Interrupts

If a time interval is set the time shorter than the oscillation stabilization time, the interval interrupt request (TBTC: TBOF = 1) is generated from the time-base timer upon the start of normal mode. In this case, interrupts from the time-base timer must be disabled (TBTC: TBIE = 0) when switching to stop mode in which an oscillation is stopped.

  • Register and Vector Table Related to Interrupts from Time-base Timer

Table 5.4-1 Register and Vector Table Related to Time-base Timer Interrupts

Interrupt level setting register Address of vector table

Register Bits to be set High-order Low-order

IRQ7 ILR2 (007CH) L71 (bit7) L70 (bit6) FFECH FFEDH

See Section "3.4.2 Steps in the Interrupt Operation " for details on interrupt operations.

Interrupt name

Page 138 of the Fujitsu MB89202 user manual — TBTC TBOF TBIE TBC1 TBC0 TBR
Page 138 · click to enlarge
Page 138

CHAPTER 5 TIME-BASE TIMER

5.5 Operations of Time-base Timer Functions

The time-base timer functions as an interval timer or supplies clocks to some peripherals.

  • Operations of Interval Timer Function (Time-base Timer)

To use as an interval timer, the settings shown below must be made.

Figure 5.5-1 Setting Interval Timer Function

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

TBTC TBOF TBIE TBC1 TBC0 TBR

: Used bit

: Set to "1"

: Set to "0"

The counter in the time-base timer continues to count up in synchronization with the internal count clock (at the oscillation frequency divided by two) as long as the clock oscillates.

The counter counts from "0" upon being cleared (TBR = 0). When the interval timer bit overflows, the overflow interrupt request flag bit (TBOF) is set to "1". In other words, interrupts are generated at specified intervals, starting from when the counter is cleared.

  • Operations of Clock Supply Function

The time-base timer is often used to make oscillation stabilization wait time. The oscillation stabilization time is measured from when the time-base timer counter is cleared to when the oscillation stabilization bit overflows. One of three oscillation stabilization time can be selected by the oscillation stabilization time selection bits of the system clock control register (SYCC: WT1, WT0).

The time-base timer supplies clocks to the watchdog timer and A/D converter. Clearing the time-base timer counter affects the operation of continuous activation cycles. In addition, when the time-base timer is cleared, the counter in the watchdog timer is also cleared.

  • Operations of Time-base Timer

Figure 5.5-2 shows the operation of the time-base timer when:

  • power-on reset occurs.
  • sleep mode is entered while the interval timer function is being performed in normal mode.
  • stop mode is entered.
  • a counter clear request is generated.

In stop mode, the time-base timer is cleared and stops operating. When returning from stop mode, the time- base timer counts the oscillation stabilization time.

Page 139 of the Fujitsu MB89202 user manual — CHAPTER 5 TIME-BASE TIMER
Page 139 · click to enlarge
Page 139

CHAPTER 5 TIME-BASE TIMER

Figure 5.5-2 Operations of Time-base Timer

Fujitsu MB89202 — CHAPTER 5 TIME-BASE TIMER diagram (page 139)
Fig. 17

Cleared by switching to stop mode

Oscillation stabilization overflow

Interval cycle (TBTC:TBC1,TBC0=11B) Counter clear

Cleared by interrupt handling routine

SLP bit (STBC register)

Exit stop state by IRQ7 Stop

STP bit (STBC register)

Exit stop state by an external interrupt

: Oscillation stabilization time

Page 140 of the Fujitsu MB89202 user manual — CHAPTER 5 TIME-BASE TIMER
Page 140 · click to enlarge
Page 140

CHAPTER 5 TIME-BASE TIMER

5.6 Notes on Using Time-base Timer

  • Notes on Using Time-base Timer
  • Notes on using programs to set time-base timer

When the interrupt request flag bit (TBTC: TBOF) is "1" and the interrupt request enable bit is enabled (TBTC: TBIE = 1), a return from interrupt handling is not possible. The TBOF bit must be cleared.

  • Clearing time-base timer

The time-base timer is cleared when the time-base timer initialization bit is set to 0 (TBTC: TBR = 0) or when the oscillation stabilization time is required. Because the time-base timer is used as the count clock for the watchdog timer, clearing the time-base timer also clears the watchdog timer.

  • Using time-base timer as oscillation stabilization time timer

Oscillation has not yet started in stop mode or when the power is turned on. Therefore, the time-base timer makes oscillation stabilization wait time after the resonator starts operating.

The appropriate oscillation stabilization time must be selected according to the type of resonator connected to the resonator (clock generator).

See Section "3.6.1 Clock Generator ".

  • Notes on peripheral functions the time-base timer supplies to the clock

When entering the modes in which oscillation stops, the counter is cleared and the time-base timer stops operating. The clock from the time-base timer may have a shorter "H" level period or longer "L" level period (up to half the clock cycle) when the counter of the time-base timer is cleared because the clock starts operating from the initial state. The clock for the watchdog timer also starts operating from the initial state, but the watchdog timer operates at a normal cycle because the watchdog timer counter is cleared at the same time.

Page 141 of the Fujitsu MB89202 user manual — CHAPTER 5 TIME-BASE TIMER
Page 141 · click to enlarge
Page 141

CHAPTER 5 TIME-BASE TIMER

5.7 Program Example for Time-base Timer

Programming examples for the time-base timer are shown below.

  • Programming Examples for Time-base Timer
  • Processing specification

Repeatedly generate an interval timer interrupt at intervals of 218/FCH (FCH: oscillation frequency). The

time interval is approximately 21.0 ms (operating at 12.5 MHz).

  • Coding examples

TBTC EQU 0000AH ; Address of time-base timer control register

TBOF EQU TBTC:7 ; Definition of interrupt request flag bit

ILR2 EQU 007CH ; Address of interrupt level setting register 2

INT_V DSEG ABS ; [DATA SEGMENT] ORG 0FFECH IRQ7 DW WARI ; Setting interrupt vector INT_V ENDS ; Main program

CSEG ; [CODE SEGMENT] ; Stack pointer (SP) or other registers are assumed to have been initialized. : CLRI ; Interrupt disable MOV ILR2,#01111111B ; Setting interrupt level (level 1) MOV TBTC,#01000100B ; Clearing interrupt request flag, enabling interrupt

request output, selecting 218 /FCH, and clearing

time-base timer SETI ; Interrupt enable : ; Interrupt processing routine WARI CLRB TBOF ; Clearing interrupt request flag PUSHW A XCHW A,T PUSHW A : User processing: : POPW A XCHW A, T

Page 142 of the Fujitsu MB89202 user manual — CHAPTER 5 TIME-BASE TIMER
Page 142 · click to enlarge
Page 142

CHAPTER 5 TIME-BASE TIMER

POPW A RETI ENDS ; --------------------------------------------------------------------------------------------------------------------

END

Page 143 of the Fujitsu MB89202 user manual — CHAPTER 6 WATCHDOG TIMER
Page 143 · click to enlarge
Page 143

CHAPTER 6 WATCHDOG TIMER

This chapter describes the functions and operations of the watchdog timer.

6.1 Overview of Watchdog Timer

6.2 Configuration of Watchdog Timer

6.3 Watchdog Control Register (WDTC)

6.4 Operations of Watchdog Timer Functions

6.5 Notes on Using Watchdog Timer

6.6 Program Example for Watchdog Timer

Page 144 of the Fujitsu MB89202 user manual — CHAPTER 6 WATCHDOG TIMER
Page 144 · click to enlarge
Page 144

CHAPTER 6 WATCHDOG TIMER

6.1 Overview of Watchdog Timer

The watchdog timer is a 1-bit counter that uses output from the time-base timer, based on oscillation frequency, as the count clock. The watchdog timer resets the CPU when not cleared within a specified period after activation.

  • Watchdog Timer Function

The watchdog timer is a counter for preventing programs from hanging up. The timer must be cleared at specified intervals after being activated. If the timer is not cleared within a specified period of time because, for example, a program goes into an endless loop, the timer sends to the CPU a watchdog reset having a period of four instruction cycles.

The watchdog timer uses the output from the time-base timer as the count clock.

The time intervals for the watchdog timer are listed in Table 6.1-1 . When the watchdog timer is not cleared, a watchdog reset occurs following the time between the minimum time interval and the maximum time interval. The counter must be cleared before the time of the minimum time interval.

Table 6.1-1 Watchdog Timer Time Intervals

Time-base timer output (Oscillation frequency: 12.5 MHz)

Minimum time interval Approximately 335.5 ms *

Maximum time interval Approximately 671.0 ms

*: (number of counts of time-base timer (222)) × (oscillation frequency (FCH) divided by 2)

See Section "6.4 Operations of Watchdog Timer Functions " for details on the maximum and minimum time intervals of the watchdog timer.

  • The watchdog timer counter is cleared when the time-base counter is cleared (TBTC : TBR = 0) while output from the time-base timer is selected. Therefore, if the time-base timer counter supplying the count clock is cleared repeatedly within the time interval of the watchdog timer, the watchdog timer does not function correctly.
  • When switching to sleep or stop mode, the watchdog timer counter is cleared and stops operating until returning to normal operation (RUN state).

Count clock

Page 145 of the Fujitsu MB89202 user manual — R S T
Page 145 · click to enlarge
Page 145

CHAPTER 6 WATCHDOG TIMER

6.2 Configuration of Watchdog Timer

  • The watchdog timer consists of the following four function blocks.
  • Watchdog timer counter
  • Reset control circuit
  • Counter clear control circuit
  • Watchdog control register (WDTC)
  • Block Diagram of Watchdog Timer

Figure 6.2-1 Block Diagram of Watchdog Timer

Watchdog control register (WDTC)

WTE 3 WTE2 WTE1 WTE0

Watchdog timer

Clear Start

2 22 /F CH

1-bit counter Overflow Reset control circuit

R S T

(Time- base timer output)

  • Watchdog timer counter (1-bit counter)

A 1-bit counter that operates by accepting output from the time-base timer as the count clock.

  • Reset control circuit

Sends the reset signal to the CPU when the watchdog timer counter overflows.

  • Counter clear control circuit

Controls the clearing and stopping of the watchdog timer counter.

  • Watchdog control register (WDTC)

Activates and clears the watchdog timer counter. Because this register is write-only, bit manipulation instructions cannot be used.

Page 146 of the Fujitsu MB89202 user manual — RE S V
Page 146 · click to enlarge
Page 146

CHAPTER 6 WATCHDOG TIMER

6.3 Watchdog Control Register (WDTC)

The watchdog control register (WDTC) activates and clears the watchdog timer.

  • Watchdog Control Register (WDTC)

Figure 6.3-1 Watchdog Control Register (WDTC)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0009H RESV WTE3 WTE2 WTE1 WTE0 0---XXXXB R/W

WTE 3 WTE2 WTE1 WTE0

Watchdog control bit Starts the watchdog timer (upon first writing after reset)

0 1 0 1

Clears the watchdog timer (upon second or subsequent writing after a reset)

Other than above No operation

RE S V

Reserved bit Write "0" to this bit.

: Unused R/W : Readable/writable

XUndefined

Table 6.3-1 Explanation of Functions of Each Bit in Watchdog Control Register (WDTC)

bit7 RESV: Reserved bit • Write "0" to this bit.

  • Unused bits
  • Undefined when it is read.
  • Writing values does not affect operation.
  • Writing "0101 B " activates (for first writing) or clears (for second or subsequent writing) the watchdog timer.
  • Writing other than "0101 B " does not affect operation. Note:
WTE3, WTE2, WTE1, WTE0Watchdog control bits

These bits indicate "1111B" when read. Bit manipulation instructions cannot be used.

Show 5 more labels / short text on this page
Bit name Description · bit6 · to bit4 · bit3 · to bit0
Page 147 of the Fujitsu MB89202 user manual — CHAPTER 6 WATCHDOG TIMER
Page 147 · click to enlarge
Page 147

CHAPTER 6 WATCHDOG TIMER

6.4 Operations of Watchdog Timer Functions

The watchdog timer generates a watchdog reset when the watchdog timer counter overflows.

  • Operations of Watchdog Timer
  • Activating watchdog timer

The watchdog timer is activated when the first time "0101B" is written to the watchdog control bits

(WDTC: WTE3 to WTE0) of the watchdog control register.

The watchdog timer cannot be stopped without accepting a reset upon activation.

  • Clearing watchdog timer

The watchdog timer counter is cleared the second or subsequent time "0101B" is written to the watchdog

control bits (WDTC: WTE3 to WTE0) of the watchdog control register.

When the counter is not cleared within the time interval of the watchdog timer, the counter overflows and the timer generates the internal reset signal having a period of four instruction cycles.

  • Time intervals of watchdog timer

The time interval varies depending on the timing at which the watchdog timer is cleared. Figure 6.4-1 shows the relationship between the clear timings and time intervals of the watchdog timer when output from the time-base timer is used as the count clock (oscillation frequency: 12.5 MHz).

Figure 6.4-1 Clearing Watchdog Timer and Time Interval

Fujitsu MB89202 — CHAPTER 6 WATCHDOG TIMER diagram (page 147)
Fig. 18

335.5 ms Minimum time interval

Count clock output from time-base timer

Maximum time interval

Count clock output from time-base timer

Page 148 of the Fujitsu MB89202 user manual — CHAPTER 6 WATCHDOG TIMER
Page 148 · click to enlarge
Page 148

CHAPTER 6 WATCHDOG TIMER

6.5 Notes on Using Watchdog Timer

  • Notes on Using Watchdog Timer
  • Stopping watchdog timer

The watchdog timer cannot be stopped without accepting a reset upon activation.

  • Clearing watchdog timer

Clearing the time-base timer counter that supplies the count clock to the watchdog timer also clears the watchdog timer counter at the same time.

Switching to sleep or stop mode clears the watchdog timer counter.

  • Notes on creating programs

When creating a program that repeatedly clears the watchdog timer in the main loop, ensure that the time necessary for main loop processing, including interrupt handling, is shorter than the minimum time interval of the watchdog timer.

Page 149 of the Fujitsu MB89202 user manual — END
Page 149 · click to enlarge
Page 149

CHAPTER 6 WATCHDOG TIMER

6.6 Program Example for Watchdog Timer

Programming examples for the watchdog timer are provided below.

  • Programming Examples of Watchdog Timer
  • Processing specification
  • Activate the watchdog timer immediately after the program starts.
  • Clear the watchdog timer whenever the loop of the main program is run.
  • Ensure that the time necessary for running the main loop once, including interrupt handling, is shorter than the minimum time interval (approximately 335.5 ms: operating at 12.5 MHz) of the watchdog timer.
  • Coding example

WDTC EQU 0009H ; Address of watchdog control register WDT_CLR EQU 00000101B

VECT DSEG ABS ; [DATA SEGMENT] ORG 0FFFEH RST_V DW PROG ; Setting reset vector VECT ENDS ; Main program

CSEG ; [CODE SEGMENT] PROG ; Initialization routine upon reset MOVW SP,#0280H ; Setting initial value of stack pointer (for interrupt) : Initializing interrupt or other peripheral functions : INIT MOV WDTC,#WDT_CLR ; Activating watchdog timer

MAIN MOV WDTC,#WDT_CLR ; Clearing watchdog timer : User processing (interrupt may occur in this processing.) : JMP MAIN ; Ensure that the time necessary for running the loop is shorter than the minimum time interval of the watchdog timer. ENDS ;

END

Page 150 of the Fujitsu MB89202 user manual — CHAPTER 6 WATCHDOG TIMER
Page 150 · click to enlarge
Page 150

CHAPTER 6 WATCHDOG TIMER

Page 151 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 151 · click to enlarge
Page 151

CHAPTER 7 8-BIT PWM TIMER

This chapter describes the functions and operations of 8-bit PWM timer.

7.1 Overview of 8-bit PWM Timer

7.2 Configuration of 8-bit PWM Timer

7.3 Pin of 8-bit PWM Timer

7.4 Registers of 8-bit PWM Timer

7.5 Interrupt of 8-bit PWM Timer

7.6 Operations of the Interval Timer Functions

7.7 Operations of the 8-bit PWM Timer Functions

7.8 States in Each Mode During Operation

7.9 Notes on Using 8-bit PWM Timer

7.10 Program Example for PWM Timer

Page 152 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 152 · click to enlarge
Page 152

CHAPTER 7 8-BIT PWM TIMER

7.1 Overview of 8-bit PWM Timer

An 8-bit PWM timer has the interval timer functions and the PWM timer functions of an 8-bit resolution. A counter is incremented using interval timer functions in synchronization with three types of internal count clocks or the output of 8/16-bit capture timer/counter. The user can select one of these functions. Therefore, the 8-bit interval timer can be set and the square wave of any frequency can be output using the set output. In addition, if a low-pass filter is connected to the PWM output, the D/A converter can be used.

  • Interval Timer Functions (Functions to Output the Square Wave)

Interrupts are generated repeatedly at any interval by the interval timer functions.

Because the output level of the pin (P50/PWM pin) can be inverted for each interrupt, the square wave of any frequency can also be output.

  • An interval timer operation from the cycle of the count clock to 2 8 -times cycle is possible.
  • The count clock can be selected from four types.

Table 7.1-1 shows the range of intervals and square wave output.

Table 7.1-1 Range of Intervals and Square Wave Output

Count clock cycle Interval Square wave output (Hz)

1tINST 1tINST to 28tINST 1/ (2tINST) to 1/ (29tINST)

2 16tINST 24tINST to 212tINST 1/ (25tINST) to 1/ (213tINST)

3 64tINST 26tINST to 214tINST 1/ (27tINST) to 1/ (215tINST)

2tINST 2tINST to 217tINST 1/ (22tINST) to 1/ (210tINST)

32tINST 25tINST to 221tINST 1/ (26tINST) to 1/ (214tINST)

4 8/16-bit timer count clock

512tINST 29tINST to 225tINST 1/ (210tINST) to 1/ (218tINST)

1tEXT 1tEXT to 216tEXT 1/ (2tEXT) to 1/ (29tEXT)

tINST: Instruction cycle (Affected by the clock mode and others.) tEXT : Output cycle of an 8/16-bit capture timer

Internal count clock

Page 153 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 153 · click to enlarge
Page 153

CHAPTER 7 8-BIT PWM TIMER

Calculation example of intervals and square wave frequency

The following expression is the interval when the count clock cycle is set to 1 tINST and when an

oscillation frequency (FCH) of 12.5 MHz and a PWM compare register (COMR) value of DDH (221)

are set. Another expression is the frequency of the square wave output from the PWM pin that is operated continuously without changing the COMR register value.

However, the values are true when the maximum speed clock of the normal mode is selected (CS1, CS0 = 11B, 1 instruction cycle = 4/FCH) with the system clock control register (SYCC).

= (1 × 4/FCH ) × (COMR register value + 1)

= (4/12.5 MHz) × (221 + 1)

= 71.0 µs

Output frequency = FCH / (1 × 8 × (COMR register value + 1))

= 12.5 MHz/ (8 × (221 + 1))

7.04 kHz

  • PWM Timer Functions

The PWM timer functions have an 8-bit resolution and can control the "H" level width and "L" level width of one cycle.

Because the resolution is 1/256, a pulse can be output at a duty ratio of 0 to 99.6%.

The frequency of the PWM wave can be selected from four types.

The low-pass filter can be connected to the output and used as the D/A converter.

Table 7.1-2 shows the frequency of the PWM wave that can be set by PWM timer functions. Figure 7.1-1 is a configuration example of the D/A converter.

Table 7.1-2 Frequencies of the PWM Wave that can be Set by the PWM Timer Functions

1 2 3 4

Internal clock Output of an 8/16-bit capture timer/counter

Count clock cycle 1tINST 16tINST 64tINST 22tINST to

26tINST to

210tINST to

28tEXT

210tINST

214tINST

218tINST

PWM wave cycle 28tINST 212tINST 214tINST 210tINST to

214tINST to

218tINST to

28tEXT to

218tINST

222tINST

226tINST

216tEXT

tINST: Instruction cycle (Affected by the clock mode and others.) tEXT: Output frequency of an 8/16-bit capture timer

Interval · 1tEXT to

Page 154 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 154 · click to enlarge
Page 154

CHAPTER 7 8-BIT PWM TIMER

Figure 7.1-1 Configuration Example of the D/A Converter with the PWM Output and a Low-Pass Filter

Fujitsu MB89202 — CHAPTER 7 8-BIT PWM TIMER diagram (page 154)
Fig. 19

Relationship between analog output voltage and PWM output waveform

While PWM timer functions are enabled, no interrupt request occurs.

Page 155 of the Fujitsu MB89202 user manual — P50/PWM
Page 155 · click to enlarge
Page 155

CHAPTER 7 8-BIT PWM TIMER

7.2 Configuration of 8-bit PWM Timer

  • An 8-bit PWM timer consists of the following six blocks.
  • Count clock selector
  • 8-bit counter
  • Comparator
  • PWM generation and output control circuit
  • PWM compare register (COMR)
  • PWM control register (CNTR)
  • Block Diagram of an 8-bit PWM Timer

Figure 7.2-1 Block Diagram of an 8-bit PWM Timer

CNTR COMR

P/TX P1 P0 TPE TIR OE TIE

IRQ9

(Output of an 8/16-bit capture timer/counter)

Count clock selector 8-bit counter Start

TO

CLK ECLK

1 16 64 1t INST

PWM generation circuit and output control circuit

P50/PWM

t INSTInstruction cycle
Show 8 more labels / short text on this page
Internal data bus · PWM compare register · Comparator · Clear · Latch Overflow · Timer/ PWM · Output pin control · Pin Output
Page 156 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 156 · click to enlarge
Page 156

CHAPTER 7 8-BIT PWM TIMER

  • Count clock selector

The count clock selector selects one of three types of internal counter clock. The selector also selects an 8/ 16-bit capture timer or counter and uses it to increment the count of the 8-bit counter.

  • 8-bit counter

This counter is incremented by the count clock selected by the count clock selector.

  • Comparator

A latch in the comparator holds the COMR register value when the value of the 8-bit counter is 00H and

then compares the 8-bit counter with the COMR register value latched and detects a match.

  • PWM generation circuit and PWM output control circuit

During the interval timer operation, once a match is detected, an interrupt request occurs. And when the bit to control the output pin (CNTR: OE) is "1", the output level of the P50/PWM pin is inverted by the output control circuit, at which time the 8-bit counter is cleared.

During the PWM timer operation, once a match is detected, the output level of the P50/PWM pin is changed from "H" level to "L" level by the PWM generation circuit. Thereafter, when the 8-bit counter overflows, the output level is returned to "H" level.

  • COMR register

This register is used to set a value for comparison with the counter value of the 8-bit counter.

  • CNTR register

This register is used to select the operation mode, enable and disable operations, set the count clock, control interrupts, and check status.

When the operation mode is the PWM timer mode (P/TX = 0), the 8-bit counter cannot be cleared (by the match detection signal from the comparator) and the interrupt request (IRQ9) is disabled.

Page 157 of the Fujitsu MB89202 user manual — PWM:
Page 157 · click to enlarge
Page 157

CHAPTER 7 8-BIT PWM TIMER

7.3 Pin of 8-bit PWM Timer

This section describes the pin and provides a block diagram of the pin related to the 8- bit PWM timer.

  • Pin Related to the 8-bit PWM Timer

The pin related to the 8-bit PWM timer is the P50/PWM pin.

  • P50/PWM pin

This pin can be used as a general-purpose I/O port (P50) and for output of the interval timer or PWM timer (PWM).

PWM:

While the pin functions as the interval timer, the square wave is output to the pin.

While the pin functions as the PWM timer, the PWM wave is output to the pin.

When the bit to control the output pin is set to the dedicated pin (CNTR: OE = 1), the P50/PWM pin automatically functions as an output pin, regardless of the value of the port 5 data direction register (DDR5: bit0), and as the PWM pin.

  • Block Diagram of the Pin Related to the 8-bit PWM Timer

Figure 7.3-1 Block Diagram of the Pin Related to the 8-bit PWM Timer

Fujitsu MB89202 — PWM: diagram (page 157)
Fig. 20

Stop mode (SPL=1) Pull-up resistor

Resource output

Resource output is enabled

Page 158 of the Fujitsu MB89202 user manual — W
Page 158 · click to enlarge
Page 158

CHAPTER 7 8-BIT PWM TIMER

7.4 Registers of 8-bit PWM Timer

This section describes the registers related to the 8-bit PWM timer.

  • Registers Related to the 8-bit PWM Timer

Figure 7.4-1 Registers Related to the 8-bit PWM Timer

CNTR (PWM control register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0022H P/TX P1 P0 TPE TIR OE TIE 0-000000B R/W

COMR (PWM compare register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0023H XXXXXXXXB W

R/W

: Readable/Writable

W

: Write only : Unused : Undefined

Because the PWM compare register (COMR) is a write-only register, an instruction to operate bits cannot be used.

Address Initial value · Address · Initial value

Page 159 of the Fujitsu MB89202 user manual — R/W
Page 159 · click to enlarge
Page 159

CHAPTER 7 8-BIT PWM TIMER

7.4.1 PWM Control Register (CNTR)

The PWM control register (CNTR) is used to select the operation mode (interval timer operation or PWM timer operation) of the 8-bit PWM timer, switch the resolution of the PWM timer functions, and select the count clock.

  • PWM Control Register (CNTR)

Figure 7.4-2 PWM Control Register (CNTR)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0022H P/TX P1 P0 TPE TIR OE TIE 0-000000B R/W

TIE

Bit to enable an interrupt request

Disables interrupt request output.

Enables interrupt request output.

OE

Bit to control the output pin

Used as the general-purpose port (P50)

Used as the output pin for the interval timer or PWM timer (PWM)

Interrupt request flag bit

TIR

Write The interval timer used The PWM timer used The counter value does not match the settings. Not changed

Clears this bit.

The counter value matches the settings.

Not changed. Does not affect other settings.

TPE

Bit to enable the counter operation

Stops the counter operation. Starts the counter operation.

P1 P0

Bits to select a clock

0 0 1 tINST 0 1 16 tINST 1 0 64 tINST 1 1

Outputs an 8/16-bit capture timer/counter.

P/TX

Bit to select the operation mode

Operates as the interval timer.

Operates as the PWM timer.

t INSTInstruction cycle

R/W

: Readable/Writable : Initial value

Address Initial value · Read · Internal count clock

Page 160 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 160 · click to enlarge
Page 160

CHAPTER 7 8-BIT PWM TIMER

Table 7.4-1 Explanation of the Functions of Each Bit in the PWM Control Register (CNTR)

This bit is used to select the interval timer operation (P/TX = 0) or PWM timer operation (P/TX = 1). Note:

P/TXBit to select the operation mode

Before writing into this bit, stop the counter operation (TPE = 0), disable an interrupt (TIE = 0), and clear the interrupt request flag bit (TIR = 0).

bit6 Unused bit The value during a read is undetermined. A write does not affect operations.

This bit is used to select the count clock of the interval timer functions or PWM timer functions. One of three types of internal count clock or the output of the 8/16-bit capture timer or counter can be selected. Note:

P1, P0Bits to select the clock

When the counter is operating (TPE = 1), do not switch P1 and P0.

This bit is used to start and stop the interval timer functions or PWM timer functions. To start the count operation, write "1" to this bit. When "0" is written to this bit, the counter is cleared (setting 00H) and then stopped.

TPEBit to enable the counter operation

While the internal timer functions are enabled: When the counter value matches the PWM compare register (COMR) value, "1" is set to this bit. When this bit and the bit to enable an interrupt request (TIE) are "1", an interrupt request to the CPU is output. While the PWM timer functions are enabled, an interrupt request does not occur. When this bit is written, it is cleared (setting "0"). Writing "1" does not affect this bit in any way.

bit2 TIRInterrupt request flag bit

When this bit is "0", the P50/PWM pin is used as a general-purpose port (P50). When the bit is "1", it is used as a dedicated pin (PWM). When the interval timer functions are enabled, the square wave is output to the PWM pin. When the PWM timer functions are enabled, the PWM wave is output to the PWM pin.

OEBit to control the output pin
TIEBit to enable an interrupt request

This bit is used to enable and disable the output of an interrupt request to the CPU. When this bit and the interrupt request flag bit (TIR) are both "1", an interrupt request is output.

Show 7 more labels / short text on this page
Bit name Function · bit7 · bit5, · bit4 · bit3 · bit1 · bit0
Page 161 of the Fujitsu MB89202 user manual — 0023 H XXXXXXXX B
Page 161 · click to enlarge
Page 161

CHAPTER 7 8-BIT PWM TIMER

7.4.2 PWM Compare Register (COMR)

The PWM compare register (COMR) is used to set an interval while the internal timer functions are enabled. In addition, the register becomes the "H" level width of a pulse while the PWM timer functions are enabled.

  • PWM Compare Register (COMR)

Figure 7.4-3 shows the bit configuration of a PWM compare register. Because this register is a write-only register, an instruction to operate bits cannot be used.

Figure 7.4-3 PWM Compare Register (COMR)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0023 H XXXXXXXX B

W W W W W W W W

W X

: Write only : Undefined

  • While the interval timer is operating:

Specify an interval in the register to which the value compared with the counter value is to be set.

When the settings written to this register match the counter value, the counter is cleared and "1" is set to the interrupt request flag bit (CNTR: TIR = 1).

If a value is written to the COMR register while the counter is operating, the value takes effect at the next cycle (after detection of a match).

The settings of the COMR register, while the interval timer is operating, can be calculated using the following formula. The gear function, however, affects the instruction cycle.

COMR register value = interval/(count clock cycle × instruction cycle) - 1

Address Initial value

Page 162 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 162 · click to enlarge
Page 162

CHAPTER 7 8-BIT PWM TIMER

  • While the PWM timer is operating:

Specify the "H" level width of a pulse in the register to which the value that is compared with the counter value is to be set.

Until the settings written to this register match the counter value, "H" is output from the PWM pin. When a match is found, "L" is output until the counter value overflows.

If a value is written to the COMR register while the counter is operating, the value takes effect at the next cycle (after overflow).

The settings and cycle of the COMR register, while the PWM timer is operating, can be calculated using the following formula. The gear function, however, affects the instruction cycle.

COMR register value = duty ratio (%) × 256

PWM wave cycle = count clock cycle × instruction cycle × 256

Page 163 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 163 · click to enlarge
Page 163

CHAPTER 7 8-BIT PWM TIMER

7.5 Interrupt of 8-bit PWM Timer

An interrupt factor of an 8-bit PWM timer can be a match between the counter value and the PWM compare register value while interval timer functions are operating. While the PWM timer functions are enabled, an interrupt request does not occur.

  • Interrupts while Interval Timer Functions are Enabled

When the counter value is incremented from 00H using the selected count clock and matches the PWM

compare register (COMR) value, "1" is set to the corresponding interrupt request flag bit (CNTR: TIR).

At this time, if the bit to enable an interrupt request is enabled (CNTR: TIE = 1), an interrupt request (IRQ9) to the CPU occurs. Write "0" to the TIR bit using the interrupt handling routine to clear the interrupt request.

The TIR bit is set to "1" when the counter value matches the settings regardless of the value of the TIE bit.

When a match is found between the counter value and the COMR register value concurrently with the stop of the counter (CNTR: TPE = 0), the TIR bit is not set.

When the TIR bit is "1", if the TIE bit is changed from disabled to enabled (changed from "0" to "1"), an interrupt request occurs immediately.

  • Register and Vector Table Related to the Interrupts of an 8-bit PWM Timer

Table 7.5-1 Register and Vector Table Related to the Interrupts of an 8-bit PWM Timer

Interrupt level setting register Address of vector table

Register Bits to be set High-order Low-order

IRQ9 ILR3(007DH) L91(bit3) L90(bit2) FFE8H FFE9H

See Section "3.4.2 Steps in the Interrupt Operation " for interrupt operations.

Interrupt · name

Page 164 of the Fujitsu MB89202 user manual — CNTR P/TX P1 P0 TPE TIR OE TIE
Page 164 · click to enlarge
Page 164

CHAPTER 7 8-BIT PWM TIMER

7.6 Operations of the Interval Timer Functions

This section describes the operations of the interval timer functions of an 8-bit PWM timer.

  • Operations of the Interval Timer Functions

To make an 8-bit PWM timer operate as an interval timer, set registers as shown in Figure 7.6-1 .

Figure 7.6-1 Setting Interval Timer Functions

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

CNTR P/TX P1 P0 TPE TIR OE TIE

COMR

Set an interval (compare value)

: Used bit

: Set "1". : Set "0".

When the counter is activated, the counter is incremented from 00H at the start-up of the selected count

clock. When the counter value matches the value set in the COMR register (comparison value), the timer inverts the level of the PWM pin, clears the counter, sets the interrupt request flag bit (CNTR: TIR = 1), and starts incrementing again from 00H at the next start-up of the count clock.

Figure 7.6-2 shows the operations of an 8-bit PWM timer.

Page 165 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 165 · click to enlarge
Page 165

CHAPTER 7 8-BIT PWM TIMER

Figure 7.6-2 Operations of an 8-bit PWM Timer

Fujitsu MB89202 — CHAPTER 7 8-BIT PWM TIMER diagram (page 165)
Fig. 21

When the bit to control the output pin (OE) is "0", the pin functions as a general-purpose I/O port pin (P50).

If the PWM compare register (COMR) value is changed during counter operation, the value takes effect at the next cycle. *:

  • While interval timer functions are enabled (CNTR: TPE = 1), do not change the count clock cycle (CNTR: P1, P0).
  • When 00 H is set to the COMR register, the output of the PWM pin is inverted in the cycle of the count clock. While interval timer functions are enabled, the output level of the PWM pin in the counter stop state (CNTR: TPE = 0) is at "L" level.
Page 166 of the Fujitsu MB89202 user manual — CNTR P/TX P1 P0 TPE TIR OE TIE
Page 166 · click to enlarge
Page 166

CHAPTER 7 8-BIT PWM TIMER

7.7 Operations of the 8-bit PWM Timer Functions

This section describes the operations of the 8-bit PWM timer functions.

  • Operations of the 8-bit PWM Timer Functions

To enable 8-bit PWM timer functions, set registers as shown in Figure 7.7-1 .

Figure 7.7-1 Setting 8-bit PWM Timer Functions

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

CNTR P/TX P1 P0 TPE TIR OE TIE

COMR

Set an H-level pulse width (compare value).

: Used bit : Unused bit

: Set "1".

When the counter is activated, the counter is incremented from 00H at the start-up of the selected count

clock. The output (PWM waveform) of the PWM pin is "H" until a match between the counter value and the value set in the COMR register is found. Once a match is found, the output is "L" until the counter value overflows (FFH → 00H).

Figure 7.7-2 shows the PWM waveform output to the PWM pin.

Page 167 of the Fujitsu MB89202 user manual — FF H 00 H
Page 167 · click to enlarge
Page 167

CHAPTER 7 8-BIT PWM TIMER

Figure 7.7-2 Output Example of the PWM Waveform of 8-bit PWM Timer Functions

When the COMR Register Value is 00H (0% duty ratio):

FF H 00 H 00 H

"H"

"L"

When the COMR register value is 80H (50% duty ratio):

00 H FF H 00 H

80 H

"H"

"L"

When the COMR register value is FFH (99.6% duty ratio):

FF H 00 H

00 H

"H"

"L"

  • While PWM timer functions are enabled (CNTR: TPE = 1), do not change the count clock cycle (CNTR: P1, P0).
  • While PWM timer functions are enabled, the level immediately before the stop is held as the output level of the PWM pin in the counter stop state (CNTR: TPE = 0).
Show 7 more labels / short text on this page
Counter value · PWM waveform · Counter value · PWM waveform · Counter value · PWM waveform · For one count
Page 168 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 168 · click to enlarge
Page 168

CHAPTER 7 8-BIT PWM TIMER

7.8 States in Each Mode During Operation

This section describes the operations for a move to the sleep mode, a move to the stop mode, and the occurrence of a suspend request during the operation of an 8-bit PWM timer.

  • Operations in the Standby Mode and at a Suspension

When the mode is moved to sleep and stop modes, and when a suspend request occurs, the counter value status in which interval timer functions are enabled is shown in the Figure 7.8-1 , and the counter value status in which PWM timer functions are enabled is shown in the Figure 7.8-2 .

When switched to the stop mode, the counter holds a value and stops. When the stop mode is released by an external interrupt, the counter starts operation from the held value. Therefore, the first interval and the first cycle of the PWM waveform are not the values that are set. After the release of the stop mode, initialize the 8-bit PWM timer.

Page 169 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 169 · click to enlarge
Page 169

CHAPTER 7 8-BIT PWM TIMER

  • While interval timer functions are enabled:

Figure 7.8-1 Operation of the Counter in the Standby Mode and during Suspension (while Interval

Fujitsu MB89202 — CHAPTER 7 8-BIT PWM TIMER diagram (page 169)
Fig. 22

Clear by stopping operation

COMR value (FFH)

Timer cycle Stop request

Time to wait for oscillation stabilization

Clear by the program

Stopping operation Restarting operation TIR bit

* "L" level while operation is being stopped

SLP bit (STBC register)

Release of sleep by IRQ9

STP bit (STBC register)

Release of stop by an external interrupt

When the bit to specify the pin state (STBC: SPL) of the standby control register is "1", and the PWM pin is not pulled up, the PWM pin in the stop mode is Hi-Z. When the SPL bit is "0", the value immediately before the move to the stop mode is held.

Functions are Enabled)

Page 170 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 170 · click to enlarge
Page 170

CHAPTER 7 8-BIT PWM TIMER

  • While PWM timer functions are enabled:

Figure 7.8-2 Operation in the Standby Mode and during Suspension (while PWM Timer Functions are

Fujitsu MB89202 — CHAPTER 7 8-BIT PWM TIMER diagram (page 170)
Fig. 23

The level immediately before stop is held. TPE bit

SLP bit (STBC register)

Release of sleep by something other than IRQ9 (IRQ9 does not occur.)

STP bit (STBC register)

Time to wait for oscillation stabilization

Release of stop by an external interrupt

*: When the bit to specify the pin state (STBC: SPL) of the standby control register is "1", and the PWM pin is not pulled up, the PWM pin in the stop mode is Hi-Z. When the SPL bit is "0", the value immediately before the move to the stop mode is held.

Enabled)

Page 171 of the Fujitsu MB89202 user manual — 00 H
Page 171 · click to enlarge
Page 171

CHAPTER 7 8-BIT PWM TIMER

7.9 Notes on Using 8-bit PWM Timer

This section provides notes on using 8-bit PWM timer.

  • Notes on Using 8-bit PWM Timer
  • Error

The activation of the counter by a program does not synchronize the start of an increment by the selected count clock. Therefore, as an error until a match between the counter value and the PWM compare register (COMR) value is detected, the time may be shortened by up to one cycle of the count clock cycle. Figure 7.9-1 shows an error until the count operation is started.

Figure 7.9-1 Error until the Count Operation is Started

00 H

01 H 02 H 03 H 04 H

Error Cycle of 00H

  • Notes on setting by a program
  • While interval timer functions or PWM timer functions are enabled (CNTR: TPE = 1), do not change the count clock cycle (CNTR: P1, P0).
  • If the user wants to switch between the interval timer function and the PWM timer function (CNTR: P/ TX), proceed when the counter is stopped (CNTR: TPE = 0), interrupts are disabled (CNTR: TIE = 0), and interrupt requests are cleared (CNTR: TIR = 0).
  • When the interrupt request flag bit (CNTR: TIR) is "1" and the bit to enable an interrupt request is enabled (CNTR: TIE = 1), recovery from interrupt handling is no longer possible. The TIR bit must be cleared.
  • When the counter value matches the COMR register value concurrently with the counter stop (CNTR: TPE = 0), the TIR bit is not set.
  • Depending on how to set TPE, P/TX, and OE, the PWM output waveform varies as shown below. Be careful when using a program to set TPE, P/TX, and OE.

(1) When TPE, P/TX, and OE are set at the same time:

Show 4 more labels / short text on this page
Counter value · Count clock · One cycle · Activating the counter
Page 172 of the Fujitsu MB89202 user manual — "L"
Page 172 · click to enlarge
Page 172

CHAPTER 7 8-BIT PWM TIMER

MOV CNTR, #11001010B ; Starts PWM operations, internal clocks, and count operations.

; Enables the PWM output.

1/4 instruction cycle

"H"

Depending on the port state

"L"

Executing the instruction to enable PWM output

(2) When OE is set after TPE and P/TX are set:

MOV CNTR, #11001000B ; Starts PWM operations, internal clocks, and count operations.

; Uses the general-purpose port. Check MOV CNTR, #11001010B ; Enables PWM output.

"H"

Depending on the port state

"L"

Executing the instruction to enable the PWM output

Check

Page 173 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 173 · click to enlarge
Page 173

CHAPTER 7 8-BIT PWM TIMER

7.10 Program Example for PWM Timer

This section describes program examples of an 8-bit PWM timer.

  • Program Example of Interval Timer Functions
  • Processing specifications
  • 5 ms interval timer interrupts occur repeatedly.
  • The square waveform that inverts at an interval is output to the P50/PWM pin.
  • The following expression yields the COMR register value for which the interval is about 5 ms when the top speed of the gear (one instruction cycle = 4/F CH ) is obtained at an oscillation frequency of 12.5

MHz. The count clock is 64 tINST of the internal count clock.

COMR register value = 5 ms/(64 × 4/12.5 MHz) - 1 = 244.1 (0F4H)

  • Coding example

CNTR EQU 0022H ; Address of the PWM control register COMR EQU 0023H ; Address of the PWM compare register TPE EQU CNTR:3 ; Defining the bit to enable the counter operation TIR EQU CNTR:2 ; Defining the interrupt request flag bit ILR3 EQU 007D ; Address of the register to set the interrupt level INT_V DSEG ABS ; [DATA SEGMENT] ORG 0FFF8H IRQ9 DW WARI1 ; Setting the interrupt vector INT_V ENDS ; Main program

CSEG ; [CODE SEGMENT] ; The stack pointer (SP) and others are assumed to have been initialized. : CLRI ; Disabling interrupts CLRB TPE ; Stopping the counter operation MOV ILR3,#11110111B ; Setting the interrupt level (level 1) MOV COMR,#0F4H ; Comparison value with the counter value (interval) MOV CNTR,#00101011B ; Enabling the output of the PWM ; Interval timer operation, selection of 64 tINST ; Starting the counter operation and enabling the output of interrupt requests SETI ; Enabling interrupts : ; Interrupt program WARI1 CLRB TIR ; Clearing the interrupt request flag PUSHW A XCHW A,T ; Saving A and T PUSHW A

Page 174 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 174 · click to enlarge
Page 174

CHAPTER 7 8-BIT PWM TIMER

: User processing : POPW A XCHW A,T ; Restoring A and T POPW A RETI ENDS ;

Page 175 of the Fujitsu MB89202 user manual — END
Page 175 · click to enlarge
Page 175

CHAPTER 7 8-BIT PWM TIMER

  • Program Example of PWM Timer Functions
  • Processing specifications
  • A PWM wave with a duty ratio of 50% is generated. The duty ratio is then changed to 25%.
  • No interrupt occurs.
  • When the count clock is 16 t INST of an internal count clock, the cycle of the PWM wave is 16 × 4/12.5

MHz × 256 = 1.3107 ms, which occurs when the top speed of the gear (one instruction cycle = 4/FCH) is

obtained at an oscillation frequency of 12.5 MHz.

  • The COMR register value with a duty ratio of 50% is shown below.

COMR register value = 50/100 × 256 = 128 (080H)

  • Coding example

CNTR EQU 0022H ; Address of the PWM control register COMR EQU 0023H ; Address of the PWM compare register TPE EQU CNTR:3 ; Defining the bit to enable the counter operation ; Main program

CSEG ; [CODE SEGMENT] : CLRB TPE ; Stopping the counter operation MOV COMR,#80H ; Specification of the H-level width of a pulse, 50% duty

ratio MOV CNTR,#10011010B ; PWM timer operation, selection of 16 tINST ; Starting the counter operation, clearing the interrupt

request flag ; Enabling the output of the PWM pin, disabling the output

of interrupt requests : : MOV COMR,#40H ; Changing the duty ratio to 25% (Takes effect at the next

cycle of the PWM wave.) : ENDS ;

END

Page 176 of the Fujitsu MB89202 user manual — CHAPTER 7 8-BIT PWM TIMER
Page 176 · click to enlarge
Page 176

CHAPTER 7 8-BIT PWM TIMER

Page 177 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTER
Page 177 · click to enlarge
Page 177

CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTER

This chapter describes the functions and operation of the 8/16-bit capture timer/counter.

8.1 Overview of 8/16-bit Capture Timer/Counter

8.2 Configuration of 8/16-bit Capture Timer/Counter

8.3 Pins of 8/16-bit Capture Timer/Counter

8.4 Registers of 8/16-bit Capture Timer/Counter

8.5 8/16-bit Capture Timer/Counter of Interrupts

8.6 Explanation of Operations of Interval Timer Functions

8.7 Operation of Counter Functions

8.8 Functions of Operations of Capture Functions

8.9 8/16-bit Capture Timer/Counter Operation in Each Mode

8.10 Notes on Using 8/16-bit Capture Timer/Counter

8.11 Program Example for 8/16-bit Capture Timer/Counter

Page 178 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 178 · click to enlarge
Page 178

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.1 Overview of 8/16-bit Capture Timer/Counter

The 8/16-bit capture timer/counter consists of two 8-bit counters (timer 0 and timer 1). These counters can be used separately (8-bit mode) or in combination (16-bit mode). Timer 0 provides seven internal count clocks. This timer can select the interval timer function or counter function. The interval timer function increments the counter value in synchronization with one of the seven internal clocks. The counter function increments the counter value according to the clock to be input to an external pin. Timer 0 can output square waves of any frequency according to outputs from the interval timer and counter. Timer 1 provides seven internal count clocks. This timer can output square waves of any frequency but can use only the interval timer function that increments the timer value in synchronization with one of the seven internal counter clocks. For the 16-bit mode, timer 0 and timer 1 are connected in series to serve as a 16-bit timer.

  • Interval Timer Function

The interval timer function generates interrupt requests repeatedly at any time interval.

This function can also invert the output level of P34/TO/INT10 pin per time interval and output square waves of any frequency.

  • In the 8-bit mode, the interval timer function operates as two independent timers: timer 0 (8-bit capture

timer/counter) and timer 1 (8-bit timer). Interval timer operation from each count clock cycle to a 28

times cycle is possible.

  • The interval timer function can select and output square waves to the TO pin according to the timer 0 or 1 output.
  • In the 16-bit mode, the interval timer function operates as a 16-bit capture timer/counter in which timer 0 is concatenated as the lower counter and timer 1 is concatenated as the upper counter. Interval timer

operation from the count clock cycle to the 216 times cycle is possible.

  • The count clock can be selected from the seven internal clock cycles (if timer 0 selects an external clock, the interval timer function operates as the capture/counter function).
  • The timer 0 output cycle can be used as the clock for starting A/D converters continuously or as the 8bit PWM timer count clock.
Page 179 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 179 · click to enlarge
Page 179

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

Table 8.1-1 to Table 8.1-3 show the interval time and square wave output range in each operation mode.

Table 8.1-1 Timer 0 Interval Time and Square Wave Output Range in 8-bit Mode

Count clock cycle Interval time Square wave output range (Hz)

2tINST 2tINST to 29tINST 1/ (22tINST) to 1/ (210tINST)

4tINST 22tINST to 210tINST 1/ (23tINST) to 1/ (211tINST)

16tINST 24tINST to 212tINST 1/ (25tINST) to 1/ (213tINST)

64tINST 26tINST to 214tINST 1/ (27tINST) to 1/ (215tINST)

128tINST 27tINST to 215tINST 1/ (28tINST) to 1/ (216tINST)

256tINST 28tINST to 216tINST 1/ (29tINST) to 1/ (217tINST)

512tINST 29tINST to 217tINST 1/ (210tINST) to 1/ (218tINST)

External clock 1text 1text to 28text 1/ (2text) to 1/ (29text)

Table 8.1-2 Timer 1 Interval Time and Square Wave Output Range in 8-bit Mode

Count clock cycle Interval time Square wave output range (Hz)

2tINST 2tINST to 29tINST 1/ (22tINST) to 1/ (210tINST)

4tINST 22tINST to 210tINST 1/ (23tINST) to 1/ (211tINST)

16tINST 24tINST to 212tINST 1/ (25tINST) to 1/ (213tINST)

64tINST 26tINST to 214tINST 1/ (27tINST) to 1/ (215tINST)

128tINST 27tINST to 215tINST 1/ (28tINST) to 1/ (216tINST)

256tINST 28tINST to 216tINST 1/ (29tINST) to 1/ (217tINST)

512tINST 29tINST to 217tINST 1/ (210tINST) to 1/ (218tINST)

Internal count clock · Internal count clock

Page 180 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 180 · click to enlarge
Page 180

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

Table 8.1-3 Interval Time and Square Wave Output Range in 16-bit Mode

Count clock cycle Interval time Square wave output range (Hz)

2tINST 2tINST to 217tINST 1/ (22tINST) to 1/ (218tINST)

4tINST 22tINST to 218tINST 1/ (23tINST) to 1/ (219tINST)

16tINST 24tINST to 220tINST 1/ (25tINST) to 1/ (221tINST)

64tINST 26tINST to 222tINST 1/ (27tINST) to 1/ (223tINST)

128tINST 27tINST to 223tINST 1/ (28tINST) to 1/ (224tINST)

256tINST 28tINST to 224tINST 1/ (29tINST) to 1/ (225tINST)

512tINST 29tINST to 225tINST 1/ (210tINST) to 1/ (226tINST)

External clock 1tEXT 1tEXT to 216tEXT 1/ (2tEXT) to 1/ (217tEXT)

tINST: Instruction cycle (this cycle is affected by the clock mode, etc.) tEXT : External clock cycle (1tEXT greater than or equal to 4tINST)

Example of calculating interval time and square wave frequency

If the oscillation (FCH) is set to 12.5 MHz, the timer 0 data register (TDR0) value is set to DDH(221),

and the count clock cycle is set to 2tINST 8-bit mode operation, the interval time of timer 0 and the

square wave frequency output from the TO pin when the interval timer function is operated continuously without modifying the TDR0 register value are calculated from the following expressions:

However, the values calculated from these expressions are valid when the highest speed clock of the normal mode (CS1, CS0 = 11B, 1 instruction cycle = 4/FCH) is selected according to the system clock

control register (SYCC).

Interval time = (2 × 4/FCH) × (TDR0#1 register value + 1)

= (8/12.5 MHz) × (221 + 1)

142.1 µs

Output frequency = FCH/(2 × 8 × (TDR0#1 register value + 1))

= 12.5 MHz/(16 × (221 + 1))

3.53 kHz

Internal count clock

Page 181 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 181 · click to enlarge
Page 181

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • Counter Function

The counter function counts the falling edges of the external clocks input to the P33/EC external pin. The 8/ 16-bit capture timer/counter can operate independently because the EC pin acts as an external clock input pin. Only timer 0 can select the external clock. The counter function operates using timer 0 with the 8-bit mode or with the 16-bit mode.

  • The counter function counts the number of edges of the external clocks selected by the count clock selection bit (CINV) of the timer 0 control register (TCR0). When the number of edges equals the setting value, the counter function generates an interrupt request and inverts the output level of the square wave output pin.
  • In timer 0 for the 8-bit mode, a count operation up to 2 8 is possible.
  • In the 16-bit mode, a count operation up to 2 16 is possible.
  • Inputting an external clock whose cycle is constant enables the counter to be used as a device whose function is similar to an interval timer.
Page 182 of the Fujitsu MB89202 user manual — TSEL PEN
Page 182 · click to enlarge
Page 182

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.2 Configuration of 8/16-bit Capture Timer/Counter

  • The 8/16-bit capture timer/counter consists of the following seven blocks:
  • Count clock selectors 0/1
  • Counter circuits 0/1
  • Square wave output control circuit
  • Timer 0/1 data registers (TDR0, TDR1)
  • Timer 0/1 control registers (TCR0, TCR1)
  • Capture data registers (TCPL, TCPH)
  • Timer output control register (TCR2)
  • Block Diagram of 8/16-bit Capture Timer/Counter

Figure 8.2-1 Block Diagram of 8/16-bit Capture Timer/Counter

TIF0 TFCR0 T0IEN CINV TCS02 TCS01 TCS00 TSTR0

TCR0

IRQ3

TCCR

CPIF CFCLR CPIEN CCMSK TCMSK EDGS1 EDGS0 RESV

Counter clear mask (capture clr) Counter clear mask (identity clr) Counter clear

IRQ4

P34/TO/INT10 P33/EC

M P X

Q TFF

CK6

CO CK

8-bit counter "L"

CLR

CK0

EQ

TCPL

TDR0

Data register "L"

Capture register "L"

TDR1

Capture register "H" Data register "H"

TCPH

EQ

CLR CK CK6

M P X

8-bit counter "H"

CK0

TCR1

TIF1 TFCR1 T1IEN TCS12 TCS11 TCS10 TSTR 1

Port output enable Timer0, Timer1 output selection

TSEL PEN

TCR2

Show 10 more labels / short text on this page
Capture latch · Pin Pin · to · Comparator · LOAD comparator latch · Internal data bus · LOAD comparator latch · Comparator · to · 8-bit mode
Page 183 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 183 · click to enlarge
Page 183

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • Count clock selectors 0/1

Circuits that select input clocks. In timer 0 for the 8-bit mode or in the 16-bit mode, count clock selector 0/ 1 can select seven internal clocks and one external clock. In timer 1 for the 8-bit mode, the selector can select only seven internal clocks.

  • Counter circuits 0/1

Counter circuit 0 and counter circuit 1 each consist of an 8-bit counter, a comparator, a comparator data latch, and data registers (TDR0, TDR1).

The 8-bit counter is incremented according to the selected count clock and clock edge (rising/falling). The comparator compares the counter value with the comparator data latch value. When these values match, the counter is cleared and the data register value is set in (loaded to) the comparator data latch.

In the 8-bit mode, counter circuits 0 and 1 operate independently as timer 0 and timer 1, respectively. In the 16-bit mode, counter circuits 0 and 1 operate as the 16-bit counter in which counter circuit 0 is concatenated as lower 8 bits and counter circuit 1 is concatenated as higher 8 bits.

  • Square wave output control circuit

When the comparator detects that the counter value matches the comparator data latch value in the 8- or 16- bit mode, an interrupt request is generated. In this case, if square wave output is allowed, the corresponding output control circuit inverts the output of the square wave output pin.

  • Timer 0/1 data registers (TDR0, TDR1)

TDR0 and TDR1 are used to set the data to be compared with each 8-bit counter value at write.

  • Timer 0/1 control registers (TCR0, TCR1)

TCR0 and TCR1 are used to select functions, allow and prohibit operations, control interrupts, and check interrupt states.

  • 8/16-bit capture timer/counter interrupt

IRQ3: If the interrupt request output is allowed when the counter value equals the value set in the data

register in the interval timer or counter function, an IRQ3 interrupt request is generated. (In timer 0 for the 8-bit mode or in the 16-bit mode, the interrupt request output is allowed when TCR0: T0IEN=1. In timer 1 for the 8-bit mode, the interrupt request output is allowed when TCR1: T1IEN =1.)

  • 8/16-bit capture counter interrupt

IRQ4: If the interrupt request output is allowed each time a capture input edge is detected, an IRQ4

interrupt request is generated. (In timer 0 for the 8-bit mode or in the 16-bit mode, the interrupt request output is allowed when TCCR: TCEN=1.)

  • Capture data registers (TCPL, TCPH)

TCPL and TCPH store the number of events detected in the capture mode.

When capture data is read in the timer mode, the counter value is also read.

  • Timer output control register (TCR2)

TCR2 is used to allow and prohibit square wave output and select timer 0 output/timer 1 output.

Page 184 of the Fujitsu MB89202 user manual — TO:
Page 184 · click to enlarge
Page 184

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.3 Pins of 8/16-bit Capture Timer/Counter

This section provides pins of 8/16-bit capture timer/counter and a block diagram for these pins.

  • Pins of 8/16-bit Capture Timer/Counter

8/16-bit capture timer/counter pins include P33/EC and P34/TO/INT10.

  • P33/EC pin

The P33/EC pin shares functions of the general-purpose I/O port (P33) and the external clock for the timer or capture input pin (EC).

EC:

When external clock input is selected (TCR0: TCS02, TCS01, TCS00=111B) in timer 0 for the 8-bit

mode or in the 16-bit mode, the clocks input to this pin are counted. In the capture function, this pin is also used as an input pin. When using this pin as the EC pin, set 0 in the port data 3-direction register (DDR3: bit3) and set the output transistor to OFF to enable the EC pin to be used as an input port.

  • P34/TO/INT10 pin

The P34/TO/INT10 pin shares functions of the general-purpose I/O port (P34) and the square wave output pin for the timer (TO). It also shares a function of the input pin for external interrupt 1 (INT10).

TO:

In timer 0 or 1 (switching allowed) for the 8-bit mode or in the 16-bit mode, a square wave is output from this pin. If square wave output is enabled (TCR2: PEN = 1), the P34/TO/INT10 pin automatically functions as an output pin without reference to the port 3-direction register (DDR3: bit4); it functions as the TO pin. The TCR2: TSEL is used to select whether timer 0 output or timer 1 output is to be used.

Page 185 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 185 · click to enlarge
Page 185

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • Block Diagram for 8/16-bit Capture Timer/Counter Pins

Figure 8.3-1 Block Diagram for 8/16-bit Capture Timer/Counter Pins

Fujitsu MB89202 — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER diagram (page 185)
Fig. 24

PDR read Resource input Stop mode (SPL = 1)

Pull-up resistor

Resource output enable

Resource output available

Output latch PDR write Pin

When "pull-up resistor available" is selected in the pull-up setting register, the pin state in the stop mode (SPL = 1) becomes high (pull-up state), not Hi-Z. During the reset, however, pull-up becomes ineffective and the pin state becomes Hi-Z.

Page 186 of the Fujitsu MB89202 user manual — R X
Page 186 · click to enlarge
Page 186

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.4 Registers of 8/16-bit Capture Timer/Counter

This section shows registers of 8/16-bit capture timer/counter.

  • Registers of 8/16-bit Capture Timer/Counter

Figure 8.4-1 Registers of 8/16-bit Capture Timer/Counter

TCCR (capture control register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0019H CPIF CFCLR CPIEN CCMSK TCMSK EDGS1 EDGS0 RESV 00000000B R R/W

TCR1 (timer 1 control register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 001AH TIF1 TFCR1 T1IEN TCS12 TCS11 TCS10 TSTR1 000-0000B R R/W

TCR0 (timer 0 control register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 001BH TIF0 TFCR0 T0IEN CINV TCS02 TCS01 TCS00 TSTR0 00000000B R R/W

TDR1 (timer 1 data register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 001CH XXXXXXXXB R/W

TDR0 (timer 0 data register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

001DH XXXXXXXXB R/W

TCPH (capture data register H)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 001EH XXXXXXXXB R

TCPL (capture data register L)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 001FH XXXXXXXXB R

TCR2 (timer output control register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0020H PEN TSEL 00B R/W R/W R/W

: Readable/Writable : Read only : Undefined

R X

: Unused

Show 15 more labels / short text on this page
Address Initial value · Address · Initial value · Address · Initial value · Address · Initial value · Address · Initial value · Address · Initial value · Address · Initial value · Address · Initial value
Page 187 of the Fujitsu MB89202 user manual — CPIF
Page 187 · click to enlarge
Page 187

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.4.1 Capture Control Register (TCCR)

The capture control register (TCCR) is used to select functions and detection edges, control interrupts, and check interrupt states in timer 0 for the 8-bit mode of the 8/16 bit capture timer/counter or in capture mode (16-bit mode).

  • Capture Control Register (TCCR)

Figure 8.4-2 Capture Control Register (TCCR)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0019 H 00000000 B

CPIF CFCLR CPIEN CCMSK TCMSK EDGS1 EDGS0 RESV

R R/W R/W R/W R/W R/W R/W R/W

RESV

Capture input selection bit

Operation is not affected at all.

EDGS1 EDGS0

Capture mode enable/edge detection selection bit Capture input prohibition Operation in timer/counter mode

0 1 1 0

Operation in capture mode

Selection of both falling and rising edges

TCMSK

Compare match counter clear mask bit

The counter is cleared per compare match.

The counter is not cleared at compare match.

CCMSK

Counter clear mask bit (at capture operation) The counter is cleared when a capture edge is detected.

The counter is not cleared when a capture edge is detected.

CPIEN

Capture interrupt request enable bit Capture interrupt request output is prohibited.

Capture interrupt request output is allowed.

CFCLR

Capture edge detection flag clear bit Not affected (at read, always "0")

The capture edge detection flag is cleared.

CPIF

Capture edge detection flag bit

No capture edge was detected.

A capture edge was detected.

R/WReadable/Writable
RRead only : Initial value

Address Initial value · Falling edge selection · Rising edge selection

Page 188 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 188 · click to enlarge
Page 188

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

Table 8.4-1 Explanation of Functions of Each Bit in Capture Control Register (TCCR)

  • This bit is set to "1" when the edge specified by EDGS1 and EDGS0 is detected. An interrupt request is output when this bit and the capture interrupt request enable bit (CPIEN) are "1".
CPIFCapture edge detection flag bit
CFCLRCapture edge detection flag clear bit
  • This bit is used to clear the capture edge detection flag.
  • When this bit is "1" at write, the capture edge detection flag is cleared. When "0", the capture edge detection flag is not affected (remains unchanged).
CPIENCapture interrupt request enable bit
  • This bit is used to allow and prohibit interrupt request output to the CPU.
  • An interrupt request is output when this bit and the capture edge detection flag bit (CPIF) are "1".
CCMSKCounter clear mask bit (at capture operation)
  • The counter state when a capture match is detected is set.
  • When this bit is "0", the counter is cleared. When this bit is "1", the counter is not cleared.
TCMSKCompare match counter clear mask bit
  • The counter state when a compare edge is detected is set.
  • When this bit is "0", the counter is cleared. When this bit is "1", the counter is not cleared.
  • These bits are used to allow and prohibit the capture function and select capture edges.
  • When using the 8/16-bit capture timer/counter in the capture mode, set these bits to a value other than "00 B ".
  • When the edge set by these bits is input, the capture edge detection flag bit (CPIF) is set to "1".
EDGS1 and EDGS0Capture mode enable/ edge detection selection bits

bit0 RESV: Reserved bit • Even if this bit is set to "0" or "1", the operation is not affected. The value previously written becomes the read value.

Show 8 more labels / short text on this page
Bit name Function · bit7 · bit6 · bit5 · bit4 · bit3 · bit2, · bit1
Page 189 of the Fujitsu MB89202 user manual — TIF0
Page 189 · click to enlarge
Page 189

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.4.2 Timer 0 Control Register (TCR0)

The timer 0 control register (TCR0) is used to select functions, allow and prohibit operation, control interrupts, and check interrupt states in timer 0 for the 8-bit mode of the 8/16-bit capture timer/counter or in the 16-bit mode. Even if only timer 0 is used in the 8-bit mode, the timer 1 control register (TCR1) must be initialized.

  • Timer 0 Control Register (TCR0)

Figure 8.4-3 Timer 0 Control Register (TCR0)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

001B H 00000000 B

TIF0 TFCR0 T0IEN CINV TCS02 TCS01 TCS00 TSTR0

R R/W

T S TR0

Timer start bit The counter operation is stopped. The counter is cleared and increment starts.

TCS02 TCS01 TCS00

Clock source selection bits (oscillation: 12.5 MHz)

2tINST [0.64 µs] 4tINST [1.28 µs]

16tINST [5.12 µs]

64tINST [20.48 µs]

128tINST [40.96 µs]

256tINST [81.92 µs] 512tINST [163.84 µs]

External clock

tINST : Instruction cycle (Affected by the clock mode and others.)

CINV

Count clock selection bit The counter is incremented at the falling edge of a selected clock source.

The counter is incremented at the rising edge of a selected clock source.

T0IEN

Interrupt request enable bit Interrupt request output is prohibited.

Interrupt request output is allowed.

Compare match detection flag clear bit Not affected (at read, always "0")

TFCR0

The compare match detection flag is cleared.

TIF0

Compare match detection flag bit No compare match has occurred.

A compare match occurred.

R/W : Readable/Writable R : Read only : Initial value

Page 190 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 190 · click to enlarge
Page 190

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

Table 8.4-2 Explanation of Functions of Each Bit in Timer 0 Control Register (TCR0)

  • 8-bit mode When the counter value of timer 0 matches the value (comparator data latch) set in the timer 0 data register (TDR0), this bit is set to "1".
  • 16-bit mode When the counter value of timer 0 matches the value set in TDR0 and the counter value of timer 1 matches the value set in TDR1, this bit is set to "1".
  • An interrupt request is output when this bit and the interrupt request enable bit (T0IEN) are "1".
TIF0Compare match detection flag bit
TFCR0Compare match detection flag clear bit
  • This bit is used to clear the compare match detection flag bit (TIF0). When this bit is set to "1", the compare match detection flag is cleared. The flag is not affected even if this bit is set to "0".
T0IENInterrupt request enable bit
  • This bit is used to allow and prohibit interrupt request output to the CPU.
  • An interrupt request is output when this bit and the interrupt request enable bit (T0IEN) are "1".
  • This bit is used to select whether to increment the counter at the rising or falling edge of a clock. When this bit is "0", the counter is incremented at the falling edge of the clock. When "1", the counter is incremented at the rising edge.
bit4 CINVCount clock selection bit
  • These bits are used to select the count clocks to be supplied to the counter.
  • Select one clock from the seven internal clocks and one external clock.
  • When these bits are 111 B , the external clock is input. In this case, timer 0 can operate as the counter function. Note:
TCS02, TCS01, TCS00Clock source selection bits

When external clock input is selected (TCS02, TCS01, TCS00 = 111B), the P33/EC pin must be set in the input port.

  • This bit is used to start and stop the counter.
  • When this bit is set to "1", the counter is cleared and incremented according to the selected count clock. When this bit is set to "0", the counter stops its operation.
  • When the timer is started (TSTR0 = 0 → 1) in the 16-bit mode, the counters of both timer 0 and timer 1 are cleared.
bit0 TSTR0Timer start bit

When using only timer 0 of the 8/16-bit capture timer/counter in the 8-bit mode, set a value other than 111B in the count clock selection bits (TCS12, TCS11, TCS10) of the timer 1 control register (TCR1).

Using timer 0 with setting value TCS12, TCS11, TCS10 = 111B results in a malfunction.

Show 6 more labels / short text on this page
Bit name Function · bit7 · bit6 · bit5 · bit3 · to bit1
Page 191 of the Fujitsu MB89202 user manual — TIF1
Page 191 · click to enlarge
Page 191

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.4.3 Timer 1 Control Register (TCR1)

The timer 1 control register (TCR1) is used to select functions, allow and prohibit operation, control interrupts, and check interrupt states in timer 1 for the 8-bit mode of the 8/16-bit capture timer/counter. When used in the 16-bit mode, TCR1 is controlled by the timer 0 control register (TCR0), but TCR1 setting is required.

  • Timer 1 Control Register (TCR1)

Figure 8.4-4 Timer 1 Control Register (TCR1)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

001A H

TIF1 TFCR1 T1IEN TCS12 TCS11 TCS10 TSTR1 R R/W

000-0000 B

T S TR1

Timer start bit

The counter operation is stopped. The counter is cleared and increment is started.

TCS12 TCS11 TCS10

Clock source selection bits (oscillation: 12.5 MHz)

0 1

2tINST [0.64 µs]

4tINST [1.28 µs]

16tINST [5.12 µs] 64tINST [20.48 µs]

128tINST [40.96 µs] 256tINST [81.92 µs]

512tINST [163.84 µs]

tINST : Instruction cycle (Affected by the clock mode and others.)

T1IEN

Interrupt request enable bit Interrupt request output is prohibited.

Interrupt request output is allowed.

TFCR1

Compare match detection flag clear bit Not affected (at read, always "0")

The compare match detection flag is cleared.

TIF1

Compare match detection flag bit A compare match has not occurred.

R/WRe a d ab le/Writ ab le

A compare match has occurred.

RRe a d only : Initi a l v a l u e

16-bit mode

Page 192 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 192 · click to enlarge
Page 192

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

Table 8.4-3 Explanation of Functions of Each Bit in Timer 1 Control Register (TCR1)

  • This bit is set to "1" when the counter value of timer 1 matches the value (comparator data latch) set in the timer 1 data register (TDR1).
  • An interrupt request is output when this bit and the interrupt request enable bit (T1IEN) are "1". Note:
TIF1Compare match detection flag bit

In the 16-bit mode, the TIF0 bit of TCR0 is valid. The TIF1 bit is unrelated to operation.

TFCR1Compare match detection flag clear bit
  • This bit is used to clear the compare match detection flag bit (TIF1). When this bit is set to "1", the compare match detection flag is cleared. The flag is not affected even if this bit is set to "0".
T1IENInterrupt request enable bit
  • This bit is used to allow and prohibit interrupt request output to the CPU.
  • An interrupt request is output when this bit and the interrupt request enable bit (T0IEN) are "1".
  • bit4 Not used
  • This bit is undefined at read.
  • At write, this bit does not affect operation.
  • These bits are used to select the count clocks to be supplied to the counter.
  • Of seven internal clocks, select one.
  • When 111 B is written to these bits, timer 1 operates as the 16-bit mode. Note:
TCS12, TCS11, TCS10Clock source selection bits

In the 16-bit mode, the TCS02, TCS01, and TCS00 bits are valid. The TCS12, TCS11, and TCS10 bits are used to select the 16-bit mode only.

  • This bit is used to start and stop the counter.
  • When this bit is set to "1", the counter is cleared and incremented according to the selected count clock. When this bit is set to "0", the counter stops its operation.
  • In the 16-bit mode, only the TSTR0 bit can be used to start the timer. The TSTR1 bit is unrelated to operation.
bit0 TSTR1Timer start bit

When using timer 1 in the 16-bit mode, write 111B to the TCS12, TCS11, and TCS10 bits and then

control timer 1 with TCR0.

Show 6 more labels / short text on this page
Bit name Function · bit7 · bit6 · bit5 · bit3 · to bit1
Page 193 of the Fujitsu MB89202 user manual — PEN
Page 193 · click to enlarge
Page 193

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.4.4 Timer Output Control Register (TCR2)

The timer output control register (TCR2) is used to allow and prohibit the square wave output of the 8/16-bit capture timer/counter and select timer 0 output and timer 1 output.

  • Timer Output Control Register (TCR2)

Figure 8.4-5 Timer Output Control Register (TCR2)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0020 H 00 B

PEN TSEL

R/W R/W

Timer output selection bit Timer 0 output in the 8-bit mode or output in the 16-bit mode is selected.

TSEL

Timer 1 output in the 8-bit mode is selected.

PEN

Port output enable bit

The P34/TO/INT10 pin acts as the general-purpose port (P34).

R/WReadable/Writable

The P34/TO/INT10 pin acts as the square wave output pin of the 8/16-bit capture timer/counter.

: Initial value

Table 8.4-4 Explanation of Functions of Each Bit in Timer Output Control Register (TCR2)

  • Unused bits
  • At read, the values of these bits are undefined.
  • At write, these bits do not affect operation.
  • When this bit is "0", the P34/TO/INT10 pin acts as the generalpurpose port (P34). When "1", it acts as the square wave output pin (TO).
bit1 PENPort output enable bit
  • When this bit is "0", timer 0 output in the 8-bit mode or output in the 16-bit mode is selected. In this case, data is output from the TO pin. When "1", timer 1 output in the 8-bit mode is selected. In this case, data is also output from the TO pin.
bit0 TSELTimer output selection bit
Show 4 more labels / short text on this page
Address Initial value · Bit name Function · bit7 · to bit2
Page 194 of the Fujitsu MB89202 user manual — 001D H XXXXXXXX B
Page 194 · click to enlarge
Page 194

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.4.5 Timer 0 Data Register (TDR0)

The timer 0 data register (TDR0) is used to set the timer 0 value in the 8-bit mode of the 8/16-bit capture timer/counter or the interval timer value (interval timer function) or counter value (counter function) of the lower 8 bits in 16-bit mode.

  • Timer 0 Data Register (TDR0)

The values set in this register are compared with those set in the counter. Figure 8.4-6 shows the bit structure of timer 0 data register (TDR0).

Figure 8.4-6 Timer 0 Data Register (TDR0)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

001D H XXXXXXXX B

R/W R/W R/W R/W R/W R/W R/W R/W

R/WReadable/Writable
XUndefined
  • 8-bit mode (timer 0)

The values set in this register are compared with those set in the counter. When the interval timer function is used, an interval timer value is set. When the counter function is used, the count value to be detected is set. When the count operation is allowed (TCR0: TSTR0 = 0 → 1), the value in TDR0 is set in (loaded to) the comparator data latch and the counter is incremented.

When the values in the comparator data latch match those in the counter as a result of the increment, the values in the TDR0 are reset in the comparator data latch, the counter is cleared, and the count operation is continued.

The comparator data latch is reset when a match is detected, thus, the values written to the TDR0 when the counter is in operation become valid from the next cycle (after match detection).

The values set in TDR0 when the interval timer is in operation can be calculated from the expression shown below. However, the instruction cycle is affected by the clock mode and gear function.

Values set in TDR0 = interval time/(count clock cycle × instruction cycle) - 1

Address Initial value

Page 195 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 195 · click to enlarge
Page 195

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • 16-bit mode

The values in TDR0 are compared with the counter values in the lower 8 bits of the 16-bit timer.

When the interval timer function is used, the lower 8 bits of the interval time are set. When the counter function is used, the lower 8 bits of the count value to be detected are set. The values in TDR0 are loaded to the lower 8 bits of the comparator data latch when matching the counter values of the 16-bit timer or when the count operation is started. The values written to TDR0 when the 16-bit counter is in operation become valid after match detection.

For the values set in TDR1 when the interval timer function is used, see Section "8.4.6 Timer 1 Data Register (TDR1) ".

Page 196 of the Fujitsu MB89202 user manual — 001C H XXXXXXXX B
Page 196 · click to enlarge
Page 196

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.4.6 Timer 1 Data Register (TDR1)

The timer 1 data register (TDR1) is used to set the timer 1 value in the 8-bit mode of the 8/16-bit capture timer/counter or the interval timer value (interval timer function) or counter value (counter function) of the higher 8 bits in the 16-bit mode.

  • Timer 1 Data Register (TDR1)

The values set in this register are compared with those set in the counter.

Figure 8.4-7 shows the bit structure of timer 1 data register (TDR1).

Figure 8.4-7 Timer 1 Data Register (TDR1)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

001C H XXXXXXXX B

R/W R/W R/W R/W R/W R/W R/W R/W

R/WReadable/Writable
XUndefined
  • 8-bit mode (timer 1)

The values set in this register are compared with those set in the counter. When the interval timer function is used, an interval timer value is set. When the counter function is used, the count value to be detected is set. The values in TDR1 are reset in (loaded to) the comparator data latch when they match the values in the counter or when the count operation is started.

The values written to TDR1 when the counter is operating become valid from the next cycle (after match detection).

The values set in TDR1 when the interval timer is operating can be calculated from the expression shown below. However, the instruction cycle is affected by the clock mode and gear function.

Values set in TDR1 = interval time/(count clock cycle × instruction cycle) - 1

Address Initial value

Page 197 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 197 · click to enlarge
Page 197

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • 16-bit mode

The values in TDR1 are compared with the counter values in the higher 8 bits of the 16-bit timer.

When the interval timer function is used, the higher 8 bits of the interval time are set. When the counter function is used, the higher 8 bits of the count value to be detected are set. The values in TDR1 are loaded to the higher 8 bits of the comparator data latch when matching the counter values of the 16-bit timer or when the count operation is started. The values written to TDR1 when the 16-bit counter is operating become valid after match detection. In the 16-bit mode, the count operation is controlled by the timer 0 control register (TCR0).

The values set in TDR0 and TDR1 when the interval function is used can be calculated from the expression shown below. However, the instruction cycle is affected by the clock mode and gear function.

16-bit data value = interval time/(count clock cycle × instruction cycle) - 1

The higher 8 bits of the 16-bit data value are set in TDR1 and the lower 8 bits are set in TDR0.

Page 198 of the Fujitsu MB89202 user manual — TCPH
Page 198 · click to enlarge
Page 198

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.4.7 Capture Data Registers H and L (TCPH and TCPL)

The capture data register H (TCPH) stores the number of events of the higher 8 bits in the 16-bit capture mode of the 8/16-bit capture timer/counter. The capture data register L (TCPL) stores the number of events in the 8-bit capture mode of the 8/16-bit capture timer/counter or the number of events of the lower 8 bits in the 16-bit capture mode. In the read operation in the timer/counter mode, counter values are read.

  • Capture Data Registers H and L (TCPH and TCPL)

The number of events detected in the capture mode is stored in TCPH and TCPL. Data cannot be written to these registers because the registers are read-only.

Figure 8.4-8 shows the bit structures of capture data registers H and L.

Figure 8.4-8 Bit Structures of Capture Data Registers H and L (TCPH and TCPL)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

TCPH

001E H XXXXXXXX B

R R R R R R R R

TCPL

001F H XXXXXXXX B

R R R R R R R R

RRead only X : Undefined

Address Initial value

Page 199 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 199 · click to enlarge
Page 199

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.5 8/16-bit Capture Timer/Counter of Interrupts

The 8/16-bit capture timer/counter generates an interrupt if the values set in a data register match those set in the counter when the interval timer or counter is operating. The interrupt level is IRQ3 when generated by the 8/16-bit capture timer/counter. When the capture is in operation and a capture edge is detected, IRQ4 is generated.

  • 8/16-bit Capture Timer/Counter of Interrupts

Table 8.5-1 shows the interrupt request flag bit, interrupt flag clear bit, interrupt request enable bit, and the cause of the 8/16-bit capture timer/counter interruption.

Table 8.5-1 Interrupt Control Bits and the Cause of the 8/16-bit Capture Timer/Counter Interrupt

8-bit mode 16-bit mode Capture mode

Timer 0 Timer 1 Timer 0 + timer 1 Timer 0 or timer 0 +

Interrupt request flag bit TCR0TIF0 TCR1 : TIF1 TCR0 : TIF0 TCCR : CPIF
Interrupt flag clear bit TCR0TFCR0 TCR1 : TFCR1 TCR0 : TFCR0 TCCR : CFCLR
Interrupt request enable bit TCR0T0IEN TCR1 : T1IEN TCR0 : T0IEN TCCR : CPIEN

The values in TDR0 match those in the 8-bit counter.

The values in TDR1 match those in the 8-bit counter.

The values in TDR0 and TDR1 match those in the 16-bit counter.

A capture edge is detected.

In the 8-bit mode, timer 0 and timer 1 independently generats the interrupt request for 8/16-bit capture timer/counter. In the 16-bit mode, timer 0 generates the interrupt request. All basic operations are the same. Timer 0 interrupt operation in the 8-bit mode is explained here.

  • Timer 0 interrupt operation in the 8-bit mode

The counter value is incremented according to the selected count clock, starting at 00H. When the counter

value matches the value set in the comparator data latch (timer 0 data register (TDR0)) corresponding to the timer 0 data register (TDR0), the compare match detection flag bit (TCR0: TIF0) is set to "1".

In this case, when the interrupt request flag bit is allowed (when TCR0: T0IEN = 1), timer 0 generates an interrupt request (IRQ3) to the CPU. Set the TFCR0 bit to "1" and clear the interrupt request with the interrupt processing routine.

When the counter value matches the value set in the comparator data latch, the TIF0 bit is set to "1" regardless of the TFCR0 bit value.

In the 8-bit mode, timer 0 and timer 1 operate independently, and because they generate the same interrupt request (IRQ3), determination of the interrupt request flag by software may be required.

timer 1 · Interrupt cause

Page 200 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 200 · click to enlarge
Page 200

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • When the counter value matches the TDR0 value and at the same time the counter stops (TCR0: TSTR0 = 0), the TIF0 bit is not set. If the T0IEN bit is set to "1" (enable) when the TIF0 bit is "1", an interrupt request is generated immediately.
  • If the compare register value is 0000 H or 00 H , the 8/16-bit capture timer/counter cannot generate an interrupt. Therefore, when using interrupts, set a value greater than or equal to 0001 H or 01 H . The 8/ 16-bit capture timer/counter also cannot generate an interrupt if the counter function detects the 0000 H or 00 H width.
  • Register and Vector Table Related to 8/16-bit Capture Timer/Counter of Interrupts

Table 8.5-2 Register and Vector Table Related to 8/16-bit Capture Timer/counter of Interrupts

Interrupt level setting register Vector table address

Register Setting bit Higher Lower

Timer/counter function IRQ3 ILR1 (007BH) L31 (bit7) L30 (bit6) FFF4H FFF5H

Capture function IRQ4 ILR2 (007CH) L41 (bit1) L40 (bit0) FFF2H FFF3H

For interrupt operation, see Section "3.4.2 Steps in the Interrupt Operation ".

Interrupt · name

Page 201 of the Fujitsu MB89202 user manual — TCR2 PEN TSEL
Page 201 · click to enlarge
Page 201

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.6 Explanation of Operations of Interval Timer Functions

This section describes the interval timer function operation of the 8/16-bit capture timer/ counter.

  • Interval Timer Function Operation
  • 8-bit mode

To operate timer 0 as the interval timer function in the 8-bit mode, the function must be set as shown in Figure 8.6-1 .

Figure 8.6-1 Setting of Interval Timer Function (Timer 0)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

TCCR CPIF CFCLR CPIEN CCMSK TCMSK EDGS1 EDGS0 RESV

TCR1 TIF1 TFCR1 T1IEN TCS12 TCS11 TCS10 TSTR1

Setting of a value other than 111

TCR0 TIF0 TFCR0 T0IEN CINV TCS02 TCS01 TCS00 TSTR0

Setting of a value other than 111

TCR2 PEN TSEL

TDR0

Setting of interval time

: Used bit : Unused bit

To operate timer 1 as the interval timer function in the 8-bit mode, the function must be set as shown in Figure 8.6-2 .

Setting of 00

Page 202 of the Fujitsu MB89202 user manual — TCR2 PEN TSEL
Page 202 · click to enlarge
Page 202

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

Figure 8.6-2 Setting of Interval Timer Function (Timer 1)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

TCCR CPIF CFCLR CPIEN CCMSK TCMSK EDGS1 EDGS0 RESV

TCR1 TIF1 TFCR1 T1IEN TCS12 TCS11 TCS10 TSTR1

Setting of a value other than 111

TCR0 TIF0 TFCR0 T0IEN CINV TCS02 TCS01 TCS00 TSTR0

Setting of a value other than 111

TCR2 PEN TSEL

TDR1

Setting of interval time

: Used bit : Unused bit

When the counter is activated in the 8-bit mode, increment begins at the rising or falling edge of the selected clock, starting at 00H. When the counter value matches the value set in the data register

(comparator data latch), the interrupt request bit (TCR0: TIF0 or TCR1: TIF1) of the timer 0 control register is set to "1" and the count operation is started at 00H. If the counter value matches the value set in

the data register when timer 0 is being used, the output of the square wave output control circuit toggles. When square wave output is allowed (TCR2: PEN) and timer 0 is set to output selection (TCR2: TSEL = 0), a square wave is output from the timer output pin (TO). If the counter value matches the value set in the data register when timer 1 is being used, the output of the square wave output control circuit toggles. When square wave output is allowed (TCR2: PEN) and timer 1 is set to output selection (TCR2: TSEL = 1), a square wave is output from the timer output pin (TO).

Figure 8.6-3 shows interval timer function operation in the 8-bit mode.

Setting of 00

Page 203 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 203 · click to enlarge
Page 203

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

Figure 8.6-3 Interval Timer Function Operation in 8-bit Mode (Timer 0)

Fujitsu MB89202 — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER diagram (page 203)
Fig. 25

*1: If the data register is rewritten when the counter is in operation, the interval timer function becomes valid from the next cycle.

When timer 0 is started or when a match is detected, the counter is cleared and the values in the data register are loaded to the comparator data latch.

Page 204 of the Fujitsu MB89202 user manual — TDR0
Page 204 · click to enlarge
Page 204

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • 16-bit mode

To operate timer 0 as the interval timer function in the 16-bit mode, the function must be set as shown in Figure 8.6-4 .

Figure 8.6-4 Setting of Interval Timer Function in 16-bit Mode

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 TCCR CPIF CFCLR CPIEN CCMSK TCMSK EDGS1 EDGS0 RESV

TCR1 TIF1 TFCR1 T1IEN TCS12 TCS11 TCS10 TSTR1

TCR0 TIF0 TFCR0 T0IEN CINV TCS02 TCS01 TCS00 TSTR0

Setting of a value other than 111

TCR2 PEN TSEL

Setting of higher 8 bits of interval time

TDR1

Setting of lower 8 bits of interval time

TDR0

: Used bit : Unused bit : Set "0"

0. Set "1" 1

In the 16-bit mode, timers are controlled by the timer 0 control register (TCR0), but the timer 1 control register (TCR1) must be initialized. The values to be set in the data register are the higher 8 bits of TDR1 and the lower 8 bits of TDR0 (16 bits in total). The values are compared with the 16-bit counter value. The 16 bits of the counter are cleared at the same time. Other operations in the 16-bit mode are the same as timer 0 operation in the 8-bit mode.

Setting of 00

Page 205 of the Fujitsu MB89202 user manual — TDR0
Page 205 · click to enlarge
Page 205

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.7 Operation of Counter Functions

This section describes the operation of the 8/16-bit capture timer/counter function.

  • Counter Function Operation
  • 8-bit mode

To operate timer 0 as the counter function in the 8-bit mode, the function must be set as shown in Figure 8.7-1 .

Figure 8.7-1 Setting of Counter Function in 8-bit Mode

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 DDR3

TCCR CPIF CFCLR CPIEN CCMSK TCMSK EDGS1 EDGS0 RESV

TCR1 TIF1 TFCR1 T1IEN TCS12 TCS11 TCS10 TSTR1

Setting of a value other than 111

TCR0 TIF0 TFCR0 T0IEN CINV TCS02 TCS01 TCS00 TSTR0

TCR2 PEN TSEL

TCDL

Number of detected events

TDR0

Setting of the counter value to be compared

: Used bit : Unused bit 0 : Set "0" 1 : Set "1"

Counter function operation in the 8-bit mode is the same as interval timer function (timer 0 in 8-bit mode) operation except that the external clock is used instead of the internal clock.

The number of events can be known by reading the capture data register (TCPL). A specific number of events can be known by the event count detection function.

Setting of 00

Page 206 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 206 · click to enlarge
Page 206

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • Detection of the number of events

In the external clock mode, counter clear can be prohibited by the compare match counter clear mask bit (TCMSK) of the capture control register (TCCR) when a match is detected. Setting the compare match counter clear mask bit to "1" enables the event count detection function to be used. In this case, a compare match does not cause data to be re-loaded to the compare latch. To update the compare latch value, stop and restart the timer.

Figure 8.7-2 shows counter function operation in the external clock mode in which TCMSK is used.

Figure 8.7-2 Counter Function Operation in External Clock Mode

Fujitsu MB89202 — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER diagram (page 206)
Fig. 26

Counter value Un- defined

00H 01H 02H 03H 7EH 7FH 00H 01H 00

00H 01H 02H 03H 7EH 7FH 80H 81H 00

Page 207 of the Fujitsu MB89202 user manual — TCPL
Page 207 · click to enlarge
Page 207

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • 16-bit mode

To operate timer 0 as the counter function in the 16 bit mode, the function must be set as shown in Figure 8.7-3 .

Figure 8.7-3 Setting of Counter Function in 16-bit Mode

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

DDR3

TCCR CPIF CFCLR CPIEN CCMSK TCMSK EDGS1 EDGS0 RESV

TCR1 TIF1 TFCR1 T1IEN TCS12 TCS11 TCS10 TSTR1

TCR0 TIF0 TFCR0 T0IEN CINV TCS02 TCS01 TCS00 TSTR0

TCR2 PEN TSEL

TDR1

Setting of the higher 8 bits of the counter value to be compared

TDR0

Setting of the lower 8 bits of the counter value to be compared

TCPH

Higher 8 bits of the number of detected events

TCPL

Lower 8 bits of the number of detected events

: Used bit : Unused bit 0 : Set "0" 1 : Set "1"

Counter function operation in the 16-bit mode is the same as interval timer function operation in the 16-bit mode, except that the external clock is used instead of the internal clock.

Figure 8.7-4 shows counter function operation in 16-bit mode.

Setting of 00

Page 208 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 208 · click to enlarge
Page 208

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

Figure 8.7-4 Counter Function Operation in 16-bit Mode

Fujitsu MB89202 — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER diagram (page 208)
Fig. 27

0000H 0001H 0002H 0003H 1388H 0000H 0001H

Comparator data latch 1 (lower 8-bit comparison value) Comparator data latch 2 (higher 8-bit comparison value)

*: A value can be set according to any timing. When the counter is started or when a match is detected, the data register setting value is loaded to the comparator data latch. In this case, the counter is cleared.

Confirm the validity of the values set in the counter operating in 16-bit mode.

Page 209 of the Fujitsu MB89202 user manual — TCR2 PEN TSEL
Page 209 · click to enlarge
Page 209

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.8 Functions of Operations of Capture Functions

This section describes the capture function operation of the 8/16-bit capture timer/ counter.

  • Capture Function Operation
  • 8-bit mode

To operate the capture function in the 8-bit mode, the function must be set as shown in Figure 8.8-1 .

Figure 8.8-1 Setting of Capture Function in 8-bit Mode

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

DDR3

TCCR CPIF CFCLR CPIEN CCMSK TCMSK EDGS1 EDGS0 RESV

Setting of a value other than 00

TCR1 TIF1 TFCR1 T1IEN TCS12 TCS11 TCS10 TSTR1

Setting of a value other than 111

TCR0 TIF0 TFCR0 T0IEN CINV TCS02 TCS01 TCS00 TSTR0

Setting of a value other than 111

TCR2 PEN TSEL

TCPL

Number of detected events

: Used bit : Unused bit 0 : Set "0"

The 8-bit capture mode is allowed by the capture mode enable/edge detection selection bits (EDGS1 and EDGS0) of the capture control register (TCCR). "1" is written to the timer start bit (TSTR0) after the clock source selection bits (TCS02, TCS01, and TCS00) of the timer 0 control register (TCR0) have been set.

In the capture mode, the count value is captured to the capture data register (TCPL) each time a capture input edge is detected and the capture edge detection flag (CPIF) is set to "1". In this case, if the capture interrupt enable bit (CPIEN) is already set to "1", an interrupt request is output to the CPU.

The capture mode is divided into free-run mode and clear mode.

Page 210 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 210 · click to enlarge
Page 210

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • Free-run mode

Setting the clear mask bits (CCMSK and TCMSK) of TCCR to 11B enables the capture function to operate

as the free-run timer.

  • Clear mode

Setting the clear mask bits (CCMSK and TCMSK) of TCCR to a value other than 11B enables the capture

function to operate as a clear mode.

The clear mode enables the measurement of signal pulse widths and cycles. In this case, using the clear mode with the compare match detection function also enables the determination of signal availability.

The capture input pin also serves as the external clock input pin. The external clock mode cannot be used in the capture mode.

Table 8.8-1 shows the relationship between the counter mode and the compare latch operation according to the clear mask bit value.

Table 8.8-1 Relationship between Counter Mode and Compare Latch Operation

Data load to compare latch and counter clear

CCMSK TCMSK Counter mode

At capture edge detection At compare match

Data load Counter clear Data load Counter clear

Provided

0 1 Provided Provided Not provided Not provided

1 0 Not provided Not provided Provided Provided

1 1 Free-run mode Not provided Not provided Not provided Not provided

(provided/not provided) · Clear mode

Page 211 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 211 · click to enlarge
Page 211

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

Figure 8.8-2 Capture Mode Operation

Fujitsu MB89202 — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER diagram (page 211)
Fig. 28

Capture input (EC)

Page 212 of the Fujitsu MB89202 user manual — TCPL
Page 212 · click to enlarge
Page 212

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • 16-bit mode

To operate the capture function in the 16-bit mode, the function must be set as shown in Figure 8.8-3 .

Figure 8.8-3 Setting of Capture Function in 16-bit Mode

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 DDR3

TCCR CPIF CFCLR CPIEN CCMSK TCMSK EDGS1 EDGS0 RESV

Setting of a value other than 00

TCR1 TIF1 TFCR1 T1IEN TCS12 TCS11 TCS10 TSTR1

TCR0 TIF0 TFCR0 T0IEN CINV TCS02 TCS01 TCS00 TSTR0

Setting of a value other than 111

TCR2 PEN TSEL

TCPH

Higher 8 bits of the number of detected events

Lower 8 bits of the number of detected events

TCPL

: Used bit : Unused bit 0 : Set "0"

To set the 16-bit capture mode, set the TCS12, TCS11, and TCS10 bits of the timer 1 control register (TCR1) to 111B.

In the 16-bit mode, timers are controlled by the timer 0 control register (TCR0). The higher 8 bits of the number of detected events are stored in the capture data register H (TCPH), and the lower 8 bits are stored in the capture data register L (TCPL).

For operation in the 16-bit mode, see operation in the 8-bit mode.

Setting of 111

Page 213 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 213 · click to enlarge
Page 213

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.9 8/16-bit Capture Timer/Counter Operation in Each Mode

This section describes the operation of the 8/16-bit capture timer/counter when it switches to the sleep or stop mode or when a halfway stop request is issued during the operation of the interval timer or counter function.

  • Operation in Standby Mode and at Halfway Stop

Figure 8.9-1 shows the counter value states if the 8/16-bit capture timer/counter switches to the sleep or stop mode or when a halfway stop request is issued when the interval timer or counter function is in operation (at timer 0 operation).

When the counter switches to the stop mode, it retains the value and stops. If the stop mode is released by an external interrupt, the counter starts its operation at the retained value, and so the first interval time and external clock count are incorrect. When the stop mode is released, the 8/16-bit capture timer/counter must be initialized.

When the counter is temporarily stopped (TSTR0 = 0), it retains its value and stops. If the subsequent operation is continued (TSTR0 = 1), the count value is cleared and the counter is restarted.

Figure 8.9-1 Counter Operation in Standby Mode and at Halfway Stop

Fujitsu MB89202 — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER diagram (page 213)
Fig. 29

Value set in data register

Start Match

SLP bit (STBC register) Sleep release by IRQ3 Stop

STP bit (STBC register)

*: When the pin state specification bit (SPL) of the standby control register (STBC) is "1" and the TO pin is not pulled up, the TO pin in the stop mode becomes Hi-Z. When the pin state specification bit (SPL) is "0", the value immediately before the 8/16-bit capture timer/counter switches to the stop mode is retained.

Page 214 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 214 · click to enlarge
Page 214

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.10 Notes on Using 8/16-bit Capture Timer/Counter

Fujitsu MB89202 — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER diagram (page 214)
Fig. 30

This section provides notes on using the 8/16-bit capture timer/counter.

  • Notes on Using the 8/16-bit Capture Timer/Counter
  • Error

The start of the 8/16-bit capture timer/counter by a program is asynchronous with the start of the counter incremented by the selected count clock, and therefore, the error (a time difference) continues until the counter value matches the set data. Such a time difference may shorten the total count duration by a maximum of one count clock cycle. Figure 8.10-1 shows the error (a time difference) that prolongs the actual start of count operation.

Figure 8.10-1 Error Occurring until the Count Operation is Started

Fujitsu MB89202 — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER diagram (page 214)
Fig. 31
  • Using only timer 0 in 8-bit mode

When using only timer 0 of the 8/16-bit capture timer/counter in the 8-bit mode, set a value other than 111B in the count clock selection bits (TCS12, TCS11, TCS10) of the timer 1 control register (TCR1). Using timer 0 without setting 111B results in a malfunction.

  • Note on setting by program

When using the 8/16-bit capture timer/counter in the 16-bit mode, set the count clock selection bits (TCS12, TCS11, TCS10) of TCR1 to 111B.

Before using the counter values when the counter is in operation with 16-bit mode, be sure to read the counter values twice and confirm that the values are valid.

Even if square wave output is initialized when the timer is in operation (TCR0: TSTR0 = 1), the output value is not modified. The output state is initialized when the timer operation stops.

When the interrupt request flag bits (TCCR: CPIF, TCR0: TIF0, TCR1: TIF1) are "1" and the interrupt request enable bits are allowed (TCCR: CPIEN, TCR0: T0IEN, and TCR1: T1IEN = 1), return from an interrupt is impossible. In this case, clear the interrupt request flag bits (TCCR: CFCLR = 1, TCR0: TFCR0 = 1, and TCR1: TFCR1 = 1).

Page 215 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 215 · click to enlarge
Page 215

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

When the counter operation stops according to the timer start bits (TCR0: TSTR0 = 0 and TCR1: TSTR1 = 0) and the interrupt source occurs at the same time, the interrupt request flag bits (TCR0: TIF0 and TCR1: TIF1) are not set.

In the capture mode, no external clock can be selected; set the count clock bits (TCS12,TCS11, and TCR1: TCS10) to a value other than 111B.

  • Note on using interrupts

If the compare register value is 0000H or 00H, the 8/16-bit capture timer/counter cannot generate interrupts.

For this reason, when using interrupts, set a value greater than or equal to 0001H or 01H. The 8/16-bit

capture timer/counter cannot generate interrupts if the capture counter function detects the 0000H or 00H width.

Page 216 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 216 · click to enlarge
Page 216

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

8.11 Program Example for 8/16-bit Capture Timer/Counter

This section provides program examples of the 8/16-bit capture timer/counter.

  • Program Example of Interval Timer Function
  • Processing specifications
  • In the 8-bit mode, only timer 0 is used to generate a 20 ms interval timer interrupt.
  • When the interval time has elapsed, the square wave to be inverted is output to the TO pin.
  • At 12.5-MHz oscillation (F CH ), the TDR0 value whose interval time becomes 20 ms at the maximum

gear speed (1 instruction cycle = 4/FCH) is shown below. The count clock is 256tINST of the internal

count clock.

TDR0 value = 20 ms/(256 × 4/12.5 MHz) - 1 = 244 (F4H)

  • Coding example

TCCR EQU 0019H ; Address of capture control register TCR1 EQU 001AH ; Address of timer 1 control register TCR0 EQU 001BH ; Address of timer 0 control register TCR2 EQU 0020H ; Address of timer output control register TDR1 EQU 001CH ; Address of timer 1 data register TDR0 EQU 001DH ; Address of timer 0 data register

TIF0 EQU TCR0:7 ; Defines the timer 0 interrupt request flag bit. ILR1 EQU 007BH ; Address of interrupt request setting register INT_V DSEG ABS ; [DATA SEGMENT] ORG 0FFF0H IRQD DW WARI ; Sets an interrupt vector. ENDS ; Main program

CSEG ; [CODE SEGMENT] ; The stack pointer (SP), etc., is already initialized. : CLRI ; Disables the interrupt. MOV ILR1,#10111111B ; Sets the interrupt level to 2. MOV TCR0,#01001010B ; Clears the timer 0 interrupt request flag, increments the

counter at a rising edge, selects 256tINST, and stops the

operation. MOV TCR1,#01000010B ; Clears the timer 1 interrupt request flag, prohibits

interrupt request output, sets a mode other than the 16- bit mode, and stops the operation. MOV TDR0,#F4H ; Sets the value (interval time) to be compared with the

counter value.

Page 217 of the Fujitsu MB89202 user manual — END
Page 217 · click to enlarge
Page 217

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

MOV TCR2,#00000010B ; Outputs a square wave (TO) from the P34 pin. MOV TCR0,#10101011B ; Allows timer 0 interrupt request output, clears the

counter, and starts the timer. SETI ; Enables the CPU interrupt. : ; Interrupt program WARI CLRB TIF0 ; Clears the interrupt request flag. PUSHW A XCHW A,T PUSHW A : User processing POPW A XCHW A,T POPW A RETI ENDS ;

END

Page 218 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 218 · click to enlarge
Page 218

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

  • Program Example of Counter Function
  • Processing specifications
  • In the 16-bit mode, timer 0 and timer 1 are used to generate an interrupt whenever the external clock to be input to the EC pin is counted 5,000 times (1388 H ).
  • The sample program for reading the 16-bit counter value when the counter is in operation is shown below (READ16).
  • Coding example

DDR3 EQU 000DH ; Address of port 3-direction register TCCR EQU 0019H ; Address of capture control register TCR1 EQU 001AH ; Address of timer 1 control register TCR0 EQU 001BH ; Address of timer 0 control register TDR1 EQU 001CH ; Address of timer 1 data register TDR0 EQU 001DH ; Address of timer 0 data register TIF0 EQU TCR0:7 ; Defines the timer 0 interrupt request flag bit. ILR1 EQU 007CH ; Address of interrupt level setting register 2 INT_V DSEG ABS ; [DATA SEGMENT] ORG 0FFF0H IRQD DW WARI ; Sets the interrupt vector. ENDS ; Main program

CSEG ; [CODE SEGMENT] ; The stack pointer (SP), etc., is already initialized. : MOV DDR3,#00000000B ; Sets the EC pin to input. CLRI ; Disables the interrupt. MOV ILR1,#10111111B ; Sets the interrupt level to 2. MOV TDR0,#088H ; Sets the counter value and the lower 8 bits of the

compare value. MOV TDR1,#013H ; Sets the counter value and the higher 8 bits of the

compare value. MOV TCR1,#00001110B ; Sets timer 1 to 16-bit mode. MOV TCR0,#01101111B ; Clears the timer 0 interrupt request flag, allows interrupt

request output, selects an external clock, clears the counter, starts the operation, and increments the counter at a rising edge. SETI ; Enables a CPU interrupt. ; Data read subroutine READ16

MOVW A,TDR1 ; Reads 16 bits from TDR1 and TDR0. MOVW A,TDR1 ; Reads 16 bits from TDR1 and TDR0 and stores the old

value in the T register. CMPW A ; Executes double read check and compares A with T. BEQ RET16 ; Match and return

Page 219 of the Fujitsu MB89202 user manual — END
Page 219 · click to enlarge
Page 219

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

XCHW A,T INCW A ; Old value + 1 CMPW A BNE READ16 ; Jumps to re-read when a mismatch is detected. RET16 RET ; Restarts the count operation and begins counting 10,000

pulses. ; Interrupt program WARI CLRB TIF0 ; Clears the interrupt request flag. PUSHW A XCHW A,T PUSHW A : User processing : POPW A XCHW A,T POPW A RETI ENDS ;

END

Page 220 of the Fujitsu MB89202 user manual — CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER
Page 220 · click to enlarge
Page 220

CHAPTER 8 8/16-BIT CAPTURE TIMER/COUNTER

Page 221 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 221 · click to enlarge
Page 221

CHAPTER 9 12-BIT PPG TIMER

This chapter describes the functions and operation of a 12-bit PPG timer.

9.1 Overview of 12-bit PPG Timer

9.2 Configuration of 12-bit PPG Timer Circuit

9.3 Pin of 12-bit PPG Timer

9.4 Registers of 12-bit PPG Timer

9.5 Operations of 12-bit PPG Timer Functions

9.6 Notes on Using 12-bit PPG Timer

9.7 Program Example for 12-bit PPG Timer

Page 222 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 222 · click to enlarge
Page 222

CHAPTER 9 12-BIT PPG TIMER

9.1 Overview of 12-bit PPG Timer

The 12-bit PPG timer is a 12-bit binary counter, enabling the selection of one of four types of internal count clocks. The timer is capable of setting a cycle period and "H" width of output pulse waveforms and can also be used as a remote control transmission frequency generator or 12-bit PPG.

  • Functions of 12-bit PPG Timer
  • The timer generates a frequency for remote control and outputs signals to a PPG pin.
  • The timer is capable of setting a cycle period and "H" width of output pulse waveforms separately.
  • The timer enables the selection of a count clock from four types of internal clocks.
  • The timer can generate a frequency in a range from twice to 2 12 -1 times as fast as the counter clock.

Table 9.1-1 lists the ranges in which the output pulse cycle period and "H" width are variable.

Table 9.1-1 Ranges in which the Output Pulse Cycle Period and "H" Width are Variable

cycle period Output pulse cycle period Output pulse "H" width

2tINST 4tINST to 8190tINST 2tINST to 8188tINST

4tINST 8tINST to 16380tINST 4tINST to 16376tINST

16tINST 32tINST to 65520tINST 16tINST to 65504tINST

256tINST 512tINST to 1048.32ktINST 256tINST to 1048.064ktINST

t INSTInstruction cycle (to be affected by a gear function)

An example of calculating the output pulse cycle period and "H" width as executed by a 12-bit PPG function is given below.

When an oscillation (FCH) of 12.5 MHz and a count clock cycle period of 2 tINST are set, and if:

Compare value for cycle period = 011110B (30-clock period)

Compare value for "H" width = 001010B (10-clock width)

Then, "H" width and the cycle period of output pulse waveforms are calculated as given below. These calculations are obtained provided the system clock control register (SYCC) selects the fastest clock (CS1, CS0 = 11B with one instruction cycle = 4/FCH).

Internal count clock

Page 223 of the Fujitsu MB89202 user manual — PPG (1/2)
Page 223 · click to enlarge
Page 223

CHAPTER 9 12-BIT PPG TIMER

Cycle period = Compare value for cycle period × Count clock cycle period

= 011110H (30-clock period) × 2 × 4/FCH

= 30 × 2 × 0.32 µs = 19.2 µs

"H" width = Compare value for "H" width × Count clock cycle period

= 001010B (10-clock width) × 2 × 4/FCH

=10 × 2 × 0.32 µs

=6.4 µs

If the set "H" width is equal to or greater than the set cycle period, "H" level outputs occur.

  • 12-bit PPG Function

The timer’s programmable pulse output generator function can be used as a 12-bit PPG because it can set a cycle period and "H" pulse width of output pulse waveforms separately. A range of controllable duty cycles is 0.02% to 100%. However, the smaller the compare value for the cycle period, the lower the resolution (the greater a minimum-step duty cycle).

If the compare value for the cycle period is "2", a comparative setting of "H" pulse width is 1 or 2 (a duty cycle of 50% or 100%) and the resolution is 1/2.

An output frequency and a duty cycle can be calculated using the following equations:

Output pulse cycle period = Compare value for cycle period × Count clock cycle period

Duty cycle = Compare value for "H" width/Compare value × 100(%)

Table 9.1-2 lists available resolution values, minimum-step duty cycles, and output pulse cycle periods.

Table 9.1-2 Resolutions and Output Pulse Cycle Periods Supported when the Timer is Used as a 12-bit

PPG (1/2)

Output pulse cycle period

available compare values for

Count clock = 256 tINST

= 2 tINST

= 4 tINST

= 16 tINST

2 1, 2 4 tINST 8 tINST 32 tINST 512 tINST 1/2 50.0%

3 1 to 3 6 tINST 12 tINST 48 tINST 768 tINST 1/3 33.3%

4 1 to 4 8 tINST 16 tINST 64 tINST 1024 tINST 1/4 25.0%

5 1 to 5 10 tINST 20 tINST 80 tINST 1280 tINST 1/5 20.0%

6 1 to 6 12 tINST 24 tINST 96 tINST 1536 tINST 1/6 16.7%

7 1 to 7 14 tINST 28 tINST 112 tINST 1792 tINST 1/7 14.3%

8 1 to 8 16 tINST 32 tINST 128 tINST 2048 tINST 1/8 12.5%

Show 12 more labels / short text on this page
Range of · Compare · Minimum- · value for · Resolution · step duty · cycle period · cycle Count clock · Count clock · Count clock · "H" width · Unavailable 1 -
Page 224 of the Fujitsu MB89202 user manual — PPG (2/2)
Page 224 · click to enlarge
Page 224

CHAPTER 9 12-BIT PPG TIMER

Table 9.1-2 Resolutions and Output Pulse Cycle Periods Supported when the Timer is Used as a 12-bit

PPG (2/2)

Output pulse cycle period

available compare values for

Count clock = 256 tINST

= 2 tINST

= 4 tINST

= 16 tINST

9 1 to 9 18 tINST 36 tINST 144 tINST 2304 tINST 1/9 11.1%

10 1 to 10 20 tINST 40 tINST 160 tINST 2560 tINST 1/10 10.0%

:

20 1 to 20 40 tINST 80 tINST 320 tINST 5120 tINST 1/20 5.0%

:

100 1 to 100 200 tINST 400 tINST 1600 tINST 25600 tINST 1/100 1.0%

:

500 1 to 500 1000 tINST 2000 tINST 8000 tINST 128000 tINST 1/500 0.2%

:

1000 1 to 1000 2000 tINST 4000 tINST 16000 tINST 256000 tINST 1/1000 0.1%

:

2000 1 to 2000 4000 tINST 8000 tINST 32000 tINST 512000 tINST 1/2000 0.05%

:

3000 1 to 3000 6000 tINST 12000 tINST 48000 tINST 768000 tINST 1/3000 0.03%

:

4095 1 to 4095 8190 tINST 16380 tINST 65520 tINST 1048320 tINST 1/4095 0.02%

t INSTInstruction cycle
Show 11 more labels / short text on this page
Range of · Compare · Minimum- · value for · Resolution · step duty · cycle period · cycle Count clock · Count clock · Count clock · "H" width
Page 225 of the Fujitsu MB89202 user manual — SCL11 SCL10 SCL9 SCL8 SCL7 SCL6
Page 225 · click to enlarge
Page 225

CHAPTER 9 12-BIT PPG TIMER

9.2 Configuration of 12-bit PPG Timer Circuit

  • The 12-bit PPG timer comprises the following seven blocks:
  • Count clock selector
  • 12-bit counter
  • Comparator
  • 12-bit PPG control register 1 (RCR21)
  • 12-bit PPG control register 2 (RCR22)
  • 12-bit PPG control register 3 (RCR23)
  • 12-bit PPG control register 4 (RCR24)
  • Block Diagram of 12-bit PPG Timer

Figure 9.2-1 Block Diagram of 12-bit PPG Timer

RCK1 RCK0 HSC5 HSC4 HSC3 HSC2 HSC1 HSC0

RCR21

HSC11 HSC10 HSC9 HSC8 HSC7 HSC6

RCR22

Compare value for "H" width

CLK 2 4 16 256

Compare value for cycle period

SCL11 SCL10 SCL9 SCL8 SCL7 SCL6

RCR24

RCEN SCL5 SCL4 SCL3 SCL2 SCL1 SCL0

RCR23

: Instruction cycle

Show 9 more labels / short text on this page
Internal data bus · Count clock selector · 12-bit counter · P37/BZ/PPG pin · Comparator · Clear · 1t INST · Internal data bus · tINST
Page 226 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 226 · click to enlarge
Page 226

CHAPTER 9 12-BIT PPG TIMER

  • Count clock selector

This selector circuit selects one of four types of internal count clocks as the count-up clock for a 12-bit counter.

  • 12-bit counter

The 12-bit counter executes a count-up operation based on the count clock selected by the count clock selector.

This counter may be cleared according to the value of the output enable bit of the RCR23 register (RCR23:RCEN=0).

  • Comparator

The comparator maintains outputs at "H" until a count by the 12-bit counter has been synchronized with the value of the register containing the compare value for "H" width. The comparator then maintains outputs at "L" until a count by the counter is synchronized with the value of the register containing the set cycle period. At this time, the 12-bit counter is cleared and restarts to count from "00H".

  • 12-bit PPG control registers 1 (RCR21) and 2 (RCR22)

These registers comprise bits for count clock selection and bits for setting a compare value for the "H" width.

  • 12-bit PPG control registers 3 (RCR23) and 4 (RCR24)

These registers comprise a bit for specifying whether to enable or disable the 12-bit PPG output and bits for setting a compare value for the cycle period.

Page 227 of the Fujitsu MB89202 user manual — PPG:
Page 227 · click to enlarge
Page 227

CHAPTER 9 12-BIT PPG TIMER

9.3 Pin of 12-bit PPG Timer

This section describes the pin associated with the 12-bit PPG timer and illustrates a block diagram of circuitry terminating at the pin.

  • Pin Associated with the 12-bit PPG Timer

The pin associated with the 12-bit PPG timer is P37/BZ/PPG pin.

  • P37/BZ/PPG pin

This pin functions as a CMOS type (P37) general-purpose I/O port, further functioning as 12-bit PPG timer output (PPG).

PPG:

By setting the output enable bit of the appropriate 12-bit PPG control register (RCR23:RCEN) to "1", the pin functions as the PPG output pin through which the set cycle period and "H" width of PPG pulse waveforms are output.

Page 228 of the Fujitsu MB89202 user manual — Timer
Page 228 · click to enlarge
Page 228

CHAPTER 9 12-BIT PPG TIMER

  • Block Diagram of Circuitry Terminating at the Pin Associated with the 12-bit PPG

Timer

Figure 9.3-1 Block Diagram of Circuitry Terminating at the P37/BZ/PPG Pin

Fujitsu MB89202 — Timer diagram (page 228)
Fig. 32 · Timer
  • If the ON setting of the pull-up resistor is selected by the pull-up setting register, the pin state will be

the "H" level (pull-up state) in stop mode (SPL = 1).

  • Because buzzer outputs to the P37/BZ/PPG pin precede 12-bit PPG outputs to this pin, if the pin is

used as the PPG pin, turn the buzzer outputs off and set the RCEN bit such that PPG outputs are enabled.

Page 229 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 229 · click to enlarge
Page 229

CHAPTER 9 12-BIT PPG TIMER

9.4 Registers of 12-bit PPG Timer

This section describes the registers associated with the 12-bit PPG timer.

  • Registers Associated with 12-bit PPG Timer

Figure 9.4-1 Registers Associated with 12-bit PPG Timer

RCR21 (12-bit PPG control register 1)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0014H RCK1 RCK0 HSC5 HSC4 HSC3 HSC2 HSC1 HSC0 00000000B R/W

RCR22 (12-bit PPG control register 2)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0015H HSC11 HSC10 HSC9 HSC8 HSC7 HSC6 --000000B R/W

RCR23 (12-bit PPG control register 3)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0016H RCEN SCL5 SCL4 SCL3 SCL2 SCL1 SCL0 0-000000B R/W

RCR24 (12-bit PPG control register 4)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0017H SCL11 SCL10 SCL9 SCL8 SCL7 SCL6 --000000B R/W

R/WReadable and Writable : Unused
Show 7 more labels / short text on this page
Address Initial value · Initial value · Address · Address · Initial value · Address · Initial value
Page 230 of the Fujitsu MB89202 user manual — RCK1 RCK0
Page 230 · click to enlarge
Page 230

CHAPTER 9 12-BIT PPG TIMER

9.4.1 12-bit PPG Control Register 1 (RCR21)

The 12-bit PPG control register 1 comprises bits for count clock selection of the 12-bit PPG timer and bits for setting the "H" width.

  • 12-bit PPG Control Register 1 (RCR21)

Figure 9.4-2 12-bit PPG Control Register 1 (RCR21)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0014H RCK1 RCK0 HSC5 HSC4 HSC3 HSC2 HSC1 HSC0 00000000B R/W

HSC5 to HSC0

"H" width setting bits Compare value for the "H" width of 12-bit PPG outputs.

RCK1 RCK0

Count clock selection bits

0 0 2 tINST 0 1 4 tINST

1 0 16 tINST

1 1 256 tINST

R/WRe a d ab le/Writ ab le

: Initial value

Table 9.4-1 Explanation of Functions of Each Bit in 12-bit PPG Control Register 1 (RCR21)

RCK1, RCK0Count clock selection bits

These bits are used to select a count clock of the 12-bit PPG timer from four types of internal count clocks.

These bits are used to set the number of counts corresponding to the "H" width of 12-bit PPG timer outputs (the compare value for the "H" width), and the contents of these bits and the HSC6 to HSC11 bits of the RCR22 register are compared with a count by the counter.

HSC5 to HSC0"H" width setting bits
Show 5 more labels / short text on this page
Bit name Function · bit7, · bit6 · bit5 · to bit0
Page 231 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 231 · click to enlarge
Page 231

CHAPTER 9 12-BIT PPG TIMER

9.4.2 12-bit PPG Control Register 2 (RCR22)

The 12-bit PPG control register 2 comprises bits for setting the "H" width of 12-bit PPG pulse waveforms.

  • 12-bit PPG Control Register 2 (RCR22)

Figure 9.4-3 12-bit PPG Control Register 2 (RCR22)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0015H HSC11 HSC10 HSC9 HSC8 HSC7 HSC6 --000000B R/W

"H" width setting bits

Compare value for the "H" width of 12-bit PPG outputs

R/WReadable/Writable

: Unused

Table 9.4-2 Explanation of Functions of Each Bit in 12-bit PPG Control Register 2 (RCR22)

  • bit6 Unused bits
  • Bit value is undefined when being read.
  • Written value does not affect other operations.

These bits are used to set the number of counts corresponding to the "H" width of 12-bit PPG timer outputs (the compare value for the "H" width), and the contents of these bits and the HSC0 to HSC5 bits of the RCR21 register are compared with a count by the counter.

HSC11 to HSC6"H" width setting bits
Show 6 more labels / short text on this page
Address Initial value · HSC11 to HSC6 · Bit name Function · bit7, · bit5 · to bit0
Page 232 of the Fujitsu MB89202 user manual — R/W
Page 232 · click to enlarge
Page 232

CHAPTER 9 12-BIT PPG TIMER

9.4.3 12-bit PPG Control Register 3 (RCR23)

The 12-bit PPG control register 3 comprises a bit for enabling 12-bit PPG waveform outputs and bits for setting a cycle period of outputs.

  • 12-bit PPG Control Register 3 (RCR23)

Figure 9.4-4 12-bit PPG Control Register 3 (RCR23)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0016H RCEN SCL5 SCL4 SCL3 SCL2 SCL1 SCL0 0-000000B

R/W

Cycle period setting bits

Compare value for the cycle period of 12-bit PPG output

RCEN

Output disabled, counter cleared

Output enabled with count operation starting

R/W

: Readable/Writable : Unused : Initial value

Address Initial value · SCL5 to SCL0 · Output enable bit

Page 233 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 233 · click to enlarge
Page 233

CHAPTER 9 12-BIT PPG TIMER

Table 9.4-3 Explanation of Functions of Each Bit in 12-bit PPG Control Register 3 (RCR23)

When this bit is "0", the P37/BZ/PPG pin functions as a general-purpose port (P37); when the bit is "1", the pin functions as a 12-bit PPG output pin (PPG). When "0" is written for this bit, the counter is cleared and its operation stops; when "1" is written, the count operation starts. Even if PPG outputs are enabled by this bit setting, buzzer outputs, if enabled, have priority.

bit7 RCENOutput enable bit
  • bit6 Unused bit
  • Bit value is undefined when being read.
  • Written value does not affect other operations.

These bits are used to set the number of counts corresponding to the cycle period of 12-bit PPG waveform outputs (the compare value for the cycle period), and the contents of these bits and the SCL6 to SCL11 bits of RCR24 are compared with a count by the counter. Note:

SCL5 to SCL0Cycle period setting bits

Set a value that falls within the range of "000000000010B" to "111111111111B" (002H to FFFH).

Because buzzer outputs to the P37/BZ/PPG pin precede 12-bit PPG outputs to this pin, if the pin is used as the PPG pin, turn the buzzer outputs off and set the RCEN bit such that PPG outputs are enabled.

Bit name Function · bit5 · to bit0

Page 234 of the Fujitsu MB89202 user manual — R/W R/W R/W R/W R/W R/W
Page 234 · click to enlarge
Page 234

CHAPTER 9 12-BIT PPG TIMER

9.4.4 12-bit PPG Control Register 4 (RCR24)

The 12-bit PPG control register 4 comprises bits for setting a cycle period of 12-bit PPG waveform outputs.

  • 12-bit PPG Control Register 4 (RCR24)

Figure 9.4-5 12-bit PPG Control Register 4 (RCR24)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0017H SCL11 SCL10 SCL9 SCL8 SCL7 SCL6 --000000B

R/W

Cycle period setting bits Compare value for the cycle period of 12-bit PPG outputs

R/WReadable/Writable

: Unused

Table 9.4-4 Explanation of Functions of Each Bit in 12-bit PPG Control Register 4 (RCR24)

  • bit6 Unused bits
  • Bit value is undefined when being read.
  • Written value does not affect other operations.

These bits are used to set the number of counts corresponding to the cycle period of 12-bit PPG waveform outputs (the compare value for cycle period), and the contents of these bits and the SCL0 to SCL5 bits of RCR23 are compared with a count by the counter. Note:

SCL11 to SCL6Cycle period setting bits

Set a value that falls within the range of "000000000010B" to "111111111111B" (002H to FFFH).

Show 6 more labels / short text on this page
Address Initial value · SCL11 to SCL6 · Bit name Function · bit7, · bit5 · to bit0
Page 235 of the Fujitsu MB89202 user manual — RCR22 HSC11 HSC10 HSC9 HSC8 HSC7 HSC6
Page 235 · click to enlarge
Page 235

CHAPTER 9 12-BIT PPG TIMER

9.5 Operations of 12-bit PPG Timer Functions

The 12-bit PPG timer can be used as a 12-bit PPG because the output pulse cycle period and "H" pulse width can be set separately.

  • Example of Operations of 12-bit PPG Timer Functions

To operate the 12-bit PPG timer, the bits of the registers must be set as shown in Figure 9.5-1 .

Figure 9.5-1 Setting 12-bit PPG Timer

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

RCR21 RCK1 RCK0 HSC5 HSC4 HSC3 HSC2 HSC1 HSC0

RCR22 HSC11 HSC10 HSC9 HSC8 HSC7 HSC6

RCR23 RCEN SCL5 SCL4 SCL3 SCL2 SCL1 SCL0

RCR24 SCL11 SCL10 SCL9 SCL8 SCL7 SCL6

: Used bit

: Set "1"

When 12-bit PPG outputs are enabled, the 12-bit counter starts counting from" 000H" in synchronization

with the selected count clock and the PPG pin is maintained at "H" level until a count by the counter is synchronized with the compare value for the "H" width. The PPG pin is then maintained at "L" level until a count by the counter is synchronized with the compare value for the cycle period. At this time, the 12-bit counter is cleared and restarts counting from "000H". Because the "H" width and cycle period can be set

separately, the timer can be used as a 12-bit PPG.

Page 236 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 236 · click to enlarge
Page 236

CHAPTER 9 12-BIT PPG TIMER

Figure 9.5-2 illustrates the operation of the 12-bit PPG timer.

Figure 9.5-2 Operation of 12-bit PPG Timer

Fujitsu MB89202 — CHAPTER 9 12-BIT PPG TIMER diagram (page 236)
Fig. 33
(RCR2 3 , 24S CL0 to S CL11)

PPG output pulse waveform

*1: If internal count clock cycle period is 2, 4, 16, or 256 tINST, cycle period = compare value for cycle period multiplied by the count clock cycle period.

*2: If internal count clock cycle period is 2, 4, 16, or 256 tINST, "H" width = compare value for the "H" width multiplied by the count clock cycle period.

Page 237 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 237 · click to enlarge
Page 237

CHAPTER 9 12-BIT PPG TIMER

9.6 Notes on Using 12-bit PPG Timer

This section provides notes on using the 12-bit PPG timer.

  • Notes on Using 12-bit PPG Timer
  • Output pin changeover

The P37/BZ/PPG pin shares functions of a general-purpose port and a 12-bit PPG output. Because its buzzer output (BZ) function precedes the 12-bit PPG output function, if buzzer outputs are enabled, it functions as the buzzer output (BZ) pin even if PPG outputs are enabled by the RCR23 (RCEN bit). To use it as the 12-bit PPG output (PPG) pin, turn the buzzer outputs OFF.

  • Limitation of "H" width setting

Using the "H" width setting bits of the 12-bit PPG control registers 1 and 2 (RCR21:HSC5 to HSC0 and RCR22:HSC11 to HSC6), set a value that falls within the range of "000000000001B" to "111111111111B"

(001H to FFFH). If "000H" is set, "H" level outputs are delivered through the PPG pin. Furthermore, set the

value of the "H" width so as to be smaller than the value given by the cycle period setting bits of 12-bit PPG control registers 3 and 4 (RCR23:SCL5 to SCL0 and RCR24:SCL11 to SCL6). If the "H" width is equal to or greater than the cycle period, "H" level outputs are always delivered through the PPG pin.

  • Resolution

When the cycle period is set at "111111111111B" (FFFH), a maximum "H" width resolution of 1/4095 is

obtained. This resolution is reduced as the cycle period setting becomes smaller and limited to a minimum of 1/2 when the cycle period is set at "000000000010B" (002H).

  • Setting change during operation

The "H" width setting bits (RCR21:HSC5 to HSC0 and RCR22:HSC11 to HSC6) and the cycle period setting bits (RCR23:SCL5 to SCL0 and RCR24:SCL11 to SCL6) are compared with the 12-bit counter for generating a frequency of 12-bit PPG waveforms. If the set values given by these bits are changed to smaller values during the operation of the counter, a counter overflow occurs, which may extend the cycle period until synchronization with a count by the counter is detected again. Similarly, this may extend the "H" width until synchronization with a count by the counter is detected in the next cycle (cycle period).

Figure 9.6-1 illustrates setting change during the operation of the 12-bit PPG timer.

Page 238 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 238 · click to enlarge
Page 238

CHAPTER 9 12-BIT PPG TIMER

Figure 9.6-1 Setting Change during 12-bit PPG Timer Operation

Fujitsu MB89202 — CHAPTER 9 12-BIT PPG TIMER diagram (page 238)
Fig. 34

Because the count interval of the operating counter is less than the changed setting, the setting is effective only within the cycle. *1:

*2: Because a cycle period less than the count interval of the operating counter is set, synchronization is not detected and the counter overflows.

*3: Because an "H" width less the count interval of the operating counter is set, synchronization is not detected until the next cycle.

  • Error

Because the counter start by program is asynchronous with the count-up start by the selected count clock, an error (a time difference) may occur until detection of synchronization of compare values for the "H" width and for the cycle period with a count by the counter. A major error may shorten the time before the above synchronization to one count clock cycle.

Figure 9.6-2 illustrates an error (a time difference) before the count operation start.

Figure 9.6-2 Error before Count Operation Start

Fujitsu MB89202 — CHAPTER 9 12-BIT PPG TIMER diagram (page 238)
Fig. 35
Page 239 of the Fujitsu MB89202 user manual — END
Page 239 · click to enlarge
Page 239

CHAPTER 9 12-BIT PPG TIMER

9.7 Program Example for 12-bit PPG Timer

An example of 12-bit PPG timer programming is given below.

  • Program Example for 12-bit PPG Timer
  • Processing specification
  • A remote control transmission frequency with a period of about 38 µ s and a duty cycle of approx. 33% is generated.
  • The compare value for the PPG output pulse cycle period giving the above period of about 38 µ s at the maximum gear speed with oscillation of 12.5 MHz (F CH ) is determined as below. The count clock is assumed to be 4 t INST .

Compare value for cycle period (RCR23:SCL5 to SCL0 and RCR24:SCL11 to SCL6) = 38 µs/ (4 × 4/ 10MHz) = 30

  • The compare value for the "H" width of the PPG output pulse giving the duty cycle of approx. 33% is determined as below. At this time, the "H" width is about 3 µ s.

Compare value for the "H" width (RCR21:HSC5 to HSC0 and RCR22:HSC11 to HSC6) =33/100 × Compare value for the cycle period = 0.33 × 30 = 10

  • Coding example

RCR21 EQU 0014H ; Address of 12-bit PPG control register 1 RCR22 EQU 0015H ; Address of 12-bit PPG control register 2 RCR23 EQU 0016H ; Address of 12-bit PPG control register 3 RCR24 EQU 0017H ; Address of 12-bit PPG control register 4 ; Main program

CSEG ; [CODE SEGMENT] : MOV RCR21,#01001010B ; Select count clock of 4 tINST and set the above compare value for "H" width. MOV RCR22,#00H ;

MOV RCR23,#10011110B ; Specify outputs enabled and counter operation start and set the above compare value for cycle period. MOV RCR24,#00H ; : ENDS ;

END

Page 240 of the Fujitsu MB89202 user manual — CHAPTER 9 12-BIT PPG TIMER
Page 240 · click to enlarge
Page 240

CHAPTER 9 12-BIT PPG TIMER

Page 241 of the Fujitsu MB89202 user manual — Table of contents
Page 241 · click to enlarge
Page 241

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 242 of the Fujitsu MB89202 user manual — CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)
Page 242 · click to enlarge
Page 242

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

10.1 Overview of External Interrupt Circuit 1

External interrupt circuit 1 detects a predetermined edge or edges of a signal input to any of three external interrupt pins and then generates and issues an interrupt request to the CPU.

  • Functions of External Interrupt Circuit 1

The external interrupt circuit 1 functions to detect an optionally selected edge or edges of a signal input to any of the external interrupt pins and then generate and issue an interrupt request to the CPU. This interrupt ensures recovery from standby mode and enables transition to a normal operating state (main clock operation mode).

  • External interrupt pins: Three pins (P34/TO/INT10 to P36/INT12)
  • External interrupt triggering: Input of a signal with an optionally selected edge or edges (rising and/or falling edges) to one of the above external interrupt pins triggers an external interrupt.
  • Interrupt control: Interrupt request outputs are enabled or disabled according to the content of an

interrupt request enable bit of external interrupt 1 control registers 1 and 2 (EIC1, EIC2).

  • Interrupt flag:Detection of specified edge or edges is indicated by an external interrupt request flag bit

of external interrupt 1 control registers 1 and 2 (EIC1, EIC2).

  • Interrupt request: An interrupt request is generated according to the pin at which the input of the signal

triggering an external interrupt is detected (IRQ0, IRQ1, IRQ2).

Page 243 of the Fujitsu MB89202 user manual — EIR2 SL21 SL20 EIE2
Page 243 · click to enlarge
Page 243

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

10.2 Configuration of External Interrupt Circuit 1

  • External interrupt circuit 1 comprises the following two blocks:
  • Edge detecting circuits (0 to 2)
  • External interrupt control 1 registers 1, 2 (EIC1, EIC2)
  • Block Diagram of External Interrupt Circuit 1

Figure 10.2-1 Block Diagram of External Interrupt Circuit 1 (EIC1, EIC2)

P34/TO/INT10

Edge detecting circuit 1

Edge detecting circuit 0

P35/INT11

External interrupt 1 control register 1 (EIC1)

EIR1 SL11 SL10 EIE1 EIR0 SL01 SL00 EIE0

Interrupt request (IRQ0) Interrupt request (IRQ1)

P36/INT12

Edge detecting circuit 2

External interrupt 1 control register 2 (EIC2)

EIR2 SL21 SL20 EIE2

Show 8 more labels / short text on this page
Pin · Selector · Selector · Pin · Internal data bus · Pin · Selector · Interrupt request (IRQ2)
Page 244 of the Fujitsu MB89202 user manual — CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)
Page 244 · click to enlarge
Page 244

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

  • Edge detecting circuits

When the edge polarity of a signal input to one of the pins (INT10 to INT12) for external interrupt circuit 1 matches the selected edge polarity for the pin, stored in either the EIC1 or EIC2 registers in the appropriate bit position (SL00 to SL21), one of the external interrupt request flag bits (EIR0 to EIR2) corresponding to the pin is set to "1".

  • External interrupt 1 control registers (EIC1, EIC2)

The EIC1 and EIC2 registers comprise bits for edge selection, for enabling or disabling interrupt requests, and for confirming an interrupt request.

  • Triggers that cause external interrupt circuit 1 to generate an interrupt request
  • IRQ0: When a signal with an edge or edges corresponding to the selected edge polarity is input to the

INT10 pin for external interrupt circuit 1, if interrupt request outputs are enabled (EIC1:EIE0=1), external interrupt circuit 1 generates an IRQ0 interrupt request.

  • IRQ1: When a signal with an edge or edges corresponding to the selected edge polarity is input to the

INT11 pin for external interrupt circuit 1, if interrupt request outputs are enabled (EIC1:EIE1=1), external interrupt circuit 1 generates an IRQ1 interrupt request.

  • IRQ2: When a signal with an edge or edges corresponding to the selected edge polarity is input to the

INT12 pin for external interrupt circuit 1, if interrupt request outputs are enabled (EIC2:EIE2=1), external interrupt circuit 1 generates an IRQ2 interrupt request.

Page 245 of the Fujitsu MB89202 user manual — CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)
Page 245 · click to enlarge
Page 245

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

10.3 Pins of External Interrupt Circuit 1

This section describes the pins associated with external interrupt circuit 1 and illustrates a block diagram of circuitry terminating at the pins with reference to the registers and external interrupt triggering.

  • Pins Associated with External Interrupt Circuit 1

The pins associated with external interrupt circuit 1 are the P34/TO/INT10 to P36/INT12 pins.

  • P34/TO/INT10 pin

This pin functions as a general-purpose I/O dedicated port and may also serve 8/16-bit capture timer outputs (TO) and external interrupt inputs (hysteresis inputs) (INT10).

If the timer 1 control register (TCR0) disables 8/16-bit capture timer outputs and, by the port data direction register (DDR3), the pin is set to function as an input port only. The pin can also function as an external interrupt input pin (INT10). When external interrupt 1 control register 1 (EIC1) sets edge detection to OFF, however, no external interrupt requests are generated, and when interrupt request outputs are disabled, no interrupt requests are output. The pin state can be read directly from the port data register (PDR3) at any time.

  • P35/INT11 and P36/INT12 pins

These pins function as a general-purpose I/O dedicated port (P35, P36) and may also serve external interrupt inputs (hysteresis inputs) (INT11, INT12).

If, by the port data direction register (DDR3), these pins are set to function as an input port only, they also function as external interrupt input pins (INT11, INT12). When external interrupt 1 control registers 1 and 2 (EIC1, EIC2) set edge detection to OFF, however, no external interrupt requests are generated, and when interrupt request outputs are disabled, no interrupt requests are output. The pin state can be read directly from the port data register (PDR3) at any time.

Table 10.3-1 lists the pins associated with external interrupt circuit 1.

Table 10.3-1 Pins Associated with External Interrupt Circuit 1

Use for input port only (Interrupt request output or edge detection

External interrupt pin Use for external interrupt input (Interrupt request output enabled)

P34/TO/INT10 INT10 (EIC1:EIE0=1, DDR3:bit4=0, TCR2:PEN=0) P34(EIC1:EIE0=0 or SL01, SL00=00B)

P35/INT11 INT11 (EIC1:EIE1=1, DDR3:bit5=0) P35(EIC1:EIE1=0 or SL11, SL10=00B)

P36/INT12 INT12 (EIC2:EIE2=1, DDR3:bit6=0) P36(EIC2:EIE2=0 or SL21, SL20=00B)

INT10 to INT12: When a signal with an edge or edges corresponding to the selected edge polarity is input to these pins,

an interrupt corresponding to the pin is generated.

disabled)

Page 246 of the Fujitsu MB89202 user manual — Circuit 1
Page 246 · click to enlarge
Page 246

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

  • Block Diagram of Circuitry Terminating at the Pins Associated with External Interrupt

Circuit 1

Figure 10.3-1 Block Diagram of Circuitry Terminating at the Pins Associated with External Interrupt Circuit 1

Fujitsu MB89202 — Circuit 1 diagram (page 246)
Fig. 36 · Circuit 1

When the ON setting of the pull-up resistor is selected by the pull-up setting register, the pin state will be "H" level (pull-up state) rather than Hi-Z during stop mode (SPL = 1). During a reset, however, the pull-up is invalid and the pin remains at Hi-Z.

Page 247 of the Fujitsu MB89202 user manual — 0025 H EIR2 SL21 SL20 EIE2 ----0000 B
Page 247 · click to enlarge
Page 247

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

10.4 Registers of External Interrupt Circuit 1

This section describes the registers associated with external interrupt circuit 1.

  • Registers Associated with External Interrupt Circuit 1

Figure 10.4-1 Registers Associated with External Interrupt Circuit 1

EIC1 (External interrupt 1 control register 1)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0024H EIR1 SL11 SL10 EIE1 EIR0 SL01 SL00 EIE0 00000000B R/W

INT11 INT10

EIC2 (External interrupt 1 control register 2)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0025 H EIR2 SL21 SL20 EIE2 0000 B

R/W R/W R/W R/W

INT12 R/WReadable/Writable

: Unused

Show 4 more labels / short text on this page
Address · Initial value · Address · Initial value
Page 248 of the Fujitsu MB89202 user manual — EIR1
Page 248 · click to enlarge
Page 248

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

10.4.1 External Interrupt Control Register 1 (EIC1)

External interrupt control register 1 (EIC1) comprises bits for edge polarity selection and interrupt control for the INT10 and INT11 external interrupt pins.

  • External Interrupt Control Register 1 (EIC1)

Figure 10.4-2 External Interrupt Control Register 1 (EIC1)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0024H EIR1 SL11 SL10 EIE1 EIR0 SL01 SL00 EIE0 00000000 B R/W

EIE0

Interrupt request enable bit 0

Disables interrupt request outputs

Enables interrupt request outputs

SL01 SL00

Edge polarity selection bits 0

0 0 0 1

External interrupt request flag bit 0

EIR0

When being read When being written Signal input with specified edge or edges not detected This bit is cleared

Signal input with specified edge or edges detected

No change, does not affect other operations

EIE1

Interrupt request enable bit 1

Disables interrupt request outputs

Enables interrupt request outputs

SL11 SL10

Edge polarity selection bits 1

Rising edge Falling edge

External interrupt request flag bit 1

EIR1

When being read When being written

Signal input with specified edge or edges not detected This bit is cleared

Signal input with specified edge or edges detected

No change, does not affect other operations

R/WReadable/Writable

: Initial value

Show 7 more labels / short text on this page
Address Initial value · Edge detection OFF · Rising edge · Falling edge · Both edges · Edge detection OFF · Both edges
Page 249 of the Fujitsu MB89202 user manual — CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)
Page 249 · click to enlarge
Page 249

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

Table 10.4-1 Explanation of Functions of Each Bit in External Interrupt Control Register 1 (EIC1) (1/2)

  • When a signal with an edge or edges corresponding to edge polarity selected by edge polarity selection bits (SL11, SL10) is input to INT11 external interrupt pin, this bit is set to "1".
  • When this bit and interrupt request enable bit 1 (EIE1) are "1", the interrupt request is output.
  • Writing "0" clears this bit; writing "1" does not affect this bit (no change).
EIR1External interrupt request flag bit1
  • These bits are used to select the polarity of an edge or edges of a signal pulse that triggers an interrupt when the signal is input to INT11 external interrupt pin.
  • When these bits provide a value of "00 B ", edge detection is not performed and interrupt requests are not generated.
  • These bits may specify "01 B ", indicating a rising edge, "10 B ", a falling edge, or "11 B ", both edges to be detected. Note:
SL11, SL10Edge polarity selection bits 1

If an edge is selected while edge detection is OFF, edge detection may be performed unconditionally. Always clear the EIR0 bit after selecting an edge.

  • This bit enables or disables interrupt request outputs to CPU. When this bit and external interrupt request flag bit 1 (EIR1) are "1", the interrupt request is output. Notes:
  • When using the external interrupt pin, write "0" for bit5 of the port data direction register (DDR3) so that the pin serves inputs only.
  • Regardless of the interrupt request enable bit state, the state of the external interrupt pin can be read directly from the port data register (PDR3).
EIE1Interrupt request enable bit 1
  • When a signal with an edge or edges corresponding to edge polarity selected by edge polarity selection bits (SL01, SL00) is input to INT10 external interrupt pin, this bit is set to "1".
  • When this bit and interrupt request enable bit 0 (EIE0) are "1", the interrupt request is output.
  • Writing "0" clears this bit, and writing "1" does not affect this bit.
EIR0External interrupt request flag bit 0
  • These bits are used to select the polarity of an edge or edges of a signal pulse that triggers an interrupt when the signal is input to the INT10 external interrupt pin.
  • When these bits provide a value of "00 B ", edge detection is not performed and interrupt requests are not generated.
  • These bits may specify "01 B ", indicating a rising edge, "10 B ", a falling edge, or "11 B ", both edges to be detected. Note:
SL01, SL00Edge polarity selection bits 0

If edge is selected when edge detection is OFF, edge detection may be performed unconditionally. Always clear the EIR0 bit after selecting an edge.

Show 8 more labels / short text on this page
Bit name Function · bit7 · bit6, · bit5 · bit4 · bit3 · bit2, · bit1
Page 250 of the Fujitsu MB89202 user manual — CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)
Page 250 · click to enlarge
Page 250

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

Table 10.4-1 Explanation of Functions of Each Bit in External Interrupt Control Register 1 (EIC1) (2/2)

  • This bit enables or disables interrupt request outputs to the CPU. When this bit and external interrupt request flag bit 0 (EIR0) are "1", the interrupt request is output. Notes:
  • When using the external interrupt pin, write "0" for bit4 of the port data direction register (DDR3) so that the pin serves inputs only. Write "0" for bit1 of the timer output control register (TCR2) for the 8/16-bit capture timer/counter to set the port input function on.
  • Regardless of the interrupt request enable bit state, the state of the external interrupt pin can be read directly from the port data register (PDR3).
EIE0Interrupt request enable bit 0

Bit name Function · bit0

Page 251 of the Fujitsu MB89202 user manual — EIR2
Page 251 · click to enlarge
Page 251

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

10.4.2 External Interrupt Control Register 2 (EIC2)

As with external interrupt control register 1 (EIC1), external interrupt control register 2 (EIC2) comprises bits for edge polarity selection and interrupt control for the INT12 external interrupt pin.

  • External Interrupt Control Register 2 (EIC2)

Figure 10.4-3 External Interrupt Control Register 2 (EIC2)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0025H EIR2 SL21 SL20 EIE2 0000B R/W

EIE2

Interrupt request enable bit 2 Disables interrupt request outputs

Enables interrupt request outputs

S L21 S L20

Edge polarity selection bits 2 Edge detection OFF

Rising edge

Falling edge Both edges

External interrupt request flag bit 2

EIR2

When being read When being written

Signal input with specified edge or edges not detected This bit is cleared

No change, not affecting other operation

Signal input with specified edge or edges detected

R/WRe a d ab le/Writ ab le

: Initial value : Unused

Page 252 of the Fujitsu MB89202 user manual — CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)
Page 252 · click to enlarge
Page 252

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

Table 10.4-2 Explanation of Functions of Each Bit in External Interrupt Control Register 2 (EIC2)

  • Unused bits
  • Bit value is undefined when being read.
  • Written value does not affect other operations.
  • When a signal with an edge or edges corresponding to edge polarity selected by edge polarity selection bits 2 (SL21, SL20) is input to the INT12 external interrupt pin, this bit is set to "1".
  • When this bit and interrupt request enable bit 2 (EIE2) are "1", the interrupt request is output.
  • Writing "0" clears this bit, and writing "1" does not affect this bit (no change).
EIR2External interrupt request flag bit 2
  • These bits are used to select the polarity of an edge or edges of a signal pulse that triggers an interrupt when the signal is input to the INT12 external interrupt pin.
  • When these bits provide a value of "00 B ", edge detection is not performed and interrupt requests are not generated.
  • These bits may specify "01 B ", indicating a rising edge, "10 B ", a falling edge, or "11 B ", both edges to be detected. Note:
SL21, SL20Edge polarity selection bits 2

If edge is selected while edge detection is OFF, edge detection may be performed unconditionally. Always clear EIR2 bit after selecting an edge.

  • This bit enables or disables interrupt request outputs to the CPU. When this bit and external interrupt request flag bit 2 (EIR2) are "1", the interrupt request is output. Notes:
  • When using the external interrupt pin, write "0" for bit6 of the port data direction register (DDR3) so that the pin serves inputs only.
  • Regardless of the interrupt request enable bit state, the state of external interrupt pin can be read directly from the port data register (PDR3).
EIE2Interrupt request enable bit 2
Show 6 more labels / short text on this page
Bit name Function · bit7 · to bit4 · bit3 · bit2 bit1 · bit0
Page 253 of the Fujitsu MB89202 user manual — CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)
Page 253 · click to enlarge
Page 253

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

10.5 Interrupt of External Interrupt Circuit 1

The detection of a signal with the specified edge or edges, input to any of the external interrupt pins, triggers external interrupt circuit 1 to generate an interrupt request.

  • Interrupt during the Operation of External Interrupt Circuit 1

When external interrupt circuit 1 detects the specified edge or edges of external interrupt input at a pin, an external interrupt request flag bit (EIC1, EIC2:EIR0 to EIR2) corresponding to the pin is set to "1". At this time, if the interrupt request enable bit corresponding to the pin contains the value indicating the enabled state (EIC1, EIC2:EIE0 to EIE2=1), the external interrupt circuit 1 generates and then issues the appropriate interrupt request (IRQ0, IRQ1, IRQ2) to the CPU.

Write "0" for the external interrupt request flag bit within the interrupt processing routine for the interrupt request, thus clearing the interrupt request.

If external interrupts are not used for recovery from stop mode, set the edge polarity selection bits to "00B"

and the interrupt enable bits to "0".

  • When edge detection OFF is selected and set with edge polarity selection bits, the occurring input is held as is before entry to the internal edge detecting circuit. If edge is selected during the edge detection OFF state, edge detection may be performed unconditionally with the external interrupt request flag bit set to "1".
  • When interrupts are set enabled (EIC1, EIC2:EIE0 to EIE2=1) after the release from the reset state, clear the appropriate external interrupt request flag bit (EIR0 to EIR2=0) at the same time.

If the external interrupt request flag bit is "1" with the interrupt request enable bit containing a value indicating enable state, a return from the interrupt processing is not possible. Always clear the external interrupt request flag bit within the interrupt processing routine.

  • For edge selection during the edge detection OFF state, specify an edge or edges when interrupt request outputs are disabled and then clear the external interrupt request flag bit.

Regardless of the value of the appropriate interrupt request enable bit (EIE0 to EIE2), the external interrupt request flag bit is set to "1" whenever edge polarity matching is detected.

Only external interrupt circuits 1 and 2 can execute a release from stop mode by an interrupt.

With the external interrupt request flag bit being set to "1", when the interrupt request enable bit setting changes from disable to enable (0 → 1), an interrupt request is generated immediately.

Page 254 of the Fujitsu MB89202 user manual — ILR1 (007B H )
Page 254 · click to enlarge
Page 254

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

  • Register Associated with Interrupt Generation by External Interrupt Circuit 1 and

Vector Table

Table 10.5-1 Register Associated with Interrupt Generation by External Interrupt Circuit 1 and Vector Table

Interrupt level setting register Vector table address

Register Bit for setting level Upper Lower

IRQ0

L01 (bit1) L00 (bit0) FFFAH FFFBH

IRQ1 L11 (bit3) L10 (bit2) FFF8H FFF9H

ILR1 (007B H )

IRQ2 L21 (bit5) L20 (bit4) FFF6H FFF7H

For interrupt operation, see Section "3.4.2 Steps in the Interrupt Operation ".

  • Exercise Caution when Changing Edge Polarity Selection

When changing edge polarity for INT10 to INT12, always write "0" for the appropriate EIR bit to prevent unintended interrupt generation.

Interrupt designation

Page 255 of the Fujitsu MB89202 user manual — EIC2 EIR2 SL21 SL20 EIE2
Page 255 · click to enlarge
Page 255

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

10.6 Operations of External Interrupt Circuit 1

The external interrupt circuit 1 can detect a specified edge or edges of a signal input to any of the external interrupt pins.

  • Operation of External Interrupt Circuit 1

To operate external interrupt circuit 1, the bits of the registers must be set as shown in Figure 10.6-1 .

Figure 10.6-1 Setting External Interrupt Circuit 1

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

EIC1 EIR1 SL11 SL10 EIE1 EIR0 SL01 SL00 EIE0

EIC2 EIR2 SL21 SL20 EIE2

DDR3

TCR2 PEN TSEL

: Used bit : Unused bit

0. Set "0"

When the polarity of an edge or edges of a signal input from one of the external interrupt pins 1 (INT10 to INT12) matches the selected edge polarity for the pin stored in the appropriate external interrupt control register (EIC1, EIC2:SL00 to SL21), one of the external interrupt request flag bits (EIC1, EIC2:EIR0 to EIR2) corresponding to the pin is set to "1".

Page 256 of the Fujitsu MB89202 user manual — CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)
Page 256 · click to enlarge
Page 256

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

Figure 10.6-2 shows the operation when an external interrupt is input to the INT10 pin.

Figure 10.6-2 Operation of External Interrupt 1 (INT10)

Fujitsu MB89202 — CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE) diagram (page 256)
Fig. 37

Interrupt request flag bit is cleared by the program

Even when the pin is used as an external interrupt input pin, the pin state can be read directly from the port data register (PDR3).

Page 257 of the Fujitsu MB89202 user manual — CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)
Page 257 · click to enlarge
Page 257

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

10.7 Program Example for External Interrupt Circuit 1

An example of programming external interrupt circuit 1 is given below.

  • External Interrupt Circuit 1 Programming Example
  • Processing specification

External interrupt circuit 1 detects the rising edge of a pulse input to the INT10 pin and generates an interrupt.

  • Coding example

DDR3 EQU 000DH ; Address of port data direction register (DDR) EIC1 EQU 0024H ; External interrupt control register 1 TCR2 EQU 0020H ; Address of 8/16-bit capture timer output control

register ILR1 EQU 007BH ; Setting of interrupt level setting register 1

EIR0 EQU EIC1:3 ; Definition of external interrupt request flag bit SL01 EQU EIC1:2 ; Definition of edge polarity selection bits SL00 EQU EIC1:1 ; Definition of edge polarity selection bits EIE0 EQU EIC1:0 ; Definition of interrupt request enable bit INT_V DSEG ABS ; [DATA SEGMENT] ORG 0FFFAH IRQ1 DW WARI ; Interrupt vector (INT1) setting INT_V ENDS ; Main program

CSEG ; [CODE SEGMENT] ; Stack pointer (SP) is assumed to have been initialized. : ; CLRI ; Disable interrupts. CLRB EIR1 ; Clear external interrupt request flag. MOV TCR2,#00000000B ; Set pin P34/TO/INT10 to serve port inputs. MOV DDR3,#00000000B ; Set P34 to serve inputs only. MOV ILR1,#11111110B ; Set interrupt level at 2. CLRB SL01 ; Select rising edge. SETB SL00 ; CLRB EIR0 ; Clear external interrupt request flag. SETB EIE0 ; Enable interrupt request outputs. SETI ; Enable interrupts. : ; Interrupt processing routing WARI CLRB EIE0 ; Clear external interrupt request flag (INT0). PUSHW A XCHW A,T

Page 258 of the Fujitsu MB89202 user manual — END
Page 258 · click to enlarge
Page 258

CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)

PUSHW A : User processing : POPW A XCHW A,T POPW A RETI ENDS ;

END

Page 259 of the Fujitsu MB89202 user manual — Table of contents
Page 259 · click to enlarge
Page 259

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 260 of the Fujitsu MB89202 user manual — CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)
Page 260 · click to enlarge
Page 260

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

11.1 Overview of External Interrupt Circuit 2

External interrupt circuit 2 detects the predetermined level of a signal input to any of the eight external interrupt pins and generates and issues an interrupt request to the CPU.

  • Functions of External Interrupt Circuit 2 (Level Detection)

External interrupt circuit 2 functions to detect an "L" level signal input to any of the external interrupt pins and generate and issue an interrupt request to the CPU, thereby enabling recovery from standby mode and a transition to normal operating state (main clock operation mode).

  • External interrupt pins: Eight pins (P00/INT20/AN4 to P03/INT23/AN7, P04/INT24 to P07/INT27)
  • External interrupt triggering: Input of an "L" level signal to one of the above external interrupt pins triggers an external interrupt.
  • Interrupt control: An external interrupt 2 control register (EIE2) enables or disables external interrupt

inputs.

  • Interrupt flag:Detection of the "L" level is indicated by an external interrupt request flag bit of the

external interrupt 2 flag register (EIF2).

  • Interrupt request: An interrupt request is generated if the state of one of the above external interrupt pins

is "L" (IRQA).

Page 261 of the Fujitsu MB89202 user manual — CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)
Page 261 · click to enlarge
Page 261

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

11.2 Configuration of External Interrupt Circuit 2

  • The external interrupt circuit 2 comprises the following three blocks:
  • Interrupt request generating circuit
  • External interrupt 2 control register (EIE2)
  • External interrupt 2 flag register (EIF2)
  • Block Diagram of External Interrupt Circuit 2

Figure 11.2-1 Block Diagram of External Interrupt Circuit 2

Fujitsu MB89202 — CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL) diagram (page 261)
Fig. 38

External interrupt 2 control register (EIE2) External interrupt 2 flag register (EIF2)

IE27 IE26 IE25 IE24 IE23 IE22 IE21 IE20 IF20

  • Interrupt request generating circuit

The interrupt request generating circuit generates an interrupt request signal in accordance with the signal input to one of the external interrupt pins (INT20 to INT27) and the contents of an external interrupt input enable bit.

  • External interrupt 2 control register (EIE2)

The external interrupt input enable bits (IE20 to IE27) enable or disable "L" level input from the external interrupt pins, with each bit corresponding to a pin.

  • External interrupt 2 flag register (EIF2)

The external interrupt request flag bit (IF20) is used to hold or clear an interrupt request signal.

  • Trigger causing external interrupt circuit 2 to generate an interrupt
  • IRQA:When an "L" level signal is input to any of the external interrupt pins INT20 to INT27 and the

external interrupt input enable bit corresponding to the pin is "1", external interrupt circuit 2 generates an interrupt request.

Page 262 of the Fujitsu MB89202 user manual — CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)
Page 262 · click to enlarge
Page 262

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

11.3 Pins of External Interrupt Circuit 2

This section describes the pins associated with external interrupt circuit 2 and illustrates a block diagram of circuitry terminating at the pins with reference to the registers and interrupt triggering.

  • Pins Associated with External Interrupt Circuit 2

The pins associated with external interrupt circuit 2 are eight external interrupt pins.

  • P00/INT20/AN4 to P03/INT23/AN7

These external interrupt pins function as external interrupt input pins (hysteresis input) and as the pins of the general-purpose I/O port and analog inputs.

The P00/INT20/AN4 to P03/INT23/AN7 pins function as external interrupt input pins (INT20 to INT23) if set to function as an input port by the corresponding bits of the port 0 data direction register (DDR0), if set to be enabled for external interrupt inputs (ADEN=0) by the corresponding bits of the A/D enable register (ADEN), and if external interrupt inputs are enabled (EIE2:IE20 to IE27=1) by the external interrupt 2 control register (EIE2). When set to function as an input port by the DDR0 register, the state of these pins can be read from the port 0 data register (PDR0) at any time.

  • P04/INT24 to P07/INT27

These external interrupt pins function as external interrupt input pins (hysteresis input) and also serving as the pins of the general-purpose I/O port.

The P04/INT24 to P07/INT27 pins function as external interrupt input pins (INT24 to INT27) if set to function as an input port by the corresponding bits of the port 0 data direction register (DDR0) and if external interrupt inputs are enabled by the external interrupt 2 control register (EIE2). When set to function as an input port, the state of these pins can be read from the port 0 data register (PDR0) at any time.

Table 11.3-1 lists the pins associated with external interrupt circuit 2.

Table 11.3-1 Pins Associated with External Interrupt Circuit 2

Use for external interrupt input

Use for general-purpose I/O port

P00/INT20/AN4 INT20 (EIE2:IE20=1,DDR0:bit0=0,ADEN:ADE4=0) P00 (EIE2:IE20=0)

P01/INT21/AN5 INT21 (EIE2:IE21=1,DDR0:bit1=0,ADEN:ADE5=0) P01 (EIE2:IE21=0)

P02/INT22/AN6 INT22 (EIE2:IE22=1,DDR0:bit2=0,ADEN:ADE6=0) P02 (EIE2:IE22=0)

P03/INT23/AN7 INT23 (EIE2:IE23=1,DDR0:bit3=0,ADEN:ADE7=0) P03 (EIE2:IE23=0)

P04/INT24 INT24 (EIE2:IE24=1,DDR0:bit4=0) P04 (EIE2:IE24=0)

P05/INT25 INT25 (EIE2:IE25=1,DDR0:bit5=0) P05 (EIE2:IE25=0)

P06/INT26 INT26 (EIE2:IE26=1,DDR0:bit6=0) P06 (EIE2:IE26=0)

P07/INT27 INT27 (EIE2:IE27=1,DDR0:bit7=0) P07 (EIE2:IE27=0)

External interrupt pin · (Interrupt input enabled) · (Interrupt input disabled)

Page 263 of the Fujitsu MB89202 user manual — Circuit 2
Page 263 · click to enlarge
Page 263

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

  • Block Diagram of Circuitry Terminating at the Pins Associated with External Interrupt

Circuit 2

Figure 11.3-1 Block Diagram of Circuitry Terminating at the Pins Associated with External Interrupt

Fujitsu MB89202 — Circuit 2 diagram (page 263)
Fig. 39 · Circuit 2
SPLPin status setting bit of standby control register (STBC)

When the ON setting of the pull-up resistor is selected by the pull-up setting register, the pin state will be "H" level (pull-up state) rather than Hi-Z during stop mode (SPL = 1). During a reset, however, the pull-up is invalid and the pin remains at Hi-Z.

Circuit 2

Page 264 of the Fujitsu MB89202 user manual — EIE2
Page 264 · click to enlarge
Page 264

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

  • Association between the Interrupt Enable Bits for External Interrupt Circuit 2 and the

External Interrupt Pins

The interrupt enable bits are associated with the external interrupt pins as listed in Table 11.3-2 .

Table 11.3-2 Correspondence between the External Interrupt Enable Bits and the External

Register Bit name External interrupt pin

EIE2

Show 9 more labels / short text on this page
Interrupt Pins · bit7 IE27 INT27 · bit6 IE26 INT26 · bit5 IE25 INT25 · bit4 IE24 INT24 · bit3 IE23 INT23 · bit2 IE22 INT22 · bit1 IE21 INT21 · bit0 IE20 INT20
Page 265 of the Fujitsu MB89202 user manual — 0037 H IF20 -------0 B
Page 265 · click to enlarge
Page 265

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

11.4 Registers of External Interrupt Circuit 2

The external interrupt 2 control register (EIE2) is used to enable or disable the external interrupt pins.

  • Registers Associated with External Interrupt Circuit 2

Figure 11.4-1 Registers Associated with External Interrupt Circuit 2

EIE2 (External interrupt 2 control register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0036H IE27 IE26 IE25 IE24 IE23 IE22 IE21 IE20 00000000B

R/W

EIF2 (External interrupt 2 flag register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0037 H IF20 0 B

R/W

R/WReadable/Writable

: Unused

Address Initial value · Address Initial value

Page 266 of the Fujitsu MB89202 user manual — EIE2
Page 266 · click to enlarge
Page 266

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

11.4.1 External Interrupt 2 Control Register (EIE2)

The external interrupt circuit 2 control register (EIE2) enables or disables the interrupt inputs to the external interrupt pins INT20 to INT27.

  • External Interrupt Circuit 2 Control Register (EIE2)

Figure 11.4-2 External Interrupt Circuit 2 Control Register (EIE2)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0036H IE27 IE26 IE25 IE24 IE23 IE22 IE21 IE20 00000000B

R/W

External interrupt request enable bits

Disables external interrupt request outputs

Enables external interrupt request outputs

R/WRe a d ab le/Writ ab le

: Initial value

Table 11.4-1 Correspondence between the Bits of the External Interrupt 2 Control Register

(EIE2) and the External Interrupt Pins

Register Bit name External interrupt pin

EIE2

Show 9 more labels / short text on this page
IE27 to IE20 · bit7 IE27 INT27 · bit6 IE26 INT26 · bit5 IE25 INT25 · bit4 IE24 INT24 · bit3 IE23 INT23 · bit2 IE22 INT22 · bit1 IE21 INT21 · bit0 IE20 INT20
Page 267 of the Fujitsu MB89202 user manual — CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)
Page 267 · click to enlarge
Page 267

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

Table 11.4-2 Functions of the Bits of the External Interrupt 2 Control Register (EIE2)

  • These bits enable or disable the interrupt inputs to external interrupt pins INT20 to INT27.
  • When one of these bits is set to "1", the corresponding external interrupt pin functions as an external interrupt input pin and accepts external interrupt inputs.
  • When the bit is set to "0", the corresponding pin functions as a general-purpose port, but does not accept external interrupt inputs. Notes:
IE27 to IE20External interrupt input enable bits
  • When using a pin as an external interrupt pin, write "0" in the port 0 data direction register (DDR0) in the bit corresponding to the pin so that the pin serves inputs only.
  • Regardless of the external interrupt input enable bit state, the state of the external interrupt pin can be read directly from the port 0 data register (PDR0). For pins INT20 to INT23, furthermore, write "0" into A/D enable register (ADEN) in the bits corresponding to the pins to use the pins for external interrupt inputs.

Bit name Function · bit7 · to bit0

Page 268 of the Fujitsu MB89202 user manual — (EIF2)
Page 268 · click to enlarge
Page 268

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

11.4.2 External Interrupt 2 Flag Register (EIF2)

The external interrupt 2 flag register (EIF2) is used to hold the interrupt state by flagging an interrupt request flag when a level interrupt is detected and then clearing the flag.

  • External Interrupt 2 Flag Register (EIF2)

Figure 11.4-3 External Interrupt 2 Flag Register (EIF2)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0037 H IF20 0 B

R/W

External interrupt request flag bit

IF20

When being read When being written No interrupt request ("L" level not detected) This bit is cleared

R/W

: Readable/Writable : Unused

Interrupt request is generated ("L" level detected)

No change in the bit, does not affect other operations

: Initial value

Table 11.4-3 Explanation of Functions of Each Bit in External Interrupt 2 Flag Register

(EIF2)

  • Unused bits
  • Bit value is undefined when being read.
  • The written value does not affect other operations.
  • When an "L" level signal is input to one of the external interrupt pins(INT20 to INT27) for which external interrupt inputs are enabled, this bit is set to "1".
  • Writing "0" clears this bit, and writing "1" does not change this bit state and does not affect other operations. Note:
IF20External interrupt request flag bit

The external interrupt enable bits of the external interrupt 2 control register (EIE2:IE20 to IE27) may disable external interrupt inputs. Interrupt requests continue to be generated and issued to the CPU until the IF20 bit is cleared to "0".

Show 5 more labels / short text on this page
Address Initial value · Bit name Function · bit7 · to bit1 · bit0
Page 269 of the Fujitsu MB89202 user manual — Vector Table
Page 269 · click to enlarge
Page 269

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

11.5 Interrupt of External Interrupt Circuit 2

An "L" level input signal input to one of the external interrupt pins triggers external interrupt circuit 2 to generate an interrupt.

  • Interrupt during the Operation of External Interrupt Circuit 2

When an "L" level signal is input to one of the external interrupt pins for which interrupt inputs are enabled, the external interrupt request flag bit (EIF2:IF20) is set to "1" and external interrupt circuit 2 generates and issues an interrupt request (IRQA) to the CPU. Write "0" for the IF20 bit within the interrupt processing routine, thus clearing the interrupt request.

When the external interrupt request flag bit (IF20) is set to "1", external interrupt circuit 2 generates the interrupt request, even if external interrupt inputs to the pin are set to disabled by the bit corresponding to the pin among the interrupt enable bits (IE20 to IE27) of the external interrupt 2 control register (EIE2), until the IF20 bit is cleared. Therefore, the IF20 bit must always be cleared.

If the "L" level input to the external interrupt pin continues as it is, even if the IF20 bit is cleared with external interrupt inputs to the pin remaining enabled, the IF20 bit is immediately set to "1" again. Disable external interrupt inputs to the pin or remove the cause of the external interrupt as required.

  • When enabling interrupts to the CPU following a release from the reset state, clear the IF20 bit in advance.
  • "L" level inputs to external interrupt pins (INT20 to INT27) trigger external interrupt circuit 2 to generate the same interrupt request (IRQA). Thus, when an external interrupt input is detected, it is necessary to identify the pin at which the input occurs by reading the port 0 data register (PDR0) before the input changes to "H" level.

Only external interrupt circuits 1 and 2 can execute a release from the stop mode by an interrupt.

  • Register Associated with Interrupt Generation by External Interrupt Circuit 2 and

Vector Table

Table 11.5-1 Register Associated with Interrupt Generation by External Interrupt Circuit 2 and Vector

Interrupt level setting register Vector table address

Register Bit for setting level Upper Lower

IRQA ILR3 (007DH) LA1 (bit5) LA0 (bit4) FFE6H FFE7H

For interrupt operation, see Section "3.4.2 Steps in the Interrupt Operation ".

Table · Interrupt designation

Page 270 of the Fujitsu MB89202 user manual — ADEN
Page 270 · click to enlarge
Page 270

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

11.6 Operations of External Interrupt Circuit 2

External interrupt circuit 2 detects "L" level at any of the external interrupt pins, then generates and issues an interrupt request to the CPU.

  • Operation of External Interrupt Circuit 2

To operate the external interrupt circuit 2, the bits of the registers must be set as shown in Figure 11.6-1 .

Figure 11.6-1 Setting External Interrupt Circuit 2

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

EIE2 IE27 IE26 IE25 IE24 IE23 IE22 IE21 IE20

EIF2 IF20

DDR0

0

ADEN

0

: Used bit

: Unused bit

0. Set "0"

When an "L" level signal is input to an external interrupt pin among the pins INT20 to INT27 with external interrupt inputs being enabled by one of the IE20 to IE27 bits corresponding to the pin, external interrupt circuit 2 generates and issues an IRQA interrupt request to the CPU.

Figure 11.6-2 shows the operation of external interrupt circuit 2 (when the INT20/AN4 pin is used).

Page 271 of the Fujitsu MB89202 user manual — CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)
Page 271 · click to enlarge
Page 271

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

Figure 11.6-2 Operation of External Interrupt 2 (INT20)

Fujitsu MB89202 — CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL) diagram (page 271)
Fig. 40

Pulse waveform input to INT20/AN4 pin (Detection of the "L" level) External interrupt input enabled state

Even when the pin is used as an external interrupt input pin, the pin state can be read directly from the port 0 data register (PDR0).

Page 272 of the Fujitsu MB89202 user manual — CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)
Page 272 · click to enlarge
Page 272

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

11.7 Program Example for External Interrupt Circuit 2

An example of programming external interrupt circuit 2 is given below.

  • Program Example for External Interrupt Circuit 2
  • Processing specification

The external interrupt circuit 2 detects an "L" level signal input to the P00/INT20/AN4 pin and generates an interrupt.

  • Coding example

DDR0 EQU 0001H ; Address of the port data direction register ADEN EQU 0034H ; Address of the A/D enable register EIE2 EQU 0036H ; Address of the external interrupt 2 control register EIF2 EQU 0037H ; Address of the external interrupt 2 flag register

IF20 EQU EIF2:0 ; Definition of the external interrupt request flag bit

ILR3 EQU 007DH ; Address of the interrupt level setting register

INT_V DSEG ABS ; [DATA SEGMENT] ORG 0FFE6H IRQA DW WARI ; Interrupt vector setting INT_V ENDS

; Main program CSEG ; [CODE SEGMENT] ; Stack pointer (SP) is assumed to have been initialized. : ; CLRI ; Disable interrupts. CLRB IF20 ; Clear external interrupt request flag. MOV ILR2,#11111110B ; Set interrupt level to 2.

MOV DDR0,#00000000B ; Set pin INT20/AN4 to serve inputs only.

MOV ADEN,#00000000B ; Set pin INT20/AN4 to enable external interrupt inputs.

MOV EIE2,#00000001B ; Enable external interrupt inputs to pin INT20/AN4. SETI ; Enable interrupts. : ; Interrupt processing routine

WARI MOV EIE2,#00000000B ; Disable external interrupt inputs to pin INT20/AN4. CLRB IF20 ; Clear external interrupt request flag.

Page 273 of the Fujitsu MB89202 user manual — END
Page 273 · click to enlarge
Page 273

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

PUSHW A XCHW A,T PUSHW A : User processing : POPW A XCHW A,T POPW A RETI ENDS ;

END

Page 274 of the Fujitsu MB89202 user manual — CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)
Page 274 · click to enlarge
Page 274

CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)

Page 275 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 275 · click to enlarge
Page 275

CHAPTER 12 A/D CONVERTER

This chapter describes the functions and operations of the A/D converter.

12.1 Overview of A/D Converter

12.2 Configuration of A/D Converter

12.3 Pins of A/D Converter

12.4 Registers of A/D Converter

12.5 Interrupt of A/D Converter

12.6 Operations of A/D Converter Functions

12.7 Notes on Using A/D Converter

12.8 Program Example for A/D Converter

Page 276 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 276 · click to enlarge
Page 276

CHAPTER 12 A/D CONVERTER

12.1 Overview of A/D Converter

An A/D converter, which is of a 10-bit successive approximation type, selects an input signal from eight channel analog inputs. The A/D converter can be activated with software, an internal clock, or the output of an 8/16-bit capture timer/counter (16-bit mode).

  • A/D Conversion Functions

These functions convert the analog voltage (input voltage) input from an analog input to 10-bit digital values.

  • An analog input can be selected from eight channels.
  • The conversion speed is 38 instruction cycles (when the main clock oscillation frequency is 12.5 MHz, the speed is 12.2 µ s).
  • When A/D conversion is completed, an interrupt occurs.
  • Software can determine that the conversion has been completed.

To activate A/D conversion functions, follow one of the methods given below.

  • Activation with a software program.
  • Continuous activation through the output of a time-base timer (main clock oscillation frequency divided

by 28).

  • Continuous activation through the output of an 8/16-bit capture timer/counter (16-bit mode).
Page 277 of the Fujitsu MB89202 user manual — TO
Page 277 · click to enlarge
Page 277

CHAPTER 12 A/D CONVERTER

12.2 Configuration of A/D Converter

  • The A/D converter consists of the following nine blocks.
  • Clock selector (input clock selector for activation of A/D conversion)
  • Analog channel selector
  • Sample hold circuit
  • D/A converter
  • Comparator
  • Control circuit
  • A/D data register (ADDH and ADDL)
  • A/D control register 1 (ADC1)
  • A/D control register 2 (ADC2)
  • Block Diagram of the A/D Converter

Figure 12.2-1 Block Diagram of the A/D Converter

A/D control register 2 (ADC2)

RESV4 RESV3 ADCK ADIE RESV2 EXT RESV1

TO (output of an 8/16-bit timer)

(output of a time-base timer) 28/FCH Clock selector

P0 3 /INT2 3 /AN7 P02/INT22/AN6

P01/INT21/AN5 P00/INT20/AN4

Analog channel selector

Sample hold circuit

Comparator

P4 3 /AN 3 P42/AN2 P41/AN1 P40/AN0

Internal data bus

Control circuit

A/D data register

(ADDH,ADDL)

ANS2 ANS1 ANS0 ADI ADMV RESV0 AD

A/D control register 1 (ADC1)

IRQ 8

: Output of an 8/16-bit capture timer/counter : Oscillation

TO

F CH

D/A converter

Page 278 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 278 · click to enlarge
Page 278

CHAPTER 12 A/D CONVERTER

  • Clock selector

The clock selector selects the clock to be used to activate A/D conversion while continuous activation is enabled (ADC2: EXT = 1).

  • Analog channel selector

This circuit selects one out of the eight analog inputs.

  • Sample hold circuit

This circuit holds the input voltage selected by the analog channel selector. By performing the sample hold of the voltage input immediately after the activation of A/D conversion, A/D conversion can be performed without the variance of the input voltage affecting it during A/D conversion (during comparison).

  • D/A converter

This generates the voltage that corresponds to the values set in the ADDH and ADDL registers.

  • Comparator

This compares the input voltage for which sample hold is performed, with the output voltage of the D/A converter to determine which is the greater of the two.

  • Control circuit

The control circuit has the following function.

  • For A/D conversion functions, this circuit determines the values in turn from the MSB in the 10-bit A/D data register toward the LSB based on the large and small signals from the comparator. When the conversion is completed, it sets the interrupt request flag bit (ADC1: ADI).
  • A/D data register (ADDH and ADDL)

The high-order 2 bits of 10-bit A/D data are stored in the ADDH register. The low-order 8 bits of 10-bit A/D data are stored in the ADDL register.

The ADDH and ADDL registers have the following function.

  • For A/D conversion function, these registers store the results of A/D conversion.
  • A/D control register 1 (ADC1)

This register is used to enable and disable functions, select an analog input, check statuses, and control interrupts.

  • A/D control register 2 (ADC2)

This register is used to select an input clock, enable and disable interrupts, select functions, and perform other activities.

  • Interrupts of the A/D converter

When the set conditions are satisfied at the completion of A/D conversion for IRQ8, if an interrupt request output is enabled (ADC2: ADIE = 1), an interrupt request occurs.

Page 279 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 279 · click to enlarge
Page 279

CHAPTER 12 A/D CONVERTER

12.3 Pins of A/D Converter

This section describes the pins related to the A/D converter and shows a block diagram of the pins related to the A/D converter.

  • Pins Related to the A/D Converter

The pins related to the A/D converter are P03/INT23/AN7 to P00/INT20/AN4, and P43/AN3 to P40/AN0 pins.

  • P03/INT23/AN7 to P00/INT20/AN4 and P43/AN3 to P40/AN0

P03/INT23/AN7 to P00/INT20/AN4, and P43/AN3 to P40/AN0 pins can be used as general-purpose I/O ports (P03 to P00, and P43 to P40) and as analog inputs (AN7 to AN0).

When A/D conversion functions are used, input the analog voltage to be converted to these pins. To enable a pin as the analog input, set "1" to the bit that corresponds to the A/D enable register (ADEN), set "0" to the bit that corresponds to the port data direction register (DDR0), and switch the output transistor to OFF, and select one using the bit for selecting an analog input channel (ADC1: ANS0 to ANS2). Even when the A/D converter is used, pins not used as analog inputs can be used as general- purpose I/O ports.

[AN7 to AN0]

Page 280 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 280 · click to enlarge
Page 280

CHAPTER 12 A/D CONVERTER

  • Block Diagram of the Pins Related to the A/D Converter

Figure 12.3-1 Block Diagram of P03/INT23/AN7 to P00/INT20/AN4 Pins

Fujitsu MB89202 — CHAPTER 12 A/D CONVERTER diagram (page 280)
Fig. 41

A/D converter enable bit (only P00 to P03) To the A/D converter analog input To an external interrupt

From disabling an external interrupt PDR read

Pull-up resistor

Output latch PDR write

SPL: Pin status setting bit of the standby control register (STBC)

Figure 12.3-2 Block Diagram of P43/AN3 to P40/AN0 Pins

Fujitsu MB89202 — CHAPTER 12 A/D CONVERTER diagram (page 280)
Fig. 42

A/D converter enable bit To the A/D converter analog input

Output latch PDR write Pins

Stop mode (SPL = 1) DDR read

Page 281 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 281 · click to enlarge
Page 281

CHAPTER 12 A/D CONVERTER

12.4 Registers of A/D Converter

Figure 12.4-1 shows the registers related to the A/D converter.

  • Registers Related to the A/D Converter

Figure 12.4-1 Registers Related to the A/D Converter

ADC1 (A/D control register 1)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0030H ANS2 ANS1 ANS0 ADI ADMV RESV0 AD -0000000B R/W R R/W R/W

ADC2 (A/D control register 2)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0031H RESV4 RESV3 ADCK ADIE RESV2 EXT RESV1 -0000001B R/W

ADDH (A/D data register H)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0032H XXB R R

ADDL (A/D data register L)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0033H XXXXXXXXB R

ADEN (A/D enable register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0034H ADE7 ADE6 ADE5 ADE4 ADE3 ADE2 ADE1 ADE0 00000000B R/W

R/WReadable/Writable
RRead only : Unused X : Undefined
Show 9 more labels / short text on this page
Address Initial value · Address · Initial value · Address · Initial value · Address · Initial value · Address · Initial value
Page 282 of the Fujitsu MB89202 user manual — ANS2 ANS1 ANS0
Page 282 · click to enlarge
Page 282

CHAPTER 12 A/D CONVERTER

12.4.1 A/D Control Register 1 (ADC1)

A/D control register 1 (ADC1) is used to set the enabling and disabling functions of the A/D converter, select an analog input, and check the status.

  • A/D Control Register 1 (ADC1)

Figure 12.4-2 A/D Control Register 1 (ADC1)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0030H ANS2 ANS1 ANS0 ADI ADMV RESV0 AD -0000000B

R/W R R/W R/W

A/D conversion activation bit This bit is enabled only when software is activated (ADC2: EXT = 0). Always 0 for at reading.

AD

A/D conversion functions are not activated. A/D conversion functions are activated.

RESV0

Not changed. This does not affect others.

Not changed. This does not affect others.

ADMV

Not during conversion.

During conversion.

Interrupt request flag bit

ADI

During read During write

Conversion has not been completed. This bit is cleared.

Conversion has been completed.

Not changed. This does not affect others.

ANS2 ANS1 ANS0

Analog input channel selection bits

AN0 pin (P40/AN0) AN1 pin (P41/AN1)

AN3 pin (P43/AN3) AN4 pin (P00/INT20/AN4)

AN6 pin (P02/INT22 /AN6) AN7 pin (P03/INT23 /AN7)

R/WReadable/Writable
RRead only : Initial value
Show 5 more labels / short text on this page
Address Initial value · Reserved bit · Converting flag bit · AN2 pin (P42/AN2) · AN5 pin (P01/INT21/AN5)
Page 283 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 283 · click to enlarge
Page 283

CHAPTER 12 A/D CONVERTER

Table 12.4-1 Explanation of Functions of Each Bit in the Bits in A/D Control Register 1 (ADC1)

  • bit7 Unused bit
  • The value during read is not determined.
  • Write does not affect operations.

This bit is used to select which pin to be used as an analog input from AN0 to AN7. When software is activated (ADC2: EXT = 0), this bit can be rewritten concurrently with the activation of A/D conversion (AD = 1). Note:

ANS2, ANS1, ANS0Analog input channel selection bits

Pins not used as analog inputs can be used as general-purpose ports.

  • When A/D conversion functions are enabled:
  • When A/D conversion is completed, "1" is set to this bit.
  • When this bit and the bit for enabling an interrupt request (ADC2: ADIE) are "1", an interrupt request is output.
  • At write, this bit is cleared with "0". When "1" is set to this bit, nothing is changed or affected by this.
ADIInterrupt request flag bit

This bit indicates that A/D conversion is being performed, when A/D conversion functions are enabled. During conversion (comparison), this bit is set to "1". Note:

bit2 ADMVConvertion flag bit

This bit is read-only. The written value is ignored and nothing is affected by the value.

bit1 RESV0Reserved bit
  • The value during read is not determined.
  • Write does not affect operations.
  • This bit is used to activate A/D conversion functions with software.
  • In the state where continuous activation is not performed (ADC2: EXT = 0), when "1" is set to this bit, A/D conversion functions are activated. Notes:
ADA/D conversion activation bit
  • Even if "0" is written to this bit, the operation of A/D conversion functions cannot be stopped. The read value is always "0".
  • During continuous activation, this bit is ignored.
Show 5 more labels / short text on this page
Bit name Function · bit6 · to bit4 · bit3 · bit0
Page 284 of the Fujitsu MB89202 user manual — RESV3 RESV4
Page 284 · click to enlarge
Page 284

CHAPTER 12 A/D CONVERTER

12.4.2 A/D Control Register 2 (ADC2)

A/D control register 2 (ADC2) is used to select an input clock, enable and disable an interrupt and continuous activation.

  • A/D Control Register 2 (ADC2)

Figure 12.4-3 A/D Control Register 2 (ADC2)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0031H RESV4 RESV3 ADCK ADIE RESV2 EXT RESV1 -0000001B R/W

RESV1

Be sure to write "1" to this bit.

Bit for enabling continuous activation

EXT

Enables activation by setting the AD bit in the ADC1 register. Enables continuous activation through the clock selected in the ADCK bit.

RESV2

Be sure to write "0" to this bit.

ADIE

Enabling an interrupt request bit

Disables the interrupt request output.

Enables the interrupt request output.

Selecting an input clock bit

ADCK

Enabled only at continuous activation (EXT = 1)

From the time-base timer output (28/FCH).

From the 8/16-bit capture timer/counter output (TO).

RESV3 RESV4

Be sure to write 00B to these bits.

R/WReadable/ Writable

: Unused : Initial value

Show 4 more labels / short text on this page
Address Initial value · Reserved bit · Reserved bit · Reserved bits
Page 285 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 285 · click to enlarge
Page 285

CHAPTER 12 A/D CONVERTER

Table 12.4-2 Explanation of Functions of Each Bit in A/D Control Register 2 (ADC2)

  • bit7 Unused bit
  • The value during read is not determined.
  • Write does not affect operations.
RESV4,RESV3Reserved bits
  • This bit is a reserved bit.
  • Be sure to write 00 B to these bits.
bit4 ADCKSelecting an input clock bit

This bit is used to select an input clock for activation of A/D conversion functions in the state where continuous activation is performed (EXT = 1). When this bit is "0", the internal clock with an oscillation frequency (selected using the output of a time-base timer) divided by 28 is selected. When "1", the output of an 8/16-bit capture timer/counter (TO: 16-bit mode) is selected.

ADIEEnabling an interrupt request bit

This bit is used to enable and disable the output of an interrupt to the CPU. When this bit and the interrupt request flag bit (ADC1: ADI) are "1", an interrupt request is output.

bit2 RESV2Reserved bit
  • This bit is a reserved bit.
  • Be sure to write "0" to this bit.

This bit is used to select whether the A/D conversion functions are to be activated with software or activated continuously in synchronization with an input clock. When this bit is "0", software activation with the bit for activating A/D conversion (ADC1: AD) is enabled. When "1", continuous activation on the rising edge of the clock selected using the bit for selecting an input clock (ADC2: ADCK) is enabled.

EXTBit for enabling continuous activation
bit0 RESV1Reserved bit
  • This bit is a reserved bit.
  • Be sure to write "1" to this bit.
Show 5 more labels / short text on this page
Bit name Function · bit6, · bit5 · bit3 · bit1
Page 286 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 286 · click to enlarge
Page 286

CHAPTER 12 A/D CONVERTER

12.4.3 A/D Data Register (ADDH and ADDL)

A/D data register (ADDH and ADDL) stores the results of A/D conversion at 10-bit A/D conversion. The high-order 2 bits of 10-bit data correspond to the ADDH register. The low-order 8 bits correspond to the ADDL register.

  • A/D Data Register (ADDH and ADDL)

Figure 12.4-4 shows the bit configuration of the A/D data registers.

Figure 12.4-4 A/D Data Registers (ADDH and ADDL)

ADDH (A/D data register H)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0032H XXB R R

ADDL (A/D data register L)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0033H XXXXXXXXB R

RRead only X : Undefined

Of the 10-bit A/D data, the high-order 2 bits correspond to bits 1 and 0 in the ADDH register. The low- order 8 bits correspond to bits 7 to 0 in the ADDL register.

  • When A/D conversion functions are enabled

When A/D conversion is activated, after about 38 instruction cycles, the data on the conversion results are fixed and stored to these registers. Therefore, after A/D conversion, read these registers (conversion results), write "0" to the ADI bit (bit3) in the ADC1 register until the next A/D conversion is completed, and clear the flags after A/D conversion. During A/D conversion, the values in these registers are not determined. When A/D conversion functions are enabled, these registers function as read-only registers.

Address Initial value · Address Initial value

Page 287 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 287 · click to enlarge
Page 287

CHAPTER 12 A/D CONVERTER

12.4.4 A/D Enable Register (ADEN)

The ADEN register is used to select the analog input port that corresponds to different pins. Writing "1" to an appropriate ADEN register bit enables analog input.

  • A/D Enable Register (ADEN)

Figure 12.4-5 shows the bit configuration of the A/D enable register.

Figure 12.4-5 A/D Enable Register (ADEN)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0034H ADE7 ADE6 ADE5 ADE4 ADE3 ADE2 ADE1 ADE0 00000000B R/W

ADE7 to ADE0 A/D input bits

Port input Analog input

R/WRe a d ab le/Writ ab le

: Initial value

An A/D input port can be used as a general-purpose I/O port.

The ADEN register is used to select the port that corresponds to the analog input.

Set "1" to the corresponding bit in the ADEN register for the port to be used for analog input. This prevents the DC pass when the middle level voltage is applied to the A/D input port.

When this register is to be used as the A/D input port, do not select the bit that indicates use of a pull-up resistor from the pull-up setting register.

Page 288 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 288 · click to enlarge
Page 288

CHAPTER 12 A/D CONVERTER

12.5 Interrupt of A/D Converter

A factor for an interrupt of the A/D converter is the following. • Completion of conversion when A/D conversion functions are enabled

  • Interrupt when A/D Conversion Functions are Enabled

When A/D conversion is completed, the interrupt request flag bit (ADC1: ADI) is set to "1". At this time, if the bit for enabling an interrupt request is enabled (ADC2: ADIE = 1), an interrupt request to the CPU (IRQ8) occurs. Write "0" to the ADI bit using the routine for interrupt handling to clear the interrupt request.

The ADI bit is set when A/D conversion is completed, irrespective of the value of the ADIE bit.

When the ADI bit is "1", if the ADIE bit is enabled (changed from "0" to "1"), an interrupt request occurs immediately.

  • Register and Vector Table Related to the Interrupt of the A/D Converter

Table 12.5-1 Register and Vector Table Related to the Interrupt of the A/D Converter

Register to set the interrupt level Address of the vector table

Register Bit to be set High order Low order

IRQ8 ILR3 (007DH) L81 (bit1) L80 (bit0) FFEAH FFEBH

See Section "3.4.2 Steps in the Interrupt Operation " for the interrupt operation.

Interrupt name

Page 289 of the Fujitsu MB89202 user manual — ADEN
Page 289 · click to enlarge
Page 289

CHAPTER 12 A/D CONVERTER

12.6 Operations of A/D Converter Functions

The A/D converter can be activated with software or activated continuously.

  • Activating the A/D Converter Functions
  • Software activation

To activate A/D conversion functions with software, set registers as shown in Figure 12.6-1 .

Figure 12.6-1 Setting A/D Conversion Functions (at Software Activation)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 ADC1 ANS2 ANS1 ANS0 ADI ADMV RESV0 AD

ADC2 RESV4 RESV3 ADCK ADIE RESV2 EXT RESV1 0 1

ADDH

The results of A/D conversion are stored.

ADDL

The results of A/D conversion are stored.

ADEN

: Used bit : Unused bit 1 : Set "1" 0 : Set "0" : Set "1" to an appropriate bit

When A/D conversion is activated, the operations of A/D conversion functions are started. In addition, even during conversion, A/D conversion functions can be reactivated.

  • Continuous activation

To activate A/D conversion functions continuously, set registers as shown in Figure 12.6-2 .

Page 290 of the Fujitsu MB89202 user manual — ADEN
Page 290 · click to enlarge
Page 290

CHAPTER 12 A/D CONVERTER

Figure 12.6-2 Setting A/D Conversion Functions (at Continuous Activation)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 ADC1 ANS2 ANS1 ANS0 ADI ADMV RESV0 AD

ADC2 RESV4 RESV3 ADCK ADIE RESV2 EXT RESV1 0 0 0 1 1

ADDH

The results of A/D conversion are stored.

ADDL

The results of A/D conversion are stored.

ADEN

: Used bit : Unused bit 1 : Set "1" 0 : Set "0" : Set "1" to an appropriate bit

When continuous activation is enabled, A/D conversion is activated on a rising edge of the selected input clock and the operations of A/D conversion functions are started. When continuous activation is disabled (ADC2: EXT = 0), continuous activation is stopped and activation with software is possible.

  • Operations of A/D Conversion Functions

The operations of the A/D converter are described here. It takes about 38 instruction cycles from activating A/D conversion to completing it.

1. When A/D conversion is activated, the conversion in-progress flag bit is set (ADC1: ADMV = 1), and the analog input set is connected to the sample hold circuit.
2. During about 16 instruction cycles, the voltage of the analog input is captured and held in the capacitor for internal sample hold. This voltage is held until A/D conversion has been completed.
3. The comparator compares the voltage captured and held in the capacitor for sample hold with the reference voltage for A/D conversion from the MSB to the LSB. The results are transferred to the ADDH and ADDL registers in turn.
4. When all the results have been transferred to the ADDH and ADDL registers, the conversion inprogress flag bit is cleared (ADC1: ADMV = 0), and the interrupt request flag bit is set (ADC1: ADI = 1).
Page 291 of the Fujitsu MB89202 user manual — R C
Page 291 · click to enlarge
Page 291

CHAPTER 12 A/D CONVERTER

12.7 Notes on Using A/D Converter

This section describes notes on using the A/D converter.

  • Notes on Using the A/D Converter
  • Input impedance of the analog input

The A/D converter contains the sample hold circuit as shown in Figure 12.7-1 , captures the voltage of the analog input, and holds it in the capacitor for sample hold in about 16 instruction cycles, after activation of A/D conversion. Accordingly, when the output impedance of the external circuit of the analog input is high, the analog input voltage may not be stabilized during analog input sampling period. Therefore, set the output impedance of the external circuit to a sufficiently low level (lower than about 4 kΩ). If the output impedance of the external circuit cannot be set low, it is recommended that a capacitor with about 0.1 µF be added externally to the analog input.

Figure 12.7-1 Equivalent Circuit of Analog Input

MB89202/F202RA series Sample hold circuit

R C

Selecting an analog channel

After activation of A/D conversion, close 16 instruction cycles

  • Notes on setting using a program
  • When A/D conversion functions are enabled, the values in the ADDH and ADDL registers are held without being changed until the activation of A/D conversion. However, once A/D conversion is activated, the values in the ADDH and ADDL registers become undefined immediately.
  • When A/D conversion functions are enabled, do not reselect an analog input channel (ADC1: ANS3 to ANS0). Especially, during continuous activation, disable continuous activation (ADC2: EXT = 0), and wait for the conversion in-progress flag bit (ADC1: ADMV) to be "0" for reselection.
  • The A/D converter is stopped via a reset and activation of the stop mode, and all registers are initialized.
  • When the interrupt request flag bit (ADC1: ADI) is "1" and an interrupt request is enabled (ADC2: ADIE = 1), recovery from interrupt handling is no longer possible. Be sure to clear the ADI bit.

When A/D conversion is completed, if the next conversion is reactivated, the interrupt request flag bit (ADC1: ADI) is not set.

AN0 to AN7 · Converter

Page 292 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 292 · click to enlarge
Page 292

CHAPTER 12 A/D CONVERTER

  • Notes on interrupt requests

If A/D conversion is reactivated (ADC1: AD = 1) and terminated at the same time, the interrupt request flag bit (ADC1: ADI) is not set.

  • Conversion time

Changing the oscillation frequency or clock speed (gear functions) affects the conversion speed of A/D conversion functions.

  • Input clock of continuous activation

The output of an 8/16-bit capture timer/counter is affected by gear functions. The output of a time-base timer is not affected by gear functions. Clearing a time-base timer affects cycles.

Since the output of an 8/16-bit capture timer/counter is the output of the 16-bit mode, the 8-bit mode cannot be used.

Page 293 of the Fujitsu MB89202 user manual — CHAPTER 12 A/D CONVERTER
Page 293 · click to enlarge
Page 293

CHAPTER 12 A/D CONVERTER

12.8 Program Example for A/D Converter

This section shows a program example of the 10-bit A/D converter.

  • Program Example of the A/D Conversion Functions
  • Processing specifications

The analog voltage to be applied to the AN0 pin is converted to digital voltage through software activation.

In this example, completion of conversion is detected in a loop in the program without using interrupts.

  • Coding example

PDR4 EQU 000FH ; Address of port 4 data register 4 ADC1 EQU 0030H ; Address of A/D control register 1 ADC2 EQU 0031H ; Address of A/D control register 2 ADDH EQU 0032H ; Address of A/D data register H ADDL EQU 0033H ; Address of A/D data register L ADEN EQU 0034H ; Enables the A/D input pin. AN0 EQU PDR4:0 ; Defines the AN0 analog input. ADE0 EQU ADEN:0 ; Enables the AN0 analog input. ADI EQU ADC1:3 ; Defines the interrupt request flag bit. ADMV EQU ADC1:2 ; Defines the conversion in-progress flag bit. AD EQU ADC1:0 ; Defines the bit for activating A/D conversion (software

activation). EXT EQU ADC2:1 ; Defines the bit for enabling continuous activation. ; Main program

CSEG ; [CODE SEGMENT] : SETB AN0 ; Sets the P40/AN0 pin to the analog input. CLRI ; Disables interrupts. SETB ADE0 ; Enables the AN0 pin. CLRB EXT ; Disables continuous activation. AD_WAIT

BBS ADMV,AD_WAIT ; Loop for verifying that the A/D converter is stopped. MOV ADC1,#00000000B ; Selects analog input channel 0 (AN0), clears the

interrupt request flag, does not perform software activation. MOV ADC2,#00000001B ; Disables the interrupt request output, selects A/D

conversion functions, and selects software activation. SETI ; Enables interrupts. : SETB AD ; Activates software. AD_CONV

BBS ADMV,AD_CONV ; Loop for waiting for completion of A/D conversion

(at about 12.2 µs/12.5 MHz) CLRB ADI ; Clears the interrupt request flag.

Page 294 of the Fujitsu MB89202 user manual — END
Page 294 · click to enlarge
Page 294

CHAPTER 12 A/D CONVERTER

MOV A,ADDL ; Reads A/D conversion data (low-order 8 bits). MOV A,ADDH ; Reads A/D conversion data (high-order 2 bits). : : ENDS ;

END

Page 295 of the Fujitsu MB89202 user manual — CHAPTER 13
Page 295 · click to enlarge
Page 295

CHAPTER 13

UART

This chapter describes the functions and operations of UART.

13.1 Overview of UART

13.2 Configuration of UART

13.3 Pins of UART

13.4 Registers of UART

13.5 Interrupt of UART

13.6 Operations of UART Functions

13.7 Program Example for UART

Page 296 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 296 · click to enlarge
Page 296

CHAPTER 13 UART

13.1 Overview of UART

UART is a general-purpose communication interface for serial data. UART allows variable-length serial data to be transferred synchronously or asynchronously with a clock. The transfer format is NRZ. The dedicated baud rate generator, external clock, or internal timer (8-bit PWM timer) settings determine the data transfer format.

  • Functions of UART

UART supports (serial I/O) functions for sending serial data to, or receiving serial data from a CPU or peripheral functions.

The full-duplex double-buffer enables bi-directional full-duplex communication.

  • Synchronous data transfer mode or asynchronous data transfer mode can be selected.
  • The internal baud rate generator allows one of 14 baud rates to be selected. Also, external clock input and 8-bit PWM timer output allow user-defined baud rates to be specified.
  • The length of data is variable. When no parity is used, 7 bits to 9 bits are available. When parity is used, 6 bits to 8 bits are available (Table 13.1-1 ).
  • The data transfer format is NRZ (Non Return to Zero).

Table 13.1-2 provides the transfer rates of the dedicated baud rate generator, and Table 13.1-3 provides the transfer rates of the external clock.

Table 13.1-1 UART Operating Modes

Synchronization mode Stop bit length Parity not used Parity used

0 7 bits 6 bits Synchronous/asynchronous 1 bit or 2 bits *

1 8 bits 7 bits Synchronous/asynchronous 1 bit or 2 bits *

2 8+1 bits - Synchronous/asynchronous 1 bit or 2 bits *

3 9 bits 8 bits Synchronous/asynchronous 1 bit or 2 bits *

*: Only one bit is allowed for the stop bit length when data is received. The second bit is ignored even if it is received.

Data length · Operating mode

Page 297 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 297 · click to enlarge
Page 297

CHAPTER 13 UART

  • Serial Switch

UART and 8-bit serial I/O use the same pins, thus they cannot be simultaneously used. The serial switch circuit needs be used to select either of them.

When UART is selected using the serial switch, P30/UCK/SCK is used as the UART serial clock I/O pin (UCK), P31/UO/SO is used as the UART data output pin (UO), and P32/UI/SI is used as the UART data input pin (UI).

In this chapter, the pin function switch and register functions are explained on the presupposition that UART is selected using the serial switch circuit.

  • Choice of the Transfer Clock Rate

Figure 13.1-1 Baud Rate Generator and Serial Clock Generator

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 297)
Fig. 43

SMDE CS1, CS0 CR

When RC2 and RC1 = 1, the divider is 1 even in asynchronous mode.

t IN S TIn s tr u ction cycle
  • Example of the baud rates selectable when the dedicated baud rate generator is used

Table 13.1-2 lists the baud rates selectable when the dedicated baud rate generator is used.

Table 13.1-2 Transfer Cycles and Transfer Rates Available for the Dedicated Baud Rate Generator

(when FCH = 12.5 MHz)

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 297)
Fig. 44

0 0 0 1(0) 83/12019 0.8/1.25M 33/30048 0.32/3.1M 0 0 1 2(1) 166/6010 1.6/625k 67/15024 0.64/1.6M 0 1 0 4(2) 333/3005 3.2/313k 133/7512 1.28/781k 0 1 1 8(3) 666/1503 6.4/156k 266/3756 2.56/391k 1 0 0 16(4) 1331/751 12.8/78k 532/1878 5.12/195k 1 0 1 32(5) 2662/375 25.6/39k 1065/939 10.24/98k 1 1 0 2(1) 13/78125 1.6/625k 5.12/195k 0.64/1.6M 16(4) 102/9766 12.8/78k 41/24k 5.12/195k

Page 298 of the Fujitsu MB89202 user manual — (PR2,PR1,PR0)
Page 298 · click to enlarge
Page 298

CHAPTER 13 UART

Figure 13.1-2 Example of Calculating the Baud Rate

Synchronous/ asynchronous mode selected

Clock gear selected 4/FCH, 8/FCH 16/FCH, 64/FCH

(PR2,PR1,PR0)

(RC2,RC1,RC0)

(CR)

Value of baud rate

(SMDE) Divided by 1 or 13 Note: When RC2 is 1 and RC1 is 1, the divider is 1.

Divided by 1, 2, 2.5, 3, 4, or 5

Divided by 1, 2, 4, 8, 16, or 32

Divided by 1, or 8

The baud rate is specified using the clock gear register (CS1 and CS0), clock divider registers (PR2, PR1, and PR0), or baud rate selection registers (RC2, RC1, and RC0). For the example of calculating the baud rate, see Table 13.1-2 .

  • Asynchronous transfer mode

1/12019bps= 0.8 µs{4/FCH × 2.5(PR2=0,PR1=1,PR0=0)} × 1(CS1=CS0=1) ×

8(asynchronous) × 1(RC2=RC1=RC0=0) × 13(asynchronous)

  • Synchronous transfer mode

1/1.25Mbps = 0.8 µs{4/FCH × 2.5(PR2=0,PR1=1,PR0=0)} × 1(CS1=CS0=1) ×

1(synchronous) × 1(RC2=RC1=RC0=0) × 1(synchronous)

Table 13.1-3 provides an example of the baud rates selectable when an external clock is used.

Table 13.1-3 Transfer Cycles and Transfer Rates Selectable for an External Clock

Asynchronous transfer mode Synchronous transfer mode

rate Transfer cycle Transfer rate

baud rate Transfer cycle Transfer rate

CR=0 16 256/FCH or more 48828 or less 1 16/FCH or more 781 k or less CR=1 64 1024/FCH or more 12207 or less

*: The minimum value of FCH specified for 12.5 MHz is external clock cycle 16/FCH = 1.28 µs. FCH: Oscillation frequency

Figure 13.1-3 Example of Calculating the Baud Rate (when an External Clock is Selected)

1 External clock input CR CR=0 16 64 CR=1

Value of baud rate

(min8 /F CH 2)
F CHO s cill a tion fre qu ency
Show 8 more labels / short text on this page
Clock divider selected · Baud rate selected · Clock rate · 1 = · Divider for baud · Divider for · (bps) * · (bps) *
Page 299 of the Fujitsu MB89202 user manual — CR=1:64 1
Page 299 · click to enlarge
Page 299

CHAPTER 13 UART

Table 13.1-4 provides an example of the baud rates selectable when the 8-bit PWM timer is used.

Table 13.1-4 Transfer Cycles and Transfer Rates Selectable for the 8-bit PWM Timer

Asynchronous transfer mode Synchronous transfer mode

PWM timer count clock

Divider for clock Transfer rate (bps) Divider for

clock Transfer rate (bps)

1tINST CR=0 16 97656 to 763 2 781k to 6.1k CR=1 64 24414 to 191

16tINST CR=0 16 6103 to 47.8 2 48828 to 381.5 CR=1 64 1526 to 11.9

64tINST CR=0 16 1526 to 11.9 2 12207 to 95.4 CR=1 64 381.5 to 3

CR=0 16 48828 to 381.5 2 391k to 3k CR=1 64 12207 to 95.4

tINST: Instruction cycle The system clock control register (SYCC) selects the maximum clock speed (CS1 and CS0 = 11B, 1 instruction cycle = 4/FCH) in active mode.

Figure 13.1-4 shows an example of calculating the baud rate when the PWM timer is selected.

Figure 13.1-4 Example of Calculating the Baud Rate (when the PWM Timer is Selected)

Input clock select bit

(COMP)

64/F CH 16/F CH 8/F CH 4/F CH

1(P1=0,P0=0) 16(P1=0,P0=1) 64(P1=1,P0=0) 8/16 timer (P1=1,P0=1)

CR=1:64 1

= 2 CR CR=0:16

Value specified in the compare register + 1

Value of baud rate

The value of the baud rate is determined by the clock input specified in the clock dividing rate register (CS1 and CS0). The clock input is determined with an external clock (PWM timer). For calculation, see Table 13.1-3 and Table 13.1-4 .

  • When an external clock is selected (F CH = 12.5 MHz)

1/49kbps=1.28 µs (min.) × 16 (CR=0)

  • When the PWM timer is selected (F CH = 12.5 MHz)

1/98kbps=0.32 µs (4/FCH) × 1 (P1=0,P0=0) × 1 (COMR=0) × 2 × 16 (CR=0)

1/24414 bps=0.32 µs (4/FCH) × 1 (P1=0,P0=0) × 1 (COMR=0) × 2 × 64 (CR=1)

Show 4 more labels / short text on this page
cycle · 8/16-bit capture timer/counter · Clock gear selected · (PWM) Compare register
Page 300 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 300 · click to enlarge
Page 300

CHAPTER 13 UART

13.2 Configuration of UART

  • UART consists of the following ten registers and components:
  • Serial mode control register (SMC)
  • Serial rate control register (SRC)
  • Serial status and data register (SSD)
  • Serial input data register (SIDR)
  • Serial output data register (SODR)
  • Baud rate generator
  • Reception control circuit
  • Transmission control circuit
  • Clock divider selection register (UPC)
  • UART prescaler
  • Block Diagram of UART

Figure 13.2-1 Block Diagram of UART

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 300)
Fig. 45

Register Register Completion of receipt of one byte

Page 301 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 301 · click to enlarge
Page 301

CHAPTER 13 UART

  • Serial mode control register (SMC)

The SMC register controls UART operating mode. This register specifies the parity setting, stop bit length, operating mode (data length), and synchronous/asynchronous mode, and enables/disables UART serial clock output and serial data output.

  • Serial rate control register (SRC)

The SRC register controls the UART data transfer speed (baud rate). This register selects the input clock and specifies the transfer rate to be applied when the baud rate generator is used.

  • Serial status and data register (SSD)

The SSD register indicates UART transmitting/receiving status, status in an error, parity received, or data received at bit8. This register also enables/disables interrupts or specifies and confirms parity transmitted or data transmitted with bit8.

  • Serial input data register (SIDR)

The SIDR register stores received data. Serial input is converted, then stored into this register. However, the most significant bit of 9-bit data is stored in the SSD RD8/RP bit.

  • Serial output data register (SODR)

The SODR register specifies data to be transmitted. Data written into this register is converted to serial format, then output. The most significant bit of 9-bit data is set in the SSD TD8/TP bit.

  • Clock generator

The clock generator generates the transmit/receive clock in accordance with the dedicated baud rate generator, external clock, and 8-bit PWM timer output.

  • Reception control circuit

The reception control circuit consists of the received byte counter, start bit detection circuit, and received parity handling circuit.

The received byte counter takes count of received data. When a unit of data that corresponds to the specified data length is fully received, an interrupt request is generated.

The start bit detection circuit detects start bits in serial input signals. When the start bit detection circuit detects a start bit, it writes data into the SIDR with shifts in accordance with the transfer rate.

When parity is used, the received parity handling circuit stores the parity bit in the data received. It also stores the most significant bit of 9-bit data received.

  • Transmission control circuit

The transmission control circuit consists of the transmitted byte counter and transmitted parity handling circuit.

The transmitted byte counter takes count of data to be transmitted. When a unit of data that corresponds to the specified data length is fully transmitted, an interrupt request is generated.

When parity is used, the transmitted parity handling circuit generates a parity bit for the data to be transmitted. It sets the most significant bit for data transmitted when it is made up of 9 bits.

Page 302 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 302 · click to enlarge
Page 302

CHAPTER 13 UART

  • UART interrupt sources

When data with the specified length is correctly received or when the overrun error or framing error occurs while data is being received, the reception interrupt request (IRQ6) is generated if the reception interrupt request is enabled (SSD: RIE = 1).

When data to be transmitted is written into the SODR register, sent to the internal shift register, and the next data then becomes writable, the transmission interrupt request (IRQ5) is generated if the transmission interrupt request is allowed (SSD: TIE = 1).

  • UART prescaler, baud rate generator, clock divider selection register

The clock input to the baud rate generator is changeable by switching the rate of division using the clock divider selection registers.

[Reception] · [Transmission]

Page 303 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 303 · click to enlarge
Page 303

CHAPTER 13 UART

13.3 Pins of UART

Pins relating to UART are the clock I/O pin (P30/UCK/SCK), serial data output pin (P31/UO/SO), and serial data input pin (P32/UI/SI).

  • UART Relating Pins
  • P30/UCK/SCK

This pin functions as the general-purpose I/O port (P30), UART clock I/O pin (UCK), or 8-bit serial clock I/O pin (SCK). When clock output is enabled (SMC: SCKE = 1), this pin functions as the UART clock output pin (UCK) regardless of the value in the corresponding port direction register. When this pin functions as the UART clock, do not use any external clock (SRC: CS1 and CS0 must be other than 00B).

When using this pin as the UART clock input pin, disable clock output (SMC: SCKE = 0) and set it as the input port using the corresponding port direction register (DDR3: bit0 = 0). In this case, be sure to select the external clock (SRC: CS1 and CS0 = 00B).

  • P31/UO/SO

This port functions as the general-purpose I/O port (P31), UART serial data output pin (UO), or 8-bit serial data output pin (SO). When serial data output is enabled (SMC: SOE = 1), this pin functions as the UART serial data output pin (UO) regardless of the value in the corresponding port direction register.

  • P32/UI/SI

This port functions as the general-purpose I/O port (P32), UART serial data input pin (UI), or 8-bit serial data input pin (SI). When using this pin as the UART serial data input pin, set this pin as the input port by using the corresponding port direction register (DDR3: bit2 = 0).

Page 304 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 304 · click to enlarge
Page 304

CHAPTER 13 UART

  • Block Diagram of the UART-relating Pins

Figure 13.3-1 Block Diagram of UART-relating Pins

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 304)
Fig. 46

Resource output

Resource output enable

Pull-up resistor

Resource output allowed

P30/UCK/SCK P31/UO/SO

When use of the pull-up resistor is selected in the pull-up setting register, the pin status does not become Hi-Z but "H" level (pull-up state) in stop mode (SPL = 1). However, the pull-up resistor is not applied during reset; accordingly, the pin status becomes Hi-Z.

Page 305 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 305 · click to enlarge
Page 305

CHAPTER 13 UART

13.4 Registers of UART

Figure 13.4-1 shows the UART-relating registers.

  • UART-relating Registers

Figure 13.4-1 UART-relating Registers

SMC (serial mode control register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0028H PEN SBL MC1 MC0 SMDE SCKE SOE 00000-00B R/W

SRC (serial rate control register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0029H CR CS1 CS0 RC2 RC1 RC0 --011000B R/W

SSD (serial status and data register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 002AH RDRF ORFE TDRE TIE RIE TD8/TP RD8/RP 00100-1XB R R R/W R

SIDR (serial input data register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 002BH XXXXXXXXB R

SODR (serial output data register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 002BH XXXXXXXXB W

UPC (clock divider selection register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 002CH PREN PR2 PR1 PR0 0010B R/W

SSEL (serial switch register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 003BH SSEL 0B R/W R/W : Readable/Writable R : Read only W : Write only : Unused X : Undefined

Show 13 more labels / short text on this page
Address · Initial value · Address · Initial value · Address · Initial value · Address · Initial value · Address · Initial value · Address · Initial value · Address
Page 306 of the Fujitsu MB89202 user manual — PEN
Page 306 · click to enlarge
Page 306

CHAPTER 13 UART

13.4.1 Serial Mode Control Register (SMC)

The serial mode control register (SMC) specifies the parity setting, stop bit length, operating mode (data length), and synchronous/asynchronous mode, and enables/ disables UART serial clock output and serial data output.

  • Serial Mode Control Register (SMC)

Figure 13.4-2 Serial Mode Control Register (SMC)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0028H PEN SBL MC1 MC0 SMDE SCKE SOE 00000-00B

R/W

S OE

Serial data output enable bit

General-purpose port or 8-bit serial I/O data output pin

UART serial data output pin

S CKE

Clock output enable bit

General-purpose port or clock input pin for UART/8-bit serial I/O

UART clock output pin

S MDE

Synchronization mode selection bit

Synchronous transfer mode

Asynchronous transfer mode

Operating mode selection bits

MC1 MC0

Operating mode

D a t a writtenWitho u t p a rity (PEN = 0)

With parity (PEN = 1)

0 0 0 7 bits 6 bits

0 1 1 8 bits 7 bits

1 0 2 8+1 bits

1 1 3 9 bits 8 bits

S BL

Stop bit length selection bit

2 bits

PEN

Parity enable bit

Parity disabled

Parity enabled (TD8/TP in the SSD register allows choice of even/odd.)

R/WRe a d ab le/Writ ab le

: Unused

: Initial value

1 bit

Page 307 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 307 · click to enlarge
Page 307

CHAPTER 13 UART

Table 13.4-1 Explanation of Functions of Each Bit in the Serial Mode Control Register (SMC)

bit7 PENParity enable bit

This bit selects whether the parity bit is to be added (at transmission) and detected (at reception) when serial data is input/output.

This bit selects the stop bit length for data to be transmitted. Note:

bit6 SBLStop bit length selection bit

When data is received, only the first bit of stop bits is detected and the second and later bits are ignored.

  • These bits specify operating mode (data length).
  • There are 7 types of data length selectable in combination with a parity bit.
MC1, MC0Operating mode selection bits
SMDESynchronization mode selection bit
  • This bit specifies synchronous transfer or asynchronous transfer mode.
  • When this bit is "0", synchronous transfer mode is set. When this is "1", asynchronous transfer mode is set.
  • bit2 Unused bit
  • The value read out from this bit is undefined.
  • Writing a value into this bit does not affect any operations.
  • This bit controls I/O of the serial clock.
  • When this bit is "0", P30/UCK/SCK pin functions as the serial clock input pin. When this bit is "1", it functions as the serial clock output pin. Notes:
  • When the UCK pin functions as the serial clock input pin (SCKE = 0), set the P30/UCK/SCK pin as the input port. Also, select the external clock using the clock input selection bit (SRC: CS1 and CS0 = 00 B ).
  • When the UCK pin is set as the serial clock output pin (SCKE = 1), select a clock other than the external clock (SRC: CS1 and CS0 must not be 00 B ). Note:
bit1 SCKEClock output enable bit

When the UCK pin is specified as the serial clock output (SCKE = 1), it functions as the UCK output pin regardless of the state of the general- purpose port (P30).

When this bit is "0", the P31/UO/SO pin functions as a general-purpose port (P31). When this bit is "1", it functions as the serial data output pin (UO). Note:

bit0 SOESerial data output enable bit

When serial data output is enabled (SOE = 1), the pin functions as the UO pin regardless of the state of the general-purpose port (P31).

Show 4 more labels / short text on this page
Bit name Description · bit5, · bit4 · bit3
Page 308 of the Fujitsu MB89202 user manual — R/W
Page 308 · click to enlarge
Page 308

CHAPTER 13 UART

13.4.2 Serial Rate Control Register (SRC)

The serial rate control register (SRC) controls the data transfer rate (baud rate) in asynchronous transfer mode. The SRC selects the input clock and sets the transfer rate for the dedicated baud rate generator.

  • Serial Rate Control Register (SRC)

Figure 13.4-3 Serial Rate Control Register (SRC)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0029H CR CS1 CS0 RC2 RC1 RC0 --011000B R/W

Baud rate selection bits

RC2 RC1 RC0

Asynchronous (µs/baud) Synchronous (µs/baud)

0 0 0 83 /12019 0. 8 /1.25M

0 0 1 166/6010 1.6/625k

0 1 0 333/3005 3.2/313k

0 1 1 666/1503 6.4/156k

1 0 0 1331/751 12.8/78k

1 0 1 2662/375 25.6/39k

1 1 0 13/78125 1.6/625k

102/9766 12.8/78k

Clock input selection bits

C S 1 C S 0

Clock input CR bit Clock frequency divider Asynchronous Synchronous

0 16 0 0 1 64 1

External clock

0 16 0 1 1 64 2

PWM timer output

0 1 1 1 8 1

Dedicated baud rate generator

Clock rate input selection bit

CR

Effective only in asynchronous transfer mode (SMC: SMDE = 1)*

1/16 of the clock input

1/64 of the clock input

R/W

However, when the dedicated baud rate generator is used (CS1 and CS0 = 11B), it is fixed at 1/8. * : : Readable/Writable

: Initial value : Unused

Unused

Page 309 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 309 · click to enlarge
Page 309

CHAPTER 13 UART

Table 13.4-2 Explanation of Functions of Each Bit in the Serial Rate Control Register (SRC)

  • bit6 Unused bits
  • The values read out from these bits are undefined.
  • Writing values to these bits does not affect any operations.
  • This bit selects the clock rate in asynchronous transfer mode. However, when the dedicated baud rate generator is used (CS1 and CS0 = 11 B ), it is fixed at 1/8 regardless of the value in the CR bit. Specifying an external clock or 8-bit PWM timer output as the clock input, the baud rate is set to 1/16 or 1/64 of the corresponding clock frequency, depending on the CR value.
  • This bit is not significant in synchronous transfer mode.
CRClock rate input selection bit
CS1,CS0Clock input selection bits
  • These bits select the clock input.
  • The clock input can be an external clock (UCK pin), 8-bit PWM timer, or dedicated baud rate generator.
  • There are 8 types of baud rate in asynchronous transfer mode and 6 types of baud rate in synchronous transfer mode: 14 types of baud rate are selectable in total.
  • These bits are effective only when the dedicated baud rate generator is used for the clock input. These bits are not significant when an external clock or 8-bit PWM timer output is used.
RC2,RC1,RC0Baud rate selection bits
Show 7 more labels / short text on this page
Bit name Description · bit7, · bit5 · bit4, · bit3 · bit2 · to bit0
Page 310 of the Fujitsu MB89202 user manual — R/W
Page 310 · click to enlarge
Page 310

CHAPTER 13 UART

13.4.3 Serial Status and Data Register (SSD)

The serial status and data register (SSD) controls data transmission/reception of UART and status in an error, enables/disables interrupts, and specifies and checks settings for parity or bit-8 transmitting data.

  • Serial Status and Data Register (SSD)

Figure 13.4-4 Serial Status and Data Register (SSD)

Address Initial value

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

002AH RDRF ORFE TDRE TIE RIE TD8/TP RD8/RP 00100-1XB R R R/W R

Bit-8 receiving data/parity bit

RD 8 /

Parity used Parity not used (SMC: PEN = 1) (SMC: PEN = 0)

RP

Detects odd parity.

Bit-8 receiving data*

Detects even parity.

Bit-8 transmitting data/parity bit

TD 8 /

Parity used (SMC: PEN = 1)

Parity not used (SMC: PEN = 0)

TP

Adds odd parity.

Sets bit-8 transmitting data.*

Adds even parity.

RIE

Reception interrupt request enable bit

Disables output of reception interrupt requests.

Enables output of reception interrupt requests.

TIE

Transmission interrupt request enable bit Disables output of transmission interrupt requests.

Enables output of transmission interrupt requests.

TDRE

Transmitted data flag bit

Data to be transmitted included

Data to be transmitted not included

RDRFORFE

Received data flag bit/Overrun/Framing error flag bit

No data

Framing error

Normal data

Overrun error (previous data remaining) : Readable/Writable : Read only : Unused : Undefined : Initial value : Effective only when data length is 9 bits (SMC: MC1 and MC0 = 10B and 11B, operating mode is 2 or 3.) *

R/W

R

Page 311 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 311 · click to enlarge
Page 311

CHAPTER 13 UART

Table 13.4-3 Explanation of Functions of Each Bit in the Serial Status and Data Register (SSD)

  • This bit indicates the state of serial input data register (SIDR).
  • When this bit is "1", reading the SSD register, then the SIDR register clears RDRF.
  • When this bit and reception interrupt request enable bit (RIE) are "1", the reception interrupt request is output.
  • This bit is intended only for read. Writing a value into this bit has no significance and does not affect any operation.
bit7 RDRFReceived data flag bit
  • This bit indicates that the overrun or framing error occurs.
  • When an error occurs (ORFE = 1), no data is transferred from the reception shift register to the SIDR register. Therefore, when an error occurs, the RDRF bit is not set. When this bit is "1", reading the SSD register then SIDR register clears the ORFE bit with "0".
  • When this bit and reception interrupt request enable bit (RIE) are "1", the reception interrupt request is output.
  • This bit is intended only for read. Writing a value into this bit has no significance and does not affect any operation.
ORFEOverrun/Framing error flag bit
  • This bit indicates the state of serial output data register (SODR).
  • When this bit is "1", reading the SSD register and writing data into the SODR register output the data to the serial data output pin (UO).
  • When this bit and transmission interrupt request enable bit (TIE) are "1", the transmission interrupt request is output.
TDRETransmitted data flag bit
TIETransmission interrupt request enable bit
  • This bit enables or disables the transmission interrupt request to the CPU.
  • When this bit and transmission data flag bit (TDRE) are "1", the transmission interrupt request is output.
  • This bit enables or disables the reception interrupt request to the CPU.
  • When this bit and reception data flag bit (RDRF) are "1", the reception interrupt request is output.
  • When this bit and error flag bit (ORFE) are "1", the reception interrupt request for an error is output.
RIEReception interrupt request enable bit
  • bit2 Unused bit
  • The value read out from this bit is undefined.
  • Writing a value into this bit does not affect any operations.
  • When parity is not used and operating mode is 2 or 3 (the length of data to be transmitted/received is 9), this bit is handled as bit8 in the SODR register. When operating mode is not 2 or 3 and parity is not used, this bit is not significant.
  • When parity is used, this bit selects even parity or odd parity for the transmitted data.
TD8/TPBit-8 transmitting data/ parity bit
  • When parity is not used and operating mode is 2 or 3 (the length of data to be transmitted/received is 9), this bit is handled as bit8 in the SIDR register. When operating mode is not 2 or 3 and parity is not used, this bit is not significant.
  • When parity is used, this bit indicates the parity of received data.
RD8/RPBit-8 receiving data/ parity bit
Show 7 more labels / short text on this page
Bit name Description · bit6 · bit5 · bit4 · bit3 · bit1 · bit0
Page 312 of the Fujitsu MB89202 user manual — RDRF ORFE
Page 312 · click to enlarge
Page 312

CHAPTER 13 UART

  • Receiving Status

Figure 13.4-5 shows the states (receiving status) of serial input data obtained from the received data flag bit (RDRF) and error flag bit (ORFE).

Figure 13.4-5 Receiving Status

RDRF ORFE

Received data flag bit/Overrun/Framing error flag bit

No data Framing error

Overrun error (previous data remaining)

: Initial value

Normal data

Page 313 of the Fujitsu MB89202 user manual — 002B H XXXXXXXX B
Page 313 · click to enlarge
Page 313

CHAPTER 13 UART

13.4.4 Serial Input Data Register (SIDR)

The serial input data register (SIDR) is for inputting (receiving) serial data.

  • Serial Input Data Register (SIDR)

Figure 13.4-6 shows the configuration of the serial input data register bits.

Figure 13.4-6 Serial Input Data Register (SIDR)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

002B H XXXXXXXX B

R R R R R R R R

R X

: Read only : Undefined

The SIDR stores received data. The serial data input pin (UI pin) receives serial data signals, the shift register converts them, then this register stores them.

  • When operating mode is 0, 1, or 3

For both the RDRF (Received data flag bit) and ORFE (Overrun/framing error flag bit), these flags go on and an interrupt request to the CPU is generated when data is fully transmitted or received, then the stop bit at the end is detected. When the RDRF is active, the data received is transmitted to the SIDR.

When the received data is correctly stored in this register, "1" is set for the received data flag bit (RDRF). If the reception interrupt request is allowed, the reception interrupt is generated. When the RDRF bit has been checked in interrupt processing or the program and the received data has been stored into this register, read the contents in this register after reading the SSD register, then clear the RDRF flag.

  • When operating mode is 2

For both RDRF and ORFE, these flags go on when data is fully transmitted or received with the final data bit (D8) set to "1" and the stop bit at the end is detected. However, when the framing error occurs, the flag goes on regardless of the final data bit. An interrupt request to the CPU is generated when the flag goes on and the interrupt request is allowed.

Address Initial value

Page 314 of the Fujitsu MB89202 user manual — 002B H XXXXXXXX B
Page 314 · click to enlarge
Page 314

CHAPTER 13 UART

13.4.5 Serial Output Data Register (SODR)

The serial output data register (SODR) sends out (transmits) serial data.

  • Serial Output Data Register (SODR)

Figure 13.4-7 shows the configuration of the serial output data register bits.

Figure 13.4-7 Serial Output Data Register (SODR)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

002B H XXXXXXXX B

W W W W W W W W

W X

: Write only : Undefined

When transmission is enabled, writing data to be transmitted into this register after reading the SSD register sends the data to be transmitted to the transmission shift register, converts it into the serial format, then outputs it from the serial data output pin (UO pin).

When the transmitted data is written into the SODR register, the transmitted data flag bit is cleared with "0". After the transmitted data is sent to the transmission shift register, the transmitted data flag bit is set to "1", the data transmitted next then becomes writable. At this time, if the transmission interrupt request is enabled, an interrupt is generated. Write the data transmitted next when a transmission interrupt occurs or while the transmitted data flag bit is "1".

Address Initial value

Page 315 of the Fujitsu MB89202 user manual — PREN
Page 315 · click to enlarge
Page 315

CHAPTER 13 UART

13.4.6 Clock Divider Selection Register (UPC)

The clock divider selection register is used to generate the UART reference clock by dividing the oscillation frequency. It also enables/disables operation of the prescaler for creating the reference clock.

  • Clock Divider Selection Register (UPC)

Figure 13.4-8 Clock Divider Selection Register (UPC)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

002C H PREN PR2 PR1 PR0 0010 B

R/W R/W R/W R/W

Clock divider selection bits

PR2 PR1 PR0

Divides the clock by 1.

Divides the clock by 2. Divides the clock by 2.5.

Divides the clock by 3.

Divides the clock by 4.

Divides the clock by 5.

Do not specify this setting.

Do not specify this setting.

R/W

: Readable/Writable : Unused

PREN

UART prescaler operation enable bit Disables the prescaler operation.

: Initial value

Enables the prescaler operation.

Address Initial value · Divider

Page 316 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 316 · click to enlarge
Page 316

CHAPTER 13 UART

Table 13.4-4 Explanation of Functions of Each Bit in the Clock Divider Selection Register (UPC)

  • Unused bits
  • The values read out from these bits are undefined.
  • Writing values into these bits does not affect any operation.
  • Enables/disables operation of the prescaler that creates the UART reference clock by dividing the oscillation frequency.
  • When this bit is "1", the UART prescaler supplies the reference clock that corresponds to the frequency selected using the oscillation frequency selection bit to the baud rate generator. When this bit is "0", the prescaler does not operate, thus the internal baud rate generator cannot be used for data transfer or data receive purposes.
PRENUART prescaler operation enable bit
PR2, PR1, PR0Clock divider selection bits
  • The UART prescaler supplies to the internal baud rate generator, the reference clock that corresponds to the divider selected using these bits.

The inside of UART is initialized when it is in synchronization transfer mode, asynchronous transfer mode, external clock mode, or internal clock mode with the clock from the prescaler. Therefore, turn on the PREN bit (PREN = 1) to enable operation of the prescaler before using the UART functions.

Show 6 more labels / short text on this page
Bit name Description · bit7 · to bit4 · bit3 · bit2 · to bit0
Page 317 of the Fujitsu MB89202 user manual — SSEL
Page 317 · click to enlarge
Page 317

CHAPTER 13 UART

13.4.7 Serial Switch Register (SSEL)

The serial switch register (SSEL) switches the P30/UCK/SCK, P31/UO/SO, and P32/UI/SI pins between UART and 8-bit serial I/O.

  • Serial Switch Register (SSEL)

Figure 13.4-9 Serial Switch Register (SSEL)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

003B H SSEL 0 B R/W

Serial switch bit Sets UART. Sets 8-bit serial I/O. : Readable/Writable : Unused : Initial value

SSEL

R/W

Table 13.4-5 Description of the Serial Switch Register (SSEL) Bits

  • Unused bits
  • The values read out from these bits are undefined.
  • Writing values to these bits does not affect any operations.
bit0 SSELSerial switch bit
  • When this bit is "0", UART is used.
  • When this bit is "1", 8-bit serial I/O is used.
Show 4 more labels / short text on this page
Address Initial value · Bit name Description · bit7 · to bit1
Page 318 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 318 · click to enlarge
Page 318

CHAPTER 13 UART

Figure 13.4-10 Block Diagram of Serial Switch Register

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 318)
Fig. 47
Page 319 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 319 · click to enlarge
Page 319

CHAPTER 13 UART

13.5 Interrupt of UART

  • UART supports the interrupt-related error flag bit (ORFE), received data flag bit (RDRF), and transmitted data flag bit (TDRE), and the following interrupt sources:
  • When received data is sent from the reception shift register to the serial input data register (SIDR). (Reception interrupt)
  • When transmitted data is sent from the serial output data register (SODR) to the transmission shift register. (Transmission interrupt)
  • Transmission Interrupt

When the SSD register is read and the output data is written into the SODR register, the data written into the SODR register is transferred to the internal transmission shift register. When next data becomes writable, the TDRE bit is set to "1", then an interrupt request to the CPU (IRQ5) is generated if the transmission interrupt is enabled (SSD: TIE = 1).

  • Reception Interrupt
  • When operating mode is 0, 1, or 3

When data is correctly input up to the stop bit, the RDRF bit is set to "1". If an overrun error or framing error occurs, the ORFE bit is set to "1".

These bits are set when a stop bit is detected. If the reception interrupt is enabled (SSD: RIE = 1), an interrupt request to the CPU (IRQ6) is generated.

  • When operating mode is 2

For both RDRF and ORFE, data is received or transmitted with the final data bit (D8) set to "1", these flags go on when the stop bit at the end is detected. However, when the framing error occurs, the flag goes on regardless of the final data bit. An interrupt request to the CPU is generated when the flag goes on and the input data becomes "1".

  • UART Interrupt Related Registers and Vector Table Addresses

Table 13.5-1 provides the registers relating to the UART interrupts and vector table addresses. For details of the interrupt operation, see Section "3.4.2 Steps in the Interrupt Operation ".

Table 13.5-1 UART Interrupt Related Registers and Vector Table Addresses

Interrupt level setting register Vector table address

Register Bit Upper digits Lower digits

IRQ5 ILR2 (007CH) L51 (bit3) L50 (bit2) FFF0H FFF1H

IRQ6 ILR2 (007CH) L61 (bit5) L60 (bit4) FFEEH FFEFH

Interrupt name

Page 320 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 320 · click to enlarge
Page 320

CHAPTER 13 UART

13.6 Operations of UART Functions

UART supports four types of operating mode. Mode 0, mode 1, and mode 3 are general serial transfer mode in which any data length can be selected in the range of 6 bits with parity used, to 9 bits without parity used. (See Table 13.1-1 .)

  • Transferred Data Format

UART can handle data in the NRZ (Non Return to Zero) format only. Data to be transferred always begins with the start bit ("L" level), specified number of data bits are transferred with LSB first, then data transfer is ended with the stop bit ("H" level). Figure 13.6-1 shows the relationship between the transmit/receive clock and transferred/received data when operating mode 0 without parity used, two stop bits, synchronous transfer mode, and transferred data 01001101B (8 bits) are specified. Note that Figure 13.6-1 does not apply

to the relationship between the serial clock and serial I/O signal in asynchronous transfer mode.

Figure 13.6-1 Transferred Data Format

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 320)
Fig. 48
Page 321 of the Fujitsu MB89202 user manual — DDR 3
Page 321 · click to enlarge
Page 321

CHAPTER 13 UART

  • Theory of Operation for Operating Mode 0, 1, 2, and 3

In operating mode 0, 1, 2, or 3, UART operates as a general serial communication function. Figure 13.6-2 shows the settings required in UART operating mode 0, 1, 2, or 3.

Figure 13.6-2 Operating Mode 0, 1, 2, or 3

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

SMC PEN SBL MC1 MC0 SMDE SCKE SOE

SRC CR CS1 CS0 RC2 RC1 RC0

SSD RDRF ORFE TDRE TIE RIE TD8/TP RD8/RP

S IDR

Stores received data.

S ODR

Writes data to be transmitted.

DDR 3

SS EL SS EL

: Used bit

: Set "0"

* : For MC1 and MC0, set 00B in mode 0, 01B in mode 1, 10B in mode 2, and 11B in

mode 3.

* * · * · *

Page 322 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 322 · click to enlarge
Page 322

CHAPTER 13 UART

13.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)

When writing data to be transmitted into the SODR register after reading the SSD register sends the data written into the SODR register to the transmission shift register, parallel-serial conversion then starts. The data converted is output at the serial data output pin from the lowest bit in sequence (with LSB first). When the next data becomes writable, "1" is set to the TDRE bit, then an interrupt request to the CPU is generated if the transmission interrupt is allowed (SSD: TIE = 1).

  • Transmission Operations in Operating Mode is 0, 1, 2, or 3

Figure 13.6-3 shows the transmission operations when operating mode is 1, parity is not used, and the number of stop bits is "1".

Figure 13.6-3 Transmission Operations in Operating Mode 0, 1, 2, or 3

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 322)
Fig. 49

Sent to the transmission shift register Sent to the transmission shift register

STOP START START 0 1 2 3 4 5 6 7

Page 323 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 323 · click to enlarge
Page 323

CHAPTER 13 UART

13.6.2 Reception Operations (Operating Mode 0, 1, or 3)

When data is received at the serial data input pin, the internal reception shift register converts it from serial to parallel. If the data is correctly transmitted up to the stop bit(s), data in the internal shift register is transferred to the SIDR register, then "1" is set to the RDRF bit.

  • Reception Operations (Operating Mode 0, 1, or 3)

If an overrun error or framing error occurs, the received data is not transmitted to the SIDR register, but the ORFE bit is set to "1".

Either of the RDRF bit and ORFE bit goes on when the final stop bit is detected after data is fully received. If the reception interrupt is enabled (SSD: RIE = 1), an interrupt request to the CPU (IRQ6) is generated. When the RDRF bit goes on, the received data has been transmitted to the SIDR register.

In operating mode 2, when the RIE bit is "1", RDRF bit or ORFE bit is "1", and reception interrupt pin is "1", the mode 2 UART reception interrupt request is output to the CPU.

In operating mode 1, the parity bit is read as data in the 7th bit. Set up the program so that the 7th bit is not read.

Figure 13.6-4 , Figure 13.6-5 , and Figure 13.6-6 show the reception operations when parity is not used and the number of stop bits is "1" in operating mode 0, 1, or 3.

Figure 13.6-4 Reception Operations in Operating Mode 0, 1, or 3

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 323)
Fig. 50

STOP START 0 1 2 3 4 5 6 7

Page 324 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 324 · click to enlarge
Page 324

CHAPTER 13 UART

Figure 13.6-5 Operations in Operating Mode 0, 1, or 3 when the Overrun Error Occurs

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 324)
Fig. 51

STOP START 0 1 2 3 4 5 6 7

Figure 13.6-6 Operations in Operating Mode 0, 1, or 3 when the Framing Error Occurs

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 324)
Fig. 52

STOP START 0 1 2 3 4 5 6 7

After initialization is cancelled due to a reset, time for 11 shift-clock cycles is required to initialize the internal controller. Therefore, be sure to enable the UART prescaler operation (PREN = 1) using the oscillation frequency register after a reset.

Page 325 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 325 · click to enlarge
Page 325

CHAPTER 13 UART

13.6.3 Reception Operations (Operating Mode 2 Only)

When data is received at the serial data input pin, the internal reception shift register converts it from serial to parallel. If the data is correctly transmitted up to the stop bit(s), data in the internal shift register is transferred to the SIDR register, then "1" is set to the RDRF bit.

  • Reception Operations (Operating Mode 2 Only)

If an overrun error or framing error occurs, the received data is not transmitted to the SIDR register, but the ORFE bit is set to "1".

For both RDRF and ORFE, data is fully received/transmitted with the final data bit (D8) set to "1", these flags go on when the stop bit at the end is detected. However, when the framing error occurs, the flag goes on regardless of the final data bit. An interrupt request to the CPU is generated when the flag goes on and interrupt request is enabled.

If the reception interrupt is enabled (SSD: RIE = 1), an interrupt request to the CPU (IRQ5) is generated. When the RDRF bit goes on, the received data is transmitted to the SIDR register.

Figure 13.6-7 to Figure 13.6-9 show the reception operations when parity is not used and the number of stop bits is "1" in operating mode 2.

Figure 13.6-7 Reception Operations in Operating Mode 2

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 325)
Fig. 53

STOP START 0 1 2 3 4 5 6 7 8

Figure 13.6-8 Operations in Operating Mode 2 when the Overrun Error Occurs

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 325)
Fig. 54

STOP START 0 1 2 3 4 5 6 7 8

Page 326 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 326 · click to enlarge
Page 326

CHAPTER 13 UART

Figure 13.6-9 Operations in Operating Mode 2 when the Framing Error Occurs

Fujitsu MB89202 — CHAPTER 13 UART diagram (page 326)
Fig. 55

STOP START 0 1 2 3 4 5 6 7 8

After initialization is cancelled due to a reset, time for 11 shift-clock cycles is required to initialize the internal controller. Therefore, be sure to enable the UART prescaler operation (PREN = 1) using the oscillation frequency register after a reset.

Page 327 of the Fujitsu MB89202 user manual — CHAPTER 13 UART
Page 327 · click to enlarge
Page 327

CHAPTER 13 UART

13.7 Program Example for UART

This section provides program example for UART.

  • Program Example for UART
  • Program specifications
  • Serial data transfer is implemented using the UART communication functions.
  • The P30/UCK/SCK, P31/UO/SO, and P32/UI/SI pins are used for communication.
  • The transfer rate is set to 300 bps using the internal baud rate generator.
  • 13 H is transmitted from the UO pin, and data is received by interrupts.
  • The baud rate is the oscillation frequency (F CH = 12.5 MHz) at the maximum gear speed (1 instruction

cycle = 4/FCH). The clock divider is 2.5. (1/375 bps = 8320 tINST)

  • Coding example

PDR3 EQU 000CH ; Port data register address DDR3 EQU 000DH ; Port direction register address SSEL EQU 003BH ; Serial selection register address SMC EQU 0028H ; Serial mode control register address SRC EQU 0029H ; Serial rate control register address SSD EQU 002AH ; Serial status and data register address SIDR EQU 002BH ; Serial input data register address SODR EQU 002BH ; Serial output data register address UPC EQU 002CH ; Clock divider selection register address ILR2 EQU 007CH ; Interrupt level setting register address INT_V DSEG ABS ; [DATA SEGMENT] ORG 0FFEEH IRQ6 DW WARI2 ; Reception interrupt vector setting IRQ5 DW WARI1 ; Transmission interrupt vector setting INT_V ENDS ; Main program

CSEG ; [CODE SEGMENT] ; The stack pointer (SP) and related components have to be

initialized. : CLRI ; Disable interrupts. MOV ILR2,#11101011B ; Set an interrupt level (level 1). MOV UPC,#11111010B ; Allow operation with the clock whose frequency is divided

by 2.5. MOV SSEL,#00000000B ; Select UART. MOV DDR3,#00000000B ; Set the UI pin as the input pin. MOV SMC,#01011011B ; Set non-parity, the number of stop bits 1, and operating

Page 328 of the Fujitsu MB89202 user manual — END
Page 328 · click to enlarge
Page 328

CHAPTER 13 UART

mode 1. Set asynchronous mode, enable clock output and serial data output. MOV SRC,#00011101B ; Select the dedicated baud rate generator, and set the baud

rate 375 bps. MOV SSD,#00001000B ; Disable the transmission interrupt request and enable the

reception interrupt request. MOV A,SSD ; Required before transmission

(TDRE = 1 enables transmission) MOV A,SIDR ; Clear error flags. MOV SODR,#13H ; Write the data to be transmitted (13H).

SETI ; Enable instruction. : ; Interrupt processing routine WARI PUSHW A ; Save A and T. XCHW A,T PUSHW A MOV A,SSD ; Read the data to be transmitted, then clears the input data

flag. MOV A,SIDR : User-defined process : POPW A ; Restore A and T. XCHW A,T POPW A RETI ENDS ;

END

Page 329 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 329 · click to enlarge
Page 329

CHAPTER 14 8-BIT SERIAL I/O

This chapter describes the functions and operation of the 8-bit serial I/O.

14.1 Overview of 8-Bit Serial I/O

14.2 Configuration of 8-Bit Serial I/O

14.3 Pins of 8-Bit Serial I/O

14.4 Registers of 8-Bit Serial I/O

14.5 Interrupt of 8-Bit Serial I/O

14.6 Operations of Serial Output Functions

14.7 Operations of Serial Input Functions

14.8 8-Bit Serial I/O Operation in Each Mode

14.9 Notes on Using 8-Bit Serial I/O

14.10 Example of 8-Bit Serial I/O Connection

14.11 Program Example for 8-Bit Serial I/O

Page 330 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 330 · click to enlarge
Page 330

CHAPTER 14 8-BIT SERIAL I/O

14.1 Overview of 8-Bit Serial I/O

The 8-bit serial I/O has a function that serially transfers 8-bit data in synchronization with a shift clock. It can select one shift clock from three internal shift clocks and one external shift clock. It can also select LSB first or MSB first as the data shift direction.

  • Serial I/O Function

The 8-bit serial I/O function serially inputs and outputs 8-bit data in synchronization with a shift clock.

  • Converts 8-bit parallel data to 8-bit serial data and outputs it. Also inputs 8-bit serial data, converts the data to 8-bit parallel data, and stores it.
  • Can select one shift clock from three internal shift clocks and one external shift clock.
  • Can control shift clock input/output and output internal shift clocks.
  • Can select LSB first or MSB first as the data shift direction.

Table 14.1-1 Shift Clock Cycle and Transfer Rate

Shift clock Clock cycle Frequency (Hz) Transfer rate (FCH=12.5MHz, At maximum speed*)

2tINST 1/ (2tINST) 1562.5 kbps

8tINST 1/ (8tINST) 390.6 kbps

32tINST 1/ (32tINST) 97.66 kbps

(input) 2tINST or lower 1/(2tINST) or lower DC to 1562.5 kbps

FCH : Oscillation frequency tINST: Instruction cycle * : When the highest speed clock of a general mode is selected with the system clock control register (SYCC)

(CS1 and CS0 bits of SYCC = 11B, 1 instruction cycle = 4/FCH)

  • Serial Function Switching

The 8-bit serial I/O and UART cannot be used simultaneously because they use the same pin. For this reason, the serial function switching circuit must be used to switch the 8-bit serial I/O and UART. For more information on the serial function switching circuit, see Section "13.4.7 Serial Switch Register (SSEL) ".

Selecting the 8-bit serial I/O with this serial function switching circuit enables P30/UCK/SCK to be used as the serial clock I/O pin (SCK) of the serial I/O, and P31/UO/SO to be used as the data output pin (SO). This selection also enables P32/UI/SI to be used as the data input pin (SI).

This chapter describes pin function switching and the register function, etc., on the assumption that the 8- bit serial I/O is selected with the serial function switching circuit.

Internal shift clock · (output) · External shift clock

Page 331 of the Fujitsu MB89202 user manual — P30/UCK/SCK
Page 331 · click to enlarge
Page 331

CHAPTER 14 8-BIT SERIAL I/O

14.2 Configuration of 8-Bit Serial I/O

  • Each 8-bit serial I/O channel consists of the following four blocks:
  • Shift clock control circuit
  • Shift clock counter
  • Serial data register (SDR)
  • Serial mode register (SMR)
  • Block Diagram of 8-bit Serial I/O

Figure 14.2-1 Block Diagram of 8-bit Serial I/O

D0 to D7 D7 to D0

P32/UI/SI

Serial data register (SDR)

SST

BDS

P31/UO/SO

CKS0

CKS1

Output allowance Output allowance

SOE

SCKE

SIOE

SIOF

2t INST 8t INST 32t INST

Serial mode register (SMR)

Shift clock control circuit

P30/UCK/SCK

IRQC

: Instruction cycle

Show 16 more labels / short text on this page
Internal data bus · Transfer direction selection · MSB first · LSB first · (Shift direction) · Pin · D7 to D0 · Output buffer · Pin · Shift clock selection · Overflow · Interrupt request · Pin · Output buffer Clear · Shift clock counter · t INST
Page 332 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 332 · click to enlarge
Page 332

CHAPTER 14 8-BIT SERIAL I/O

  • Shift clock control circuit

As a shift clock of the shift clock control circuit, one of three internal clocks and one external clock is selected.

Selecting an internal clock enables the shift clock to be output to the SCK pin. Selecting an external clock enables the clock to be input from the SCK pin to act as the shift clock. The shift clock control circuit shifts the SDR in accordance with this shift clock and outputs the shifted-out value to the SO pin. It also captures the data input from the SI pin while shifting it to the SDR.

  • Shift clock counter

The shift clock counter counts the number of times the SDR was shifted using the shift clock. When 8-bit shift is completed, the counter overflows.

When the counter overflows, the serial I/O transfer start bit of the SMR (SST = 0) is cleared and the interrupt request flag bit (SIOF = 1) is set. When serial transfer stops (SST = 0), the counter stops its count. It is cleared when serial transfer is started (SST = 1).

  • Serial data register (SDR)

The SDR retains transfer data. The data written to the SDR is converted to serial data and output. Serial input is converted to parallel data and stored.

  • Serial mode register (SMR)

The SMR is a serial I/O control register. It is used to allow and prohibit serial I/O operation, select shift clocks, and set a transfer (shift) direction. It is also used to control interrupts and check interrupt states.

  • 8-bit serial I/O interrupt
  • IRQC: If the interrupt request output is allowed (SMR: SIOE = 1) when the I/O function of the 8-bit

serial I/O inputs or outputs 8-bit serial data, a interrupt request (IRQC) is generated.

Page 333 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 333 · click to enlarge
Page 333

CHAPTER 14 8-BIT SERIAL I/O

14.3 Pins of 8-Bit Serial I/O

8-bit serial I/O pins include P32/UI/SI, P31/UO/SO, and P30/UCK/SCK pins.

  • Pins of 8-bit Serial I/O
  • P32/UI/SI pin

The P32/UI/SI pin functions as the general-purpose I/O port (P32). It also functions as the serial data input pin (SI) of the 8-bit serial I/O or as the serial data input pin (UI) of the UART.

When using the P32/SI pin as the SI pin, set the P32/UI/SI pin to "input port" with the port direction register (DDR3: bit2 = 0).

  • P31/UO/SO pin

The P31/UO/SO pin functions as the general-purpose I/O port (P31). It also functions as the serial data output pin (SO) function of the 8-bit serial I/O or as the serial data output pin (UO) function of the UART.

When the serial data output is allowed (SMR: SOE = 1), the P31/UO/SO pin automatically becomes an output pin irrespective of the values in the port direction register (bit1 of DDR3) and functions as the SO pin.

  • P30/UCK/SCK pin

The P30/UCK/SCK pin functions as the general-purpose I/O port (P30). It also functions as the shift clock I/O pin (SCK) of the 8-bit serial I/O or as the shift clock I/O pin (UCK) of the UART.

When using the P30/UCK/SCK pin as the shift clock input pin

When using the SCK pin as the shift clock input pin, set it to "input port" with the port direction register (DDR3: bit3 = 0) and prohibit shift clock output (SMR: SCKE = 0). In this case, be sure to select the external shift clock (SMR: CKS1, CKS0 = 11B).

When using the P30/UCK/SCK pin as the shift clock output pin

When the shift clock output is allowed (SMR: SCKE = 1), the P30/UCK/SCK pin automatically becomes an output pin irrespective of the values in the port direction register (DDR3: bit0) and functions as the SCK output pin. In this case, be sure to select an internal shift clock (when SMR: CKS1, CKS0 are not 11B).

Page 334 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 334 · click to enlarge
Page 334

CHAPTER 14 8-BIT SERIAL I/O

  • Block Diagram for 8-bit Serial I/O Pins

Figure 14.3-1 Block Diagram for 8-bit Serial I/O Pins

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 334)
Fig. 56

PDR read Resource output Stop mode (SPL = 1)

Pull-up resistor

Resource output enable

Resource output available

P30/UCK/SCK P31/UO/SO P32/UI/SI

When "pull-up resistor available" is selected in the pull-up setting register, the pin state in stop mode (SPL = 1) becomes high (pull-up state), not Hi-Z. During the reset, however, pull-up becomes invalid and the pin state becomes Hi-Z.

Page 335 of the Fujitsu MB89202 user manual — 003A H XXXXXXXX B
Page 335 · click to enlarge
Page 335

CHAPTER 14 8-BIT SERIAL I/O

14.4 Registers of 8-Bit Serial I/O

Figure 14.4-1 shows 8-bit serial I/O registers.

  • Registers of 8-bit Serial I/O

Figure 14.4-1 8-bit Serial I/O Registers

SMR (serial mode register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0039H SIOF SIOE SCKE SOE CKS1 CKS0 BDS SST 00000000B

R/W

SDR (serial data register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

003A H XXXXXXXX B

R/W R/W R/W R/W R/W R/W R/W R/W

R/WReadable and Writable

: Undefined

When using a bit manipulation instruction, make sure that the SST bit is "0".

Show 4 more labels / short text on this page
Address · Initial value · Address · Initial value
Page 336 of the Fujitsu MB89202 user manual — SIOF
Page 336 · click to enlarge
Page 336

CHAPTER 14 8-BIT SERIAL I/O

14.4.1 Serial Mode Register (SMR)

The serial mode register (SMR) is used to allow and prohibit 8-bit serial I/O operation, select a shift clock, set a transfer direction, control interrupts, and check interrupt states.

  • Serial Mode Register (SMR)

Figure 14.4-2 Serial Mode Register (SMR)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0039H SIOF SIOE SCKE SOE CKS1 CKS0 BDS SST 00000000B R/W

Serial I/O transfer start bit

SST

At read At write

Serial I/O transfer is stopped. Serial I/O transfer is stopped or prohibited. Serial I/O transfer is in progress. Serial I/O transfer is started or allowed.

Transfer direction selection bit

BDS

LSB first (serial I/O transfer starts at the lowest bit.)

MSB first (serial I/O transfer starts at the highest bit.)

CKS1 CKS0

Shift clock selection bits SCK pin

0 0 2 tINST 0 1 8 tINST 1 0 32 tINST 1 1

t INSTInstruction cycle

SOE

Serial data output allowance bit P31/UO/SO is used as a general-purpose port (P31).

P31/UO/SO is used as a serial data output pin.

SCKE

Shift clock output allowance bit P30/UCK/SCK is used as a general-purpose port (P30) or the shift clock input pin (SCK). P30/UCK/SCK is used as the shift clock output pin.

SIOE

Interrupt request allowance bit Interrupt request output is prohibited. Interrupt request output is allowed.

Interrupt request flag bit

SIOF

At read At write Serial transfer has not terminated. This bit is cleared.

Remains unchanged. This bit does not affect other bits.

Serial transfer has already terminated.

R/WReadable and Writable

: Initial value

Show 7 more labels / short text on this page
Address Initial value · Output · Internal shift clock · Output · Output · External shift clock · Input
Page 337 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 337 · click to enlarge
Page 337

CHAPTER 14 8-BIT SERIAL I/O

Table 14.4-1 Explanation of Functions of Each Bit in Serial Mode Register (SMR) (1/2)

  • When 8-bit serial data is input or output during serial I/O operation, this bit is set to "1". When this bit and the interrupt request allowance bit (SIOE) are "1", an interrupt request is output.
  • Setting this bit to "0" clears it, while setting it to "1" does not affect this bit or implement any changes.
bit7 SIOFInterrupt request flag bit
SIOEInterrupt request allowance bit

This bit is used to allow and prohibit interrupt request output to the CPU. When this bit and the interrupt request allowance bit (SIOF) are "1", an interrupt request is output.

  • This bit is used to control shift clock I/O.
  • When this bit is "0", the P30/UCK/SCK pin functions as the shift clock input pin. When "1", it functions as the shift clock output pin. Notes:
  • To use the P30/UCK/SCK pin as the shift clock input pin, it must be set as an input port. Also select the external shift clock with the shift clock selection bits (Set the CKS1 and CKS0 bits to 11 B ).
  • For shift clock output (SCKE bit = 1), select an internal shift clock (do not set the CKS1 and CKS0 bits to 11 B ). Notes:
SCKEShift clock output allowance bit
  • When shift clock output is allowed (when this bit is "1"), the P30/UCK/ SCK pin functions as the UCK/SCK output pin irrespective of the general-purpose port (P30) state.
  • When using the P30/UCK/SCK pin as a general-purpose port (P30), set its pin as the shift clock input pin (set this bit to "0").

When this bit is "0" the P31/UO/SO pin functions as a general-purpose port (P31). When "1", the P31/UO/SO pin functions as the serial data output pin (UO/SO). Note:

SOESerial data output allowance bit

When serial data output is allowed (when this bit is set to "1"), the P31/ UO/SO pin functions as the UO/SO pin irrespective of the general- purpose port (P31) state.

  • These bits are used to select three internal shift clocks or one external shift clock.
  • When these bits are not 11 B , an internal shift clock is selected. When the shift clock output allowance bit (SCKE) is "1", a shift clock is output from the UCK/SCK pin.
  • When these bits are 11 B , the external clock is selected. When the P30/ UCK/SCK pin is set as the shift clock input pin, a shift clock is input from the UCK/SCK pin (when the SCKE bit and bit0 of the DDR3 are "0").
CKS1, CKS0Shift clock selection bits
Show 6 more labels / short text on this page
Bit name Function · bit6 · bit5 · bit4 · bit3, · bit2
Page 338 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 338 · click to enlarge
Page 338

CHAPTER 14 8-BIT SERIAL I/O

Table 14.4-1 Explanation of Functions of Each Bit in Serial Mode Register (SMR) (2/2)

This bit is used to select whether to transfer serial data, starting at the lowest bit (LSB first, BDS = 0) or the highest bit (MSB first, BDS = 1). When this bit is set to "0", serial data is transferred, starting at the lowest bit. When it is set to "1", serial data is transferred, starting at the highest bit. Note:

BDSTransfer direction selection bit

If this bit is rewritten after serial data has been written to the SDR to replace higher data with lower data, the data in the SDR becomes invalid.

  • This bit is used to control serial I/O transfer start and allowance. It can also be used to judge whether serial I/O transfer terminated.
  • If this bit is set to "1" when the internal shift clock is selected (when the CKS1 and CKS0 bits are not 11 B ), the shift clock counter is cleared and serial I/O transfer is started.
  • If this bit is set to "1" when the external shift clock is selected (when the CKS1 and CKS0 bits are 11 B ), serial I/O transfer is allowed and the shift clock counter is cleared. The transfer side enters the external shift clock input wait state.
  • When serial I/O transfer terminates, this bit is set (cleared) to "0" and the SIOF bit is set to "1".
  • If this bit is set to "0" during serial I/O transfer (SST = 1), serial I/O transfer is suspended. When serial I/O transfer is suspended, it is necessary to reset the SDR of the data output side and restart data input side transfer (clear the shift clock counter).
bit0 SSTSerial I/O transfer start bit

Bit name Function · bit1

Page 339 of the Fujitsu MB89202 user manual — 003A H XXXXXXXX B
Page 339 · click to enlarge
Page 339

CHAPTER 14 8-BIT SERIAL I/O

14.4.2 Serial Data Register (SDR)

The serial data register (SDR) retains 8-bit serial I/O transfer data. The SDR functions as a transmission data register at serial output operation. It functions as a reception data register at serial input operation.

  • Serial Data Register (SDR)

Figure 14.4-3 shows the bit structure of the SDR.

Figure 14.4-3 Serial Data Register (SDR)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

003A H XXXXXXXX B

R/W R/W R/W R/W R/W R/W R/W R/W

R/WReadable and Writable X : Undefined
  • At serial output operation

The SDR functions as a transmission data register at serial output operation. When serial I/O transfer is started (SMR: SST = 1), the 8-bit serial data written to the SDR is transferred. Transmission data does not remain in the SDR because it is shifted out via serial I/O transfer.

  • At serial input operation

The SDR functions as a reception data register. When serial I/O transfer is started (SMR: SST = 1), the serially transferred reception data is stored in the SDR.

  • When the serial I/O is in transfer operation

When the serial I/O is in transfer operation, do not write data to the SDR. Moreover, note that the read values have no significance.

When serial output and serial input are allowed at the same time, serial I/O operation is performed.

Address Initial value

Page 340 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 340 · click to enlarge
Page 340

CHAPTER 14 8-BIT SERIAL I/O

14.5 Interrupt of 8-Bit Serial I/O

An 8-bit serial I/O interrupt is caused by completion of 8-bit serial data I/O.

  • Interrupt at Serial I/O Operation

In the 8-bit serial I/O, serial output operation and serial input operation are performed at the same time. When serial I/O transfer is started, the values in the serial data register (SDR) are input and output on a per bit basis in synchronization with the set shift clock cycle. When the shift clock of the 8th bit rises, the interrupt request flag bit (SMR: SIOF) is set to "1".

In this case, when the interrupt request output allowance bit is allowed (SMR: SIOE = 1), the interrupt request (IRQC) for CPU interrupt occurs.

Write "0" to the SIOF bit with the interrupt processing routine and clear the interrupt request. When 8-bit serial output is completed, the SIOF bit is set irrespective of the SIOE bit value.

If serial I/O transfer stop (SMR: SST = 0) and serial data transfer termination take place at the same time during serial I/O operation, the interrupt request flag bit (SMR: SIOF = 1). If the SIOE bit is allowed (0 → 1), however, the interrupt request occurs immediately.

  • 8-bit Serial I/O Interrupt Register and Vector Table

Table 14.5-1 8-bit Serial I/O Interrupt Register and Vector Table

Interrupt level setting register Vector table address

Register Setting bit Higher Lower

IRQC ILR4 (007EH) LC1 (bit1) LC0 (bit0) FFE2H FFE3H

For interrupt operation, see Section "3.4.2 Steps in the Interrupt Operation ".

Interrupt name

Page 341 of the Fujitsu MB89202 user manual — SDR
Page 341 · click to enlarge
Page 341

CHAPTER 14 8-BIT SERIAL I/O

14.6 Operations of Serial Output Functions

In the 8-bit serial I/O, 8-bit serial output operation synchronized with a shift clock is possible.

  • Serial Output Operation

Serial output operation is divided into serial output operation using an internal shift clock and serial output operation by using the external shift clock. When serial I/O operation is allowed, serial data is input in the SDR and, at the same time, the contents of the SDR are output to the serial data output pin (SO).

  • Serial output operation via internal shift clock

Serial output operation using the internal shift clock requires the settings shown in Figure 14.6-1 .

Figure 14.6-1 Settings Required for Serial Output Operation using Internal Shift Clock

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

SMR SIOF SIOE SCKE SOE CKS1 CKS0 BDS SST

1 1 Other than 11

SDR

SSEL SSEL

: Used bit

: Set "1"

When serial output operation is started, the contents of the SDR are output to the SO pin in synchronization with the falling edge of the selected internal shift clock. In this case, the transfer destination (serial input side) must be in the external shift clock input wait state.

Transmission data setting

Page 342 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 342 · click to enlarge
Page 342

CHAPTER 14 8-BIT SERIAL I/O

  • Serial output operation using external shift clock

Serial output operation with the external shift clock requires the settings shown in Figure 14.6-2 .

Figure 14.6-2 Settings Required for Serial Output Operation using External Shift Clock

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 342)
Fig. 57

SMR SIOF SIOE SCKE SOE CKS1 CKS0 BDS SST 0 1

: Used bit : Unused bit : Set "0" : Set "1"

When serial output operation is allowed, the contents of the SDR are output to the SO pin in synchronization with the falling edge of the external shift clock. When serial operation is completed, immediately reset the SDR, set it again, then allow serial output operation (SMR: SST = 1) to prepare for the output of the next data.

When the remote serial input operation (rising edge) is completed and the 8-bit serial I/O enters the idle state (state in which it waits for the output of the next data), set the external shift clock to a high level.

Figure 14.6-3 shows 8-bit serial output operation.

Figure 14.6-3 8-bit Serial Output Operation

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 342)
Fig. 58

SDR #7 #6 #5 #4 #3 #2 #1 #0

  • Operation at Serial Output Completion

At the rising edge of the shift clock for serial data of the 8th bit, the interrupt request flag bit (SMR: SIOF) is set to "1" and the serial I/O start bit (SMR: SST) is set (cleared) to "0".

Page 343 of the Fujitsu MB89202 user manual — SDR
Page 343 · click to enlarge
Page 343

CHAPTER 14 8-BIT SERIAL I/O

14.7 Operations of Serial Input Functions

In the 8-bit serial I/O, 8-bit serial input operation synchronized with a shift clock is possible.

  • Serial Input Operation

Serial input operation is divided into serial input operation with an internal shift clock and serial input operation with an external shift clock. When serial I/O operation is allowed, serial data is input in the SDR and, at the same time, the contents of the SDR are output to the serial data output pin (SO).

  • Serial input operation using internal shift clock

Serial input operation with the internal shift clock requires the settings shown in Figure 14.7-1 .

Figure 14.7-1 Settings Required for Serial Input Operation using Internal Shift Clock

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

SMR SIOF SIOE SCKE SOE CKS1 CKS0 BDS SST

SDR

DDR3

SSEL SSEL

: Used bit : Unused bit

: Set "0"

: Set "1"

When serial input operation is started, the value of the serial data input pin (SI) is captured and held in the SDR in synchronization with the rising edge of the selected internal shift clock. In this case, the SDR of the transfer destination (serial output side) must already be set and the transfer destination must be in the external shift clock input wait state.

Other than 11 · Reception data storage

Page 344 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 344 · click to enlarge
Page 344

CHAPTER 14 8-BIT SERIAL I/O

  • Serial input operation using external shift clock

Serial input operation with the external shift clock requires the settings shown in Figure 14.7-2 .

Figure 14.7-2 Settings Required for Serial Input Operation using External Shift Clock

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 344)
Fig. 59

SMR SIOF SIOE SCKE SOE CKS1 CKS0 BDS SST

When serial input operation is allowed, the value of the SI pin is captured and held in the SDR in synchronization with the rising edge of the external shift clock. When serial input is completed, immediately read the SDR and allow serial input operation (SMR: SST = 1) to prepare for the input of the next data. In this case, when the 8-bit serial I/O is idle (state in which it is waiting for the output of the next data), keep the external shift clock at a "H" level.

Figure 14.7-3 shows 8-bit serial input operation.

Figure 14.7-3 8-bit Serial Input Operation

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 344)
Fig. 60

SDR #7 #6 #5 #4 #3 #2 #1 #0

  • Operation at Serial Input Completion

At the rising edge of the shift clock for the serial data of the 8th bit, the interrupt request flag bit (SMR: SIOF) is set to "1" and the serial I/O start bit (SMR: SST) is set (cleared) to "0".

Page 345 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 345 · click to enlarge
Page 345

CHAPTER 14 8-BIT SERIAL I/O

14.8 8-Bit Serial I/O Operation in Each Mode

This section describes the operation of the 8-bit serial I/O if the 8-bit serial I/O switches to sleep or stop mode or a stop request is issued when it is in operation.

  • When the Internal Shift Clock is Used
  • 8-bit serial I/O operation in sleep mode

In sleep mode, as shown in Figure 14.8-1 , the 8-bit serial I/O continues data transfer without stopping the serial I/O operation.

Figure 14.8-1 8-bit Serial I/O Operation in Sleep Mode (Internal Shift Clock)

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 345)
Fig. 61
  • 8-bit serial I/O operation in stop mode

In stop mode, as shown in Figure 14.8-2 , the 8-bit serial I/O stops the serial I/O operation and suspends data transfer. After stop mode has been released, reinitialize the 8-bit serial I/O because operation is resumed halfway.

Page 346 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 346 · click to enlarge
Page 346

CHAPTER 14 8-BIT SERIAL I/O

Figure 14.8-2 8-bit Serial I/O Operation in Stop Mode (Internal Shift Clock)

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 346)
Fig. 62

SST bit Oscillation stabilization wait time Stop mode request Clear via program

  • 8-bit serial I/O operation at issuance of stop request during operation

As shown in Figure 14.8-3 , if operation is stopped (SMR: SST = 0) during data transfer, the 8-bit serial I/O stops data transfer and clears the shift clock counter. For this reason, the transfer destination must also be initialized. If serial output is in operation, set the SDR again before restarting the 8-bit serial I/O.

Figure 14.8-3 8-bit Serial I/O Operation at Issuance of Stop Request during Operation(Internal Shift Clock)

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 346)
Fig. 63
Page 347 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 347 · click to enlarge
Page 347

CHAPTER 14 8-BIT SERIAL I/O

  • When the External Shift Clock is Used
  • 8-bit serial I/O operation in sleep mode

In sleep mode, as shown in Figure 14.8-4 , the 8-bit serial I/O continues data transfer without stopping the serial I/O operation.

Figure 14.8-4 8-bit Serial I/O Operation in Sleep Mode (External Shift Clock)

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 347)
Fig. 64

Transfer stop state

#0 #1 #2 #4 #3 #7 #5 #6

STP bit (STBC register)

Sleep mode release via IRQC

  • 8-bit serial I/O operation in stop mode

In stop mode, as shown in Figure 14.8-5 , the 8-bit serial I/O stops the serial I/O operation and suspends data transfer. After stop mode has been released, a transfer destination error occurs because operation is resumed halfway. In this case, initialize the 8-bit serial I/O.

Figure 14.8-5 8-bit Serial I/O Operation in Stop Mode (External Shift Clock)

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 347)
Fig. 65
Page 348 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 348 · click to enlarge
Page 348

CHAPTER 14 8-BIT SERIAL I/O

  • 8-bit serial I/O operation at issuance of stop request during operation

As shown in Figure 14.8-6 , if operation is stopped (SMR: SST = 0) during data transfer, the 8-bit serial I/O stops data transfer and clears the shift clock counter. For this reason, the transfer destination must also be initialized. If serial output is in operation, set the SDR again before restarting the 8-bit serial I/O. In this case, when the external clock is input, the SO pin output changes.

Figure 14.8-6 8-bit Serial I/O Operation at Issuance of Stop Request during Operation

Fujitsu MB89202 — CHAPTER 14 8-BIT SERIAL I/O diagram (page 348)
Fig. 66

(External Shift Clock)

Page 349 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 349 · click to enlarge
Page 349

CHAPTER 14 8-BIT SERIAL I/O

14.9 Notes on Using 8-Bit Serial I/O

This section provides notes on using the 8-bit serial I/O.

  • Notes on Using 8-bit Serial I/O
  • Error at serial transfer start

The time at which serial I/O transfer is started with a serial transfer program (SMR: SST = 1) is asynchronous with the time when the falling edge (output) or rising (input) edge of a shift clock occurs. For this reason, the time that lasts until the first serial data is input or output is delayed by a maximum of one cycle of the set shift clock.

  • Malfunction due to noise

If external noise causes an extra pulse (pulse exceeding the hysteresis width) to be placed on a shift clock during serial data transfer, the 8-bit serial I/O may malfunction.

  • Notes on setting via program
  • Write data to the serial mode register (SMR) and serial data register (SDR) only when the 8-bit serial I/ O is stopped (SMR: SST = 0).
  • When starting or allowing serial I/O transfer (SMR: SST=1), do not change other bits of the SMR.
  • If MSB first is set when a shift clock is used in external shift clock input, the highest bit level is output as the SO pin output level. If LSB first is set, the lowest bit level is output as the SO pin output level. MSB first and LSB first are set when the external shift clock is input. In this case, however, serial data output must be allowed (SMR: SOE = 1) even if serial I/O transfer is stopped (SMR: SST = 0).
  • If serial I/O transfer stop (SMR: SST = 0) and serial data transfer termination take place at the same time during serial I/O operation, the interrupt request flag bit (SMR: SIOF) is not set to "1".
  • If the SIOF bit is set to "1" and the interrupt request output allowance bit is enabled (SMR: SIOE = 1), control cannot return from interrupt processing. Be sure to clear the SIOF bit.
  • Shift clock idle state

The external shift clock must maintain the "H" level during the wait time between one 8-bit data transfer and another (idle state). When the internal shift clock is selected (SMR: CKS1, CKS0 = not 11B) and the

P30/UCK/SCK pin is used as the shift clock output pin (SMR: SCKE = 1), data is output at the "H" level in the idle state.

Figure 14.9-1 shows the shift clock idle state.

Figure 14.9-1 Shift Clock Idle State

Idle state 8-bit data transfer 8-bit data transfer Idle state Idle state

External shift clock

Page 350 of the Fujitsu MB89202 user manual — SIO-A
Page 350 · click to enlarge
Page 350

CHAPTER 14 8-BIT SERIAL I/O

14.10 Example of 8-Bit Serial I/O Connection

This section provides an example of mutual connection between 8-bit serial I/Os of MB89202/F202RA series for bidirectional serial I/O operation.

  • When Bidirectional Serial I/O Operation is Performed

Figure 14.10-1 Example of 8-bit Serial I/O Connection (Interface between MB89202/F202RA Series)

SO

SI

SI SO Output Input

SIO-A

SIO-B SCK

SCK

Internal shift clock External shift clock

Page 351 of the Fujitsu MB89202 user manual — NO
Page 351 · click to enlarge
Page 351

CHAPTER 14 8-BIT SERIAL I/O

Figure 14.10-2 Bidirectional Serial I/O Operation

S IO-A

S IO-B

S TART S TART

Stop SIO-A operation

Stop SIO-B operation

( SS T=0)

( SS T=0)

Set SI pin to serial data input (input port)

Set SI pin to serial data input (input port)

Set SCK pin to shift clock input

Set SCK pin to shift clock output -

- Set SO pin to serial data

Set SO pin to serial data output

output

- Select internal shift clock

Select external shift clock

Set data transfer (shift clock) direction -

Select same data transfer (shift) direction as SIO-A

Set output data

NO

Is SIO-B in serial transfer allowance

state?(*1)

Transfer allowance state

Allow serial data transfer

YE S

( SS T=1)

Set output data

Start serial I/O transfer(*2)

( SS T=1)

S IO-A

S IO-B

Serial data output via SIO-A

Serial data transfer

Serial data transfer

Simultaneous data input via SIO-B

NO NO

End of 8-bit transfer?

End of 8-bit transfer?

YE S ( SS T=0)

YE S ( SS T=0)

Read input data

Read input data

YE S

Is next data available?

The SST bit is the serial I/O transfer start bit of the serial mode register (SMR). SST:

NO

END

If only the SO, SI, and SCK pins are connected, there is no method for directly checking whether SIO-B is in the serial transfer allowance state. For this reason, a timer, etc., must be used to monitor the wait time period that lasts until SIO-B is allowed for transfer via software.

If SIO-B is not allowed for serial I/O transfer, data cannot be transferred correctly even if SIO-A starts serial I/O transfer.

When 8-bit data transfer terminates, a interrupt request occurs.

Show 5 more labels / short text on this page
(*3) · (*3) · *1 · *2 · *3
Page 352 of the Fujitsu MB89202 user manual — CHAPTER 14 8-BIT SERIAL I/O
Page 352 · click to enlarge
Page 352

CHAPTER 14 8-BIT SERIAL I/O

14.11 Program Example for 8-Bit Serial I/O

This section provides program example for 8-bit serial I/O.

  • Program Example for 8-bit Serial Output
  • Processing Specifications
  • The 8-bit serial output program outputs 8-bit serial data (55 H ) from the SO pin of the 8-bit serial I/O.

When serial I/O transfer terminates, an interrupt occurs.

  • The program resets transfer data with the interrupt processing routine and outputs it continuously.
  • The program operates in accordance with the internal shift clock. This clock is output from the SCK pin.
  • If the shift clock is 32t INST when the maximum gear speed (1 instruction cycle = 4/F CH ) at the 12.5-

MHz oscillation (FCH), the transfer rate and interrupt cycle are as follows:

Transfer rate = 12.5 MHz/4/32 = 97.7 kbps, interrupt cycle = 8 × 32 × 4/10 MHz = 81.92 µs

  • Coding example

SMR EQU 0039H ; Address of serial mode register SDR EQU 003AH ; Address of serial data register SSEL EQU 003BH ; Address of serial/UART selection register SIOF EQU SMR:7 ; Defines the interrupt request flag bit. SST EQU SMR:0 ; Defines the serial I/O transfer start bit. ILR4 EQU 007EH ; Address of interrupt request setting register 4 INT_V DSEG ABS ; [DATA SEGMENT] ORG 0FFE2H IRQC DW WARI ; Sets an interrupt vector. INT_V ENDS ; Main program

CSEG ; [CODE SEGMENT] ; The stack pointer (SP), etc., are already initialized. : CLRI ; Disables interrupts. CLRB SST ; Stops serial I/O transfer. MOV ILR4,#11111101B ; Sets the interrupt level to 1. MOV SDR,#55H ; Sets transfer data (55H). MOV SMR,#01111000B ; Clears the interrupt request flag, allows the interrupt

request output, shift clock output (SCK), and serial data output (SO), selects 32tINST, and sets LSB first. MOV SSEL,#00000001B ; Selects the 8-bit serial I/O. SETB SST ; Starts serial I/O transfer. SETI ; Enables interrupts. :

Page 353 of the Fujitsu MB89202 user manual — END
Page 353 · click to enlarge
Page 353

CHAPTER 14 8-BIT SERIAL I/O

; Interrupt processing routine WARI CLRB SIOF ; Clears the interrupt request flag. PUSHW A XCHW A,T ; Saves A and T. PUSHW A MOV SDR,#55H ; Resets transfer data (55H).

SETB SST ; Starts serial I/O transfer. : User processing : POPW A XCHW A,T ; Returns A and T. POPW A RETI ENDS ;

END

  • Program Example for 8-bit Serial Input
  • Processing specifications
  • The 8-bit serial input program inputs 8-bit serial data from the SI pin of the 8-bit serial I/O. When serial I/O transfer terminates, an interrupt occurs.
  • The program reads transfer data with the interrupt processing routine and inputs it continuously.
  • The program uses the external shift clock to be input from the SCK pin.
  • Coding example

DDR3 EQU 000DH ; Address of data direction register 3 SMR EQU 0039H ; Address of serial mode register SDR EQU 003AH ; Address of serial data register SSEL EQU 003BH ; Address of serial/UART selection register SIOF EQU SMR:7 ; Defines the interrupt request flag bit. SST EQU SMR:0 ; Defines the serial I/O transfer start bit. ILR4 EQU 007EH ; Address of interrupt request setting register 4 INT_V DSEG ABS ; [DATA SEGMENT] ORG 0FFE2H IRQC DW WARI ; Sets an interrupt vector. INT_V ENDS ; Main program

CSEG ; [CODE SEGMENT] ; The stack pointer (SP), etc., is already initialized. : MOV DDR3,#00000000B ; Sets the P30/SCK and P32/SI pins to input. CLRI ; Disables interrupts. CLRB SST ; Stops serial I/O transfer. MOV ILR4,#11111101B ; Sets the interrupt level to 1.

Page 354 of the Fujitsu MB89202 user manual — END
Page 354 · click to enlarge
Page 354

CHAPTER 14 8-BIT SERIAL I/O

MOV SMR,#01001100B ; Clears the interrupt request flag, allows the interrupt

request output, sets shift clock input (SCK), prohibits serial data output (SO), selects the external shift clock, and sets LSB first. MOV SSEL,#00000001B ; Selects the 8-bit serial I/O. SETB SST ; Allows serial I/O transfer. SETI ; Enables interrupts. : ; Interrupt processing routine WARI CLRB SIOF ; Clears the interrupt request flag. PUSHW A XCHW A,T PUSHW A MOV A,SDR ; Reads transfer data. SETB SST ; Allows serial I/O transfer. : User processing : POPW A XCHW A,T POPW A RETI ENDS ;

END

Page 355 of the Fujitsu MB89202 user manual — CHAPTER 15 BUZZER OUTPUT
Page 355 · click to enlarge
Page 355

CHAPTER 15 BUZZER OUTPUT

This chapter describes the functions and operation of the buzzer output.

15.1 Overview of the Buzzer Output

15.2 Configuration of the Buzzer Output

15.3 Pin of the Buzzer Output

15.4 Buzzer Register (BZCR)

15.5 Program Example for Buzzer Output

Page 356 of the Fujitsu MB89202 user manual — CHAPTER 15 BUZZER OUTPUT
Page 356 · click to enlarge
Page 356

CHAPTER 15 BUZZER OUTPUT

15.1 Overview of the Buzzer Output

For the buzzer output, four kinds of output frequencies (square waves) can be selected. The buzzer output may be used for the confirmation tone of key input and other tones.

  • Buzzer Output Function

The buzzer output function is a function for outputting a signal (square wave) used for tones such as a confirmation tone.

For the buzzer output, it is selectable whether to output one of four output frequencies or to disable the output.

As the buzzer output, four kinds of divided-frequency outputs are supplied from the time-base timer.

The time-base timer supplies clock for the buzzer output. Therefore, buzzer output will be affected when time-base timer is cleared.

Table 15.1-1 lists the four kinds of output frequencies (square waves) specifiable for the buzzer output.

Table 15.1-1 Output Frequencies

Clock supplier Buzzer output Square wave output (at 12.5 MHz)

213/FCH FCH/213 (1.526 kHz)

212/FCH FCH/212 (3.052 kHz)

211/FCH FCH/211 (6.104 kHz)

210/FCH FCH/210 (12.21 kHz)

F CHOscillation frequency

Calculation example of an output frequency

If time-base timer output FCH/210 is selected in the buzzer register (BZCR) (BZ2=1, BZ1=0, and

BZ0=0) and the oscillation (FCH) is 12.5 MHz, the output frequency being output from the BZ pin is

calculated as follows:

Output frequency = FCH/210

= 12.5 MHz/1024

12.21 kHz

time-base timer

Page 357 of the Fujitsu MB89202 user manual — P 3 7/BZ/PPG
Page 357 · click to enlarge
Page 357

CHAPTER 15 BUZZER OUTPUT

15.2 Configuration of the Buzzer Output

  • The buzzer output consists of the following two blocks:
  • Buzzer output selector
  • Buzzer register (BZCR)
  • Block Diagram of the Buzzer Output

Figure 15.2-1 Block Diagram of Buzzer Output

Internal data bus

BZCR

BZ2 BZ1 BZ0

Buzzer enable signal

2 13/FCH 2 12/FCH 2 11/FCH 2 10/FCH

Selector output

Buzzer output selector

From time-base timer

P 3 7/BZ/PPG

F CH

: Oscillation frequency

  • Buzzer output selector

The buzzer output selector is a circuit for selecting one of the four frequencies (square waves) output from the time-base timer. The buzzer register (BZCR) sets it.

  • Buzzer register (BZCR)

The buzzer register (BZCR) is a register for setting the buzzer output frequency and enable the buzzer output. When the BZCR register sets an output frequency (other than 000B), the buzzer output is enabled so

that the P37/BZ/PPG pin automatically becomes the buzzer output (BZ) pin. Even if the PPG pin has been enabled, the BZ pin has higher priority.

Pin

Page 358 of the Fujitsu MB89202 user manual — CHAPTER 15 BUZZER OUTPUT
Page 358 · click to enlarge
Page 358

CHAPTER 15 BUZZER OUTPUT

15.3 Pin of the Buzzer Output

Fujitsu MB89202 — CHAPTER 15 BUZZER OUTPUT diagram (page 358)
Fig. 67

The pin related to the buzzer output is P37/BZ/PPG.

  • P37/BZ/PPG Pin

The P37/BZ/PPG pin works as a general-purpose I/O (P37) pin, output pin for the buzzer output (BZ), or output pin for the 12-bit PPG (PPG).

  • BZ pin

The BZ pin outputs the square wave for the buzzer of the frequency having been specified for the BZ pin. When a buzzer output frequency is specified (other than BZCR:BZ2,BZ1,BZ0=000B), the P37/BZ/PPG pin

automatically works as the BZ pin regardless of the value of output latch. Even if the PPG output has been enabled, it works as the BZ pin that has higher priority.

  • Block Diagram of the Pin Related to the Buzzer Output

Figure 15.3-1 Block Diagram of Pin Related to Buzzer Output

Fujitsu MB89202 — CHAPTER 15 BUZZER OUTPUT diagram (page 358)
Fig. 68

Stop mode (SPL=1) Pull-up resistor

Peripheral output enable PDR read (At read-modify-write)

If pull-up resistor supported is specified by the pull-up setting register, the state of the pin in stop mode (SPL=1) is not Hi-Z but "H" level (pull-up state). During a reset, however, the pull-up is disabled and the state is Hi-Z.

Page 359 of the Fujitsu MB89202 user manual — F CH
Page 359 · click to enlarge
Page 359

CHAPTER 15 BUZZER OUTPUT

15.4 Buzzer Register (BZCR)

The buzzer register (BZCR) is used to select an output frequency of the buzzer and also serves as the buzzer output enable.

  • Buzzer Register (BZCR)

Figure 15.4-1 Buzzer Register (BZCR)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0018H BZ2 BZ1 BZ0 000 B R/W R/W R/W

BZ2 BZ1 BZ0

Buzzer selection bits (FCH: 12.5 MHz) Works as a general-purpose output port (P37) or the 12-bit PPG output (PPG).

0

Outputs FCH/213 (1.526 kHz) to the BZ pin.

Outputs FCH/212 (3.052 kHz) to the BZ pin.

Outputs FCH/211 (6.104 kHz) to the BZ pin.

R/W

Outputs FCH/210 (12.21 kHz) to the BZ pin. : Readable/Writable

0

: Initial value : Unused

F CH

: Oscillation frequency

Address Initial value

Page 360 of the Fujitsu MB89202 user manual — CHAPTER 15 BUZZER OUTPUT
Page 360 · click to enlarge
Page 360

CHAPTER 15 BUZZER OUTPUT

Table 15.4-1 Functions of Each Bit in Buzzer Register (BZCR)

  • Unused bits
  • Undefined at read
  • No effect on the operation at write
  • Select a buzzer output and enable the output.
  • If 000 B is set to these bits, the buzzer output is disabled and the pin works as a general-purpose port (P37) or as the 12-bit PPG output (PPG). With the exception of 000 B , the pin becomes the buzzer pin and outputs a square wave. Even if the pin has been functioning as the 12-bit PPG output, setting a value other than 000 B causes the pin to work as the BZ pin prior to its operation as the PPG pin. For the buzzer output, four kinds of time-base timer divided cycle outputs are supplied.
BZ2, BZ1, and BZ0Buzzer selection bits
Show 5 more labels / short text on this page
Bit name Function · bit7 · to bit3 · bit2 · to bit0
Page 361 of the Fujitsu MB89202 user manual — END
Page 361 · click to enlarge
Page 361

CHAPTER 15 BUZZER OUTPUT

15.5 Program Example for Buzzer Output

This section shows an program example for buzzer output.

  • Program Example for Buzzer Output
  • Processing specification

Suppose that the buzzer output of 3.052 kHz is output to the BZ pin and then the buzzer output is cut off.

If 212/FCH is selected when the oscillation (FCH) is 12.5 MHz, the buzzer output frequency is calculated as

follows:

Buzzer output frequency12.5 MHz/2 12 = 12.5 MHz/4096 = 3.052 kHz
  • Coding example

BZCR EQU 0018H ; Address of the buzzer register ; Main program

CSEG ; [CODE SEGMENT] : MOV BZCR,#00000010 ; Buzzer output on (3.052 kHz / Oscillation of 12.5 MHz) : : : MOV BZCR,#00000000 ; Buzzer output off (I/O port or PPG output) : : ENDS ;

END

Page 362 of the Fujitsu MB89202 user manual — CHAPTER 15 BUZZER OUTPUT
Page 362 · click to enlarge
Page 362

CHAPTER 15 BUZZER OUTPUT

Page 363 of the Fujitsu MB89202 user manual — CHAPTER 16 WILD REGISTER FUNCTION
Page 363 · click to enlarge
Page 363

CHAPTER 16 WILD REGISTER FUNCTION

This chapter describes the functions and operation of the wild registers.

16.1 Overview of the Wild Register Function

16.2 Configuration of the Wild Register Function

16.3 Registers of the Wild Register Function

16.4 Operations of the Wild Register Functions

Page 364 of the Fujitsu MB89202 user manual — CHAPTER 16 WILD REGISTER FUNCTION
Page 364 · click to enlarge
Page 364

CHAPTER 16 WILD REGISTER FUNCTION

16.1 Overview of the Wild Register Function

The wild register function is a function for patching the faulty part of a program by setting the address and the correct data in the incorporated registers. Up to two bytes of data correction is possible.

  • Wild Register Function

The wild register function assigns an address in the ROM area of the microcontroller and replaces the existing data corresponding to the address, with new data. For example, if an error exists in a program, setting the address of the faulty part and correction data to the register can correct the faulty data.

  • Wild Register Applicable Addresses

The address area where the wild register function can apply varies slightly with the models. Table 16.1-1 shows the wild register applicable addresses for each model.

Table 16.1-1 Wild Register Applicable Addresses

Model name ROM area

MB89V201 8000H to FFFFH

MB89202/F202 C000H to FFFFH

The wild register function cannot be debugged with a tool. Perform the operation check of the wild register on the actual microcontroller, MB89202/F202/F202RA.

Page 365 of the Fujitsu MB89202 user manual — CHAPTER 16 WILD REGISTER FUNCTION
Page 365 · click to enlarge
Page 365

CHAPTER 16 WILD REGISTER FUNCTION

16.2 Configuration of the Wild Register Function

  • The wild register function consists of the following two blocks: Memory area part
  • Data setting register (WRDR)
  • Higher address set register (WRARH)
  • Lower address set register (WRARL) Control circuit part
  • Block Diagram of the Wild Register Function

Figure 16.2-1 Block Diagram of Wild Register Function

Fujitsu MB89202 — CHAPTER 16 WILD REGISTER FUNCTION diagram (page 365)
Fig. 69
  • Memory area part

This part consists of the data setting register, higher address set register ("H" address), and lower address set register ("L" address). Set the address and data to be replaced by the wild register. The MB89202/ F202RA series incorporates two bytes for each register.

  • Control circuit part

This part compares the data held in the address set registers and the actual data on the address bus. If it detects a match, it sets the data in the data setting register to the data bus. The control circuit part can control the operation by the address comparison EN register.

Page 366 of the Fujitsu MB89202 user manual — 0047 H RESV1 RESV0 ------00 B R/W R/W
Page 366 · click to enlarge
Page 366

CHAPTER 16 WILD REGISTER FUNCTION

16.3 Registers of the Wild Register Function

Figure 16.3-1 shows the registers related to the wild register function.

  • Registers Related to the Wild Register Function

Figure 16.3-1 Registers Related to Wild Register Function

WRDR0,WRDR1

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0042H RD07 RD06 RD05 RD04 RD03 RD02 RD01 RD00 XXXXXXXX B 0045H R/W

WRARH0,WRARH1

(Higher address set register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0040H RA15 RA14 RA13 RA12 RA11 RA10 RA09 RA08 XXXXXXXX B 0043H R/W

WRARL0,WRARL1

(Lower address set register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0041 H RA07 RA06 RA05 RA04 RA03 RA02 RA01 RA00 XXXXXXXX B 0044H R/W

WREN

(Address comparison EN register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0046 H EN01 EN00 00 B R/W R/W

WROR

(Data test set register)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0047 H RESV1 RESV0 00 B R/W R/W

R/WReadable and Writable : Unused X : Undefined
Show 11 more labels / short text on this page
(Data setting register) · Initial value · Address · Address · Initial value · Address · Initial value · Address · Initial value · Address · Initial value
Page 367 of the Fujitsu MB89202 user manual — CHAPTER 16 WILD REGISTER FUNCTION
Page 367 · click to enlarge
Page 367

CHAPTER 16 WILD REGISTER FUNCTION

16.3.1 Data Setting Registers (WRDR0 and WRDR1)

The data setting registers (WRDR0 and WRDR1) are registers where the correct data used by the wild register function is set.

  • Data Setting Register (WRDR)

Figure 16.3-2 Data Setting Register (WRDR)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

WRDR0 0042H RD07 RD06 RD05 RD04 RD03 RD02 RD01 RD00 XXXXXXXXB R/W

WRDR1 0045H RD07 RD06 RD05 RD04 RD03 RD02 RD01 RD00 XXXXXXXXB R/W

R/WReadable and Writable
XUndefined

Table 16.3-1 Functions of Data Setting Register (WRDR)

Wild register number Register name Function

0 WRDR0 1-byte registers that store the data at the address assigned by WRARL and WRARH. The data will be effective at the addresses (WRARL and WRARH) corresponding to the individual wild register numbers. 1 WRDR1

The WRDR register is readable, only when the WREN register (address comparison EN register) is set.

Address Initial value

Page 368 of the Fujitsu MB89202 user manual — R/W
Page 368 · click to enlarge
Page 368

CHAPTER 16 WILD REGISTER FUNCTION

16.3.2 Higher Address Set Registers (WRARH0 and WRARH1)

The higher address set registers (WRARH0 and WRARH1) are registers where the higher byte of addresses to be corrected by the wild register function are set.

  • Higher Address Set Register (WRARH)

Figure 16.3-3 Higher Address Set Register (WRARH)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

WRARH0 0040 H RA15 RA14 RA13 RA12 RA11 RA10 RA09 RA08 XXXXXXXX B R/W

WRARH1 0043 H RA15 RA14 RA13 RA12 RA11 RA10 RA09 RA08 XXXXXXXX B R/W

R/W

: Readable and Writable : Undefined

Table 16.3-2 Functions of Higher Address Set Register (WRARH)

Wild register number Register name Function

0 WRARH0 1-byte registers that specify the higher addresses of memory being assigned. They specify the addresses corresponding to the individual wild register numbers. 1 WRARH1

Address Initial value

Page 369 of the Fujitsu MB89202 user manual — R/W
Page 369 · click to enlarge
Page 369

CHAPTER 16 WILD REGISTER FUNCTION

16.3.3 Lower Address Set Registers (WRARL0 and WRARL1)

The lower address set registers (WRARL0 and WRARL1) are registers where the lower byte of addresses to be corrected by the wild register function are set.

  • Lower Address Set Register (WRARL)

Figure 16.3-4 Lower Address Set Register (WRARL)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

WRARL0 0041H RA07 RA06 RA05 RA04 RA03 RA02 RA01 RA00 XXXXXXXXB R/W

WRARL1 0044H RA07 RA06 RA05 RA04 RA03 RA02 RA01 RA00 XXXXXXXX B R/W

R/W

: Readable and Writable : Undefined

Table 16.3-3 Functions of Lower Address Set Register (WRARL)

Wild register number Register name Function

0 WRARL0 1-byte registers that specify the lower addresses of memory being assigned. They specify the addresses corresponding to the individual wild register numbers. 1 WRARL1

Address Initial value

Page 370 of the Fujitsu MB89202 user manual — WREN
Page 370 · click to enlarge
Page 370

CHAPTER 16 WILD REGISTER FUNCTION

16.3.4 Address Comparison EN Register (WREN)

The address comparison EN register (WREN) is a register that enables the operation of wild register function for the individual wild register numbers.

  • Address Comparison EN Register (WREN)

Figure 16.3-5 Address Comparison EN Register (WREN)

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

WREN

0046 H EN01 EN00 ------00 B

R/W R/W

R/WReadable and Writable

: Unused

Table 16.3-4 Explanation of Functions of Each Bit in Address Comparison EN Register (WREN)

Unused bits Undefined at read No effect to the operation at write

When this bit is "0", the corresponding wild register function does not work. When this bit is "1", the wild register function is enabled. If there is a match with the address held in WRARH1 and WRARL1, the value of WRDR1, instead of ROM, is output to the internal bus.

When this bit is "0", the corresponding wild register function does not work. When this bit is "1", the wild register function is enabled. If there is a match with the address held in WRARH0 and WRARL0, the value of WRDR0, instead of ROM, is output to the internal bus.

Show 6 more labels / short text on this page
Address Initial value · Bit name Function · bit7 · to bit2 · bit1 EN01 · bit0 EN00
Page 371 of the Fujitsu MB89202 user manual — CHAPTER 16 WILD REGISTER FUNCTION
Page 371 · click to enlarge
Page 371

CHAPTER 16 WILD REGISTER FUNCTION

16.3.5 Data Test Set Register (WROR)

A test register. Do not access this register.

Page 372 of the Fujitsu MB89202 user manual — CHAPTER 16 WILD REGISTER FUNCTION
Page 372 · click to enlarge
Page 372

CHAPTER 16 WILD REGISTER FUNCTION

16.4 Operations of the Wild Register Functions

This section describes the operation order of the wild register.

  • Operation Order of the Wild Register Function

Table 16.4-1 describes the operation order of the wild register. In the operation example column, it corrects data at address FC36H, from FFH to B5H.

Table 16.4-1 Operation Order of Wild Register

AddressFC36 H /data: FF H WRARL0=36 H WRARH0=FC H

1 Set an address of the wild register correspondence area to the address set register.

2 Set the correction data to the data setting register. WRDR0=B5H

3 Set "1" to the address comparison EN00 bit. WREN=01H

When address = FC36H is accessed

4 The wild register works at the time of address matching.

Data = B5H

  • Wild Register Addresses List

Table 16.4-2 lists the addresses corresponding to the wild register numbers.

Table 16.4-2 Wild Register Addresses List

Higher address Lower address Data

Register name Address Register name Address Register name Address

1 WRARH0 040H WRARL0 041H WRDR0 042H

2 WRARH1 043H WRARL1 044H WRDR1 045H

Operation Operation example

Page 373 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 373 · click to enlarge
Page 373

CHAPTER 17 FLASH MEMORY

This chapter describes the functions and operation of the 128K-bit flash memory. The following three methods are available for writing data to and erasing data from the flash memory:

1. Parallel programmer 2. Writing/erasing data using a serial programmer 3. Executing programs to write/erase data This chapter explains "Executing programs to write/ erase data".

17.1 Overview of Flash Memory

17.2 Flash Memory Control Status Register (FMCS)

17.3 Starting the Flash Memory Automatic Algorithm

17.4 Confirming the Automatic Algorithm Execution State

17.5 Detailed Explanation of Writing to Erasing Flash Memory

17.6 Flash Security Feature

17.7 Notes on using Flash Memory

Page 374 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 374 · click to enlarge
Page 374

CHAPTER 17 FLASH MEMORY

17.1 Overview of Flash Memory

The 128K-bit flash memory is mapped to the C000H to FFFFH bank in the CPU memory

map. The functions of the flash memory interface circuit enable read-access and program-access from the CPU in the same way as mask ROM. Instructions from the CPU can be used via the flash memory interface circuit to write data to and erase data from the flash memory. Internal CPU control therefore enables rewriting of the flash memory while it is mounted. As a result, improvements in programs and data can be performed efficiently.

  • Flash Memory Features
  • 16 Kbyte × 8-bit configuration
  • Use of automatic program algorithm (Embedded Algorthm)
  • Detection of completion of writing/erasing using data polling or toggle bit functions
  • Detection of completion of writing/erasing using CPU interrupts
  • Compatible with JEDEC standard commands
  • Minimum of 10000 write / erase operations (MB89F202/F202RA)
  • High voltage supply on RST pin (applicable to MB89F202RA only)

During writing data to or erasing all data in flash memory, a typical +10V D.C. voltage should be applied at the RST pin. After applying the high voltage, wait for 10ms before writing data or erasing all data in flash memory. And this applied voltage should be kept at the RST pin until data writing or erasing has been completed.

  • Writing to/Erasing Flash Memory

The flash memory cannot be written to and read at the same time. That is, when data is written to or erased data from the flash memory, the program in the flash memory must first be copied to RAM. The entire process is then executed in RAM so that data is simply written to the flash memory. This eliminates the need for the program to access the flash memory from the flash memory itself.

  • Flash Memory Register

Compatible with JEDEC standard commands

Bit No. bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

0079H INTE RDYINT WE RDY -

Read/write (R/W) (R/W) (R/W) (R) (-)

Initial value (0) (0) (0) (X) (-)

Page 375 of the Fujitsu MB89202 user manual — INTE
Page 375 · click to enlarge
Page 375

CHAPTER 17 FLASH MEMORY

17.2 Flash Memory Control Status Register (FMCS)

The flash memory control status register (FMCS), together with the flash memory interface circuit, is used to write data to and erase data from the flash memory.

  • Flash Memory Control Status Register (FMCS)

Figure 17.2-1 Flash Memory Control Status Register (FMCS)

bit3 bit2 bit1 bit0 Initial value

0079 H

INTE

RDYINT

WE

RDY

000X---- B

R/W

R/W

R/W

R

Unused bit

Reading / Writing has no effect.

ReaDY bit (for enabling data to be written into/erased from flash memory)

RDY

Data is being written or erased.

Data writing/erasing has been completed. (Subsequent data can be written/erased.)

WE

Write enable bit

Disables data to be written into/erased from flash memory.

Enables data to be written into/erased from flash memory.

RDYINT

Flash memory operation state indication bit

Data is being written/erased.

Data writing/erasing has been completed.

(An interrupt request is generated.)

INTE

Causing an interrupt to the CPU to be generated bit

tINST : Instruction cycle R/W : Readable/Writable R : Read only : Initial value

Enables an interrupt when data writing/erasing is completed.

Disables an interrupt when data writing/erasing is completed.

Show 5 more labels / short text on this page
Address · bit7 · bit6 · bit5 · bit4
Page 376 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 376 · click to enlarge
Page 376

CHAPTER 17 FLASH MEMORY

Table 17.2-1 Explanation of Functions of Each Bit in the Flash Memory Control Status Register (FMCS)

INTECausing an interrupt to the CPU to be generated bit

Bit causing an interrupt (IRQB) to the CPU to be generated when writing into or erasing from flash memory is completed. An interrupt (IRQB) to the CPU is generated when both the INTE bit and RDYINT bit are "1". If the INTE bit is "0", no interrupt is generated.

Bit for indicating operation status of flash memory. This bit is set to "1" when writing into or erasing from flash memory is completed. After data has been written into or erased from flash memory and this bit has been set to "1", subsequent data can be written into or erased from flash memory. Writing "0" clears this bit with "0", while if "1" is written into this bit, it is ignored. This bit is set to "1" upon the termination of the flash memory automatic algorithm (see Section "17.3 Starting the Flash Memory Automatic Algorithm ". The read modifier write (RMW) command always reads "1" from this bit.

RDYINTFlash memory operation state indication bit

Bit for write-enabling flash memory areas. When this bit is set to "1", a write instruction performed after a command sequence for a section from C000H to FFFFH (see Section "17.3 Starting the Flash Memory Automatic Algorithm ") is issued writes data into a flash memory area. When this bit is set to "0", no write/erase signals are generated. This bit is used to start a command for writing data into or erasing data from flash memory. It is recommended that this bit be set to "0" to prevent data from being incorrectly written into flash memory, whenever there is no data to be written or erased.

bit5 WEWrite enable bit

Bit for status checking for writing data into or erasing data from flash memory. No data can be written into or erased from flash memory while this bit is "0". However, a read command, reset command, and suspend commands such as the sector erase suspend command can be accepted while this bit is "0".

bit4 RDYReaDY bit

Reading / Writing for these bits have no effect.

The RDYINT and RDY bits cannot be changed at the same time. Create a program so that decisions are made using one or the other of these bits.

Automatic algorithm Termination timing RDYINT bit RDY bit

Show 7 more labels / short text on this page
Bit name Description · bit7 · bit6 · bit3 · to bit0 · Unused bits · 1 machine cycle
Page 377 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 377 · click to enlarge
Page 377

CHAPTER 17 FLASH MEMORY

17.3 Starting the Flash Memory Automatic Algorithm

Four types of commands are available for starting the flash memory automatic algorithm: Read/Reset, Write, and Chip Erase.

  • Command Sequence Table

Table 17.3-1 lists the commands used for flash memory write/erase.

Table 17.3-1 Command Sequence Table

1st bus write cycle

2nd bus write cycle

3rd bus write cycle

4th bus read/ write cycle

5th bus write cycle

6th bus write cycle

Address Data Address Data Address Data Address Data Address Data Address Data

1 XXXX F0 -

4 FAAA AA F554 55 FAAA F0 RA RD -

Write program 4 FAAA AA F554 55 FAAA A0 PA PD -

Chip Erase 6 FAAA AA F554 55 FAAA 80 FAAA AA F554 55 FAAA 10

*: Both of the two types of Read/Reset commands can reset the flash memory to read mode.

  • The addresses shown in the table are those on the CPU memory map. All addresses and data are represented in hexadecimal notation. The letter X indicates an appropriate value. RA: Read address PA: Write address. RD: Read data PD: Write data.
  • The flash memory can only accept the command sequences mentioned on the above table (Read/Reset, Write program, Chip Erase), other command sequences are strictly prohibited to be sent to the flash memory or else the flash memory may become malfunction.
Show 5 more labels / short text on this page
Command · Bus write access · sequence · Read/Reset · (*)
Page 378 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 378 · click to enlarge
Page 378

CHAPTER 17 FLASH MEMORY

17.4 Confirming the Automatic Algorithm Execution State

Because the write/erase flow of the flash memory is controlled using the automatic algorithm, the flash memory has hardware for posting its internal operating state and completion of operation. This automatic algorithm enables confirmation of the operating state of the built-in flash memory using the following hardware sequence flags.

  • Hardware Sequence Flags

The hardware sequence flags are configured from the five-bit output of DQ7, DQ6, DQ5, and DQ2. The functions of these bits are those of the data polling flag (DQ7), toggle bit flag (DQ6), timing limit exceeded flag (DQ5), and toggle bit2 flag (DQ2). The hardware sequence flags can therefore be used to confirm that writing or chip sector erase has been completed or that erase code write is valid.

The hardware sequence flags can be accessed by read-accessing the addresses of the target sectors in the flash memory after setting of the command sequence (see Table 17.3-1 in Section "17.3 Starting the Flash Memory Automatic Algorithm "). Table 17.4-1 lists the bit assignments of the hardware sequence flags.

Table 17.4-1 Bit Assignments of Hardware Sequence Flags

bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0

Hardware sequence flag DQ7 DQ6 DQ5 - - DQ2 - -

To determine whether automatic writing or chip sector erase is being executed, the hardware sequence flags can be checked or the status can be determined from the RDY bit of the flash memory control status register (FMCS) that indicates whether writing has been completed. After writing/erasing has terminated, the state returns to the read/reset state. When creating a program, use one of the flags to confirm that automatic writing/erasing has terminated. Then, perform the next processing operation, such as data read. In addition, the hardware sequence flags can be used to confirm whether the second or subsequent sector erase code write is valid. The following sections describe each hardware sequence flag separately. Table 17.4-2 lists the functions of the hardware sequence flags.

Table 17.4-2 Hardware Sequence Flag Functions

State DQ7 DQ6 DQ5 DQ2

Executing Automatic writing operation DQ7 Toggle 0 1

Automatic erasing operation 0 Toggle 0 Toggle

Exceeding the time limit

Automatic writing operation DQ7 Toggle 1 1

Automatic erasing operation 0 Toggle 1 Toggle

Page 379 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 379 · click to enlarge
Page 379

CHAPTER 17 FLASH MEMORY

17.4.1 Data Polling Flag (DQ7)

The data polling flag uses the data polling function to post that the automatic algorithm is being executed or has terminated

  • Write

Read-access during execution of the automatic write algorithm causes the flash memory to output the opposite data of bit7 last written, regardless of the value at the address specified by the address signal. Read-access at the end of the automatic write algorithm causes the flash memory to output bit7 of the read value of the address specified by the address signal.

  • Automatic Erasing

Read-access during execution of the automatic erasing algorithm causes the flash memory to output "0", regardless of the value at the address specified by the address signal. After the automatic erasing algorithm is executed, "1" is output.

When the automatic algorithm comes to the end of its operation, bit7 (data polling) changes its state asynchronously during a read operation. This means that flash memory sends data about the operation state to bit7 and will then send out fixed data. When flash memory ends the automatic algorithm or even if bit7 is outputting fixed data, the values of the other bits are still undetermined. Fixed data in the other bits can be read by successively executing read operations.

Page 380 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 380 · click to enlarge
Page 380

CHAPTER 17 FLASH MEMORY

17.4.2 Toggle Bit Flag (DQ6)

Like the data polling flag, the toggle bit flag uses the toggle bit function to post that the automatic algorithm is being executed or has terminated.

  • Automatic Write/Erase

Making successive read accesses while the automatic writing/erasing algorithm is being performed toggles flash memory and makes it output 1 and then 0, in turn, regardless of the specified address. Making successive read accesses when the automatic writing/erasing algorithm ends makes flash memory to stop bit6 toggle and outputs the value of bit6 (DATA:6) corresponding to the value read from the specified address. The toggle bit becomes effective after the last write cycle in each command sequence.

Page 381 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 381 · click to enlarge
Page 381

CHAPTER 17 FLASH MEMORY

17.4.3 Timing Limit Exceeded Flag (DQ5)

The timing limit exceeded flag is used to post that execution of the automatic algorithm has exceeded the time (internal pulse count) prescribed in the flash memory.

  • Automatic Write/Erase

Bit5 indicates that execution of the automatic algorithm exceeded the time (internal pulse count) specified in flash memory. For an excess, bit5 outputs 1. Thus, if this bit outputs 1 while the automatic algorithm is operating, data writing or data erasing failed.

Bit5 indicates a failure when an attempt is made to write data into a non-blank area without erasing any data. In the case of such a failure, fixed data cannot be read from bit7 (data polling) and bit6 (toggle bit) remains unchanged (toggled). If the time limit is exceeded while there is a failure, "1" is set in bit5. In this case, note that the setting of bit5 to "1" does not indicate a flash memory failure but the incorrect use of flash memory. If bit5 is set to "1" as described above, execute a reset command.

Page 382 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 382 · click to enlarge
Page 382

CHAPTER 17 FLASH MEMORY

17.4.4 Toggle Bit-2 Flag (DQ2)

The toggle bit-2 flag (DQ2) is used to detect that flash memory is performing an automatic erase operation, together with the toggle bit.

  • Automatic Write/Erase

Making successive read accesses while the automatic erasing algorithm is being performed toggles flash memory and makes it output 1 and then 0, in turn, regardless of the specified address. Making successive read accesses while the automatic writing algorithm is being performed toggles flash memory and makes it output 1 regardless of the specified address.

Making successive read accesses when the automatic writing/erasing algorithm ends makes flash memory to stop bit2 toggle and outputs the value of bit2 (DATA:6) corresponding to the value read from the specified address. The toggle bit becomes effective after the last write cycle in each command sequence.

Page 383 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 383 · click to enlarge
Page 383

CHAPTER 17 FLASH MEMORY

17.5 Detailed Explanation of Writing to Erasing Flash Memory

This section describes each operation procedure of flash memory Read/Reset, Write, Chip Erase, when a command that starts the automatic algorithm is issued.

  • Detailed Explanation of Flash Memory Write/Erase

The flash memory executes the automatic algorithm by issuing a command sequence (see Table 17.3-1 in Section "17.3 Starting the Flash Memory Automatic Algorithm "for a write cycle to the bus to perform Read/Reset, Write, Chip Erase operations. Each bus write cycle must be performed continuously. In addition, whether the automatic algorithm has terminated can be determined using the data polling or other function. At normal termination, the flash memory is returned to the read/reset state.

Each operation of the flash memory is described in the following order:

17.5.1 Setting The Read/Reset State

17.5.2 Writing Data

17.5.3 Erasing All Data (Erasing Chips)

Page 384 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 384 · click to enlarge
Page 384

CHAPTER 17 FLASH MEMORY

17.5.1 Setting The Read/Reset State

This section describes the procedure for issuing the Read/Reset command to set the flash memory to the read/reset state.

  • Setting the Read/Reset State

The flash memory can be set to the read/reset state by sending the Read/Reset command in the command sequence table (see Table 17.3-1 in Section "17.3 Starting the Flash Memory Automatic Algorithm ") continuously to the target sector in the flash memory.

The Read/Reset command has two types of command sequences that execute the first and third bus operations. However, there are no essential differences between these command sequences.

The read/reset state is the initial state of the flash memory. When the power is turned on and when a command terminates normally, the flash memory is set to the read/reset state. In the read/reset state, other commands wait for input.

In the read/reset state, data is read by regular read-access. As with the mask ROM, program access from the CPU is enabled. The Read/Reset command is not required to read data by a regular read. The Read/Reset command is mainly used to initialize the automatic algorithm in such cases as when a command does not terminate normally.

Page 385 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 385 · click to enlarge
Page 385

CHAPTER 17 FLASH MEMORY

17.5.2 Writing Data

This section describes the procedure for issuing the Write command to write data to the flash memory. Figure 17.5-1 shows an example of the flash memory write procedure.

  • Writing Data

The data write automatic algorithm of the flash memory can be started by sending the Write command in the command sequence table (see Table 17.3-1 in Section "17.3 Starting the Flash Memory Automatic Algorithm ") continuously to the flash memory. When data write to the target address is completed in the fourth cycle, the automatic algorithm and automatic write are started.

  • Specifying Addresses

Writing can be done in any order of addresses. However, the Write command writes only data of one byte for each execution.

  • Notes on Writing Data

Writing cannot return data 0 to data 1. When data 1 is written to data 0, the data polling algorithm (DQ7) or toggle operation (DQ6) does not terminate and the flash memory elements are determined to be faulty. If the time prescribed for writing is thus exceeded, the timing limit exceeded flag (DQ5) is determined to be an error. Otherwise, the data is viewed as if dummy data 1 had been written. However, when data is read in the read/reset state, the data remains 0. Data 0 can be set to data 1 only by erase operations.

All commands are ignored during execution of the automatic write algorithm. If a hardware reset is started during writing, the data of the written addresses will be unpredictable.

  • Writing to the Flash Memory

Figure 17.5-1 is an example of the procedure for writing to the flash memory. The hardware sequence flags (see Section "17.4 Confirming the Automatic Algorithm Execution State ") can be used to determine the state of the automatic algorithm in the flash memory. Here, the data polling flag (DQ7) is used to confirm that writing has terminated.

The data read to check the flag is read from the address written to last.

The data polling flag (DQ7) changes at the same time that the timing limit exceeded flag (DQ5) changes. For example, even if the timing limit exceeded flag (DQ5) is "1", the data polling flag bit (DQ7) must be rechecked.

Also for the toggle bit flag (DQ6), the toggle operation stops at the same time that the timing limit exceeded flag bit (DQ5) changes to "1". The toggle bit flag (DQ6) must therefore be rechecked.

Page 386 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 386 · click to enlarge
Page 386

CHAPTER 17 FLASH MEMORY

Figure 17.5-1 Example of the Flash Memory Write Procedure

Fujitsu MB89202 — CHAPTER 17 FLASH MEMORY diagram (page 386)
Fig. 70

Make sure +10V DC voltage is applied at the RST pin before start writing

FMC SWE ( b it5) En ab le fl as h memory write

Write command sequence (1) FAAA

Read internal address Next address

Read internal address

FMCS: WE (bit5) Write-disable flash memory.

Confirm with the hardware sequence flags.

Page 387 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 387 · click to enlarge
Page 387

CHAPTER 17 FLASH MEMORY

17.5.3 Erasing All Data (Erasing Chips)

This section describes the procedure for issuing the Chip Erase command to erase all data in the flash memory.

  • Erasing All Data (Erasing Chips)

All data can be erased from the flash memory by sending the Chip Erase command in the command sequence table (see Table 17.3-1 in Section "17.3 Starting the Flash Memory Automatic Algorithm ") continuously to the target sector in the flash memory.

The Chip Erase command is executed in six bus operations. When writing of the sixth cycle is completed, the chip erase operation is started. For chip erase, the user need not write to the flash memory before erasing. During execution of the automatic erase algorithm, the flash memory writes "0" for verification before all of the cells are erased automatically.

Page 388 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 388 · click to enlarge
Page 388

CHAPTER 17 FLASH MEMORY

17.6 Flash Security Feature

Flash security feature provides possibilities to protect the content of the flash memory from being read from external.

  • Abstract

By writing the protection code of "01H" to the predefined flash security address of the flash memory,

access to the flash memory is restricted. Once the flash memory is protected, unlock the security function can only be done by performing the chip erase operation. Otherwise, read/write access of the flash memory from the external pins is not possible. This function is suitable for applications requiring security of self- containing data stored in the flash memory.

Table 17.6-1 Flash Security Address

Product Flash Memory Size Flash Security Address

MB89F202/F202RA 16 Kbyte FFFCH

  • How to enable the Flash Security Feature

After writing the code "01H" to the flash security address, the subsequent external reset or power on

enables the flash security feature.

  • How to disable the Flash Security Feature

Perform the chip erase operation.

  • Behavior under the Flash Security Feature
Read operationinvalid data read
Write operationignored
  • Others
  • For the configuration of the standard parallel programmer, please follow the specification of parallel programmer.
  • In order to prevent the device form enabling the flash security feature accidentally, writing the protection code at the last of flash memory programming is recommended.

The security byte is allocated inside the flash memory. After writing the code "01H" to the flash security address, the subsequent external reset or power on enables the flash security feature. Therefore, if the flash security feature is not required, do not write "01H" to the security byte address. Once the flash security feature is enabled, all the flash memory failure analysis cannot be performed.

Page 389 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 389 · click to enlarge
Page 389

CHAPTER 17 FLASH MEMORY

17.7 Notes on using Flash Memory

This section provides notes on using the MB89F202, especially for flash memory.

  • Input of a Hardware Reset (RST)

To input a hardware reset when reading is in progress, i.e., when the automatic algorithm has not been started, secure a minimum low-level width of 1650 ns.

To input a hardware reset while a write or erase is in progress, i.e., while the automatic algorithm is being started, secure a minimum low-level width of 1650 ns. In this case, 20 µs are required until the data becomes readable after the operation being performed terminates and the flash memory is fully initialized.

Performing a hardware reset during a write operation makes the data being written undetermined. Also note that performing a hardware reset or shut-down during an erase operation may make the sector from which data is being erased unusable.

  • Software Reset, Watchdog Timer Reset

When write/erase of flash memory is set up for normal mode and CPU memory access mode is internal ROM mode, and if a reset cause occurs while the automatic algorithm of flash memory is being activated, the CPU may run out of control.

The cause of a reset does not initialize the flash memory and keeps the automatic algorithm operating. Thus, when the CPU starts a sequence after the reset is cancelled, the flash memory may not have been in a read state. Prevent a cause of a reset from occurring while the flash memory is writing or erasing.

  • Program Access to Flash Memory

While the automatic algorithm is being activated, any read access to the flash memory is disabled. When CPU memory access mode is set to internal ROM mode, move program areas into another area such as RAM, and then start a write or erase.

In this case, when the flash containing interrupt vectors are erased, the writing or erasing of interrupt processing cannot be executed.

For the same reason, other interrupt processing shall be disabled while the automatic algorithm is being activated.

  • Flash Content Protection

Flash content can be read using parallel / serial programmer if the flash content protection mechanism is not activated.

One predefined area of the flash (FFFCH) is assigned to be used for preventing the read access of flash

content. If the protection code "01H" is written in this address (FFFCH), the flash content cannot be read by

any parallel / serial programmer.

in FFFCH). It is advised to write the flash protection code at last.

Page 390 of the Fujitsu MB89202 user manual — CHAPTER 17 FLASH MEMORY
Page 390 · click to enlarge
Page 390

CHAPTER 17 FLASH MEMORY

Page 391 of the Fujitsu MB89202 user manual — APPENDIX
Page 391 · click to enlarge
Page 391

APPENDIX

This appendix shows the I/O map, the overview of the instructions, mask options in MB89202/F202RA series, and the pin states.

APPENDIX A I/O Map

APPENDIX B Overview of the Instructions

APPENDIX C Mask Options

APPENDIX D Programming EPROM with Evaluation Chip

APPENDIX E Pin State of the MB89202/F202RA Series

Page 392 of the Fujitsu MB89202 user manual — APPENDIX A I/O Map
Page 392 · click to enlarge
Page 392

APPENDIX A I/O Map

APPENDIX A I/O Map

For the registers of peripheral functions incorporated in the MB89202/F202RA series, the addresses shown in Table A-1 are assigned.

  • I/O Map

Table A-1 I/O Map (1 / 4)

Address Register abbreviation Register name Read/write Initial value

0000H PDR0 Port 0 data register R/W XXXXXXXX

0001H DDR0 Port 0 data direction register W 00000000

0002H to 0006H Vacancy

0007H SYCC System clock control register R/W 1--11100

0008H STBC Standby control register R/W 00010---

0009H WDTC Watchdog control register R/W 0---XXXX

000AH TBTC Time-base timer control register R/W 00---000

000CH PDR3 Port 3 data register R/W XXXXXXXX

000DH DDR3 Port 3 data direction register W 00000000

000EH RSFR Reset flag register R XXXX

000FH PDR4 Port 4 data register R/W XXXX

0010H DDR4 Port 4 data direction register R/W 0000

0011H OUT4 Port 4 output format register R/W 0000

0012H PDR5 Port 5 data register R/W X

0013H DDR5 Port 5 data direction register R/W 0

0014H RCR21 12-bit PPG control register 1 R/W 00000000

0015H RCR22 12-bit PPG control register 2 R/W --000000

0016H RCR23 12-bit PPG control register 3 R/W 0-000000

0017H RCR24 12-bit PPG control register 4 R/W --000000

000BH Vacancy

Page 393 of the Fujitsu MB89202 user manual — APPENDIX A I/O Map
Page 393 · click to enlarge
Page 393

Table A-1 I/O Map (2 / 4)

Address Register abbreviation Register name Read/write Initial value

0018H BZCR Buzzer register R/W 000

0019H TCCR Capture control register R/W 00000000

001AH TCR1 Timer 1 control register R/W 000-0000

001BH TCR0 Timer 0 control register R/W 00000000

001CH TDR1 Timer 1 data register R/W XXXXXXXX

001DH TDR0 Timer 0 data register R/W XXXXXXXX

001EH TCPH Capture data register H R XXXXXXXX

001FH TCPL Capture data register L R XXXXXXXX

0020H TCR2 Timer output control register R/W 00

0022H CNTR PWM control register R/W 0-000000

0023H COMR PWM compare register W XXXXXXXX

0024H EIC1 External interrupt 1 control register 1 R/W 00000000

0025H EIC2 External interrupt 1 control register 2 R/W 0000

0026H Vacancy 0027H

0028H SMC Serial mode control register R/W 00000-00

0029H SRC Serial rate control register R/W --011000

002AH SSD Serial status and data register R/W 00100-1X

002BH SIDR Serial input data register R XXXXXXXX

SODR Serial output data register W XXXXXXXX

002CH UPC Clock divided cycle selection register R/W 0010

002DH to 002FH Vacancy

0030H ADC1 A/D control register 1 R/W -0000000

0031H ADC2 A/D control register 2 R/W -0000001

0032H ADDH A/D data register H R XX

0033H ADDL A/D data register L R XXXXXXXX

0021H Vacancy

Page 394 of the Fujitsu MB89202 user manual — APPENDIX A I/O Map
Page 394 · click to enlarge
Page 394

APPENDIX A I/O Map

Table A-1 I/O Map (3 / 4)

Address Register abbreviation Register name Read/write Initial value

0034H ADEN A/D enable register R/W 00000000

0036H EIE2 External interrupt 2 control register 1 R/W 00000000

0037H EIF2 External interrupt 2 control register 2 R/W 0

0039H SMR Serial mode register R/W 00000000

003AH SDR Serial data register R/W XXXXXXXX

003BH SSEL Serial function switching register R/W 0

003CH to 003FH Vacancy

0040H WRARH0 Higher address set register 0 R/W XXXXXXXX

0041H WRARL0 Lower address set register 0 R/W XXXXXXXX

0042H WRDR0 Data setting register 0 R/W XXXXXXXX

0043H WRARH1 Higher address set register 1 R/W XXXXXXXX

0044H WRARL1 Lower address set register 1 R/W XXXXXXXX

0045H WRDR1 Data setting register 1 R/W XXXXXXXX

0046H WREN Address comparison EN register R/W 00

0047H WROR Wild register data test register R/W 00

0048H to 005FH Vacancy

0060H PDR6 Port 6 data register R/W XX

0061H DDR6 Port 6 data direction register* R/W 00

0062H PUL6 Port 6 pull-up set register R/W 00

0063H PDR7 Port 7 data register R/W XXX

0064H DDR7 Port 7 data direction register R/W 000

0065H PUL7 Port 7 pull-up set register R/W 000

0035H Vacancy · 0038H Vacancy

Page 395 of the Fujitsu MB89202 user manual — APPENDIX A I/O Map
Page 395 · click to enlarge
Page 395

Table A-1 I/O Map (4 / 4)

Address Register abbreviation Register name Read/write Initial value

0066H to 006FH Vacancy

0070H PUL0 Port 0 pull-up set register R/W 00000000

0071H PUL3 Port 3 pull-up set register R/W 00000000

0072H PUL5 Port 5 pull-up set register R/W 0

0073H to 0078H Prohibited area

0079H FMCS Flash memory control status register R/W, R 000X

007AH Prohibited area

007BH ILR1 Interrupt level set register 1 W 11111111

007CH ILR2 Interrupt level set register 2 W 11111111

007DH ILR3 Interrupt level set register 3 W 11111111

007EH ILR4 Interrupt level set register 4 W 11111111

007FH ITR Interrupt test register Inhibited 00

  • Explanation on read/write
R/WReadable and Writable

R: Read only

W: Write only

  • Explanation on initial value
0. The initial value of this bit is "0".
1. The initial value of this bit is "1".

X: The initial value of this bit is undefined.

*: No used in MB89F202/F202RA.

Do not use the prohibited areas.

Page 396 of the Fujitsu MB89202 user manual — APPENDIX B Overview of the Instructions
Page 396 · click to enlarge
Page 396

APPENDIX B Overview of the Instructions

APPENDIX B Overview of the Instructions

This section describes the instructions used for the F2MC-8L.

  • Overview of the Instructions of the F 2 MC-8L

The F2MC-8L has 140 kinds of 1-byte machine instructions (actually, the map is 256 bytes). An instruction and succeeding operands make an instruction code.

Figure B-1 shows the correspondence between the instruction codes and instruction map.

Figure B-1 Correspondence between Instruction Codes and Instruction Map

0 to 2 bytes are provided depending on the instruction. 1 byte

Instruction code Machine instruction Operand Operand

Higher 4 bits [Instruction map]

  • The instructions are classified into four groups including transfer instructions and branch instructions.
  • Various methods for addressing are supported. Depending on the selection of an instruction and specification of operands, 10 kinds of addressing can be selected.
  • Bit manipulation instructions are supported, so read-modify-write operation is possible.
  • Instructions directing special operations are supported.

Lower 4 bits

Page 397 of the Fujitsu MB89202 user manual — APPENDIX B Overview of the Instructions
Page 397 · click to enlarge
Page 397
  • Explanation on the Codes Representing Instructions

Table B-1 describes the codes used to explain the instruction codes in Appendix B.

Table B-1 Explanation on Codes on Instructions’ List

dir Direct address (8 bits)

off Offset (8 bits)

ext Extended address (16 bits)

#vct Vector table number (3 bits)

#d8 Immediate data (8 bits)

#d16 Immediate data (16 bits)

dir:b Bit direct address (8:3 bits)

rel Branch relative address (8 bits)

@ Register indirect (Example@A, @IX, and @EP)

A Accumulator (8 bits or 16 bits, determined on basis of instruction to be used)

AH Higher 8 bits of the accumulator (8 bits)

AL Lower 8 bits of the accumulator (8 bits)

T Temporary accumulator (8 bits or 16 bits, determined on basis of instruction to be used)

TH Higher 8 bits of the temporary accumulator (8 bits)

TL Lower 8 bits of the temporary accumulator (8 bits)

IX Index register (16 bits)

EP Extra pointer (16 bits)

PC Program counter (16 bits)

SP Stack pointer (16 bits)

PS Program status (16 bits)

dr Either accumulator or index register (16 bits)

CCR Condition code register (8 bits)

RP Register bank pointer (5 bits)

Ri General-purpose register (8 bits, i = 0 to 7)

X Indicates that X itself is the immediate data. (8 bits or 16 bits, determined on basis of instruction to be used)

(X) Indicates that the contents of X is the accessing subject. (8 bits or 16 bits, determined on basis of instruction to be used)

((X)) Indicates that the address specified in X is the accessing subject. (8 bits or 16 bits, determined on basis of instruction to be used)

Code Meaning

Page 398 of the Fujitsu MB89202 user manual — OP CODE
Page 398 · click to enlarge
Page 398

APPENDIX B Overview of the Instructions

  • Explanation on the Items of Instructions’ List

Table B-2 Explanation on Items of Instructions’ List

MNEMONIC Represents the instruction coded in the assembler.

~ Indicates the number of cycles of the instruction (number of instruction cycles).

# Indicates the number of bytes of the instruction.

Operation Indicates the operation of the instruction.

  • Indicates how the contents of TL, TH, and AH change (automatic transfer from A to T) when the instruction is executed. The codes in this column indicate the following:
  • - indicates no change.
  • dH indicates the higher 8 bits of the data coded for the operation.
  • AL and AH indicate the contents of AL and AH just before the execution of the instruction.
  • 00 indicates that it becomes 00.

TL,TH,AH

N,Z,V,C Indicates whether the instruction changes the corresponding flags. If ( is shown in this column, the instruction changes the corresponding flags.

Indicates the instruction code. If the appropriate instruction occupies multiple codes, they are listed under the following rule: Example:

OP CODE

48 to 4F means the serial numbers from 48 to 4F.

Item Description

Page 399 of the Fujitsu MB89202 user manual — MOVW A, 1 2 3 4 H
Page 399 · click to enlarge
Page 399

B.1 Addressing

  • For the F 2 MC-8L, the following 10 kinds of addressing modes are supported:
  • Direct addressing
  • Extended addressing
  • Bit direct addressing
  • Index addressing
  • Pointer addressing
  • General-purpose register addressing
  • Immediate addressing
  • Vector addressing
  • Relative addressing
  • Inherent addressing
  • Explanation on Addressing
  • Direct addressing

The addressing, which is indicated by dir in the instructions list, is used for accessing the area from 0000H to 00FFH. In this addressing, the higher one byte of the address is 00H. Specify the lower one byte with the

operand.

Figure B.1-1 shows an example.

Figure B.1-1 Example of Direct Addressing

MOV 12H, A

4 5H 4 5H A 001 2H

  • Extended Addressing

The addressing, which is indicated by ext in the instructions list, is used for accessing the entire area of 64 KB. In this addressing, specify the higher one byte of the address with the first operand and the lower one byte with the second operand.

Figure B.1-2 shows an example.

Figure B.1-2 Example of Extended Addressing

MOVW A, 1 2 3 4 H

1 2 3 4 H

1 2 3 5 H 5 6 H 7 8 H A 5 6 7 8H

Page 400 of the Fujitsu MB89202 user manual — MOVW A, @EP
Page 400 · click to enlarge
Page 400

APPENDIX B Overview of the Instructions

  • Bit Direct Addressing

The addressing, which is indicated by dir:b in the instructions list, is used for accessing the area from 0000H to 00FFH on a per bit basis. In this addressing, the higher one byte of the address is 00H. Specify the

lower one byte with the operand; and the bit position in the specified address with the lower three bits of the operation code.

Figure B.1-3 shows an example.

Figure B.1-3 Example of Bit Direct Addressing

SETB 34H : 2

0 0 3 4H 7 6 5 4 3 2 1 0 X 1 X XB

  • Index addressing

The addressing, which is indicated by @IX(off in the instructions list, is used for accessing the entire area of 64 KB. In this addressing, the contents of the first operand are signed and added to IX (index register). Then the results are used as the address.

Figure B.1-4 shows an example.

Figure B.1-4 Example of Index Addressing

MOVW A, @IX+5 AH

2 7 A 5H 2 7 F FH 1 2H 2 8 0 0H 3 4H 1 2 3 4H

A IX

  • Pointer Addressing

The addressing, which is indicated by @EP in the instructions list, is used for accessing the entire area of 64 KB. In this addressing, the contents of EP (extra pointer) are used as the address.

Figure B.1-5 shows an example.

Figure B.1-5 Example of Pointer Addressing

MOVW A, @EP

2 7 A 5 H EP

2 7 A 5 H

1 2 3 4 H A 1 2 H 3 4 H 2 7 A 6 H

Page 401 of the Fujitsu MB89202 user manual — 0 FFCO H : FFC1 H
Page 401 · click to enlarge
Page 401
  • General-purpose Register Addressing

The addressing, which is indicated by Ri in the instructions list, is used for accessing the register bank of the general-purpose register area. In this addressing, the higher one byte of the address is fixed to 01. The lower one byte is generated from the contents of RP (register bank pointer) and the lower three bits of the operation code. The address is then accessed.

Figure B.1-6 shows an example.

Figure B.1-6 Example of General-purpose Register Addressing

MOV A, R 6

A BH A A B H 0 1 0 1 0 B RP H

0 1 5 6

  • Immediate Addressing

The addressing, which is indicated by #d8 in the instructions list, is used when immediate data is required. In this addressing, the operand directly becomes the immediate data. The specification of byte/word is determined using the operation code.

Figure B.1-7 shows an example.

Figure B.1-7 Example of Immediate Addressing

MOV A, #56 H

56 H A

  • Vector Addressing

The addressing, which is indicated by vct in the instructions list, is used for branching to a subroutine registered in the table. In this addressing, the operation code includes the vct information, with the addresses generated on the basis of the correspondence with the contents of Table B.1-1 .

Table B.1-1 Vector Table Address Corresponding to vct

#vct Vector table address (Jump destination, higher address:lower address)

0 FFCO H : FFC1 H

1 FFC2 H : FFC3 H

2 FFC4 H : FFC5 H

3 FFC6 H : FFC7 H

4 FFC8 H : FFC9 H

5 FFCA H : FFCB H

6 FFCC H : FFCD H

7 FFCE H : FFCF H

Page 402 of the Fujitsu MB89202 user manual — 9 A B D H
Page 402 · click to enlarge
Page 402

APPENDIX B Overview of the Instructions

Figure B.1-8 shows an example.

Figure B.1-8 Example of Vector Addressing

CALLV #5

F F C A H

F E D C H PC F E H

D C H F F C B H

  • Relative Addressing

The addressing, which is indicated by rel in the instructions list, is used for branching to the area of 128 bytes before or after the PC (program counter). In this addressing, the contents of the operand with a sign are added to the PC. The results are then stored in the PC.

Figure B.1-9 shows an example.

Figure B.1-9 Example of Relative Addressing

BNE FEH

New PC 9 A B CH Old PC 9ABCH + FFFEH

9 A B A H

In this example, the control jumps to the address holding the operation code of BNE, causing an endless loop.

  • Inherent addressing

This addressing, which has no operand in the instructions list, is used for performing an operation determined on the basis of the operation code. In this addressing, the operations differ depending on the instructions.

Figure B.1-10 shows an example.

Figure B.1-10 Example of Inherent Addressing

NOP

New PC 9 A B CH Old PC

9 A B D H

(Conversion)

Page 403 of the Fujitsu MB89202 user manual — 1234 H 1233 H
Page 403 · click to enlarge
Page 403

B.2 Special Instructions

This section describes the special instructions other than addressing.

  • Special Instructions
  • JMP @A

By this instruction, the control branches to PC (program counter) using the contents of A (accumulator) as the address. N items of jump destinations have been listed on the table, one of which is selected and transferred to A. Executing this instruction can achieve N kinds of branch processing.

Figure B.2-1 shows an overview.

Figure B.2-1 JMP @A

(Before execution) (After execution)

A

1234 H 1234 H

A

Old PC New PC

1234 H XXXX H

  • MOVW A, PC

This instruction performs the opposite operation of JMP @A. In other words, the contents of the PC are stored in A. When this instruction has been executed in the main routine and a specific subroutine is to be called, it is possible to verify that the contents of A are the predetermined value in the subroutine. It is also possible to verify that the branch was not from an unexpected part, so it is useful in judging that a runaway has occurred.

Figure B.2-2 shows an overview.

Figure B.2-2 MOVW A, PC

(Before execution) (After execution)

A A

XXXX H 1234 H

Old PC New PC

1234 H 1233 H

When this instruction is executed, the contents of A are not the address holding the operation code of this instruction but the same value as the address holding the next instruction. In Figure B.2-2 , therefore, the value stored in A, 1234H, is the same as the address holding the operation code next to the MOVW A, PC.

Page 404 of the Fujitsu MB89202 user manual — A
Page 404 · click to enlarge
Page 404

APPENDIX B Overview of the Instructions

  • MULU A

This instruction multiplies AL (the lower eight bits of accumulator) by TL (the lower eight bits of the temporary accumulator) without a sign and stores the results in 16 bits length to A. The contents of T (temporary accumulator) remain as they are. For the operation, the contents of AH (the higher eight bits of accumulator) and TH (the higher eight bits of temporary accumulator) before the execution are not used. Take care when using a branch based on the result of multiplication because the flags were not changed.

Figure B.2-3 shows an overview.

Figure B.2-3 MULU A

(Before execution) (After execution)

5678 H 1860 H

A

A

T

1234 H 1234 H

T

  • DIVU A

This instruction divides T of 16 bits by AL of 8 bits without a sign, stores the results in 8 bits to AL, and stores the remainder of 8 bits to TL. Both AH and TH become 0. For the operation, the contents of AH before execution are not used. If the results exceed 8 bits, they are not guaranteed. Also, the fact that the results exceeded 8 bits is not indicated. So when using data units that may cause this type of situation, judge them in advance.

Take care when using a branch based on the result of division, because the flags were not changed.

Figure B.2-4 shows an overview.

Figure B.2-4 DIVU A

(Before execution) (After execution)

A

5678 H

A

0034 H

1862 H

0002 H

T

T

Page 405 of the Fujitsu MB89202 user manual — PTS1
Page 405 · click to enlarge
Page 405
  • XCHW A, PC

This instruction replaces the contents of A and the contents of PC, resulting in a branch to the address indicated by the contents of A before execution. The contents of A after execution become the value of the address next to the address holding the operation code, XCHW A, PC. This instruction is useful especially when a table is specified in the main routine and a subroutine uses it.

Figure B.2-5 shows an overview.

Figure B.2-5 XCHW A, PC

(Before execution) (After execution)

5678 H 1235 H

A

A

PC

1234 H

PC

5678 H

After execution of this instruction, the contents of A do not become the address holding the operation code of this instruction. Instead, they are the same as the address holding the next instruction. In Figure B.2-5 , therefore, the value stored in A is 1235H, agreeing with the address holding the operation code next to

XCHW A, PC. Note that it is not 1234H but 1235H.

Figure B.2-6 shows an example of assembler coding.

Figure B.2-6 Usage Example of XCHW A, PC

MOVW XCHW DB MOVW

A, #PUTSUB A, PC

PUTSUB

XCHW A, EP PUSHW A MOV A, @EP INCW EP MOV IO, A CMP A, #EOL BNE PTS1 POPW A XCHW A, EP JMP @A

PTS1

'PUT OUT DATA', EOL A, 1234H

Outputs a table data unit.

(Main routine) (Subroutine)

Page 406 of the Fujitsu MB89202 user manual — PC
Page 406 · click to enlarge
Page 406

APPENDIX B Overview of the Instructions

  • CALLV #vct

This addressing is used for branching to one of the subroutine addresses registered in the table. After the return address (the contents of PC) is saved to the address indexed by SP (stack pointer), the control is branched to the address listed in the vector table via the vector addressing. This instruction is one byte, so using it for the frequently used subroutines enables the entire program size to be smaller.

Figure B.2-7 shows the overview.

Figure B.2-7 Executing Example of CALLV #3

(Before execution) (After execution)

PC

5678 H

PC

FEDC H

1234 H

1232 H

SP

SP

1232 H

1232 H 1233 H

X X H

5 6 H

1233 H

X X H

7 9 H

FFC6 H

F E H

FFC6 H

F E H

FFC7 H

D C H

FFC7 H

DC H

When this instruction is executed, the contents of the PC to be saved in the stack area are not the address holding the operation code of this instruction. Instead, they comprise the address holding the next instruction. In Figure B.2-7 , therefore, the value saved in the stack (1232H and 1233H) is the same as the

address holding the operation code next to CALLV #vct (return address), i.e. 5679H.

) · (- 2

Page 407 of the Fujitsu MB89202 user manual — B.3 Bit Manipulation Instructions (SETB and CLRB)
Page 407 · click to enlarge
Page 407

B.3 Bit Manipulation Instructions (SETB and CLRB)

Some registers of peripheral functions have bits that perform a read operation different from ordinary read for a bit manipulation instruction.

  • Read-modify-write Operation

The bit manipulation instructions can set "1" (SETB) to the specified bit in a register or RAM or clear it to "0" (CLRB). Because the CPU handles the data in 8 bits, however, it actually reads the 8-bit data, modifies the specified bit, and then writes it back to the original address. This series of operations is called read- modify-write operation.

Table B.3-1 shows the bus operation at bit manipulation instructions.

Table B.3-1 Bus Operation at Bit Manipulation Instructions

CODE MNEMONIC ~ Cycle Address bus Data bus RD WR RMW

A0 to A7 CLRB dir:b 4 1 N+1 Dir 0 1 0

2 dir address Data 0 1 1

A8 to AF SETB dir:b 3 dir address Data 1 0 0

4 N+2 Next operation 0 1 0

  • Read Destination at Execution of a Bit Manipulation Instruction

For some I/O ports and interrupt request flag bits, the read destination for read-modify-write is different from that for ordinary read.

  • I/O port (at bit manipulation)

For some I/O ports, the value of the I/O pin is read at ordinary read; meanwhile, the value of output latch is read at bit manipulation. This is to prevent the other bits of the output latch from being accidentally changed regardless of the I/O direction and pin state.

  • Interrupt request flag bit (at bit manipulation)

The interrupt request flag bits work as flag bits for confirming an interrupt request at ordinary read; meanwhile, "1" is always read at bit manipulation. This is to prevent the interrupt request flag bits from being written as "0", and accidentally clearing the flags at bit manipulation for another bit.

Page 408 of the Fujitsu MB89202 user manual — - - - - - - - D7
Page 408 · click to enlarge
Page 408

APPENDIX B Overview of the Instructions

B.4 F 2 MC-8L Instructions List

Table B.4-1 to Table B.4-4 list the instructions used by the F2MC-8L.

  • Transfer Instructions

Table B.4-1 List of Transfer Instructions (1 / 2)

No. MNEMONIC ~ # Operation TL TH AH N Z V C OP CODE

1 MOV dir, A 3 2 (dir) ← (A) - 45

2 MOV @IX+off, A 4 2 ((IX) +off) ← (A) - 46

3 MOV ext, A 4 3 (ext) ← (A) - 61

4 MOV @EP, A 3 1 ( (EP) ) ← (A) - 47

5 MOV Ri, A 3 1 (Ri) ← (A) - 48 to 4F

6 MOV A, #d8 2 2 A) ← d8 AL - - + + - - 04

7 MOV A, dir 3 2 (A) ← (dir) AL - - + + - - 05

8 MOV A, @IX +off 4 2 (A) ← ( (IX) +off) AL - - + + - - 06

9 MOV A, ext 4 3 (A) ← (ext) AL - - + + - - 60

10 MOV A, @A 3 1 (A) ← ( (A) ) AL - - + + - - 92

11 MOV A, @EP 3 1 (A) ← ( (EP) ) AL - - + + - - 07

12 MOV A, Ri 3 1 (A) ← (Ri) AL - - + + - - 08 to 0F

13 MOV dir, #d8 4 3 (dir) ← d8 - 85

14 MOV @IX+off, #d8 5 3 ( (IX) +off) ← d8 - 86

15 MOV @EP, #d8 4 2 ( (EP) ) ← d8 - 87

16 MOV Ri, #d8 4 2 (Ri) ← d8 - 88 to 8F

17 MOVW dir, A 4 2 (dir) ← (AH), (dir+1) ← (AL)

- D5

18 MOVW @IX+off , A 5 2 ( (IX)+off ) ← (AH), ((IX)+off+1

- D6

19 MOVW ext, A 5 3 (ext) ← (AH), (ext+1) ← (AL)

- D4

20 MOVW @EP, A 4 1 ( (EP) ) ← (AH), ( (EP)+1) ← (AL)

- D7

21 MOVW EP, A 2 1 (EP) ← (A) - E3

22 MOVW A, #d16 3 3 (A) ← d16 AL AH dH + + - - E4

Page 409 of the Fujitsu MB89202 user manual — B.4 F2MC-8L Instructions List
Page 409 · click to enlarge
Page 409

Table B.4-1 List of Transfer Instructions (2 / 2)

No. MNEMONIC ~ # Operation TL TH AH N Z V C OP CODE

23 MOVW A, dir 4 2 (AH) ← (dir), (AL) ← (dir+1)

AL AH dH + + - - C5

24 MOVW A, @IX+off 5 2 (AH) ← ( (IX) +off), (AL) ← ( (IX)

AL AH dH + + - - C6

25 MOVW A, ext 5 3 (AH) ← (ext), (AL) ← (ext+1)

AL AH dH + + - - C4

26 MOVW A, @A 4 1 (AH) ← ( (A) ), (AL) ← ( (A)+1)

AL AH dH + + - - 93

27 MOVW A, @EP 4 1 (AH) ← ( (EP) ), (AL) ← ( (EP)+1)

AL AH dH + + - - C7

28 MOVW A, EP 2 1 (A) ← (EP) - - dH - F3

29 MOVW EP, #d16 3 3 (EP) ← d16 - E7

30 MOVW IX, A 2 1 (IX) ← (A) - E2

31 MOVW A, IX 2 1 (A) ← (IX) - - dH - F2

32 MOVW SP, A 2 1 (SP) ← (A) - E1

33 MOVW A, SP 2 1 (A) ← (SP) - - dH - F1

34 MOV @A, T 3 1 ( (A) ) ← (T) - 82

35 MOVW @A, T 4 1 ( (A) ) ← (TH), ) ( (A)+1) ← (TL)

- 83

36 MOVW IX, #d16 3 3 (IX) ← d16 - E6

37 MOVW A, PS 2 1 (A) ← (PS) - - dH - 70

38 MOVW PS, A 2 1 (PS) ← (A) - - - + 71

39 MOVW SP, #d16 3 3 (SP) ← d16 - E5

40 SWAP 2 1 (AH) ← →(AL) - - AL - 10

41 SETB dir:b 4 2 (dir):b ← 1 - A8 to AF

42 CLRB dir:b 4 2 (dir):b ← 0 - A0 to A7

43 XCH A, T 2 1 (AL) ← → (TL) AL - 42

44 XCHW A, T 3 1 (A) ← → (T) AL AH dH - 43

45 XCHW A, EP 3 1 (A) ← → (EP) - - dH - F7

46 XCHW A, IX 3 1 (A) ← → (IX) - - dH - F6

47 XCHW A, SP 3 1 (A) ← → (SP) - - dH - F5

48 MOVW A, PC 2 1 (A) ← (PC) - - dH - F0

Page 410 of the Fujitsu MB89202 user manual — B.4 F2MC-8L Instructions List
Page 410 · click to enlarge
Page 410

APPENDIX B Overview of the Instructions

At byte transfer operation to A, the automatic transfer to T is represented by TL ← AL.

The operands in a multiple-operand instruction are stored in the order in which they are indicated in MNEMONIC.

  • Operation Instructions

Table B.4-2 List of Operation Instructions (1 / 4)

No. MNEMONIC ~ # Operation TL TH AH N Z V C OP CODE

1 ADDC A, Ri 3 1 (A) ← (A)+(Ri)+C - - - + 28 to 2F

2 ADDC A, #d8 2 2 (A) ← (A)+d8+C - - - + 24

3 ADDC A, dir 3 2 (A) ← (A)+(dir)+C - - - + 25

4 ADDC A, @IX+off 4 2 (A) ← (A)+( (IX)+off)+C - - - + 26

5 ADDC A, @EP 3 1 (A) ← (A)+( (EP) )+C - - - + 27

6 ADDCW A 3 1 (A) ← (A)+(T)+C - - dH + 23

7 ADDC A 2 1 (AL) ← (AL)+(TL)+C - - - + 22

8 SUBC A, Ri 3 1 (A) ← (A)-(Ri)-C - - - + 38 to 3F

9 SUBC A, #d8 2 2 (A) ← (A)-d8-C - - - + 34

10 SUBC A, dir 3 2 (A) ← (A)-(dir)-C - - - + 35

11 SUBC A, @IX+off 4 2 (A) ← (A)-( (IX)+off)-C - - - + 36

12 SUBC A, @EP 3 1 (A) ← (A)-( (EP) )-C - - - + 37

13 SUBCW A 3 1 (A) ← (T)-(A)-C - - dH + 33

14 SUBC A 2 1 (AL) ← (TL)-(AL)-C - - - + 32

15 INC Ri 4 1 (Ri) ← (Ri)+1 - - - + + + - C8 to CF

16 INCW EP 3 1 (EP) ← (EP)+1 - C3

17 INCW IX 3 1 (IX) ← (IX)+1 - C2

18 INCW A 3 1 (A) ← (A)+1 - - dH + + - - C0

19 DEC Ri 4 1 (Ri) ← (Ri)-1 - - - + + + - D8 to DF

20 DECW EP 3 1 (EP) ← (EP)-1 - D3

21 DECW IX 3 1 (IX) ← (IX)-1 - D2

22 DECW A 3 1 (A) ← (A)-1 - - dH + + - - D0

23 MULU A 19 1 (A) ← (AL) x (TL) - - dH + 01

24 DIVU A 21 1 (A) ← (T)/(AL), MOD → (T) dL 00 00 - 11

Page 411 of the Fujitsu MB89202 user manual — (A) (AL) ( (EP) )
Page 411 · click to enlarge
Page 411

Table B.4-2 List of Operation Instructions (2 / 4)

No. MNEMONIC ~ # Operation TL TH AH N Z V C OP CODE

25 ANDW A 3 1 - - dH + + R - 63

(A) (A) (T)

26 ORW A 3 1 - - dH + + R - 73

(A) (A) (T)

27 XORW A 3 1 - - dH + + R - 53

(A) (A) (T)

28 CMP A 2 1 (TL) - (AL) - - - + 12

29 CMPW A 3 1 (T)- (A) - - - + 13

30 RORC A 2 1 - - - + + - + 03

C A

31 ROLC A 2 1 - - - + + - + 02

C A

32 CMP A, #d8 2 2 (A) - d8 - - - + 14

33 CMP A, dir 3 2 (A) - (dir) - - - + 15

34 CMP A, @EP 3 1 (A) - ( (EP) ) - - - + 17

35 CMP A, @IX+off 4 2 (A)-( (IX)+off) - - - + 16

36 CMP A, Ri 3 1 (A) - (Ri) - - - + 18 to 1F

37 DAA 2 1 decimal adjust for addition - - - + 84

38 DAS 2 1 decimal adjust for subtraction - - - + 94

39 XOR A 2 1 - - - + + R - 52

(A) (AL) (TL)

40 XOR A, #d8 2 2 - - - + + R - 54

41 XOR A, dir 3 2 - - - + + R - 55

42 XOR A, @EP 3 1 - - - + + R - 57

(A) (AL) ( (EP) )

(A) (AL) d8 · (A) (AL) (dir)

Page 412 of the Fujitsu MB89202 user manual — (A) (AL) ( (EP) )
Page 412 · click to enlarge
Page 412

APPENDIX B Overview of the Instructions

Table B.4-2 List of Operation Instructions (3 / 4)

No. MNEMONIC ~ # Operation TL TH AH N Z V C OP CODE

43 XOR A, @IX+off 4 2 - - - + + R - 56

(A) (AL) ( (IX) +off)

44 XOR A, Ri 3 1 - - - + + R - 58 to 5F

45 AND A 2 1 - - - + + R - 62

(A) (AL) (TL)

2 2 - - - + + R - 64

46 AND A, #d8

3 2 - - - + + R - 65

47 AND A, dir

3 1 - - - + + R - 67

48 AND A, @EP

(A) (AL) ( (EP) )

4 2 - - - + + R - 66

49 AND A, @IX+off

(A) (AL) ( (IX)+off)

3 1 - - - + + R - 68 to 6F

50 AND A, Ri

51 OR A 2 1 - - - + + R - 72

52 OR A, #d8 2 2 - - - + + R - 74

53 OR A, dir 3 2 - - - + + R - 75

54 OR A, @EP 3 1 - - - + + R - 77

(A) (AL) ( (EP) )

55 OR A, @IX+off 4 2 - - - + + R - 76

(A) (AL) ( (IX)+off)

56 OR A, Ri 3 1 - - - + + R - 78 to 7F

57 CMP dir , #d8 5 3 (dir)-d8 - - - + 95

Show 8 more labels / short text on this page
(A) (AL) (Ri) · (A) (AL) d8 · (A) (AL) (dir) · (A) (AL) (Ri) · (A) (AL) (Ri) · (A) (AL) d8 · (A) (AL) (dir) · (A) (AL) (Ri)
Page 413 of the Fujitsu MB89202 user manual — B.4 F2MC-8L Instructions List
Page 413 · click to enlarge
Page 413

Table B.4-2 List of Operation Instructions (4 / 4)

No. MNEMONIC ~ # Operation TL TH AH N Z V C OP CODE

58 CMP @EP, #d8 4 2 ( (EP) )-d8 - - - + 97

59 CMP @IX+off, #d8 5 3 ( (IX)+off)-d8 - - - + 96

60 CMP Ri, #d8 4 2 (Ri)-d8 - - - + 98 to 9F

61 INCW SP 3 1 (SP) ← (SP)+1 - C1

62 DECW SP 3 1 (SP) ← (SP)-1 - D1

  • Branch Instructions

Table B.4-3 List of Branch Instructions

No. MNEMONIC ~ # Operation TL TH AH N Z V C OP CODE

1 BZ/BEQ rel 3 2 if Z=1 then PC ← PC+rel - FD

2 BNZ/BNE rel 3 2 if Z=0 then PC ← PC+rel - FC

3 BC/BLO rel 3 2 if C=1 then PC ← PC+rel - F9

4 BNC/BHS rel 3 2 if C=0 then PC ← PC+rel - F8

5 BN rel 3 2 if N=1 then PC ← PC+rel - FB

6 BP rel 3 2 if N=0 then PC ← PC+rel - FA

7 BLT rel 3 2 - FF

if N=1 then PC PC+rel

8 BGE rel 3 2 - FE

if N=0 then PC PC+rel

9 BBC dir:b, rel 5 3 if(dir:b)=0 then PC ← PC+rel - + - - B0 to B7

10 BBS dir:b, rel 5 3 if(dir:b)=1 then PC ← PC+rel - + - - B8 to BF

11 JMP @A 2 1 (PC) ← (A) - E0

12 JMP ext 3 3 (PC) ← ext - 21

13 CALLV #vct 6 1 vector call - E8 to EF

14 CALL ext 6 3 subroutine call - 31

15 XCHW A, PC 3 1 (PC) ← (A), (A) ← (PC)+1 - - dH - F4

16 RET 4 1 return from subroutine - 20

17 RETI 6 1 return from interrupt - - - restore 30

Page 414 of the Fujitsu MB89202 user manual — B.4 F2MC-8L Instructions List
Page 414 · click to enlarge
Page 414

APPENDIX B Overview of the Instructions

  • Other Instructions

Table B.4-4 List of Other Instructions

No. MNEMONIC ~ # Operation TL TH AH N Z V C OP CODE

1 PUSHW A 4 1 ( (SP) ) ← (A), (SP) ← (SP)-2 - 40

2 POPW A 4 1 (A) ← ((SP)), (SP) ← (SP)+2 - - dH - 50

3 PUSHW IX 4 1 ( (SP) ) ← (IX), (SP) ← (SP)-2 - 41

4 POPW IX 4 1 (IX) ← ((SP)), (SP) ← (SP)+2 - 51

5 NOP 1 1 No operation - 00

6 CLRC 1 1 (C) ← 0 - R 81

7 SETC 1 1 (C) ← 1 - S 91

8 CLRI 1 1 (I) ← 0 - 80

9 SETI 1 1 (I) ← 1 - 90

Page 415 of the Fujitsu MB89202 user manual — SUBCW
Page 415 · click to enlarge
Page 415

B.5 Instruction Map

Table B.5-1 shows the instruction map of the F2MC-8L.

  • Instruction Map

Table B.5-1 Instruction Map of the F2MC-8L

A A A, ext A, PS dir:0 dir:0, rel A A @A A, PC

A, SP

A, IX

A, EP

A, #d8 A, #d8 A, #d8 dir:4 dir:4, rel A, ext ext, A A, #d16 A, PC

A, dir A, dir A, dir A, dir dir, A A, dir A, dir A, dir dir, #d8 dir, #d8 dir:5 dir:5, rel A, dir dir, A SP, #d16 A, SP

@IX+d, A @IX+d, #d8 @IX+d, #d8 dir:6 dir:6, rel A, @IX+d @IX+d, A IX, #d16 A, IX

A, @EP A, @EP A, @EP A, @EP @EP, A A, @EP A, @EP A, @EP @EP#, d8 @EP#, d8 dir:7 dir:7, rel A, @EP @EP, A EP, #d16 A, EP

A, R0 A, R0 A, R0 A, R0 R0, A A, R0 A, R0 A, R0 R0, #d8 R0, #d8 dir:0 dir:0, rel R0 R0 #0 rel

A, R1 A, R1 A, R1 A, R1 R1, A A, R1 A, R1 A, R1 R1, #d8 R1, #d8 dir:1 dir:1, rel R1 R1 #1 rel

A, R2 A, R2 A, R2 A, R2 R2, A A, R2 A, R2 A, R2 R2, #d8 R2, #d8 dir:2 dir:2, rel R2 R2 #2 rel

A, R3 A, R3 A, R3 A, R3 R3, A A, R3 A, R3 A, R3 R3, #d8 R3, #d8 dir:3 dir:3, rel R3 R3 #3 rel

A, R5 A, R5 A, R5 A, R5 R5, A A, R5 A, R5 A, R5 R5, #d8 R5, #d8 dir:5 R5 R5 #5 rel dir:5, rel

A, R6 A, R6 A, R6 A, R6 R6, A A, R6 A, R6 A, R6 R6, #d8 R6, #d8 dir:6 dir:6, rel R6 R6 #6 rel

A, R7 A, R7 A, R7 A, R7 R7, A A, R7 A, R7 A, R7 R7, #d8 R7, #d8 dir:7 dir:7, rel R7 R7 #7 rel

NOP SWAP RET RETI PUSHW POPW MOV MOVW CLRI SETI CLRB BBC dir INCW DECW JMP MOVW

MOVW

MOVW

MOVW

ADDC SUBC XOR AND OR DAA DAS CLRB BBC dir MOVW MOVW MOVW XCHW

MOV CMP ADDC SUBC MOV XOR AND OR MOV CMP CLRB BBC dir MOVW MOVW MOVW XCHW

MOV A, CMP A, ADDC A, SUBC A, MOV XOR A, AND A, OR A, MOV, CMP, CLRB BBC dir MOVW MOVW MOVW XCHW

MOV CMP ADDC SUBC MOV XOR AND OR MOV CMP CLRB BBC dir MOVW MOVW MOVW XCHW

A, R4 A, R4 A, R4 R4, A A, R4 A, R4 A, R4 R4, #d8 dir:4 dir:4, rel R4 #4 rel R4 R4, #d8 A, R4

7 8 9 A B C D E F

MOV CMP ADDC SUBC MOV XOR AND OR MOV CMP SETB BBS dir INC DEC CALLV BNC

MOV CMP ADDC SUBC MOV XOR AND OR MOV CMP SETB BBS dir INC DEC CALLV BNZ

MOV CMP ADDC SUBC MOV XOR AND OR MOV CMP SETB BBS dir INC DEC CALLV BGE

F CMP ADDC SUBC MOV XOR AND OR MOV CMP SETB BBS dir INC DEC CALLV BLT

MOV CMP ADDC SUBC MOV XOR AND OR MOV CMP SETB BBS dir INC DEC CALLV BC

MOV CMP ADDC SUBC MOV XOR AND OR MOV CMP SETB BBS dir INC DEC CALLV BP

MOV CMP ADDC SUBC MOV XOR AND OR MOV CMP SETB BBS dir INC DEC CALLV BN

MOV CMP ADDC SUBC MOV XOR AND OR MOV CMP SETB BBS dir INC DEC CALLV BZ

SP, A

IX, A

EP, A

MOVW

MOVW

MOVW

SP

EP

DECW

DECW

DECW

SP

EP

INCW

INCW

INCW

dir:1, rel

dir:2, rel

dir:3, rel

dir:1

dir:2

dir:3

CLRC SETC CLRB

CLRB

CLRB

A, @A

A, @A

MOVW

MOV

@A, T

@A, T

MOVW

MOV

PS, A

A

A

MOVW

ORW

OR

A

A

ANDW

MOV

AND

A

A

POPW

XORW

XOR

A, T

A, T

PUSHW

XCHW

XCH

A

A

A, #d8 A, #d8

SUBCW

CALL

SUBC

A

ADDCW

A

ADDC

JMP

A

A

CMPW

MULU DIVU

CMP

CMP

A

A

A

ROLC

RORC

MOV

MOV

H

A

B

D

E

Show 8 more labels / short text on this page
BBC dir · BBC dir · BBC dir · ext, A · addr16 · A addr16 · A, #d8 · A, #d8
Page 416 of the Fujitsu MB89202 user manual — APPENDIX C Mask Options
Page 416 · click to enlarge
Page 416

APPENDIX C Mask Options

APPENDIX C Mask Options

Table C-1 lists the mask options of the MB89202/F202RA series.

  • Mask Options

Table C-1 Mask Options

No. Part number MB89202 MB89F202/F202RA MB89V201

Specifying procedure Specify when ordering

Specify by part number

1 Selection of initial value of main clock oscillation settling time* (with FCH = 12.5 MHz)

Selectable Fixed to 218/FCH Fixed to 218/FCH

1. 2 14 /F CH (Approx.1.31 ms)
10. 2 17 /F CH (Approx.10.5 ms)
11. 2 18 /F CH (Approx.21.0 ms)

2 Reset pin output

Selectable With reset output With reset output

With reset output Without reset output

3 Power on reset selection

Selectable With power-on reset With power-on reset

With power-on reset Without power-on reset

FCH : Main clock scillation frequency * : Initial value to which the oscillation settling time bit (SYCC : WT1, WT0) in the system clock control register is set

masking

Page 417 of the Fujitsu MB89202 user manual — FFFF H
Page 417 · click to enlarge
Page 417

APPENDIX D Programming EPROM with Evaluation Chip

This section describes how to program EPROM with evaluation chip.

  • Programming EPROM with Evaluation Chip
  • EPROM for use

32 Kbyte EPROM (equivalent to MBM27C256A DIP-28)

Figure D-1 Memory Map of the Evaluation Chip

In normal operation mode

(Corresponding address on the ROM programmer)

0000 H

I/O

00 8 0 H

RAM 512bytes

02 8 0 H

Unavailable

8 000 H

0000 H

Program area Program area

(PROM 32Kbytes)

(PROM 32Kbytes)

FFFF H

7FFF H

  • Programming EPROM
1. Make the MBM27C256-equivalent setting for the EPROM programmer
2. Load the program data to the area from 0000 H to 7FFF H of the EPROM programmer.
3. Program the area from 0000 H to 7FFF H with the EPROM programmer.
Page 418 of the Fujitsu MB89202 user manual — P40/AN0
Page 418 · click to enlarge
Page 418

APPENDIX E Pin State of the MB89202/F202RA Series

APPENDIX E Pin State of the MB89202/F202RA Series

Table E-1 describes the pin states in each operation mode of the MB89202/F202RA series.

  • Pin States in Each Operation Mode

Table E-1 Pin States in Each Operation Mode

Pin name In normal operation

(SPL = 1) During a reset

(SPL = 0)

X0 Oscillation input Oscillation

input Hi-Z Hi-Z Oscillation

X1 Oscillation output Oscillation

output "H" output "H" output Oscillation

P00/INT20/AN4

Port I/O or resource I/O Hold Hold Hi-Z *1,*2 Hi-Z

P30/UCK/SCK

Port I/O or resource I/O Hold Hold Hi-Z *1,*2 Hi-Z

P40/AN0

Port I/O or resource I/O Hold Hold Hi-Z *2 Hi-Z

P50/PWM Port I/O or resource I/O Hold Hold Hi-Z *2 Hi-Z

P60, P61 Port I/O Hold Hold Hi-Z *2 Hi-Z

P70 to P72 Port I/O Hold Hold Hi-Z *2 Hi-Z

*1: For port input and peripheral input, the internal input level is fixed to prevent them from generating a leak via the input open. However, if external interrupts are allowed for P00 to P07 and P34 to P36, only the external interrupts are available as their inputs. *2: The pins, for which pull-up is selected by the option setting, enter the pull-up state. Hi-Z: Indicates high impedance. Hold: The pins, for which output is set, maintain the pin state (level) just before the mode transition. SPL: Pin state spacification bit of the standby control register (STBC)

Show 10 more labels / short text on this page
In sleep · In stop mode · In stop mode · mode · mode · input · output · to P07/INT27 · to P37/BZ/PPG · to P43/AN3
Page 419 of the Fujitsu MB89202 user manual — INDEX
Page 419 · click to enlarge
Page 419

INDEX

INDEX

The index follows on the next page. This is listed in alphabetic order.

Page 420 of the Fujitsu MB89202 user manual — Table of contents
Page 420 · click to enlarge
Page 420

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 421 of the Fujitsu MB89202 user manual — Table of contents
Page 421 · click to enlarge
Page 421

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 422 of the Fujitsu MB89202 user manual — Table of contents
Page 422 · click to enlarge
Page 422

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 423 of the Fujitsu MB89202 user manual — ............................................................ 68 DIP-32P-M06
Page 423 · click to enlarge
Page 423

INDEX

E

Command Sequence Table 361 COMR

EIC

External Interrupt Control Register 1 (EIC1)

PWM Compare Register (COMR) 145 Condition Code Register

232 External Interrupt Control Register 2 (EIC2)

Configuration of the Condition Code Register (CCR)

235 EIE

29 Configuration

External Interrupt Circuit 2 Control Register (EIE2)

Configuration of Memory Space 22 Configuration of the Condition Code Register (CCR)

250 EIF

29 Configuration of the General-purpose Registers

External Interrupt 2 Flag Register (EIF2) 252 Erase

32 Configuration of the Interrupt Level Setting Registers

Automatic Write/Erase 364, 365, 366 Detailed Explanation of Flash Memory Write/Erase

(ILR1 to ILR4) 36 Configuration of the Register Bank Pointer (RP)

367 Erasing

31 Configuration of the Reset Flag Register (RSFR)

Automatic Erasing 363 Erasing All Data (Erasing Chips) 371 Writing to/Erasing Flash Memory 358 Erasing All Data

45 Configuration of the System Clock Control Register

(SYCC) 56 Dedicated Register Configuration 27 Controlling Acceptance

Erasing All Data (Erasing Chips) 371 Erasing Chips

Erasing All Data (Erasing Chips) 371 Evaluation Chip

Bits for Controlling Acceptance of Interrupts

30 Counter

Programming EPROM with Evaluation Chip

Counter Function 165 Counter Function Operation 189 Program Example of Counter Function 202 CPU Reads

401 Example

Example of Operations of 12-bit PPG Timer Functions

219 Exercise Caution

States of Pins after the CPU Reads the Mode Data

50

Exercise Caution when Changing Edge Polarity

Selection 238 Explanation

D

Explanation on Addressing 383 Explanation on the Codes Representing Instructions

Data Setting Register (WRDR) 351 DDR

381 Explanation on the Items of Instructions’List

Registers of Port 4 91 Registers of Port 5 95 Registers PDR0, DDR0, and PUL0 of Port 0 79 Registers PDR3, DDR3, and PUL3 of Port 3 85 Registers PDR6, DDR6, and PUL6 of Port 6 102 Registers PDR7, DDR7, and PUL7 of Port 7 108 Detailed Explanation

382 External Interrupt

Association between the Interrupt Enable Bits for

External Interrupt Circuit 2 and the External Interrupt Pins 248 Block Diagram of Circuitry Terminating at the Pins

Associated with External Interrupt Circuit 1

Detailed Explanation of Flash Memory Write/Erase

230 Block Diagram of Circuitry Terminating at the Pins

367 Diagram

Associated with External Interrupt Circuit 2

Diagram for State Transition in Standby Mode

247 Block Diagram of External Interrupt Circuit 1

68 DIP-32P-M06

227 Block Diagram of External Interrupt Circuit 2

Package Dimension of DIP-32P-M06 10 Pin Assignment of DIP-32P-M06 8

245 Functions of External Interrupt Circuit 1 226

Command Sequence · Data Setting Register

Page 424 of the Fujitsu MB89202 user manual — Table of contents
Page 424 · click to enlarge
Page 424

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 425 of the Fujitsu MB89202 user manual — Table of contents
Page 425 · click to enlarge
Page 425

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 426 of the Fujitsu MB89202 user manual — Table of contents
Page 426 · click to enlarge
Page 426

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 427 of the Fujitsu MB89202 user manual — Table of contents
Page 427 · click to enlarge
Page 427

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 428 of the Fujitsu MB89202 user manual — Table of contents
Page 428 · click to enlarge
Page 428

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 429 of the Fujitsu MB89202 user manual — Table of contents
Page 429 · click to enlarge
Page 429

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 430 of the Fujitsu MB89202 user manual — Table of contents
Page 430 · click to enlarge
Page 430

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 431 of the Fujitsu MB89202 user manual — (SYCC) ................................................56
Page 431 · click to enlarge
Page 431

INDEX

When Bidirectional Serial I/O Operation is Performed

334 Serial Input

State of Reset Waiting for Stabilization of Oscillation

49 Stack

Operation at Serial Input Completion 328 Program Example for 8-bit Serial Input 337 Serial Input Operation 327 Serial Input Data Register

16-bit Data Storage State in Stack 26 Stack Area

Stack Area for Interrupt Processing 42 Stack Operation

Serial Input Data Register (SIDR) 297 Serial Mode Control Register

Stack Operation at the Beginning of Interrupt

Serial Mode Control Register (SMC) 290 Serial Mode Register

Processing 41 Stack Operation at the End of Interrupt Processing

41 Standby Control Register

Serial Mode Register (SMR) 320 Serial Output

Operation at Serial Output Completion 326 Program Example for 8-bit Serial Output 336 Serial Output Operation 325 Serial Output Data Register

Standby Control Register (STBC) 66 Standby Mode

Cancellation of Standby Mode by an Interrupt

70 Diagram for State Transition in Standby Mode

Serial Output Data Register (SODR) 298 Serial Rate Control Register

68 Notes on Setting Standby Mode 70 Operation in Standby Mode and at Halfway Stop

Serial Rate Control Register (SRC) 292 Serial Status and Data Register

197 Operations in Standby Mode 63 Operations in the Standby Mode and at a Suspension

Serial Status and Data Register (SSD) 294 Serial Switch

Serial Switch 281 Serial Switch Register

152 Standby Mode 62 Transition to Standby Mode and Interrupt 70 State

Serial Switch Register (SSEL) 301 Setting

Setting the Read/Reset State 368 SIDR

State of Reset Waiting for Stabilization of Oscillation

49 States of Pins after the CPU Reads the Mode Data

Serial Input Data Register (SIDR) 297 Single-chip Mode

50 States of Pins during Reset 50 STBC

Single-chip Mode 72 Sleep Mode

Operations Related to Sleep Mode 64 SMC

Standby Control Register (STBC) 66 Steps

Serial Mode Control Register (SMC) 290 SMR

Steps in the Interrupt Operation 37 Stop Mode

Operations Related to Stop Mode 65 Structure

Serial Mode Register (SMR) 320 SODR

Serial Output Data Register (SODR) 298 Software Reset

Structure of Port 0 78 Structure of Port 3 84 Structure of Port 4 90 Structure of Port 5 94 Structure of Port 6 100 Structure of Port 7 107 Suspension

Software Reset,Watchdog Timer Reset 373 Special Instructions

Special Instructions 387 Square Wave

Interval Timer Functions (Functions to Output

Operations in the Standby Mode and at a Suspension

the Square Wave) 136 SRC

152 SYCC

Serial Rate Control Register (SRC) 292 SSD

Configuration of the System Clock Control Register

(SYCC) 56 System Clock Control Register

Serial Status and Data Register (SSD) 294 SSEL

Configuration of the System Clock Control Register

Serial Switch Register (SSEL) 301

(SYCC) 56

Stabilization of Oscillation

Page 432 of the Fujitsu MB89202 user manual — W
Page 432 · click to enlarge
Page 432

INDEX

T

Transition to Standby Mode and Interrupt 70 Transmission

TBTC

Time-base Timer Control Register (TBTC) 119 TCCR

Transmission Interrupt 303 Transmission Operations

Transmission Operations in Operating Mode is

Capture Control Register (TCCR) 171 TCPH and TCPL

0,1,2,or 3 306

Capture Data Registers H and L (TCPH and TCPL)

U

..........................................................182 TCR

UART

Timer 0 Control Register (TCR0) 173 Timer 1 Control Register (TCR1) 175 Timer Output Control Register (TCR2) 177 TDR

Block Diagram of the UART-relating Pins

288 Block Diagram of UART 284 Functions of UART 280 Program Example for UART 311 UART Relating Pins 287 UART-relating Registers 289 UART Interrupt Related Registers

Timer 0 Data Register (TDR0) 178 Timer 1 Data Register (TDR1) 180 Theory

Theory of Operation for Operating Mode 0,1,2, and 3

305 Time-base Timer

UART Interrupt Related Registers and Vector Table

Addresses 303 UART-relating Registers

Block Diagram of Time-base Timer 118 Notes on Using Time-base Timer 124 Operations of Interval Timer Function

UART-relating Registers 289 UPC

(Time-base Timer) 122 Operations of Time-base Timer 122 Oscillation Stabilization Time and Time-base Timer

Clock Divider Selection Register (UPC) 299

Interrupts 121 Programming Examples for Time-base Timer

125 Register and Vector Table Related to Interrupts from

8-bit Serial I/O Interrupt Register and Vector Table 324 Register and Vector Table Related to 8/16-bit Capture

Time-base Timer 121 Time-base Timer Control Register

Timer/Counter of Interrupts 184 Register and Vector Table Related to Interrupts from

Time-base Timer Control Register (TBTC) 119 Timer 0 Control Register

Time-base Timer 121 Register and Vector Table Related to the Interrupt of

Timer 0 Control Register (TCR0) 173 Timer 0 Data Register

the A/D Converter 272 Register and Vector Table Related to the Interrupts of

Timer 0 Data Register (TDR0) 178 Timer 1 Control Register

an 8-bit PWM Timer 147 Register Associated with Interrupt Generation by

Timer 1 Control Register (TCR1) 175 Timer 1 Data Register

External Interrupt Circuit 1 and Vector Table 238 Register Associated with Interrupt Generation by

Timer 1 Data Register (TDR1) 180 Timer Output Control Register

External Interrupt Circuit 2 and Vector Table 253 UART Interrupt Related Registers and Vector Table

Timer Output Control Register (TCR2) 177 tINST

Addresses 303 Vector Table Area

Instruction Cycle (tINST) 57 Transfer

Transfer Instructions 392 Transfer Clock Rate

(AddressFFC0 H to FFFF H ) .................. 24

Choice of the Transfer Clock Rate 281 Transferred Data Format

W

Transferred Data Format 304 Transition

Watchdog Control Register (WDTC) 130 Watchdog Timer

Diagram for State Transition in Standby Mode

68

Block Diagram of Watchdog Timer 129 Notes on Using Watchdog Timer 132

Vector Table · Vector Table Area · Watchdog Control Register

Page 433 of the Fujitsu MB89202 user manual — Table of contents
Page 433 · click to enlarge
Page 433

Table of contents

CHAPTER 1 OVERVIEWp.171.1 Features of MB89202/F202RA Seriesp.181.2 MB89202/F202RA Series Product Lineupp.201.3 Differences between Modelsp.221.4 Block Diagram of MB89202/F202RA Seriesp.231.5 Pin Assignmentp.241.6 Package Dimensionsp.261.7 Pin Functions Descriptionp.281.8 I/O Circuit Typesp.30CHAPTER 2 HANDLING DEVICESp.332.1 Precautions on Handling Devicesp.34CHAPTER 3 CPUp.373.1 Memory Spacep.383.1.1 Specific-purpose Areasp.403.1.2 Location of 16-bit Data on Memoryp.423.2 Dedicated Registerp.433.2.1 Condition Code Register (CCR)p.453.2.2 Register Bank Pointer (RP)p.473.3 General-Purpose Registersp.483.4 Interruptsp.503.4.1 Interrupt Level Setting Registers (ILR1 to ILR4)p.523.4.2 Steps in the Interrupt Operationp.533.4.3 Multiple Interruptsp.553.4.4 Interrupt Processing Timep.563.4.5 Stack Operation at Interrupt Processingp.573.4.6 Stack Area for Interrupt Processingp.583.5 Resetp.593.5.1 Reset Flag Register (RSFR)p.613.5.2 External Reset Pinp.633.5.3 Reset Operationp.643.5.4 State of Each Pin at Resetp.663.6 Clockp.673.6.1 Clock Generatorp.693.6.2 Clock Controllerp.703.6.3 System Clock Control Register (SYCC)p.723.6.4 Clock Modep.743.6.5 Oscillation Stabilization Wait Timep.763.7 Standby Mode (Low-Power Consumption Mode)p.783.7.1 Operations in Standby Modep.793.7.2 Sleep Modep.803.7.3 Stop Modep.813.7.4 Standby Control Register (STBC)p.823.7.5 Diagram for State Transition in Standby Modep.843.7.6 Notes on Standby Modep.863.8 Memory Access Modep.88CHAPTER 4 I/O PORTSp.914.1 Overview of I/O Portsp.924.2 Port 0p.944.2.1 Registers of Port 0 (PDR0, DDR0, and PUL0)p.964.2.2 Operations of Port 0 Functionsp.984.3 Port 3p.1004.3.1 Registers of Port 3 (PDR3, DDR3, PUL3)p.1024.3.2 Operations of Port 3 Functionsp.1044.4 Port 4p.1064.4.1 Registers of Port 4 (PDR4)p.1084.4.2 Operations of Port 4 Functionsp.1094.5 Port 5p.1104.5.1 Registers of Port 5 (PDR5, DDR5, PUL5)p.1124.5.2 Operations of Port 5 Functionsp.1144.6 Port 6p.1164.6.1 Registers of Port 6 (PDR6, DDR6, PUL6)p.1194.6.2 Operations of Port 6 Functionsp.1214.7 Port 7p.1234.7.1 Registers of Port 7 (PDR7, DDR7, PUL7)p.1254.7.2 Operations of Port 7 Functionsp.1274.8 Programming Example of I/O Portp.129CHAPTER 5 TIME-BASE TIMERp.1315.1 Overview of Time-base Timerp.1325.2 Configuration of Time-base Timerp.1345.3 Time-base Timer Control Register (TBTC)p.1355.4 Interrupt of Time-base Timerp.1375.5 Operations of Time-base Timer Functionsp.1385.6 Notes on Using Time-base Timerp.1405.7 Program Example for Time-base Timerp.141CHAPTER 6 WATCHDOG TIMERp.1436.1 Overview of Watchdog Timerp.1446.2 Configuration of Watchdog Timerp.1456.3 Watchdog Control Register (WDTC)p.1466.4 Operations of Watchdog Timer Functionsp.1476.5 Notes on Using Watchdog Timerp.1486.6 Program Example for Watchdog Timerp.149CHAPTER 7 8-BIT PWM TIMERp.1517.1 Overview of 8-bit PWM Timerp.1527.2 Configuration of 8-bit PWM Timerp.1557.3 Pin of 8-bit PWM Timerp.1577.4 Registers of 8-bit PWM Timerp.1587.4.1 PWM Control Register (CNTR)p.1597.4.2 PWM Compare Register (COMR)p.1617.5 Interrupt of 8-bit PWM Timerp.1637.6 Operations of the Interval Timer Functionsp.1647.7 Operations of the 8-bit PWM Timer Functionsp.1667.8 States in Each Mode During Operationp.1687.9 Notes on Using 8-bit PWM Timerp.1717.10 Program Example for PWM Timerp.173CHAPTER 8 8/16-BIT CAPTURE TIMER/ COUNTERp.1778.1 Overview of 8/16-bit Capture Timer/Counterp.1788.2 Configuration of 8/16-bit Capture Timer/Counterp.1828.3 Pins of 8/16-bit Capture Timer/Counterp.1848.4 Registers of 8/16-bit Capture Timer/Counterp.1868.4.1 Capture Control Register (TCCR)p.1878.4.2 Timer 0 Control Register (TCR0)p.1898.4.3 Timer 1 Control Register (TCR1)p.1918.4.4 Timer Output Control Register (TCR2)p.1938.4.5 Timer 0 Data Register (TDR0)p.1948.4.6 Timer 1 Data Register (TDR1)p.1968.4.7 Capture Data Registers H and L (TCPH and TCPL)p.1988.5 8/16-bit Capture Timer/Counter of Interruptsp.1998.6 Explanation of Operations of Interval Timer Functionsp.2018.7 Operation of Counter Functionsp.2058.8 Functions of Operations of Capture Functionsp.2098.9 8/16-bit Capture Timer/Counter Operation in Each Modep.2138.10 Notes on Using 8/16-bit Capture Timer/Counterp.2148.11 Program Example for 8/16-bit Capture Timer/Counterp.216CHAPTER 9 12-BIT PPG TIMERp.2219.1 Overview of 12-bit PPG Timerp.2229.2 Configuration of 12-bit PPG Timer Circuitp.2259.3 Pin of 12-bit PPG Timerp.2279.4 Registers of 12-bit PPG Timerp.2299.4.1 12-bit PPG Control Register 1 (RCR21)p.2309.4.2 12-bit PPG Control Register 2 (RCR22)p.2319.4.3 12-bit PPG Control Register 3 (RCR23)p.2329.4.4 12-bit PPG Control Register 4 (RCR24)p.2349.5 Operations of 12-bit PPG Timer Functionsp.2359.6 Notes on Using 12-bit PPG Timerp.2379.7 Program Example for 12-bit PPG Timerp.239CHAPTER 10 EXTERNAL INTERRUPT CIRCUIT 1 (EDGE)p.24110.1 Overview of External Interrupt Circuit 1p.24210.2 Configuration of External Interrupt Circuit 1p.24310.3 Pins of External Interrupt Circuit 1p.24510.4 Registers of External Interrupt Circuit 1p.24710.4.1 External Interrupt Control Register 1 (EIC1)p.24810.4.2 External Interrupt Control Register 2 (EIC2)p.25110.5 Interrupt of External Interrupt Circuit 1p.25310.6 Operations of External Interrupt Circuit 1p.25510.7 Program Example for External Interrupt Circuit 1p.257CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT 2 (LEVEL)p.25911.1 Overview of External Interrupt Circuit 2p.26011.2 Configuration of External Interrupt Circuit 2p.26111.3 Pins of External Interrupt Circuit 2p.26211.4 Registers of External Interrupt Circuit 2p.26511.4.1 External Interrupt 2 Control Register (EIE2)p.26611.4.2 External Interrupt 2 Flag Register (EIF2)p.26811.5 Interrupt of External Interrupt Circuit 2p.26911.6 Operations of External Interrupt Circuit 2p.27011.7 Program Example for External Interrupt Circuit 2p.272CHAPTER 12 A/D CONVERTERp.27512.1 Overview of A/D Converterp.27612.2 Configuration of A/D Converterp.27712.3 Pins of A/D Converterp.27912.4 Registers of A/D Converterp.28112.4.1 A/D Control Register 1 (ADC1)p.28212.4.2 A/D Control Register 2 (ADC2)p.28412.4.3 A/D Data Register (ADDH and ADDL)p.28612.4.4 A/D Enable Register (ADEN)p.28712.5 Interrupt of A/D Converterp.28812.6 Operations of A/D Converter Functionsp.28912.7 Notes on Using A/D Converterp.29112.8 Program Example for A/D Converterp.293CHAPTER 13 UARTp.29513.1 Overview of UARTp.29613.2 Configuration of UARTp.30013.3 Pins of UARTp.30313.4 Registers of UARTp.30513.4.1 Serial Mode Control Register (SMC)p.30613.4.2 Serial Rate Control Register (SRC)p.30813.4.3 Serial Status and Data Register (SSD)p.31013.4.4 Serial Input Data Register (SIDR)p.31313.4.5 Serial Output Data Register (SODR)p.31413.4.6 Clock Divider Selection Register (UPC)p.31513.4.7 Serial Switch Register (SSEL)p.31713.5 Interrupt of UARTp.31913.6 Operations of UART Functionsp.32013.6.1 Transmission Operations (Operating Mode 0, 1, 2, and 3)p.32213.6.2 Reception Operations (Operating Mode 0, 1, or 3)p.32313.6.3 Reception Operations (Operating Mode 2 Only)p.32513.7 Program Example for UARTp.327CHAPTER 14 8-BIT SERIAL I/Op.32914.1 Overview of 8-Bit Serial I/Op.33014.2 Configuration of 8-Bit Serial I/Op.33114.3 Pins of 8-Bit Serial I/Op.33314.4 Registers of 8-Bit Serial I/Op.33514.4.1 Serial Mode Register (SMR)p.33614.4.2 Serial Data Register (SDR)p.33914.5 Interrupt of 8-Bit Serial I/Op.34014.6 Operations of Serial Output Functionsp.34114.7 Operations of Serial Input Functionsp.34314.8 8-Bit Serial I/O Operation in Each Modep.34514.9 Notes on Using 8-Bit Serial I/Op.34914.10 Example of 8-Bit Serial I/O Connectionp.35014.11 Program Example for 8-Bit Serial I/Op.352CHAPTER 15 BUZZER OUTPUTp.35515.1 Overview of the Buzzer Outputp.35615.2 Configuration of the Buzzer Outputp.35715.3 Pin of the Buzzer Outputp.35815.4 Buzzer Register (BZCR)p.35915.5 Program Example for Buzzer Outputp.361CHAPTER 16 WILD REGISTER FUNCTIONp.36316.1 Overview of the Wild Register Functionp.36416.2 Configuration of the Wild Register Functionp.36516.3 Registers of the Wild Register Functionp.36616.3.1 Data Setting Registers (WRDR0 and WRDR1)p.36716.3.2 Higher Address Set Registers (WRARH0 and WRARH1)p.36816.3.3 Lower Address Set Registers (WRARL0 and WRARL1)p.36916.3.4 Address Comparison EN Register (WREN)p.37016.3.5 Data Test Set Register (WROR)p.37116.4 Operations of the Wild Register Functionsp.372CHAPTER 17 FLASH MEMORYp.37317.1 Overview of Flash Memoryp.37417.2 Flash Memory Control Status Register (FMCS)p.37517.3 Starting the Flash Memory Automatic Algorithmp.37717.4 Confirming the Automatic Algorithm Execution Statep.37817.4.1 Data Polling Flag (DQ7)p.37917.4.2 Toggle Bit Flag (DQ6)p.38017.4.3 Timing Limit Exceeded Flag (DQ5)p.38117.4.4 Toggle Bit-2 Flag (DQ2)p.38217.5 Detailed Explanation of Writing to Erasing Flash Memoryp.38317.5.1 Setting The Read/Reset Statep.38417.5.2 Writing Datap.38517.5.3 Erasing All Data (Erasing Chips)p.38717.6 Flash Security Featurep.38817.7 Notes on using Flash Memoryp.389APPENDIXp.391APPENDIX A I/O Mapp.392APPENDIX B Overview of the Instructionsp.396B.1 Addressingp.399B.2 Special Instructionsp.403B.3 Bit Manipulation Instructions (SETB and CLRB)p.407B.4 F2MC-8L Instructions Listp.408B.5 Instruction Mapp.415APPENDIX C Mask Optionsp.416APPENDIX D Programming EPROM with Evaluation Chipp.417APPENDIX E Pin State of the MB89202/F202RA Seriesp.418
Page 434 of the Fujitsu MB89202 user manual — INDEX
Page 434 · click to enlarge
Page 434

INDEX

Page 435 of the Fujitsu MB89202 user manual — Published FUJITSU LIMITED Electronic Devices
Page 435 · click to enlarge
Page 435

CM25-10153-2E

FUJITSU SEMICONDUCTOR • CONTROLLER MANUAL

F 2 MC-8L

8-BIT MICROCONTROLLER

HARDWARE MANUAL

February 2008 the second edition

Published FUJITSU LIMITED Electronic Devices

Edited Strategic Business Development Dept.

MB89202/F202RA Series

Page 436 of the Fujitsu MB89202 user manual — APPENDIX E Pin State of the MB89202/F202RA Series
Page 436 · click to enlarge
Page 436
Page 436 of the Fujitsu MB89202 user manual — APPENDIX E Pin State of the MB89202/F202RA Series

Ask about the Fujitsu MB89202

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 Fujitsu MB89202

Be the first to ask — other owners or our team will answer.

Original document

Fujitsu MB89202 manual PDF

436 pages·5.1 MB·Computer Hardware·PDF
Click any page above to open it here
Page 1 / …
100%
Loading pages…