Fujitsu F2MC-16LX Hardware Manual

16-bit microcontroller mb90330 series
Hide thumbs

Advertisement

Quick Links

Table of Contents
FUJITSU SEMICONDUCTOR
CM44-10129-1E
CONTROLLER MANUAL
2
TM
F
MC
-16LX
16-bit Microcontroller
MB90330 series
HARDWARE MANUAL

Advertisement

Table of Contents
loading

  Related Manuals for Fujitsu F2MC-16LX

  Summary of Contents for Fujitsu F2MC-16LX

  • Page 1 FUJITSU SEMICONDUCTOR CM44-10129-1E CONTROLLER MANUAL -16LX 16-bit Microcontroller MB90330 series HARDWARE MANUAL...
  • Page 3 -16LX 16-bit Microcontroller MB90330 series HARDWARE MANUAL FUJITSU LIMITED...
  • Page 5 MB90330 Series. Please read through this manual. For more information on various instructions, refer to "Instruction Manual". Trademarks MC, an abbreviation for, FUJITSU Flexible Microcontroller and is a registered trademark of FUJITSU LIMITED. Embedded Algorithm is a registered trademark of Advanced Micro Devices, Inc.
  • Page 6 oscillation stability wait time. Chapter 6 Low-Power Consumption Mode This chapter describes the overview of the low-power consumption mode, register configuration/ function, and operation of the low-power consumption mode. Chapter 7 Mode setting This chapter describes the overview of mode settings, mode pin, mode data, and operation in each mode of mode setting.
  • Page 7 Chapter 26 Example of connecting serial writing This chapter describes the serial on-board writing of the flash ROM (Fujitsu standard). APPENDIX Appendix includes detailed information on I/O map, interrupt vector, and instruction list, which are not...
  • Page 8 (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.
  • Page 9: Table Of Contents

    CONTENTS CHAPTER 1 OVERVIEW .....................1 Feature of MB90330 Series........................2 Block Diagram ............................7 Package Dimension..........................8 Pin Assignment............................10 Pin Function............................11 I/O Circuit Types ............................18 Handling of Device..........................21 CHAPTER 2 CPU .......................25 Outline Specification of CPU .........................26 Memory Space............................27 Register of CPU.............................32 2.3.1 Accumulator (A)..........................34 2.3.2 User Stack Pointer (USP) and System Stack Pointer (SSP) ............35...
  • Page 10 Register of µDMAC.......................... 89 3.8.2 3.8.2.1 DMA Descriptor Channel Specification Register (DCSR) ............90 3.8.2.2 DMA Status Register (DSRH/DSRL).................... 92 3.8.2.3 DMA Stop Status Register (DSSR) ....................93 3.8.2.4 DMA Permission Register (DERH/DERL) ..................94 3.8.3 DMA Descriptor Window Register (DDWR)..................95 3.8.3.1 DMA Data Counter (DDCTH/DDCTL) ..................
  • Page 11 Mode Data ............................178 External Memory Access ........................182 7.4.1 Automatic Ready Function Selection Register (ARSR)..............184 7.4.2 External Address Output Control Register (HACR)................185 7.4.3 Bus Control Signal Selection Register (EPCR) ................186 Operation in Each Mode of Mode Setting....................188 7.5.1 External Memory Access Control Signal ..................189 7.5.2 Ready Function ..........................192 7.5.3...
  • Page 12 12.3.3 Operation of 16-bit Input Capture ....................260 12.3.4 Timing of 16-bit Free-run Timer ..................... 261 12.3.5 Output Compare Timing ........................ 262 12.3.6 Input Timing of Input Capture ......................263 CHAPTER 13 USB FUNCTION ..................265 13.1 Overview of USB Function........................266 13.2 Block Diagram of USB Function ......................
  • Page 13 14.5.8 Error Status ............................347 14.5.9 Packet End .............................348 14.5.10 Suspend Resume ...........................349 14.5.11 Cutting of Device ..........................352 14.6 Each Token Flow Chart of USB Mini-HOST ..................353 CHAPTER 15 PWC TIMER ....................355 15.1 Overview of PWC Timer ........................356 15.2 Register of PWC Timer........................358 15.2.1 PWC Control Status Register (PWCSR) ..................359 15.2.2 PWC Data Buffer Register (PWCR) ....................364 15.2.3 PWC Ratio of Dividing Frequency Control Register (DIVR) ............365...
  • Page 14 18.4 Precaution of Using DTP/External Interrupt..................427 CHAPTER 19 8/10-BIT A/D CONVERTER................429 19.1 Overview of 8/10-bit A/D Converter ....................430 19.2 Configuration of 8/10-bit A/D Converter....................431 19.3 Register of 8/10-bit A/D Converter...................... 433 19.3.1 A/D Control Status Register (High) (ADCS1)................. 434 19.3.2 A/D Control Status Register (Low) (ADCS0) .................
  • Page 15 21.6.1 Baud Rate of the UART Internal Clock Using the Dedicated Baud Rate Generator ......501 21.6.2 Baud Rate of the External Clock Using the Dedicated Baud Rate Generator ........502 21.6.3 Baud Rate of the External Clock (One-to-one Mode)..............503 21.7 Explanation of Operation of UART ......................504 21.7.1 Operation in Asynchronous Mode (Operation Mode 0 or Operation Mode1) .........506 21.7.2 Operation in Synchronous Mode (Operation Mode 2)..............509 21.7.3 Bidirectional Communication Function (Normal Mode) ..............512...
  • Page 16 25.6 Write/Erase of Flash memory ......................577 25.6.1 Read/Reset State in Flash Memory ....................578 25.6.2 Writing Data to Flash Memory ....................... 579 25.6.3 Erasing All Data from Flash Memory (Chip Erase) ................ 581 25.6.4 Erasing Any Data in Flash Memory (Sector Erasing) ..............582 25.6.5 Flash Memory Sector Erase Suspension..................
  • Page 17: Chapter 1 Overview

    CHAPTER 1 OVERVIEW This chapter describes basics to give the understanding of the MB90330 series as a whole such as the features, block diagrams, and overviews of the functions. 1.1 Feature of MB90330 Series 1.2 Block Diagram 1.3 Package Dimension 1.4 Pin Assignment 1.5 Pin Function 1.6 I/O Circuit Types...
  • Page 18: Feature Of Mb90330 Series

    CHAPTER 1 OVERVIEW Feature of MB90330 Series The MB90330 series are 16-bit microcontrollers designed for applications, such as personal computer peripheral devices, that require USB communications. The USB function enables not only 12-Mbps function operations but also simplified host operations (Mini-HOST). It is equipped with functions that are suitable for personal computer peripheral devices such as displays and audio devices, and control of mobile devices that support USB communications.
  • Page 19 CHAPTER 1 OVERVIEW Capacity of built-in ROM and ROM type • Mask ROM:256 Kbytes, 384 Kbytes • Flash ROM:384 Kbytes Built-in RAM • Mass production products:16 Kbytes, 24 Kbytes • Flash products:24 Kbytes • Evaluation chip: 28 Kbytes Process: CMOS technology Low-power consumption (standby) mode •...
  • Page 20 CHAPTER 1 OVERVIEW C interface: 3 channels 8/10-bit A/D converter (RC sequential comparator type):16 channels DTP/external interrupt: 8 channels • USB function (Conform to USB2.0 Full Speed):1 channel • USB Mini-HOST:1 channel...
  • Page 21 CHAPTER 1 OVERVIEW Product Lineup Table 1.1-1 MB90330 Series Product Lineup List (1/2) Product name MB90V330A * MB90F334A MB90333A MB90334A Classification For evaluation Flash products MASK ROM products ROM size None 384 Kbytes 256 Kbytes 384 Kbytes RAM size 28 Kbytes 24 Kbytes 16 Kbytes 24 Kbytes...
  • Page 22 CHAPTER 1 OVERVIEW Table 1.1-1 MB90330 Series Product Lineup List (2/2) Product name MB90V330A * MB90F334A MB90333A MB90334A DTP/external interrupt Input count: 8 Interrupt factor: rising edge/falling edge/"L" level/"H" level selectable USB Function (Conforming to USB2.0 Full Speed) Supports Full speed Endpoint are specifiable up to six.
  • Page 23: Block Diagram

    CHAPTER 1 OVERVIEW Block Diagram Figure 1.2-1 shows the block diagram of a MB90330 series. Block Diagram of the MB90330 Series Figure 1.2-1 Block Diagram of the MB90330 Series X0,X1 Clock X0A,X1A control circuit MC-16LX core Port 6 RAM(28Kbyte)* P67/INT7/SDA0 External interrupt P66/INT6/SCL0 (ch0 to 7)
  • Page 24: Package Dimension

    (Mounting height) +.008 .059 INDEX –.004 "A" ˚ LEAD No. 0.10±0.10 0.16±0.03 0.145±0.055 0.50±0.20 (.004±.004) 0.40(.016) 0.07(.003) (.006±.001) (.006±.002) (.020±.008) (Stand off) 0.60±0.15 0.25(.010) (.024±.006) Dimensions in mm (inches). 2003 FUJITSU LIMITED F120006S-c-4-5 Note: The values in parentheses are reference values.
  • Page 25 –.004 INDEX 0~8 ˚ "A" 0.10±0.05 LEAD No. (.004±.002) +0.05 (Stand off) 0.60±0.15 0.22±0.05 0.145 –0.03 0.50(.020) 0.08(.003) (.024±.006) (.009±.002) +.002 .006 –.001 0.25(.010) Dimensions in mm (inches). 2002 FUJITSU LIMITED F120033S-c-4-4 Note: The values in parentheses are reference values.
  • Page 26: Pin Assignment

    CHAPTER 1 OVERVIEW Pin Assignment Figure 1.4-1 shows the pin assignments of a MB90330 series. Pin Assignment (LQFP-120) Figure 1.4-1 Pin Assignments of the MB90330 Series (LQFP-120) P30/A00/TIN1 P31/A01/TOT1 P32/A02/TIN2 P33/A03/TOT2 P34/A04 P55/HAK P35/A05 P54/HRQ P36/A06 P53/WRH P37/A07 P52/WRL P40/A08/TIN0 P51/RD P41/A09/TOT0 P50/ALE...
  • Page 27: Pin Function

    CHAPTER 1 OVERVIEW Pin Function Table 1.5-1 describes the MB90330 series pin functions. Pin Function Table 1.5-1 Pin Function (1/7) Pin No. Pin Name Circuit Functional description Type It is oscillation terminal. It is oscillation terminal. It is 32 kHz oscillation terminal. It is 32 kHz oscillation terminal.
  • Page 28 CHAPTER 1 OVERVIEW Table 1.5-1 Pin Function (2/7) Pin No. Pin Name Circuit Functional description Type 113 to 116 P20 to P23 It is General-purpose input/output port. Functions as the general-purpose input/output port in the external bus mode if the bit corresponding to external address output control register (HACR) is set to "1".
  • Page 29 CHAPTER 1 OVERVIEW Table 1.5-1 Pin Function (3/7) Pin No. Pin Name Circuit Functional description Type It is General-purpose I/O port. Functions as the external address pin in non-multi-bus mode. TIN0 Functions as an event input pin for 16-bit reload timer ch0. It is General-purpose I/O port.
  • Page 30 CHAPTER 1 OVERVIEW Table 1.5-1 Pin Function (4/7) Pin No. Pin Name Circuit Functional description Type It is General-purpose I/O port. Functions as the data write strobe output (WRLX) pin on the lower side in external bus mode. Functions as a general-purpose I/O port when the WRE bit in the EPCR register is "0".
  • Page 31 CHAPTER 1 OVERVIEW Table 1.5-1 Pin Function (5/7) Pin No. Pin Name Circuit Functional description Type It is General-purpose I/O port (Withstand voltage of 5 V). INT5 Function as input pins for external interrupt ch5. Functions as the PWC input pin. It is General-purpose I/O port (Withstand voltage of 5 V).
  • Page 32 CHAPTER 1 OVERVIEW Table 1.5-1 Pin Function (6/7) Pin No. Pin Name Circuit Functional description Type 56 to 59 PA0 to PA3 It is General-purpose I/O port (Withstand voltage of 5 V). IN0 to IN3 Captures as trigger input for ch0 to ch3 of the input capture. 60 to 63 PA4 to PA7 It is General-purpose I/O port (Withstand voltage of 5 V).
  • Page 33 CHAPTER 1 OVERVIEW Table 1.5-1 Pin Function (7/7) Pin No. Pin Name Circuit Functional description Type It is power supply pin. It is power supply pin. It is power supply pin. It is power supply pin. It is power supply pin (GND). It is power supply pin (GND).
  • Page 34: I/O Circuit Types

    CHAPTER 1 OVERVIEW I/O Circuit Types Table 1.6-1 shows I/O circuit types for pins of a MB90330 series. I/O Circuit Types Table 1.6-1 I/O Circuit Types (1/3) Classification Circuit Remarks • Oscillation return resistance: X1,X1A X1, X0about 1 MΩ X1A,X0A10 MΩ •...
  • Page 35 CHAPTER 1 OVERVIEW Table 1.6-1 I/O Circuit Types (2/3) Classification Circuit Remarks • CMOS hysteresis input with pull-up • Resistance: About 50 kΩ CMOS hysteresis input • CMOS output • CMOS hysteresis input Open drain control signal • With open drain control •...
  • Page 36 CHAPTER 1 OVERVIEW Table 1.6-1 I/O Circuit Types (3/3) Classification Circuit Remarks • USB I/O pins D + Input D - Input Differential input Full D + Output Full D - Output Low D + Output Low D - Output direction speed •...
  • Page 37: Handling Of Device

    CHAPTER 1 OVERVIEW Handling of Device This section describes the precautions when handling devices. Precautions when Handling Devices Preventing Latch-up, Turning on Power Supply Latch-up may occur on CMOS IC under the following conditions: • If a voltage higher than V or lower than V is applied to input and output pins, •...
  • Page 38 CHAPTER 1 OVERVIEW About Crystal oscillator circuit Noise near the X0/X1 pins and X0A/X1A pins may cause the device to malfunction. Design the printed circuit board so that X0/X1 pins and X0A/X1A pins, the crystal oscillator (or the ceramic oscillator) and the bypass capacitor to ground are located as close to the device as possible.
  • Page 39 CHAPTER 1 OVERVIEW Caution on Operations during PLL Clock Mode Even if the oscillator comes off or the clock input stops with the PLL clock selected for this microcontroller, the microcontroller may continue to operate at the free-running frequency of the PLL internal automatic oscillator circuit.
  • Page 40 CHAPTER 1 OVERVIEW...
  • Page 41: Chapter 2 Cpu

    CHAPTER 2 This chapter describes specifications, memories and register functions to know the MB90330 series. 2.1 Outline Specification of CPU 2.2 Memory Space 2.3 Register of CPU 2.4 Prefix Code...
  • Page 42: Outline Specification Of Cpu

    CHAPTER 2 CPU Outline Specification of CPU The outline specification of CPU is explained. Outline Specification of CPU The F MC-16LX CPU core is the 16-bit CPU designed for applications requiring the high-speed real-time process for house hold device, etc. The F MC-16LX instruction set is designed for controller applications enabling the high-speed and high-efficiency control process.
  • Page 43: Memory Space

    CHAPTER 2 CPU Memory Space The F MC-16LX CPU has the 16 Mbytes memory space in which all inputs and outputs of data program that are administered by the F MC-16LX CPU are placed in this 16 Mbytes memory space. The CPU indicates these addresses with the 24-bit address bus and accesses each resource.
  • Page 44 CHAPTER 2 CPU Address Generation Type In F MC-16LX CPU, there is two address generation method. One is the linear addressing to specify the entire 24-bit address by the instruction and the other is the bank addressing to specify the upper 8-bit address and the lower 16-bit address by an appropriate bank register and the instruction, respectively.
  • Page 45 CHAPTER 2 CPU Addressing Types by Bank The bank addressing specifies the bank for each space by five bank registers as shown below by dividing the 16 Mbytes space into 256 of 64 Kbytes banks: Program bank register (PCB) Data bank register (DTB) User stack bank register (USB) System stack bank register (SSB) Additional data bank register (ADB)
  • Page 46 CHAPTER 2 CPU Figure 2.2-4 Physical address of Each Space FFFFFF Program space FF0000 PCB (Program bank register) B3FFFF Additional space ADB (Additional data bank register) B30000 92FFFF User stack space 920000 USB (User stack bank register) 68FFFF Data space DTB (Data bank register) 680000 4BFFFF...
  • Page 47 CHAPTER 2 CPU Multi Byte Length Data Access Fundamentally, accesses are made within a bank. For an instruction accessing a multi-byte data item, address FFFF is followed by address 0000 of the same bank. Figure 2.2-6 is an example of an instruction accessing multi-byte data.
  • Page 48: Register Of Cpu

    CHAPTER 2 CPU Register of CPU The F MC-16LX registers can be roughly grouped into two types, the special registers in the CPU and the general-purpose registers in memory. Special registers are a dedicated hardware for the CPU inside, and their use is limited by the CPU architecture. General- purpose registers share the CPU address space with the RAM.
  • Page 49 CHAPTER 2 CPU General-purpose Register Figure 2.3-1 Configuration of Dedicated Registers Accumulator User stack pointer System stack pointer Processor status Program counter Direct page register Program bank register Data bank register User stack bank register System stack bank register Additional data bank register 8 bit 16 bit 32 bit...
  • Page 50: Accumulator (A)

    CHAPTER 2 CPU 2.3.1 Accumulator (A) The function of accumulator (A) is explained. Accumulator (A) The accumulator (A) consists of two 16-bit length arithmetic operation registers (AH/AL) to be used for the temporary storage of operation result and data transfer, etc. The AH and the AL are concatenated to be used for the 32 bit data process.
  • Page 51: User Stack Pointer (Usp) And System Stack Pointer (Ssp)

    CHAPTER 2 CPU 2.3.2 User Stack Pointer (USP) and System Stack Pointer (SSP) Functions of the user stack pointer (USP) and the system stack pointer (SSP) are described here. User Stack Pointer (USP) and System Stack Pointer (SSP) The user stack pointer (USP) and the system stack pointer (SSP) are 16-bit registers indicating the memory addresses for data saving or restoring at execution of a push or pop instruction or a subroutine.
  • Page 52: Processor Status (Ps)

    CHAPTER 2 CPU 2.3.3 Processor Status (PS) The function of processor status (PS) is explained. Processor Status (PS) The processor status (PS) consists of bits to perform the CPU operation and to indicate the CPU status. As shown in Figure 2.2-6, the upper byte of PS register consists of the register bank pointer (RP) and the interrupt level mask register (ILM).
  • Page 53 CHAPTER 2 CPU Zero flag (Z) If the operation result is all 0, Z flag is set, and, besides, cleared. Overflow flag (V) The V flag is set and cleared when a signed numeric value overflow occurs and does not occur, respectively, as a result of operation execution.
  • Page 54 CHAPTER 2 CPU Table 2.3-1 Level Indicated by Interrupt Level Mask Register (ILM) ILM2 ILM1 ILM0 Level value Acceptable interrupt level Disables the interrupt. Only 0 Small level value smaller than 1 Small level value smaller than 2 Small level value smaller than 3 Small level value smaller than 4 Small level value smaller than 5 Small level value smaller than 6...
  • Page 55: Program Counter (Pc)

    CHAPTER 2 CPU 2.3.4 Program Counter (PC) The function of program counter (PC) is explained. Program Counter (PC) The PC is a 16-bit counter to indicate the lower 16 bits of memory address of the instruction code to be executed by the CPU. The upper 8-bit address is indicated by the program bank register (PCB). The PC content is updated by the conditional branch instruction, the subroutine call instruction, the interrupt, the reset, etc.
  • Page 56: Program Bank Register (Pcb)

    CHAPTER 2 CPU 2.3.5 Program Bank Register (PCB) The function of program bank register (PCB) is explained. Program Bank Register (PCB) <Initial Value: Value in Reset Vector> Program bank register (PCB) consists of the following registers: • Data bank register (DTB) <Initial value:00 >...
  • Page 57: Direct Page Register (Dpr)

    CHAPTER 2 CPU 2.3.6 Direct Page Register (DPR) The function of direct page register (DPR) is explained. Direct Page Register (DPR) <Initial Value:01 > The direct page register (DPR) specifies the addresses 8 to addresses 15 of instruction operand in the direct addressing mode as shown in Figure 2.3-11.
  • Page 58: General-Purpose Registers (Register Bank)

    CHAPTER 2 CPU 2.3.7 General-purpose Registers (Register Bank) Functions of general-purpose registers (register bank) are described here. General-purpose Registers (Register Bank) The register bank consisting of 8 words can be used as the general-purpose register for arithmetic operations of the byte register (R0 to R7), the word register (RW0 to RW7), and the long word register (RL0 to RL3).
  • Page 59: Prefix Code

    CHAPTER 2 CPU Prefix Code A part of instruction operation can be changed by placing the prefix code before the instruction. Three types of prefix codes can be used: • The bank select prefix • The common register bank prefix •...
  • Page 60 CHAPTER 2 CPU POPW PS The SSB or the USB is used according to the S flag regardless of the prefix. The effect of the prefix reaches the following instruction. MOV ILM,#imm8 The instruction operation is normal although the prefix continuously affects the next instruction. RETI SSB is used regardless of the prefix.
  • Page 61 CHAPTER 2 CPU Interrupt instruction (INT #vct8,INT9,INT addr16,INTO addr24,POPW PS) The CCR is changed as specified by the instruction regardless of the prefix. JCTX@A The CCR is changed as specified by the instruction regardless of the prefix. MOV ILM,#imm8 The instruction operation is normal although the prefix continuously affects the next instruction.
  • Page 62 CHAPTER 2 CPU Interrupt Suppression Instruction The interrupt request is not sampled for the following 10 types of instructions: MOV ILM,#imm8/PCB/SPB/OR CCR,#imm8/NCC AND CCR,#imm8/ADB/CMR/POPW PS/DTB When a valid interrupt request occurs during the execution of one of the above instructions, the interrupt can be processed only if an instruction other than the above is executed.
  • Page 63: Chapter 3 Interrupt

    CHAPTER 3 INTERRUPT This chapter describes the interruption, extended intelligent I/O service (EI OS), and direct memory access controller (µDMAC) of MB90330 Series. 3.1 Outline of Interrupt 3.2 Interrupt Cause and Interrupt Vector 3.3 Interrupt Control Register and Peripheral Function 3.4 Hardware Interrupt 3.5 Software Interrupt 3.6 Interrupts by Extended Intelligent I/O Service (EI...
  • Page 64: Outline Of Interrupt

    CHAPTER 3 INTERRUPT Outline of Interrupt MC-16LX has the following five interrupt functions, which suspend the current process when an event occurs and transfer control to a separately defined program. • Hardware Interrupt • Software interrupt • Interrupts by extended intelligent I/O service (EI µ...
  • Page 65 CHAPTER 3 INTERRUPT Software interrupt Transfers control to the user-defined interrupt handing program by executing the instruction dedicated to software interrupt (for example, INT instruction). Figure 3.1-2 Overview of Software Interrupts Register file : Processor status : Interrupt enable flag B unit : Interrupt level mask register Microcode...
  • Page 66 CHAPTER 3 INTERRUPT Interruption by µDMAC µDMAC is involved in automatic data transfer between peripheral functions and memory. EI OS performs data transfer by DMA transfer although it was previously performed by the interrupt handling program. Once the data transfer process has been performed the specified number of times, µDMAC automatically executes the interrupt handling program.
  • Page 67: Interrupt Cause And Interrupt Vector

    CHAPTER 3 INTERRUPT Interrupt Cause and Interrupt Vector MC-16LX has functions that are associated with 256 types of interrupt causes, and 256 interrupt vector tables are assigned to the most significant address area of memory. This interruption vector is shared by all the interruptions. All of interrupt INT0 to INT255 are available for software interrupt, although some interrupt vectors are shared with hardware interrupt or exception processing interrupt.
  • Page 68 CHAPTER 3 INTERRUPT Interrupt Factors, Interrupt Vectors, and Interrupt Control Registers Table 3.2-2 shows the relationship between the causes of interrupts except software interrupt, and the interrupt vectors and control registers. Table 3.2-2 Interrupt Factors, Interrupt Vectors, and Interrupt Control Registers Interrupt control Interrupt vector µDMAC-...
  • Page 69 CHAPTER 3 INTERRUPT : Available. With EI OS stop function. (The interrupt request flag is cleared by the interrupt clear signal. With a stop request.) : Available. (The interrupt request flag is cleared by the interrupt clear signal.) ∆ : Available when not using the interrupt factor shared with ICR : Not available *1: The interrupt levels for the peripheral functions sharing the ICRs are identical.
  • Page 70: Interrupt Control Register And Peripheral Function

    CHAPTER 3 INTERRUPT Interrupt Control Register and Peripheral Function Interrupt control registers (ICR00 to ICR15) located in the interrupt controller, are associated with all the peripheral functions which have the interrupt function. This register controls the interrupt and the extended intelligent I/O service (EI OS).
  • Page 71 CHAPTER 3 INTERRUPT Interrupt Control Register Functions Each of the interrupt control register (ICR) has the following four functions. • Setting of interrupt level for peripheral function • Selection of whether to perform normal interrupt or external intelligent for corresponding peripheral function (EI •...
  • Page 72: Interrupt Control Registers (Icr00 To Icr15)

    CHAPTER 3 INTERRUPT 3.3.1 Interrupt Control Registers (ICR00 to ICR15) Interrupt control registers (ICR00 to ICR15) associated with all the peripheral functions provided with the interrupt function, controls the handling which takes place when an interrupt request is generated. Some functions of the registers are different between write and read.
  • Page 73 CHAPTER 3 INTERRUPT Figure 3.3-2 Interrupt Control Register (ICR00 to ICR15) at Read At read Address Initial value 0000B0 - - 000111 0000BF Interrupt level set bit Interrupt level 0 (Highest) Interrupt level 7 (No interrupt) OS enable bit Activate interrupt sequence during generation of an interrupt. Activate EI OS during generation of an interrupt.
  • Page 74: Interrupt Control Register Functions

    CHAPTER 3 INTERRUPT 3.3.2 Interrupt Control Register Functions Each of the interrupt control register (ICR00 to ICR15) consists of the following bits, which have four functions. • Interrupt level set bit (IL2 to IL0) • EI OS enable bit (ISE) •...
  • Page 75 CHAPTER 3 INTERRUPT Interrupt Control Register Functions Interrupt level set bit (IL2 to IL0) Specifies the interrupt level for the associated peripheral function. Initialized to level 7 (no interrupts) by reset. Table 3.3-2 shows the relationship between the interrupt level set bits and each interrupt level. Table 3.3-2 Correspondence between Interrupt Level Set Bits and Interrupt Levels Interrupt level 0 (highest interrupt)
  • Page 76 CHAPTER 3 INTERRUPT Table 3.3-3 Correspondence between EI OS Channel Select Bits and Descriptor Addresses ICS3 ICS2 ICS1 ICS0 Channel to be selected Descriptor address 000100 000108 000110 000118 000120 000128 000130 000138 000140 000148 000150 000158 000160 000168 000170 000178 OS status bits (S1 and S0) It is a bit only for reading.
  • Page 77: Hardware Interrupt

    CHAPTER 3 INTERRUPT Hardware Interrupt Hardware interrupt suspends the active program execution by the CPU in response to an interrupt request signal generated by a peripheral function, resulting in transfer of control to the user-defined interrupt handling program. Extended intelligent I/O service OS), µDMAC, external interrupts, and other similar processes are also executed as a type of hardware interrupt.
  • Page 78 CHAPTER 3 INTERRUPT Construction of Hardware Interrupt As shown in Table 3.4-1, there are four features related to hardware interrupt. These four must be programmed when hardware interrupt is used. Table 3.4-1 Mechanism Related to Hardware Interrupt Mechanism related to hardware Functions interrupt Interrupt enable bits, interrupt request...
  • Page 79 CHAPTER 3 INTERRUPT Hardware interrupt suppression of interrupt suppression instruction Table 3.4-2 shows the hardware interrupt suppression instruction. If the hardware interrupt request is generated during execution of hardware interrupt suppression instruction, an interrupt is processed after execution of hardware interrupt suppression instruction and then other instruction. Table 3.4-2 Hardware Interrupt Suppression Instruction Interruption/holding control instruction Prefix code...
  • Page 80: Operation Of Hardware Interrupt

    CHAPTER 3 INTERRUPT 3.4.1 Operation of Hardware Interrupt The following describes the operation sequence from generation of a hardware interrupt request to completion of interrupt handling. Start of Hardware Interrupt Operation of peripheral function (generation of interrupt request) Any peripheral function provided with the hardware interrupt request function has "interrupt request flag" and "interrupt enable flag".
  • Page 81 CHAPTER 3 INTERRUPT Operation of Hardware Interrupt Figure 3.4-2 shows the operation sequence from generation of a hardware interrupt to completion of interrupt handling. Figure 3.4-2 Operation of Hardware Interrupt Internal bus PS, PC Microcode Check Comparator MC-16LX CPU Other peripheral function Peripheral function generated Interrupt request...
  • Page 82: Operation Flow Of Hardware Interrupt

    CHAPTER 3 INTERRUPT 3.4.2 Operation Flow of Hardware Interrupt When the peripheral function generates an interrupt request, the interrupt controller notifies the CPU of the interrupt level. If the CPU is ready to accept the interrupt, it suspends the currently active instruction; the CPU then executes the interrupt handling OS) µDMAC.
  • Page 83: Procedure For Using A Hardware Interrupt

    CHAPTER 3 INTERRUPT 3.4.3 Procedure for Using a Hardware Interrupt Use of hardware interrupt requires the system stack area, peripheral functions, and interrupt control registers (ICR) to be set up. Procedure for Using a Hardware Interrupt Figure 3.4-4 shows an example of the procedure for using a hardware interrupt. Figure 3.4-4 Example of Procedure for Using a Hardware Interrupt START Setting System stack area...
  • Page 84: Multiple Interrupts

    CHAPTER 3 INTERRUPT 3.4.4 Multiple Interrupts Multiple hardware interrupts can be implemented. To do so, set different interrupt levels for interrupt level set bits (IL0 to IL2) of the ICR in response to two or more interrupt OS and multiple µDMAC requests from a peripheral function.
  • Page 85 CHAPTER 3 INTERRUPT Example of Multiple Interrupts Aa an example of multiple interrupt processing, set the A/D converter interrupt level to 2 and the timer interrupt level to "1", considering a case when timer interrupts are to be given higher priority than A/D converter interrupts.
  • Page 86: Hardware Interrupt Processing Time

    CHAPTER 3 INTERRUPT 3.4.5 Hardware Interrupt Processing Time Before the interrupt handling routine can be executed after a hardware interrupt request is generated, the time to complete of the currently active instruction and the interrupt handling time are required. Hardware Interrupt Processing Time Before the interrupt handling routine can be executed after an interrupt request is generated and the interrupt is accepted, the waiting time for the interrupt request sample and the interrupt handling time (required for preparation for interrupt handling) are required.
  • Page 87 CHAPTER 3 INTERRUPT Interrupt handling time (θ machine cycle) The CPU must save the dedicated registers in the system stack, fetch the interrupt vectors, and execute other processes by acceptance of the interrupt request. To do so, it requires the interrupt handling time with the θ...
  • Page 88: Software Interrupt

    CHAPTER 3 INTERRUPT Software Interrupt The software interrupt function transfers control from the currently active program by the CPU to the user-defined interrupt handling program in response to execution of the software interrupt instruction (INT instruction). The hardware interrupt stops during execution of a software interrupt. Start of Software Interrupt Start of software interrupt A software interrupt is started by using the INT instruction.
  • Page 89 CHAPTER 3 INTERRUPT Operation of Software Interrupt Figure 3.5-1 shows the operation sequence from generation of a software interrupt to completion of interrupt handling. Figure 3.5-1 Operation of Software Interrupt Internal bus PS, PC (2) Microcode Queue Fetch PS : Processor status : Interrupt enable flag S : Stack flag IR : Instruction register...
  • Page 90: Interrupts By Extended Intelligent I/O Service (Ei 2 Os)

    CHAPTER 3 INTERRUPT Interrupts by Extended Intelligent I/O Service (EI The extended intelligent I/O service (EI OS) executes automatic data transfer between the peripheral function (I/O) and memory. A hardware interrupt is generated at the end of the data transfer. Extended Intelligent I/O Service (EI The extended intelligent I/O service is a kind of hardware interrupts.
  • Page 91 CHAPTER 3 INTERRUPT Operation of Extended Intelligent I/O Service (EI Figure 3.6-1 shows the operation of the EI Figure 3.6-1 Operation of Extended Intelligent I/O Service (EI Memory space Peripheral by IOA function (I/O) I/O register I/O register Interrupt request by ICS Interrupt control register (ICR) Interrupt controller...
  • Page 92: Extended Intelligent I/O Service

    CHAPTER 3 INTERRUPT 3.6.1 Extended Intelligent I/O Service (EI OS) Descriptor (ISD) Extended intelligent I/O service (EI OS) descriptor (ISD) is existed to the addresses " in the internal RAM and consists of 8 bytes × 16 channels. "000100 " to "00017F Configuration of Extended Intelligent I/O Service (EI OS) Descriptor (ISD) Configuration of ISD consists of 8 bytes ×...
  • Page 93 CHAPTER 3 INTERRUPT Table 3.6-1 Correspondence between Channel Numbers and Descriptor Addresses Channel Descriptor address 000100 000108 000110 000118 000120 000128 000130 000138 000140 000148 000150 000158 000160 000168 000170 000178...
  • Page 94: Each Register Of Extended Intelligent I/O Service

    CHAPTER 3 INTERRUPT 3.6.2 Each Register of Extended Intelligent I/O Service (EI Descriptor (ISD) The extended intelligent I/O service (EI OS) descriptor (ISD) consists of the following registers. • Data counter (DCT) • I/O register address pointer (IOA) • EI OS status register (ISCS) •...
  • Page 95 CHAPTER 3 INTERRUPT Extended Intelligent I/O Service (EI OS) Status Register (ISCS) The extended intelligent I/O service status register (ISCS) updates or fixes the buffer address and I/O register address pointers by the 8-bit length register. It also indicates the transfer data format (byte or word) and the direction of transfer.
  • Page 96 CHAPTER 3 INTERRUPT Buffer address Pointer (BAP) The buffer address pointer (BAP), a 24-bit register, contains the address used for the next attempt of transfer by EI OS. The BAP is provided independently for the EI OS channels to enable the EI channels to transfer data between any address of 16 Mbytes and I/O.
  • Page 97: Operation Of Extended Intelligent I/O Service (Ei 2 Os)

    CHAPTER 3 INTERRUPT 3.6.3 Operation of Extended Intelligent I/O Service (EI If the peripheral function has generated an interrupt request and activation of EI OS has been set in the associated interrupt control register (ICR), the CPU will execute data transfer using EI OS.
  • Page 98: Procedure For Use Of Extended Intelligent I/O Service (Ei 2 Os)

    CHAPTER 3 INTERRUPT 3.6.4 Procedure for use of Extended Intelligent I/O Service (EI To use extended intelligent I/O service (EI OS), the system stack area, EI OS descriptor, peripheral function, interrupt control register (ICR), and other requirements must be set Procedure for Use of Extended Intelligent I/O Service (EI Figure 3.6-8 shows the EI OS software and the process by hardware.
  • Page 99: Os) Processing Time

    CHAPTER 3 INTERRUPT 3.6.5 Extended Intelligent I/O Service (EI OS) Processing Time The time required for extended intelligent I/O service (EI OS) processing depends on the following factors: • Setting of EI OS status register (ISCS) • Address (area) indicating I/O register address pointer (IOA) •...
  • Page 100 CHAPTER 3 INTERRUPT Further, correction may be required, depending on the condition for executing EI OS, as shown in Table 3.6-3. Table 3.6-3 Compensation Value for Data Transfer at EI OS Processing Time I/O register address pointer Internal Access External access B/Even B/Even 8/Odd...
  • Page 101 CHAPTER 3 INTERRUPT At the end caused by an end request from the peripheral function (I/O) If data transfer by EI OS is aborted due to an end request from the peripheral function (I/O) (ICR S1, ICR S0 = 11), the hardware interrupt is activated without performing data transfer. The EI OS processing time is calculated using the expression below.
  • Page 102: Exception Processing Interrupt

    CHAPTER 3 INTERRUPT Exception Processing Interrupt MC-16LX executes exception handling by executing undefined instructions. Exception handling, basically the same as interrupt, is executed when an exception item is detected during a period between instructions, the normal process is suspended for this purpose.
  • Page 103: Interruption By Μdmac

    CHAPTER 3 INTERRUPT Interruption by µDMAC µDMAC is a simplified DMA with the same function as EI 3.8.1 µDMAC Function 3.8.2 Register of µDMAC 3.8.2.1 DMA Descriptor Channel Specification Register (DCSR) 3.8.2.2 DMA Status Register (DSRH/DSRL) 3.8.2.3 DMA Stop Status Register (DSSR) 3.8.2.4 DMA Permission Register (DERH/DERL) 3.8.3 DMA Descriptor Window Register (DDWR) 3.8.3.1 DMA Data Counter (DDCTH/DDCTL)
  • Page 104: Μdmac Function

    CHAPTER 3 INTERRUPT µDMAC Function 3.8.1 µDMAC is simple DMA with the function equal with EI µDMAC Function µDMAC has the following functions. • Performs automatic data transfer between the peripheral resource (I/O) and memory. • The program execution of CPU stops in the DMA startup. •...
  • Page 105: Register Of Μdmac

    CHAPTER 3 INTERRUPT Register of µDMAC 3.8.2 µDMAC has four registers: DCSR, DSR, DSSR, and DER. The DMA descriptor used to set up DMA transfer is described in "3.8.3 DMA Descriptor Window Register (DDWR)". µDMAC Register List Figure 3.8-1 µDMA Register List DMA descriptor channel specification register (DCSR) DCSR 00009B...
  • Page 106: Dma Descriptor Channel Specification Register (Dcsr)

    CHAPTER 3 INTERRUPT 3.8.2.1 DMA Descriptor Channel Specification Register (DCSR) DMA descriptor channel specification register (DCSR) switches the descriptor of each channel. The descriptor is set after the channel is specified by this register. DMA Descriptor Channel Specification Register (DCSR) Figure 3.8-2 DMA Descriptor Channel Specification Register DCSR 00009B...
  • Page 107 CHAPTER 3 INTERRUPT One descriptor channel of the 16 channels is selected by setting the DCSR. For details, see "3.8.3 DMA Descriptor Window Register (DDWR) " *: This function can use even when Mini-HOST is operated. [bit15] STP:STP control bit STP bit Function 0 [Initial value]...
  • Page 108: Dma Status Register (Dsrh/Dsrl)

    CHAPTER 3 INTERRUPT 3.8.2.2 DMA Status Register (DSRH/DSRL) DMA status register (DSRH/DSRL) indicates that the DMA transfer ended. When "1" is set to this register, the interrupt is generated at the same time. Bit Configuration of DMA Status Register (DSRH/DSRL) Figure 3.8-3 Bit Configuration of DMA Status Register (DSRH/DSRL) 00009D DTE15 DTE14 DTE13 DTE12 DTE11 DTE10 DTE9...
  • Page 109: Dma Stop Status Register (Dssr)

    CHAPTER 3 INTERRUPT 3.8.2.3 DMA Stop Status Register (DSSR) DMA stop status register (DSSR) indicates that the DMA transfer stopped due to the STOP request. The meaning of the bit in this register is different depending on the STP bit of the DMA descriptor channel specification register (DCSR).
  • Page 110: Dma Permission Register (Derh/Derl)

    CHAPTER 3 INTERRUPT 3.8.2.4 DMA Permission Register (DERH/DERL) DMA permission register (DERH/DERL) enables the DMA transfer. When "1" is set to this register, the interrupt request, which is the DMA transfer request, generates to the corresponding channel, and starts the DMA transfer. DMA Permission Register (DERH/DERL) Figure 3.8-5 Bit Configuration of DMA Permission Register (DERH/DERL) DERH...
  • Page 111: Dma Descriptor Window Register (Ddwr)

    CHAPTER 3 INTERRUPT 3.8.3 DMA Descriptor Window Register (DDWR) The DMA descriptor, consisting of 8 bytes × 16 channels, is used to set up DMA transfer. One of the 16 channels is specified, and mapped to the DMA descriptor window register (DDWR) for being accessible.
  • Page 112: Dma Data Counter (Ddcth/Ddctl)

    CHAPTER 3 INTERRUPT 3.8.3.1 DMA Data Counter (DDCTH/DDCTL) DMA data counter (DDCTH/DDCTL) sets the data transfer. When DDCTH/DDCTL is 0, the DMA transfer ends. DMA Data Counter (DDCTH/DDCTL) DMA data counter (DDCTH/DDCTL), a 16-bit length register, indicates the counter associated with transferred number.
  • Page 113: Dma I/O Register Address Pointer (Dioah/Dioal)

    CHAPTER 3 INTERRUPT 3.8.3.2 DMA I/O Register Address Pointer (DIOAH/DIOAL) DMA I/O register address pointer (DIOAH/DIOAL) sets the I/O address pointer. The upper address (A23 to A16) is fixed at "00 ". DMA I/O Register Address Pointer (DIOAH/DIOAL) The DMA I/O register address pointer (DIOAH/DIOAL), a 16-bit length register, indicates the 16 low order bits (A15 to A00) of the DMA I/O register address.
  • Page 114: Dma Control Register (Dmacs)

    CHAPTER 3 INTERRUPT 3.8.3.3 DMA Control Register (DMACS) DMA control register (DMACS) controls the DMA transfer. The following can be controlled by the DMACS. → → • Direction control (IOA BAP and BAP IOA) • Transfer bit length (Byte and word) •...
  • Page 115 CHAPTER 3 INTERRUPT Figure 3.8-10 Wait Specification Bit Explanation source destination wait source destination Length of wait part in transfer such as above figure is defined by RDY2 and RDY1. Note: If writing transmission data to UART by using µDMAC, not setting RDY2 and RDY1 bit of DMACS register in (0, 0).
  • Page 116: Dma Buffer Address Pointer (Dbaph/Dbapm/Dbapl)

    CHAPTER 3 INTERRUPT 3.8.3.4 DMA Buffer Address Pointer (DBAPH/DBAPM/DBAPL) DMA buffer address pointer (DBAPH/DBAPM/DBAPL) sets the buffer address pointer. The DBAPH/DBAPM/DBAPL can be set A23 to A00. DMA Buffer Address Pointer (DBAPH/DBAPM/DBAPL) The DMA buffer address pointer (DBAPH/DBAPM/DBAPL), a 24-bit register, contains the address used for DMA transfer.
  • Page 117: Explanation Of Operation Of Μdmac

    CHAPTER 3 INTERRUPT Explanation of Operation of µDMAC 3.8.4 This section describes the µDMAC operation. Operation of µDMAC Figure 3.8-12 shows the DBAP operation. Data transfer using µDMAC performs the following steps in order: 1. The peripheral resource (I/O) makes a request for DMA transfer. 2.
  • Page 118 CHAPTER 3 INTERRUPT µDMAC Use Procedure Figure 3.8-13 shows the procedure for using µDMAC. Figure 3.8-13 Use Procedure of µDMAC Software processing Hardware processing (Interrput generation) START ENx=1 of appropreate ch Setting System stack area STOP request Initializing peripheral function and SE=1 DMA transfer Setting Interrupt control register...
  • Page 119: Exceptions

    Exception processing is fundamentally the same as interrupt processing. When an exception is detected between instructions, exception processing is performed separately from ordinary processing. In general, exception processing is performed as a result of an unexpected operation. Fujitsu recommends using exception processing only for debugging or for activating emergency recovery software.
  • Page 120: Stack Operation Of Interrupt Processing

    CHAPTER 3 INTERRUPT 3.10 Stack Operation of Interrupt Processing Once an interrupt is accepted, the contents of the dedicated registers are automatically saved in the system stack before control branches to the interrupt handling. Return from the stack at the end of the interrupt handling also takes place automatically. Stack Operation at the Start of Interrupt Processing Once the interrupt is accepted, the CPU automatically saves the contents of the current dedicated registers and their related data in the system stack in the order below:...
  • Page 121 CHAPTER 3 INTERRUPT Stack Area Securing stack area The stack area is used to save or return the program counter (PC) used to execute the subroutine call (CALL) or vector call (CALLV) instruction as well as execute the interrupt handling. This area is also used, by the PUSHW or POPW instruction, to save or return the contents of temporary registers and their related data.
  • Page 122: Program Example Of Interrupt Processing

    CHAPTER 3 INTERRUPT 3.11 Program Example of Interrupt Processing An example of interrupt processing program is shown below. Program Example of Interrupt Processing Processing specification An example interruption program that uses external interruption 0 (INT0) Coding example DDR6 000016H ; Port 6 direction register ENIR 00003CH ;...
  • Page 123 CHAPTER 3 INTERRUPT LOOP ; Unconditional jump ;----------Interrupt Program------------------------------------------------------------ ED_INT1: I:EIRR, #00H ; New acceptance of INT0 prohibited RETI ; Returns from interrupt. CODE ENDS ;----------Vector Settings------------------------------------------------------------------ VECT CSEG ABS=0FFH 0FFB4H ; The vector is set in interruption #18(12H) ED_INT1 0FFDCH ;...
  • Page 124 CHAPTER 3 INTERRUPT Coding example DDR6 000016H ; Port 6 direction register ENIR 00003CH ; Interruption/DTP permission register EIRR 00003DH ; Interruption/DTP factor register ELVR 00003EH ; A register to specify the required level ICR03 0000B3H ; Interrupt control registers 03 BAPL 000100H ;...
  • Page 125 CHAPTER 3 INTERRUPT DCTL,#64H ; Sets transfer byte count (100 bytes) DCTH,#00H I:ICR00,#00001000B ; EI OS channel 0, EI OS enable, interrupt level 0 (highest) I:ELVR,#00000001B ; Make INT0 "H" level request I:EIRR,#00H ; Clears interrupt cause for INT0. I:ENIR,#01H ;...
  • Page 126: Delayed Interrupt Generation Module

    CHAPTER 3 INTERRUPT 3.12 Delayed Interrupt Generation Module The delayed interrupt generation module is used to generate a task switching interrupt. Use of this module enables F MC-16LX CPU to generate or cancel an interrupt request. Block Diagram of Delayed Interrupt Generation Module Figure 3.12-1 shows the block diagram of the delayed interrupt generation module.
  • Page 127: Operation Of Delayed Interrupt Generation Module

    CHAPTER 3 INTERRUPT 3.12.1 Operation of Delayed Interrupt Generation Module When the CPU writes "1" to the appropriate bit of the DIRR by software, the request latch in the delay interrupt generation module is set, resulting in generation of the interrupt request to the interrupt controller.
  • Page 128 CHAPTER 3 INTERRUPT...
  • Page 129: Chapter 4 Reset

    CHAPTER 4 RESET This chapter explains reset of the MB90330 series. 4.1 Outline of Reset 4.2 Reset Factors and Oscillation Stabilization Wait Times 4.3 External Reset Pin 4.4 Reset Operation 4.5 Reset Factor Bit 4.6 State of Each Pin at Reset...
  • Page 130: Outline Of Reset

    CHAPTER 4 RESET Outline of Reset When the reset cause is generated, the CPU suspends the currently executed process immediately before entering the wait state for release of the reset. After the reset is cleared, processing starts from the address indicated in the reset vector. There are the following four kinds of factors of resets.
  • Page 131 CHAPTER 4 RESET External reset An external reset is generated by inputting the "L" level signal to external reset pin (RST). The input time of the "L" level signal to the (RST) pin must be continued for 16 machine cycles (16/φ) or more. The external reset, that is, the RST pin input reset does not produce the oscillation stabilization wait time.
  • Page 132: Reset Factors And Oscillation Stabilization Wait Times

    CHAPTER 4 RESET Reset Factors and Oscillation Stabilization Wait Times There are four kinds of reset factors of MB90330 series. The oscillation stabilization wait time varies with the reset cause. Reset Factors and Oscillation Stabilization Wait Times Table 4.2-1 shows the relationship between the reset causes and the oscillation stabilization wait time. Table 4.2-1 Reset Factors and Oscillation Stabilization Wait Times Reset factor Oscillation stabilization wait time...
  • Page 133 CHAPTER 4 RESET Figure 4.2-1 Oscillation Stabilization Wait Times for the Evaluation/flash and MASK Products during Power on Reset Time Evaluation/Flash Products /HCLK /HCLK operation Down-conversion Oscillation Stabilizing Stabilizing Wait Time Wait Time MASK Products /HCLK operation Oscillation Stabilizing Wait Time HCLK : Oscillation clock Note:...
  • Page 134: External Reset Pin

    CHAPTER 4 RESET External Reset Pin The external reset pin (RST pin), dedicated to reset input pin, generates an internal reset in response to input of the "L" level signal. MB90330 series are reset in sync with the CPU operating clock, except for external pin in asynchronous (generated through ports and so on), which change to the reset state.
  • Page 135: Reset Operation

    CHAPTER 4 RESET Reset Operation Once the reset is released, the object from which to read the mode data and reset vector is selected by setting the mode pin, before the mode fetch is performed. This fetch determines the CPU operation mode and the execution activation address succeeding the reset operation.
  • Page 136 CHAPTER 4 RESET Mode Fetch Once the reset is released, the CPU transfers the reset vector and mode data into the appropriate register in the CPU core. The reset vector and mode data are assigned to the four bytes of FFFFDC to FFFFDF When the reset is released, the CPU immediately outputs these addresses to the bus before fetching the reset vector and mode data.
  • Page 137: Reset Factor Bit

    CHAPTER 4 RESET Reset Factor Bit A reset factor can be identified by reading the watchdog timer control register (WDTC). Reset Factor Bit There are the flip-flop registers associated with respective reset causes, as shown in Figure 4.5-1. The contents of the flip-flops are obtained by reading the watchdog timer control register (WDTC). If the reset cause needs to be identified after the reset has been released, the values read from the WDTC register should be processed by software before control branches to the program.
  • Page 138 CHAPTER 4 RESET Correspondence of Reset Factor Bit and Reset Factor Figure 4.5-2 shows the configuration of the reset cause bits of the watchdog timer control register (WDTC). Contents of reset cause bits and associated reset causes are shown in the Table 4.5-1. For details, see the "10.2 Watchdog Timer Control Register (WDTC)"...
  • Page 139: State Of Each Pin At Reset

    CHAPTER 4 RESET State of Each Pin at Reset This section explains the state of each pin at reset. Pin Status during Reset The state of each pin during reset is determined by the settings of the mode pins (MD2 to MD0). When internal vector mode has been set: (MD2 to MD0="011 ") All I/O, or resource, pins are placed at high impedance.
  • Page 140 CHAPTER 4 RESET...
  • Page 141: Chapter 5 Clock

    CHAPTER 5 CLOCK This chapter explains the clock of the MB90330 series. 5.1 Outline of Clock 5.2 Block Diagram of Clock Generation Section 5.3 Clock Select Register (CKSCR) 5.4 Clock Mode 5.5 Oscillation Stabilization Wait Time 5.6 Connection of Oscillator and External Clock...
  • Page 142: Outline Of Clock

    CHAPTER 5 CLOCK Outline of Clock The clock generation section controls operation of the internal clock which is the operation clock for the CPU and peripheral functions. The following are four kinds of the clock. • Machine clock: Internal clock. •...
  • Page 143 CHAPTER 5 CLOCK Notes: • As for the oscillation clock, 1 MHz to 7 MHz can oscillate. The maximum operating frequency is 24 MHz for the CPU and peripheral functions. When multiplier exceeding the maximum operating frequency is specified, the device does not operate correctly. If the source oscillation at a frequency of 6 MHz, only 4-time frequency multiplication can be specified.
  • Page 144 CHAPTER 5 CLOCK Figure 5.1-1 Clock Supply Map Peripheral function Watchdog timer 16 - bit PPG timer PPG0 to PPG5 Clock generation unit 0/1/2/3/4/5 Watch timer 16 - bit PWC timer Timebase timer Subclock generation 8 - bit circuit expanded serial I/O PLL frequency multiplication circuit PCLK...
  • Page 145: Block Diagram Of Clock Generation Section

    CHAPTER 5 CLOCK Block Diagram of Clock Generation Section The clock generation section consists of the following six blocks: • System clock generation circuit • Sub clock generation circuit • PLL multiplying circuit • Clock selector • Clock select register (CKSCR) •...
  • Page 146 CHAPTER 5 CLOCK Figure 5.2-1 Block Diagram of Clock Generation Section Low power consumption mode control register (LPMCR) CG1 CG0 Reserved Pin high Pin Hi-Z impedance control control circuit Internal reset Internal reset generation circuit CPU intermittent Intermittent cycle operation sector selection CPU clock CPU clock...
  • Page 147 CHAPTER 5 CLOCK PLL multiplying circuit The oscillation clock is multiplied by PLL oscillation and supplied to the CPU clock selector. Clock selector From the main and sub clocks, and the three PLL clocks, this selects the clock to be supplied to the CPU and periphery clock control circuits.
  • Page 148: Clock Select Register (Ckscr)

    CHAPTER 5 CLOCK Clock Select Register (CKSCR) The clock select register (CKSCR) switches the clock mode between the main, sub, and PLL clocks, and selects the oscillation stabilization wait time and the PLL clock frequency multiplier. Configuration of Clock Select Register (CKSCR) Figure 5.3-1 shows the clock selection register (CKSCR) configuration.
  • Page 149 CHAPTER 5 CLOCK Note: The machine clock selection bit (MCS) is initialized by reset to main clock selection. Table 5.3-1 Functions of Clock Select Register (CKSCR) Bits (1/2) Bit name Functions • Bit indicating the main clock or sub clock, whichever selected as the machine clock. SCM: •...
  • Page 150 CHAPTER 5 CLOCK Table 5.3-1 Functions of Clock Select Register (CKSCR) Bits (2/2) Bit name Functions • Bit for selecting the multiply factor for PLL clock. • The multiplier can be selected from among three options. CS1, CS0: • Initialized to "00 "...
  • Page 151: Clock Mode

    CHAPTER 5 CLOCK Clock Mode The clock modes are the main clock mode, PLL clock mode and sub clock mode. Main Clock Mode, PLL Clock Mode, Sub Clock Mode Main clock mode The main clock mode stops the PLL clock by using an oscillation clock frequency divided by 2 as the operating clock of the CPU and peripheral resources.
  • Page 152 CHAPTER 5 CLOCK Transition from PLL clock mode to sub clock mode If the sub clock selection bit (SCS) of the clock selection register (CKSCR) is rewritten from "1" to "0" while in the PLL clock mode, the mode changes from PLL clock to sub clock. Transition from sub clock mode to PLL clock mode If the SCS bit of the CKSCR is rewritten from "0"...
  • Page 153 CHAPTER 5 CLOCK Figure 5.4-1 State Transition Diagram of Machine Clock Selection Main MCS=1 MCM=1 SCS= 0 SCM=1 Main CS1, CS0= xx MCS=1 MCS=1 MCM=1 MCM=1 Main (14) SCS=1 SCS= 0 MCS=1 SCM=1 SCM= 0 MCM=1 (10) CS1, CS0= xx SCS=1 CS1, CS0= xx SCM=1...
  • Page 154: Oscillation Stabilization Wait Time

    CHAPTER 5 CLOCK Oscillation Stabilization Wait Time When power is turned on, the stop mode is quit, or the clock mode changes from the sub to main or PLL clock, the oscillation stabilization wait time is required after the oscillation begins. This is because the oscillation of the oscillation clock remains in stopped state.
  • Page 155: Connection Of Oscillator And External Clock

    CHAPTER 5 CLOCK Connection of Oscillator and External Clock MB90330 series, containing a system clock generator circuit, generates the clock with the oscillator connected externally. It is also possible to input an externally generated clock. Connection of Oscillator and External Clock Example of connection of crystal oscillator or ceramic oscillator Connect the crystal or ceramic oscillator as shown in Figure 5.6-1.
  • Page 156 CHAPTER 5 CLOCK...
  • Page 157: Chapter 6 Low-Power Consumption Mode

    CHAPTER 6 LOW-POWER CONSUMPTION MODE This chapter describes the low-power consumption mode of the MB90330 series. 6.1 Outline of Low-Power Consumption Mode 6.2 Block Diagram of Low-power Consumption Control Circuit 6.3 Low-power Consumption Mode Control Register (LPMCR) 6.4 CPU Intermittent Operation Mode 6.5 Standby Mode 6.6 State Transition Diagram 6.7 State of the Pin during Standby Mode, Hold, and Reset...
  • Page 158: Outline Of Low-Power Consumption Mode

    CHAPTER 6 LOW-POWER CONSUMPTION MODE Outline of Low-Power Consumption Mode The MB90330 series have the following CPU operation modes by selecting the operation clock and operating the control of the clock. • Clock mode (PLL clock mode, main clock mode, and sub clock mode) •...
  • Page 159 CHAPTER 6 LOW-POWER CONSUMPTION MODE Clock Mode PLL clock mode In PLL clock mode, the CPU and peripheral function operate on a PLL multiplying clock of oscillation clock (HCLK). Note: When using USB Mini-HOST and the USB function, you need to set to the PLL clock mode. Main clock mode In main clock mode, the CPU and peripheral function operate on a clock with 2-frequency division of oscillation clock (HCLK).
  • Page 160 CHAPTER 6 LOW-POWER CONSUMPTION MODE Sub sleep mode The sub-sleep mode terminates the CPU operation clock in the sub clock mode and operates components except for the CPU under the sub clock. Timebase timer mode The timebase timer mode terminates all the operations other than the oscillation clock, the timebase timer, and the clock timer, terminating all the functions other than the timebase timer and the watch timer.
  • Page 161: Block Diagram Of Low-Power Consumption Control Circuit

    CHAPTER 6 LOW-POWER CONSUMPTION MODE Block Diagram of Low-power Consumption Control Circuit The low-power consumption control circuit is composed of the following seven blocks. • CPU intermittent operation selector • Standby controller circuit • CPU clock controller circuit • Peripheral clock controller circuit •...
  • Page 162 CHAPTER 6 LOW-POWER CONSUMPTION MODE CPU intermittent operation selector The CPU intermittent operation sector selects the number of the suspended clocks in the CPU intermittent operation mode. Standby controller circuit The standby controller circuit controls the CPU clock control circuit and the peripheral clock control circuit, and then performs the transition to the low-power consumption mode or cancellation.
  • Page 163: Low-Power Consumption Mode Control Register (Lpmcr)

    CHAPTER 6 LOW-POWER CONSUMPTION MODE Low-power Consumption Mode Control Register (LPMCR) The low-power consumption mode control register (LPMCR) performs transition to/ cancellation of the low-power consumption mode or sets the number of the CPU clock suspend cycles in the CPU intermittent operation mode. Low-power Consumption Mode Control Register (LPMCR) Figure 6.3-1 shows the configuration of the low-power consumption mode control register (LPMCR).
  • Page 164 CHAPTER 6 LOW-POWER CONSUMPTION MODE Table 6.3-1 Function Description of Each Bit of Low-power Consumption Mode Control Register (LPMCR) Bit name Functions • This bit indicates the transition to the stop mode. • Writing "1" to this bit changes the stop mode. STP: •...
  • Page 165 CHAPTER 6 LOW-POWER CONSUMPTION MODE Access to Low-power Consumption Mode Control Register Transition to the low-power consumption modes (stop mode, sleep mode, timebase timer mode, and watch mode) by writing to the low-power consumption mode control register is made, in this case, be sure to use the instructions in Table 6.3-2.
  • Page 166: Cpu Intermittent Operation Mode

    CHAPTER 6 LOW-POWER CONSUMPTION MODE CPU Intermittent Operation Mode The CPU intermittent operation mode is a mode for reducing the power consumption by intermittently operating the CPU while operating the external bus and peripheral functions at high speed. CPU Intermittent Operation Mode The CPU intermittent operation mode is a mode for stopping the clock supplied to the CPU for a predetermined period of time for each instruction execution to delay the internal bus cycle start when accessing the registers, internal memory (ROM, RAM), I/O, peripheral functions, or external bus.
  • Page 167: Standby Mode

    CHAPTER 6 LOW-POWER CONSUMPTION MODE Standby Mode Standby modes are: sleep (PLL sleep, main sleep, sub-sleep), watch, timebase timer, and stop mode. Operation Status in Standby Mode Table 6.5-1 shows the operation state in the standby mode. Table 6.5-1 Operation Status in Standby Mode Transition Main Machine...
  • Page 168: Sleep Mode

    CHAPTER 6 LOW-POWER CONSUMPTION MODE 6.5.1 Sleep Mode Sleep mode is mode for stopping the CPU operation clock and the operation other than CPU continues. When you instruct the transition to the sleep mode with the low-power consumption mode control register (LPMCR), the transition to the PLL sleep mode is made if the PLL clock mode is set, the transition to the main sleep mode is made if the main clock mode is set, and the transition to the sub sleep mode is made if the sub clock mode is set.
  • Page 169 CHAPTER 6 LOW-POWER CONSUMPTION MODE Cancellation of Sleep Modes The low-power consumption control circuit clears sleep mode by reset input or interrupt generation. Return by reset Initialization to the main clock mode is made by reset. Return by interrupt If there is an interrupt request higher than level 7 from the peripheral circuit and others in the sleep mode, the sleep mode is canceled.
  • Page 170: Timebase Timer Mode

    CHAPTER 6 LOW-POWER CONSUMPTION MODE 6.5.2 Timebase Timer Mode The timebase timer mode terminates the original oscillation and all the operations other than the timebase timer and the watch timer, resulting in termination of all the functions other than the timebase timer and the watch timer. Transition to Timebase Timer Mode In the PLL clock mode or the main clock mode (the sub clock display bit (SCM)=1 of the clock selection register (CKSCR)), writing "0"...
  • Page 171 CHAPTER 6 LOW-POWER CONSUMPTION MODE Cancellation of Timebase Timer Modes The low-power consumption circuit cancels the timebase timer mode by generating a reset input or an interrupt request. Return by external reset The external reset initializes the mode to the main clock mode. Return by interrupt If there is an interrupt request higher than level 7 from peripheral circuit and others in the timebase timer mode (except for IL2, IL1, IL0 of the interrupt control register (ICR) = "111...
  • Page 172: Watch Mode

    CHAPTER 6 LOW-POWER CONSUMPTION MODE 6.5.3 Watch Mode The watch mode terminates all the operations other than the sub clock and the watch timer, where almost all the functions of the chip are terminated. Transition to Watch Mode In the sub clock mode (the sub clock display bit of the clock selection register (CKSCR) (SCS)=0), when you write "0"...
  • Page 173 CHAPTER 6 LOW-POWER CONSUMPTION MODE Note: When handling an interrupt, the CPU usually services the interrupt after executing the instruction that follows the one specifying the watch mode. However, if the transition to the watch mode and the receipt of the external bus hold request occur at the same time, transition to interruption procedure may be made before execution of the next instruction.
  • Page 174: Stop Mode

    CHAPTER 6 LOW-POWER CONSUMPTION MODE 6.5.4 Stop Mode Stop mode is mode for stopping original oscillation and all functions are stopped. That means, data can be held with the lowest power consumption. Transition to Stop Mode If you write "1" into the stop mode bit (STP) of the low-power consumption mode control register (LPMCR), the transition to the stop mode is made.
  • Page 175 CHAPTER 6 LOW-POWER CONSUMPTION MODE Notes: • When handling an interrupt, the CPU usually services the interrupt after executing the instruction that follows the one specifying the stop mode. When transition to stop mode and acceptance of an external bus hold request have occurred at the same time, interrupt processing may transit before executing the next instruction.
  • Page 176: State Transition Diagram

    CHAPTER 6 LOW-POWER CONSUMPTION MODE State Transition Diagram The transition of the operation state and the transition conditions of MB90330 series are shown. State Transition Diagram Figure 6.6-1 shows the transition of the operation state and the transition conditions of MB90330 series. Figure 6.6-1 State Transition and Transition Conditions External reset, Watchdog timer reset, Software reset Power on...
  • Page 177 CHAPTER 6 LOW-POWER CONSUMPTION MODE Operation Status in Low-power Consumption Mode Table 6.6-1 lists the operation states in low-power consumption mode. Table 6.6-1 Operation States in Low-power Consumption Mode Main Timebase Clock Operating State Peripheral Clock Clock Clock Clock Timers Source Operation Operation...
  • Page 178: State Of The Pin During Standby Mode, Hold, And Reset

    CHAPTER 6 LOW-POWER CONSUMPTION MODE State of the Pin during Standby Mode, Hold, and Reset The state of the pin at the time of the stand by mode, the hold, or the reset is shown for each memory access code. Pin State in Single-chip Mode Table 6.7-1 shows the state of the pin in the single-chip mode.
  • Page 179 CHAPTER 6 LOW-POWER CONSUMPTION MODE *3: "Input shutoff" indicates the state in which operation of the input gate nearest to the pin is inhibited. "Output Hi-Z" means that the pin is placed at high impedance with the pin driving transistor placed in the drive disabled state. *4: When operation stops due to a cause in the USB, the signal is input via the USB port.
  • Page 180 CHAPTER 6 LOW-POWER CONSUMPTION MODE Pin State in External Bus 16-bit Data Bus and Multiplex 16-bit External Bus Mode Table 6.7-2 shows the state of the pins of the external bus 16-bit data bus mode and the multiplex 16-bit external bus mode. Table 6.7-2 Pin State in External Bus 16-bit Data Bus and Multiplex 16-bit External Bus Mode In stop mode Pin Name...
  • Page 181 CHAPTER 6 LOW-POWER CONSUMPTION MODE *2: "Output enabled" means that the contents of operation appear via the pin because the pin driving transistor is in driven state and operation of the internal circuit remains enabled. *3: Same as the other ports if this is being used for the output state. "Input enabled" means that the input function is currently enabled;...
  • Page 182 CHAPTER 6 LOW-POWER CONSUMPTION MODE Pin State in External Bus 8-bit Data Bus and Multiplex 8-bit External Bus Mode Table 6.7-3 shows the state of the pins of the external bus 8-bit data bus mode and the multiplex 8-bit external bus mode. Table 6.7-3 Pin Signal State in External Bus 8-bit Data Bus and Multiplex 8-bit External Bus Mode In stop mode Pin Name...
  • Page 183 CHAPTER 6 LOW-POWER CONSUMPTION MODE *2: "Output enabled" means that the contents of operation appear via the pin because the pin driving transistor is in driven state and operation of the internal circuit remains enabled. *3: Same as the other ports if this is being used for the output state. "Input enabled" means that the input function is currently enabled;...
  • Page 184 CHAPTER 6 LOW-POWER CONSUMPTION MODE Pin State in External Bus 16-bit Data Bus and Non-multiplex 16-bit External Bus Mode Table 6.7-4 shows the state of the pins of the external bus 16-bit data bus mode and the non-multiplex 16- bit external bus mode. Table 6.7-4 Pin State in External Bus 16-bit Data Bus and Non-multiplex 16-bit External Bus Mode In stop mode Pin Name...
  • Page 185 CHAPTER 6 LOW-POWER CONSUMPTION MODE *3: Same as the other ports if this is being used for the output state. "Input enabled" means that the input function is currently enabled; Pull-up/Pull-down or an input from the external is required. *4: If this is being used as an output port, it holds the preceding value. *5: Outputs the initial output preceding this mode.
  • Page 186 CHAPTER 6 LOW-POWER CONSUMPTION MODE Pin State in External Bus 8-bit Data Bus and Non-multiplex 8-bit External Bus Mode Table 6.3-2 shows the state of the pins of the external bus 8-bit data bus mode and the non-multiplex 8-bit external bus mode. Table 6.7-5 Pin State in External Bus 8-bit Data Bus and Non-multiplex 8-bit External Bus Mode In stop mode Pin Name...
  • Page 187 CHAPTER 6 LOW-POWER CONSUMPTION MODE *2: "Output enabled" means that the contents of operation appear via the pin because the pin driving transistor is in driven state and operation of the internal circuit remains enabled. *3: Same as the other ports if this is being used for the output state. "Input enabled" means that the input function is currently enabled;...
  • Page 188: Precautions When Using Low-Power Consumption Mode

    CHAPTER 6 LOW-POWER CONSUMPTION MODE Precautions when Using Low-power Consumption Mode Special attention for the following is needed when using the low-power consumption mode. • Transition to standby mode and interrupt • Cancellation of standby mode by interrupt • Oscillation stabilization wait time •...
  • Page 189 CHAPTER 6 LOW-POWER CONSUMPTION MODE Oscillation Stabilization Wait Time Oscillation Stabilization Wait Time of oscillation clock Because the oscillator for original oscillation is stopped in stop mode, the oscillation stabilization wait time must be required. For the oscillation stabilization wait time, you take the time selected in the oscillation stabilization wait time selection bit (WA1, WA0) of the clock selection register (CKSCR).
  • Page 190 CHAPTER 6 LOW-POWER CONSUMPTION MODE Notes on Accessing the Low-Power Consumption Mode Control Register (LPMCR) to Enter the Standby Mode To access the low-power consumption mode control register (LPMCR) with assembler language • To set the low-power consumption mode control register (LPMCR) to enter the standby mode, use the instruction listed in Table 6.3-2.
  • Page 191: Chapter 7 Mode Setting

    CHAPTER 7 MODE SETTING This chapter describes the mode setting and the external memory access. 7.1 Mode Setting 7.2 Mode Pins (MD2 to MD0) 7.3 Mode Data 7.4 External Memory Access 7.5 Operation in Each Mode of Mode Setting...
  • Page 192: Mode Setting

    CHAPTER 7 MODE SETTING Mode Setting MC-16LX has respective modes in the access method, access area, and test. Respective mode is set according to the mode pin at the time of reset and the mode- fetched mode data. Mode Setting MC-16LX has respective modes in the access method, the access area, and the test, and Figure 7.1-1 shows the classification.
  • Page 193: Mode Pins (Md2 To Md0)

    CHAPTER 7 MODE SETTING Mode Pins (MD2 to MD0) The mode pin is the three external pins (MD2 to MD0) and specifies the load methods for the reset vector and the mode data. Setting of Mode Pins (MD2 to MD0) With the mode pin (MD2 to MD0), you may select either the external data bus or the internal data bus for the reset vector read and select the bus width while selecting the external data bus.
  • Page 194: Mode Data

    CHAPTER 7 MODE SETTING Mode Data The mode data is located on the memory of the "FFFFDF " address and specifies the operation after the reset sequence. The mode data is automatically taken into the CPU by a mode fetch. Mode Data While executing the reset sequence, the mode data in the "FFFFDF "...
  • Page 195 CHAPTER 7 MODE SETTING Set Bit of Bus Mode (M1,M0) The M1and M0 bits specify the operation mode after the reset sequence. Table 7.3-2 shows the content of the M1, M0 bit setting. Table 7.3-2 Content of M1 and M0 Bit Setting Function Single-chip mode Internal ROM external bus modes...
  • Page 196 CHAPTER 7 MODE SETTING Relation between Mode Pin and Mode Data (Recommended Example) Table 7.3-3 shows the relation between the mode pin and the mode data. Table 7.3-3 Relation between Mode Pin and Mode Data Mode Single Chip Internal ROM external bus mode 8 bits (Address data multiplex) Internal ROM external bus Mode 16 bits (Address data multiplex)
  • Page 197 CHAPTER 7 MODE SETTING Operation of External Pin in Each Mode Table 7.3-4 shows the operation relation of each external pin in the non-multiplex mode and the multiplex mode. Table 7.3-4 Operation Relation of External Pin in Each Mode Functions Non- multiplex mode Multiplex mode External Address control...
  • Page 198: External Memory Access

    CHAPTER 7 MODE SETTING External Memory Access The block diagram of the external memory access, the configuration/function of the register, and the operation of the external memory access are described. I/O Signal Terminal of External Memory Access MC-16LX provides the following address/data/control signal to access the external memory/peripheral. •...
  • Page 199 CHAPTER 7 MODE SETTING Register List Figure 7.4-2 shows the list of the registers of the external bus pin control circuit. Figure 7.4-2 List of the Registers of External Bus Pin Control Circuit Automatic Ready Function 0000A5 Selection Register (ARSR) HMR1 HMR0 LMR1 LMR0 Reserved...
  • Page 200: Automatic Ready Function Selection Register (Arsr)

    CHAPTER 7 MODE SETTING 7.4.1 Automatic Ready Function Selection Register (ARSR) The configuration and functions of the automatic ready function selection register (ARSR) are described. Automatic Ready Function Selection Register (ARSR) Figure 7.4-3 shows the bit configuration of the automatic ready function selection register (ARSR). Figure 7.4-3 Bit Configuration of automatic Ready Function Selection Register (ARSR) Automatic Ready Function 0000A5...
  • Page 201: External Address Output Control Register (Hacr)

    CHAPTER 7 MODE SETTING 7.4.2 External Address Output Control Register (HACR) The configuration and functions of the external address output control register are described. External Address Output Control Register (HACR) Figure 7.4-4 shows the bit configuration of the external address output control register. Figure 7.4-4 Bit Configuration of External Address Output Control Register (HACR) External Address Output 0000A6...
  • Page 202: Bus Control Signal Selection Register (Epcr)

    CHAPTER 7 MODE SETTING 7.4.3 Bus Control Signal Selection Register (EPCR) The configuration and functions of the bus control signal selection register are described. Bus Control Signal Selection Register (EPCR) The bus control signal selection register sets the control functions of the bus operation in the external bus mode.
  • Page 203 CHAPTER 7 MODE SETTING [bit 11] HMBS Specify the bus size when accessing the external bus to the area 800000 to FFFFFF in the external data bus 16-bit mode. Bus size access of 16 bits (Initial Value in the external vector mode 1) Bus size access of 8 bits (Initial Value in the external vector mode 0.2) [bit 10] WRE Control the output of the external write signal (WRH/WRL) pins in the external data bus 16-bit mode, and...
  • Page 204: Operation In Each Mode Of Mode Setting

    CHAPTER 7 MODE SETTING Operation in Each Mode of Mode Setting Operation in each mode of mode setting is described in the timing chart. Mode Type Operations of the following items are described for each function. • External memory access control signal - External data bus 8-bit mode (non-multiplex mode) - External data bus 8-bit mode (multiplex mode) - External data bus 16-bit mode (non-multiplex mode)
  • Page 205: External Memory Access Control Signal

    CHAPTER 7 MODE SETTING 7.5.1 External Memory Access Control Signal The access to the external memory is performed at 3 cycles unless the ready function is not used. External Memory Access Control Signal Figure 7.5-1 to Figure 7.5-4 show the timing charts of the external access in each mode. The 8-bit bus width access in the external data bus 16-bit mode reads or writes the 8-bit width peripheral chip when you connect to the external bus by mixing the 8-bit width peripheral chip and the 16-bit width peripheral chip.
  • Page 206 CHAPTER 7 MODE SETTING External Data Bus 8-Bit Mode (External Data Bus 8-Bit/Multiplex Mode) Figure 7.5-2 Timing Chart of External Memory Access (Multiple Mode) Read Write Read P57/CLK P53/WRH (Port data) P52/WRL P51/RD P50/ALE Read address Write address Read address A23 to A16 (Port data) A15 to A08...
  • Page 207 CHAPTER 7 MODE SETTING External 16-Bit Bus Mode (External Data Bus 16-Bit/Multiplex Mode) Figure 7.5-4 Timing Chart of External Memory Access (External Data Bus 16-bit/multiplex Mode) Read Write Read P57/CLK P53/WRH P52/WRL P51/RD P50/ALE Read address Write address A23 to A16 Read address (Port data) A15 to A08...
  • Page 208: Ready Function

    CHAPTER 7 MODE SETTING 7.5.2 Ready Function The setting of the P56/RDY pin or the automatic ready function selection register (ARSR) enables the access to the low-speed memory and the peripheral circuits. When the RYE bit in the bus control signal selection register (EPCR) is set to "1", the condition is in the wait cycle while the period "L"...
  • Page 209 CHAPTER 7 MODE SETTING Non-multiplex mode Figure 7.5-5 Timing Chart of Ready Function (Non-multiplex Mode) Even address word read Odd address word write P57/CLK P53/WRH P52/WRL P51/RD P50/ALE A23 to A16 Write address Read address Read address Write address A15 to A08 Read address Write address A07 to A00...
  • Page 210 CHAPTER 7 MODE SETTING Multiplex mode Figure 7.5-6 Timing Chart of Ready Function (Multiplex Mode) Even address word read Odd address word write P57/CLK P53/WRH P52/WRL P51/RD P50/ALE Write address Read address A23 to A16 (Port data) A15 to A08 A07 to A00 (Port data) D15 to D08/...
  • Page 211: Holding Function

    CHAPTER 7 MODE SETTING 7.5.3 Holding Function The operation of the hold function is described in the timing chart. Operation of Holding Function If the HDE bit in the EPCR is set to "1", the hold function of the external bus by both the P54/HRQ and the P55/HAK pins are enabled.
  • Page 212 CHAPTER 7 MODE SETTING Figure 7.5-7 Timing Chart of Holding Function (Non-multiplex Mode) Read cycle Hold cycle Write cycle P57/CLK P54/HRQ P55/HAK P53/WRH P52/WRL P51/RD P50/ALE (Address) (Address) A23 to A16 (Address) (Address) A15 to A08 (Address) (Address) A07 to A00 D15 to D08/ AD15 to AD08 D07 to D00/...
  • Page 213: Chapter 8 I/O Port

    CHAPTER 8 I/O PORT This chapter describes the configuration and functions of the register used in the I/O port. 8.1 Functions of I/O Ports 8.2 I/O Port Register...
  • Page 214: Functions Of I/O Ports

    CHAPTER 8 I/O PORT Functions of I/O Ports The overview of functions of the I/O ports is shown. Functions of I/O Ports The I/O port outputs data from the CPU to the I/O pin and loads the signal input in the I/O pin in the CPU by using the port data register (PDR).
  • Page 215: I/O Port Register

    CHAPTER 8 I/O PORT I/O Port Register The configuration and functions of the register used in the I/O port are described. I/O Port Registers There are the following registers in I/O port. • Port data register (PDR0 to PDRB) • Port direction register (DDR0 to DDRB) •...
  • Page 216: Port Data Register (Pdr0 To Pdrb)

    CHAPTER 8 I/O PORT 8.2.1 Port Data Register (PDR0 to PDRB) The configuration and functions of the port data register (PDR0 to PDRB) are described. Port Data Register (PDR0 to PDRB) Figure 8.2-1 shows the list of the port data register (PDR0 to PDRB). Figure 8.2-1 List of Port Data Register (PDR0 to PDRB) Initial value Access...
  • Page 217: Port Direction Register (Ddr0 To Ddrb)

    CHAPTER 8 I/O PORT 8.2.2 Port Direction Register (DDR0 to DDRB) The configuration and functions of the port direction register are described. Port Direction Register (DDR0 to DDRB) Figure 8.2-2 shows the list of the port direction register (DDR0 to DDRB). Figure 8.2-2 List of Port Direction Register (DDR0 to DDRB) Initial value Access...
  • Page 218: Other Registers

    CHAPTER 8 I/O PORT 8.2.3 Other Registers The configuration and functions of the register other than the port data register (PDR0 to PDRB) and the port direction register (DDR0 to DDRB) are described. Port 0,1 Pull-up Resistance Register (RDR0,RDR1) Figure 8.2-3 shows the bit configuration of the pull-up resistance register (RDR0, RDR1). Figure 8.2-3 Bit Configuration of Pull-up Resistance Register (RDR0,RDR1) Initial value Access...
  • Page 219 CHAPTER 8 I/O PORT Analog Input Enable Register (ADER0,ADER1) Figure 8.2-5 shows the bit configuration of the analog input permission registers (ADER0, ADER1). Figure 8.2-5 Bit Configuration of analog Input Enable Register (ADER0, ADER1) Initial value Access ADER0 11111111 00001E Address : ADE07 ADE06 ADE05 ADE04 ADE03 ADE02 ADE01 ADE00 ADER1...
  • Page 220 CHAPTER 8 I/O PORT...
  • Page 221: Chapter 9 Timebase Timer

    CHAPTER 9 TIMEBASE TIMER This chapter describes the function and operation of the timebase timer. 9.1 Overview of Timebase Timer 9.2 Configuration of Timebase Timer 9.3 Timebase Timer Control Register (TBTC) 9.4 Interrupt of Timebase Timer 9.5 Operations of Timebase Timer 9.6 Precautions when Using Timebase Timer 9.7 Program Example of Timebase Timer...
  • Page 222: Overview Of Timebase Timer

    CHAPTER 9 TIMEBASE TIMER Overview of Timebase Timer The timebase timer has an interval timer function that enables a selection of four interval times using 18-bit free-run counter (timebase counter) count-up with synchronizing to the internal count clock (2 division of original oscillation). Furthermore, the function of timer output of oscillation stabilization wait time or function supplying operation clocks for watchdog timer are provided.
  • Page 223 CHAPTER 9 TIMEBASE TIMER Function of Clock Supply The clock supply function supplies the operating clock to the timer for oscillation stabilization wait time and some peripheral functions. Table 9.1-2 shows the clock cycle supplied from the timebase timer to each peripheral.
  • Page 224: Configuration Of Timebase Timer

    CHAPTER 9 TIMEBASE TIMER Configuration of Timebase Timer The timebase timer consists of the following four blocks. • Timebase timer counter • Counter clear circuit • Interval timer selector • Timebase timer control register (TBTC) Block Diagram of Timebase Timer Figure 9.2-1 shows the block diagram of the timebase timer.
  • Page 225 CHAPTER 9 TIMEBASE TIMER Counter clear circuit This circuit clears the counter by writing "0" to timebase timer initialization bit (TBR) of timebase timer control register (TBTC), power-on reset, transition to the stop mode, switching to PLL clock mode from the main clock mode or sub clock, or switching to the main clock mode from sub clock.
  • Page 226: Timebase Timer Control Register (Tbtc)

    CHAPTER 9 TIMEBASE TIMER Timebase Timer Control Register (TBTC) The timebase timer control register (TBTC) executes interval time selection, timebase timer counter clearance, and interrupt control and status check. Timebase Timer Control Register (TBTC) Figure 9.3-1 Timebase Timer Control Register (TBTC) Address bit15 bit14 bit13 bit12 bit11 bit10 bit7...
  • Page 227 CHAPTER 9 TIMEBASE TIMER Table 9.3-1 Timebase Timer Control Register (TBTC) Bit name Functions Reserved: Note: bit 15 Reserved bit Be sure to write "1". • The value at the time of reading is irregular. bit 14 Unused bits • No effect on writing. bit 13 •...
  • Page 228: Interrupt Of Timebase Timer

    CHAPTER 9 TIMEBASE TIMER Interrupt of Timebase Timer The timebase timer can generate an interrupt request by the overflow of the specified bit of the timebase timer counter (interval timer function). Interrupt of Timebase Timer After the timebase counter undergoes count-up with the internal count clock and the bit for the selected interval timer overflows, the interrupt request flag bit (TBOF) of timebase timer control register (TBTC) is set to "1".
  • Page 229: Operations Of Timebase Timer

    CHAPTER 9 TIMEBASE TIMER Operations of Timebase Timer The timebase timer has functions of interval timer and clock supply to peripheral functions. Operation of Interval Timer Function (Timebase Timer) Interval timer function generates interrupt requests at regular intervals. In order to function as an interval timer, setup in Figure 9.5-1 is needed.
  • Page 230 CHAPTER 9 TIMEBASE TIMER Table 9.5-1 Timebase Timer Counter Clearance Operation and Oscillation Stabilization Wait Time Operation Counter TBOF Oscillation Stabilization Wait Time Clear Writing "0" to timebase timer initialization bit (TBR) of timebase timer control register (TBTC) Power-on reset Watchdog reset Main clock oscillation stabilization wait time Release of main stop mode...
  • Page 231: Precautions When Using Timebase Timer

    CHAPTER 9 TIMEBASE TIMER Precautions when Using Timebase Timer Cautions about influences on peripheral functions due to interrupt request and timebase timer clearances. Precautions when Using Timebase Timer Clearing Interrupt request When clearing the interrupt request flag bit (TBOF) in the timebase timer control register (TBTC), perform while the timebase timer interrupt is masked by the setting of the interrupt level mask register (IML) of the interrupt request permission bit (TBIE) or the processor status (PS).
  • Page 232 CHAPTER 9 TIMEBASE TIMER Operations of Timebase Timer Operations in the following situations are shown in Figure 9.6-1. • At a power-on reset occurs. • At a transition to sleep mode during the operation of interval timer function • At a transition to stop mode. •...
  • Page 233: Program Example Of Timebase Timer

    CHAPTER 9 TIMEBASE TIMER Program Example of Timebase Timer Programming examples for the timebase timer are shown below. Program Example of Timebase Timer Processing specification Interval interruptions of 2 /HCLK (oscillation clock) are repeatedly generated. In this case, the interval time is about 0.68 ms (at 6-MHz operation).
  • Page 234 CHAPTER 9 TIMEBASE TIMER 0FF6CH ; The interruption vector is set WARI 0FFDCH ; Reset vector setting START ; Single-chip mode VECT ENDS START...
  • Page 235: Chapter 10 Watchdog Timer

    CHAPTER 10 WATCHDOG TIMER This chapter describes the function and operation of the watchdog timer. 10.1 Overview of Watchdog Timer 10.2 Watchdog Timer Control Register (WDTC) 10.3 Configuration of Watchdog Timer 10.4 Operations of Watchdog Timer 10.5 Precautions when Using Watchdog Timer 10.6 Program Examples of Watchdog Timer...
  • Page 236: Overview Of Watchdog Timer

    CHAPTER 10 WATCHDOG TIMER 10.1 Overview of Watchdog Timer The watchdog timer is a 2-bit counter operating with an output of the timebase timer or clock timer as the count clock and resets the CPU when the counter is not cleared for a preset period of time.
  • Page 237 CHAPTER 10 WATCHDOG TIMER Reference: When the watchdog timer is activated, it is initialized and set to the stopped state by a reset upon power-on or by a reset by the watchdog. Also, the watchdog counter is cleared by writing to the reset by the external pin, the software reset, and the watchdog control bit (WTE) of the watchdog timer control register and by changing to sleep, stop, and watch mode, but the watchdog timer is still activated.
  • Page 238: Watchdog Timer Control Register (Wdtc)

    CHAPTER 10 WATCHDOG TIMER 10.2 Watchdog Timer Control Register (WDTC) The watchdog timer control register (WDTC) displays the activation, clearance, and reset factor of the watchdog timer. Watchdog Timer Control Register (WDTC) Figure 10.2-1 shows the watchdog timer control register (WDTC). Table 10.2-1 describes the function of each bit of the WDTC register.
  • Page 239 CHAPTER 10 WATCHDOG TIMER Table 10.2-1 Function of Each Bit of Watchdog Timer Control Register (WDTC) Bit name Functions • Read-only bits that indicate reset factors. When a reset factor occurs, the relevant bit is set to "1". bit 7 PONR •...
  • Page 240: Configuration Of Watchdog Timer

    CHAPTER 10 WATCHDOG TIMER 10.3 Configuration of Watchdog Timer The watchdog timer consists of following five blocks. • Count clock selector • Watchdog counter (two bits counter) • Watchdog reset generator circuit • Counter clear control circuit • Watchdog timer control register (WDTC) Block Diagram of Watchdog Timer Figure 10.3-1 shows a watchdog timer block diagram.
  • Page 241 CHAPTER 10 WATCHDOG TIMER Counter clear control circuit Clears the watchdog counter and controls operation/stop of the counter. Watchdog timer control register (WDTC) Activates/clears the watchdog timer and holds the reset occurrence factor.
  • Page 242: Operations Of Watchdog Timer

    CHAPTER 10 WATCHDOG TIMER 10.4 Operations of Watchdog Timer The watchdog timer generates a watchdog reset upon an overflow of the watchdog counter. Operations of Watchdog Timer Figure 10.4-1 shows the setting required to operate the watchdog timer. Figure 10.4-1 Setting of Watchdog Timer bit15 bit8 Address...
  • Page 243 CHAPTER 10 WATCHDOG TIMER Figure 10.4-2 Relationship between Clear Timing and Interval Time of Watchdog Timer [Block diagram of Watchdog timer] 2-bit counter Reset 2 divided 2 divided Clock selector Reset circuit signal circuit circuit Count enable and clear Count enable output circuit WTE bit [Minimum interval time]...
  • Page 244: Precautions When Using Watchdog Timer

    CHAPTER 10 WATCHDOG TIMER 10.5 Precautions when Using Watchdog Timer This section explains precautions when using watchdog timer. Precautions when Using Watchdog Timer Stopping watchdog timer Once the watchdog time is activated, it cannot stop until power-on or a watchdog-external reset occurs. Interval Time Because the interval time uses carry-up signals from the timebase timer, as the count clock, clearing the timebase timer may make the interval time of the watch dog timer longer than the preset period of time.
  • Page 245: Program Examples Of Watchdog Timer

    CHAPTER 10 WATCHDOG TIMER 10.6 Program Examples of Watchdog Timer Program example of watchdog timer is given below. Program Examples of Watchdog Timer Processing specification • The watchdog timer is cleared each time in loop of the main program. • The processing of the main loop must go round within the minimum interval time. Coding example WDTC 0000A8H...
  • Page 246 CHAPTER 10 WATCHDOG TIMER...
  • Page 247: Chapter 11 Watch Timer

    CHAPTER 11 WATCH TIMER This chapter describes a overview of the watch timer, functions and configurations of its registers, and its operation. 11.1 Overview of Watch Timer 11.2 Configuration of Watch Timer 11.3 Watch Timer Control Register (WTC) 11.4 Operation of Watch Timer...
  • Page 248: Overview Of Watch Timer

    CHAPTER 11 WATCH TIMER 11.1 Overview of Watch Timer The watch timer is a 15-bit timer using the sub clock. It can generate interval interrupts. The watch timer can also be used as the clock source of the watchdog timer by setting Functions of Watch Timer The watch timer consists of a 15-bit timer and a circuit that controls interval interrupt.
  • Page 249: Configuration Of Watch Timer

    CHAPTER 11 WATCH TIMER 11.2 Configuration of Watch Timer The watch timer is composed of the following four blocks. • Interval selector • Watch Counter • Watch timer interruption generation circuit • Watch timer control register (WTC) Block Diagram of Watch Timer Figure 11.2-1 shows the watch timer block diagram.
  • Page 250: Watch Timer Control Register (Wtc)

    CHAPTER 11 WATCH TIMER 11.3 Watch Timer Control Register (WTC) Watch timer control register (WTC) controls the operation of watch timer. It also controls the interval interrupt time. Configuration of Watch Timer Control Register (WTC) Figure 11.3-1 shows the watch timer control register (WTC) configuration. Table 11.3-1 summarizes the functions of each bit functions of watch timer control register (WTC).
  • Page 251 CHAPTER 11 WATCH TIMER Table 11.3-1 Each Bit Functions of Watch Timer Control Register (WTC) Bit name Functions • This bit selects the clock source of the watchdog timer. WDCS: • Watch timer clock is selected if this bit is "0", and otherwise timebase timer clock is bit 7 Watchdog timer clock selected if this bit is "1".
  • Page 252: Operation Of Watch Timer

    CHAPTER 11 WATCH TIMER 11.4 Operation of Watch Timer The watch timer functions as s clock source for the watchdog timer, a timer for sub clock oscillation stabilization delay time and an interval timer that generates an interrupt at regular intervals. Watch Counter The watch counter is a 15-bit counter that counts sub clock and continues counting while sub clock is input.
  • Page 253 CHAPTER 12 16-BIT I/O TIMER This chapter describes a overview of the 16-bit I/O timer, the functions and configurations of its registers, and its operation. 12.1 Overview of 16-bit I/O Timer 12.2 Register of 16-bit I/O Timer 12.3 Operation of 16-bit I/O Timer...
  • Page 254: Chapter 12 16-Bit I/O Timer

    CHAPTER 12 16-BIT I/O TIMER 12.1 Overview of 16-bit I/O Timer The 16-bit I/O timer consists of one 16-bit free-run timer, and four output compare and four input capture modules. This function enables four independent waveforms to be output based on the 16-bit free-run timer, and input pulse widths and external clock cycle to be measured.
  • Page 255 CHAPTER 12 16-BIT I/O TIMER Block Diagram Figure 12.1-1 shows the 16-bit I/O timer block diagram. Figure 12.1-1 Block Diagram of 16-bit I/O Timer Control logic Interrupt to each blocks 16-bit free-run timer 16-bit timer Clear Output compare 0 OUT0 Compare register 0 Output compare 1 OUT1...
  • Page 256: Register Of 16-Bit I/O Timer

    CHAPTER 12 16-BIT I/O TIMER 12.2 Register of 16-bit I/O Timer Registers for the 16-bit I/O timer are classified into the following general categories: • 16-bit free-run timer • 16-bit output compare • 16 bit input capture The configuration and functions of register are described. Register Configuration of 16-bit I/O Timer The register configuration of the 16-bit I/O timer is shown in the following.
  • Page 257: 16-Bit Free-Run Timer

    CHAPTER 12 16-BIT I/O TIMER 12.2.1 16-bit Free-run Timer The 16-bit free-run timer consists of a 16-bit up-down counter and control status register. A value of the timer counter is used as a basic time of the input capture and output compare (base timer).
  • Page 258 CHAPTER 12 16-BIT I/O TIMER Block Diagram of 16-bit Free-run Timer Figure 12.2-5 shows the 16-bit free-run timer block diagram. Figure 12.2-5 Block Diagram of 16-bit Free-run Timer φ Interrupt request #36 Comparator IVFE STOP MODE CLR CLK2 CLK1 CLK0 Clock 16-bit free-run timer Count value output T15 to T00...
  • Page 259 CHAPTER 12 16-BIT I/O TIMER Timer Counter Data Register (TCDT) Figure 12.2-7 shows the bit configuration of the timer counter data register (TCDT). Figure 12.2-7 Bit Configuration of Timer Counter Data Register (TCDT) TCDT Timer counter data register upper 000087 R/W R/W R/W R/W Initial value...
  • Page 260 CHAPTER 12 16-BIT I/O TIMER [bit 12 to bit 10] MSI2,MSI1,MSI0 (Interrupt mask selection bit) Bit to set the number of times the compare clear interrupt be masked. It consists of a 3-bit reload counter and the count value is reloaded every time the counter value is "000 ".
  • Page 261 CHAPTER 12 16-BIT I/O TIMER [bit 5] STOP (Timer operation stop bit) It is bit for stopping count of 16-bit free-run timer. Writing "1" into this bit stops counting the 16-bit free-run timer and writing "0" starts counting it. Count permission (operation) [Initial value] Count disabled (Stop) Note that the output compare operation will stop when the 16-bit free-run timer stops counting.
  • Page 262 CHAPTER 12 16-BIT I/O TIMER [bit 2 to bit 0] CLK2,CLK1,CLK0 (Count clock cycle selection bit) Select count clock of 16-bit free-run timer. Since the clock is changed immediately after writing into the CLK2, CLK1, and CLK0 bits you must change it when the output compare and input capture are in stopping state.
  • Page 263: Output Compare

    CHAPTER 12 16-BIT I/O TIMER 12.2.2 Output Compare The output compare consists of 16-bit compare registers, compare output pin part, and a control register. It can reverse the output level for the pin and, at the same time, generate an interrupt when the 16-bit free-run timer value matches a value set in the 16- bit compare registers.
  • Page 264 CHAPTER 12 16-BIT I/O TIMER Block Diagram of Output Compare Figure 12.2-10 shows the output compare block diagram. Figure 12.2-10 Block Diagram of Output Compare Compare control OUT0,OUT2 OTE0 Compare register 0,2 CMOD 16-bit timer counter value (T15 to T00) OTE1 OUT1,OUT3 Compare control...
  • Page 265 CHAPTER 12 16-BIT I/O TIMER Output Compare Control Registers (OCS0 to OCS3) Figure 12.2-12 shows the bit configurations of the output compare control registers (OCS0 to OCS3). Figure 12.2-12 Bit Configurations of Output Compare Control Registers (OCS0 to OCS3) OCS1/OCS3 Output compare ch1:000055 control register upper...
  • Page 266 CHAPTER 12 16-BIT I/O TIMER [bit 9, bit 8] OTD1,OTD0 (Output level bit) It is used when you want to change the pin output level if the pin output of the output compare is enabled. The initial value of the compare pin output is "0". To perform a write operation, first, stop the compare operation.
  • Page 267 CHAPTER 12 16-BIT I/O TIMER Note: Since the output compare is synchronous with the clock of the 16-bit free-run timer, stopping the timer means the stop of the compare operation.
  • Page 268: Input Capture

    CHAPTER 12 16-BIT I/O TIMER 12.2.3 Input Capture This module has a function that detects a rising edge, falling edge, or both edges of externally input signal and holds a value of the 16-bit free-run timer in a register at the time of detection.
  • Page 269 CHAPTER 12 16-BIT I/O TIMER List of Register of Input Capture Figure 12.2-14 lists input capture registers. Figure 12.2-14 List of Register of Input Capture IPCP0 to IPCP3 ch0:007911 Input capture data register upper CP15 CP14 CP13 CP12 CP11 CP10 CP09 CP08 ch1:007913 Initial value XXXXXXXX...
  • Page 270 CHAPTER 12 16-BIT I/O TIMER Figure 12.2-16 The Configuration of Input Capture Control Status Register (ICS01,ICS23) ICS23 Input capture 000053 ICP3 ICP2 ICE3 ICE2 EG31 EG30 EG21 EG20 control status register 23 Initial value R/W R/W R/W R/W 00000000 ICS01 Input capture 000052 control status register 01...
  • Page 271: Operation Of 16-Bit I/O Timer

    CHAPTER 12 16-BIT I/O TIMER 12.3 Operation of 16-bit I/O Timer The operation and timing of the 16-bit I/O timer are described. Operation and Timing of 16-bit I/O Timer The following items related to the operation and timing of the 16-bit I/O timer are described. •...
  • Page 272: Operation Of 16-Bit Free-Run Timer

    CHAPTER 12 16-BIT I/O TIMER 12.3.1 Operation of 16-bit Free-run Timer The operation and timing of the 16-bit free-run timer are described. Operation of 16-bit Free-run Timer The 16-bit free-run timer starts counting at the counter value of "0000 " when a reset has been released. This counter value is a reference time for the 16-bit output compare and 16-bit input capture.
  • Page 273 CHAPTER 12 16-BIT I/O TIMER Figure 12.3-2 Timing Chart of Counter Clear by Comparison Result Agreement Counter value FFFF BFFF 7FFF 3FFF 0000 Time Reset Compare BFFF register value Interrupt...
  • Page 274: Operation Of 16-Bit Output Compare

    CHAPTER 12 16-BIT I/O TIMER 12.3.2 Operation of 16-bit Output Compare The 16-bit output compare compares the value of the 16-bit free-run timer with that set in one of the compare registers, sets the interrupt request flag and, at the same time, reverses the output level when a match is detected.
  • Page 275 CHAPTER 12 16-BIT I/O TIMER Example of the output waveform by two pairs of compare registers Figure 12.3-4 shows an example of the output waveform when the output initial value is "0". Figure 12.3-4 Example of Output Waveform by Two Pairs of Compare Registers (for Output Initial Value= "0") Compare value FFFF...
  • Page 276: Operation Of 16-Bit Input Capture

    CHAPTER 12 16-BIT I/O TIMER 12.3.3 Operation of 16-bit Input Capture The 16-bit input capture can capture the value of the 16-bit free-run timer into the capture register and generate an interrupt when it detects a predefined valid edge. Example of Taking Timing of Input Capture Figure 12.3-5 shows the input capture capturing timing example.
  • Page 277: Timing Of 16-Bit Free-Run Timer

    CHAPTER 12 16-BIT I/O TIMER 12.3.4 Timing of 16-bit Free-run Timer The 16-bit free-run timer is counted up by the input clock (internal or external clock). When an external clock is selected, this timer is counted up at a rising edge. Count Timing of Free-run Timer Figure 12.3-6 shows the count timing for the free-run timer.
  • Page 278: Output Compare Timing

    CHAPTER 12 16-BIT I/O TIMER 12.3.5 Output Compare Timing The output compare indicates that a compare match signal that is generated when the free-run timer match the value set in the compare registers can reverse the output value and raise an interrupt. The output inverse timing when a comparing match is detected is in sync with the counter timing.
  • Page 279: Input Timing Of Input Capture

    CHAPTER 12 16-BIT I/O TIMER 12.3.6 Input Timing of Input Capture Capture timing to input signal of input capture is described. Capture Timing to Input Signal Figure 12.3-10 shows the capture timing to the input signal of the input capture. Figure 12.3-10 Capture Timing to Input Signal of Input Capture φ...
  • Page 280 CHAPTER 12 16-BIT I/O TIMER...
  • Page 281: Chapter 13 Usb Function

    CHAPTER 13 USB FUNCTION This chapter describes the functions and overview of the USB Function. 13.1 Overview of USB Function 13.2 Block Diagram of USB Function 13.3 Register of USB Function 13.4 Operation Explanation of USB Function...
  • Page 282: Overview Of Usb Function

    CHAPTER 13 USB FUNCTION 13.1 Overview of USB Function The USB Function is an interface that supports the USB (Universal Serial Bus) communication protocol. It operates supporting the transfer speed of FULL (12 Mbps) and has the following characteristics. Features of USB Function •...
  • Page 283: Block Diagram Of Usb Function

    CHAPTER 13 USB FUNCTION 13.2 Block Diagram of USB Function Figure 13.2-1 shows the USB Function block diagram. Block Diagram of USB Function Figure 13.2-1 Block Diagram of USB Function EndPoint0 Internal In buffer data bus EndPoint0 Out buffer EndPoint1 buffer Interrupt #11,12...
  • Page 284: Register Of Usb Function

    CHAPTER 13 USB FUNCTION 13.3 Register of USB Function The configuration and functions of registers used in the USB Function are described. Register List of USB Function Figure 13.3-1 Register List of USB Function UDCC (R/W) EP0C (R/W) EP1C (R/W) EP2C (R/W) EP3C...
  • Page 285 CHAPTER 13 USB FUNCTION Figure 13.3-2 Register of USB Function (1/2) Address:0000D0 RESUM HCON USTP Reserved Reserved RFBK UDC control register (UDCC) Address:0000D2 Reserved PKS0 EP0 control register (EP0C) Address:0000D3 Reserved Reserved Reserved Reserved Reserved Reserved STAL Reserved Address:0000D4 PKS 1 EP1 control register (EP1C) Address:0000D5 EPEN...
  • Page 286 CHAPTER 13 USB FUNCTION Figure 13.3-2 Register of USB Function (2/2) Address:0000E7 BFINI DRQIE SPKIE Reserved BUSY SIZE Address:0000E8 Reserved SIZE EP2 status register (EP2S) Address:0000E9 BFINI DRQIE SPKIE Reserved BUSY Reserved Address:0000EA Reserved SIZE EP3 status register (EP3S) Address:0000EB BFINI DRQIE SPKIE...
  • Page 287: Udc Control Register (Udcc)

    CHAPTER 13 USB FUNCTION 13.3.1 UDC Control Register (UDCC) UDC control register (UDCC) controls the UDC core circuit. UDC Control Register (UDCC) Figure 13.3-3 shows the bit configuration of the UDC control register (UDCC). Figure 13.3-3 UDC Control Register (UDCC) Addressbit 0000D0 RESUM...
  • Page 288 CHAPTER 13 USB FUNCTION [bit 6] RESUM: Resume setting bit When it is in remote Wake-up enabled status (or DEVICE_REMOTE_WAKEUP bit is set with the SET_FEATURE command by the host) and in suspend status, the resume operation is started by writing 1 to the RESUM bit.
  • Page 289 CHAPTER 13 USB FUNCTION [bit 3, bit 2] Reserved bit It is reserved bit. Please write "0". The bit always reads "0". [bit 1] RFBK: Data toggle mode selection bit (rate feedback mode) It is a bit that selects data toggle mode for USB Interrupt transfer. RFBK Operating mode Selection of alternation data toggle mode...
  • Page 290: Ep0 Control Register (Ep0C)

    CHAPTER 13 USB FUNCTION 13.3.2 EP0 Control Register (EP0C) EP0 control register (EP0C) controls concerning end point 0. EP0 Control Register (EP0C) Figure 13.3-4 shows the bit configuration of the EP0 control register (EP0C). Figure 13.3-4 EP0 Control Register (EP0C) Address 0000D2 Reserved...
  • Page 291 CHAPTER 13 USB FUNCTION [bit 8, bit 7] Reserved bit It is reserved bit. Please write "0". The bit always reads "0" when read. [bit 6 to bit 0] PKS0:Packet size end point 0 set bit It specifies the maximum number of transfer bytes per packet. The maximum number of transfer bytes per packet that EndPoint0 can specify is 64 bytes, which is a setting common to IN and OUT.
  • Page 292: Ep1 To Ep5 Control Register (Ep1C To Ep5C)

    CHAPTER 13 USB FUNCTION 13.3.3 EP1 to EP5 Control Register (EP1C to EP5C) EP1 to EP5 control register (EP1C to EP5C) controls concerning end point 1 to 5. EP1 to EP5 Control Register (EP1C to EP5C) Figure 13.3-5 shows the bit configuration of the EP1C to EP5C control register (EP1C to EP5C). Figure 13.3-5 EP1 to EP5 Control Register (EP1C to EP5C) Address EP1C 0000D4...
  • Page 293 CHAPTER 13 USB FUNCTION [bit 15] EPEN: End Point 1 to 5 permission bit The end point is made effective. Setting the EPEN bit allows it to be configures by the host as an end point for use in the USB Function. TYPE, DIR, and PKS of the EP1 to EP5 control registers become valid for configuration information.
  • Page 294 CHAPTER 13 USB FUNCTION [bit 10] NULE: NULL automatic transfer enable bit This bit sets up a mode where the last packet transfer will be detected and 0-byte data transfer will be automatically sent when IN- direction data transfer request arrives if the automatic buffer transfer mode is set (DMAE=1).
  • Page 295: Time Stamp Register (Tmsp)

    CHAPTER 13 USB FUNCTION 13.3.4 Time Stamp Register (TMSP) The time stamp register (TMSP) displays a frame number when an SOF packet is received. Time Stamp Register (TMSP) Figure 13.3-6 shows the bit configuration of the timestamp register (TMSP). Figure 13.3-6 Time Stamp Register (TMSP) Address bit 0000DE TMSP...
  • Page 296: Udc Status Register (Udcs)

    CHAPTER 13 USB FUNCTION 13.3.5 UDC Status Register (UDCS) The UDC status register (UDCS) is a register that indicates the status of a bus on USB communications and a particular command received. Each bit in the register except SETP indicates an interrupt factor and raises an interrupt to CPU if its corresponding interrupt enable bit is specified and valid.
  • Page 297 CHAPTER 13 USB FUNCTION [bit 6] VON:VBUS connection detection bit The detection of USB cabling is shown. It is set if VBUS changes from being disconnected ("L" level kept detecting for not less than 2.6 µs) to 2.6µs continuous application of "H" level potential. The VON bit is a interrupt factor and writing "1"...
  • Page 298 CHAPTER 13 USB FUNCTION Note: Set registers again by initializing the USB Function with RST in the UDCC register when the BRST bit is detected. [bit 2] WKUP: Wake-Up detection bit It displays the fact that the USB Function has returned from suspend status. What causes the USB Function to return from suspend status are a remote wake-up by setting the RESUM bit and a wake-up from the host request, and the WKUP bit is automatically set only by a return request from the host.
  • Page 299 CHAPTER 13 USB FUNCTION [bit 0] CONF: Configuration detection bit It displays the fact that the USB Function has been configured. The CONF bit is set when a SetConfig, a USB command, has been successfully received. The CONF bit is an interrupt factor and writing "1" is ignored.
  • Page 300: Udc Interruption Enable Register (Udcie)

    CHAPTER 13 USB FUNCTION 13.3.6 UDC Interruption Enable Register (UDCIE) The UDC interrupt enable register (UDCIE) is a register that allows each interrupt factor in the UDC status register to be raised as an interrupt bit wisely except CONFN. UDC Interruption Permission Register (UDCIE) Figure 13.3-8 shows the bit configuration of the UDC interrupt enable register (UDCIE).
  • Page 301 CHAPTER 13 USB FUNCTION [bit 12] SOFIE:SOF reception interruption permission bit It allows an interrupt due to the interrupt factor for the UDC status register "SOF" to be generated. SOFIE Operating mode Interrupt disabled by SOF factor Interruption permission by SOF factor [bit 11] BRSTIE: Bus reset interruption permission bit It allows an interrupt due to the interrupt factor for the UDC status register "BRST"...
  • Page 302: Ep0I Status Register (Ep0Is)