DATASHEET SEARCH SITE | WWW.ALLDATASHEET.COM

Document overview

  • Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
  • PDF pages: 27

Technical content

Version: 0.04 This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 1/27 笙泉科技股份有限公司 Megawin Technology Co., Ltd. MG69L220A Data Sheet 8-Bit Micro-Controller with IO function Version 0.04

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 2/27 MG69L220A Datasheet Version 0.04 Table of Contents

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 3/27 MG69L220A Datasheet Version 0.04

1 Features

 Single Chip 8-bit CPU  Memory  Program Mask ROM : 8K Bytes  Data RAM : 144 Bytes  Operating voltage: 1.8V to 3.6V  42 Programmable GPIO  High sink current output  Shared input or output pins:  Input/output pins P0[7:4]  Input pins P0[3:0]  Quasi-bi-directional IO pins P1[4:0]  Output pins P2[7:0], P3 [7:0], P4[7:0], P5[3:0]  Watchdog timer built-in  Two re-loadable 8-bit timers  HALT mode and STOP mode for power saving  Build-in dual oscillation circuit:  RC type main oscillator  X32 for sub-oscillator  Dual clock operation  Build-in low voltage detectors (typical voltage: below 2.1V) and low voltage reset (typical voltage: below 1.8V)

1.1 Application Field

General Key Pad Controller.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 4/27 MG69L220A Datasheet Version 0.04

2 General Description

MG69L220A integrates an 8-bit CPU core, SRAM and system control circuits by a CMOS silicon gate technology. The ROM can store data table and program. 8 I/O 116 dots LCD driver and one large sink output pin make this chip very suitable for AURC, timepiece and sport meter.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 5/27 MG69L220A Datasheet Version 0.04

3 Pin Configurations

3.1 Pad Assignment

12 14 1513 16 17 18 19 20 21 22 23 24 25 26 P3.4 P3.3 P2.1 P2.2 P3.7 P2.3 P3.5 P2.0 P3.6 P3.2 P3.1 P3.0 P2.4 P2.5 P4.7 P4.6 P4.5 P5.3 P5.0 P5.2 P4.0 P5.1 P4.1 P4.2 P4.3 P4.4 P0.1 P0.0 P0.2 P0.4 P0.5 P0.3 P0.6 P0.7 VDD HSO VSS /RESB 3940 OSC/XI X32I P2.6 P1.4 P1.3 P1.2 P1.1 P1.0 P2.7 44 43X32O Figure 3-1 Pad Assignment

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 6/27 MG69L220A Datasheet Version 0.04

3.2 Pin Description

1,2 X32O, X32I B 32.768KHz crystal oscillator pins. 3 ~ 7 P1[4:0] I/0 Quasi-bi-directional IO pin. 8 ~ 15 P2[7:0] O Open-drain with pull-high output pin. 16 ~ 23 P3[7:0] O Open-drain with pull-high output pin. 24 ~ 31 P4[7:0] O Open-drain with pull-high output pin. 32 ~ 35 P5.0 ~ P5.3 O Open-drain with pull-high output pin. 36 ~ 39 P0.0 ~ P0.3 I Input pin with interrupt function. 40 ~ 43 P0.4 ~ P0.7 B Programmable I/O ports with interrupt function.

44 VDD P Positive power pins (need to connect together)

45 HSO O Direct sink ( sink current: 150mA) for high light LED. Default value is high after reset.

46 VSS P Ground pins (need to connect together)

47 /RES I System reset pin (low active). 48 OSCI I RC oscillator input pin. Note: In the “Type” field, “I” means input only. “O” means output only. “B” means bi-direction. “P” means Power, “G” means Ground.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 7/27 MG69L220A Datasheet Version 0.04

4 Block Diagram

6502 CPU

(HF ROSC / X32OSC) I / O SRAM / Register ROM LVR HSO circuit X32O X32I XI nRES VDD GND HSO P0.0 ~ P0.7 P1.0 ~ P1.4 P2.0 ~ P2.7 P3.0 ~ P3.7 P4.0 ~ P4.7 P5.0 ~ P5.3 Figure 4-1 Block Diagram

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 8/27 MG69L220A Datasheet Version 0.04

5 Function Description

5.1 Registers

A Y X P PCH PCL 1 S

5.2 Accumulator

The accumulator is a general-purpose 8-bit register, which stores the results of most arithmetic and logic operations. In addition, the accumulator usually contains one of two data words used in these operations.

5.3 Index Register(X,Y)

There are two 8-bit index registers (X and Y), which may be used to count program steps or to provide an index value to be used in generating an effective address. When executing an instruction, which specifies indexed addressing, the CPU fetches the OP Code and the base address, and modifies the address by adding the index register to it prior to performing the desired operation. Pre- or post-index of index address is possible.

5.4 Processor Status Register

The 8-bit processor status register contains seven status flags. Some of the flags are controlled by the program, others may be controlled both the program and the CPU. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 N V 1 B D I Z C N: Signed flag, 1 = negative, 0 = positive V: Overflow flag, 1 = true, 0 = false B: BRK interrupt command, 1 = BRK, 0 = IRQB D: Decimal mode, 1 = true, 0 = false I: IRQB disable flag, 1 = disable, 0 = enable Z: Zero flag, 1 = true, 0 = false C: Carry flag, 1 = true, 0 = false

5.5 Program Counter(PC)

The 16-bit program counter register provides the addresses, which step the micro-controller through sequential program instructions. Each time the micro-controller fetch an instruction from program memory, the lower byte of the program counter (PCL) is placed on the low-order 8 bits of the address bus and the higher byte of the program counter (PCH) is placed on the high-order 8 bits. The counter is incremented each time an instruction or data is fetched from program memory.

5.6 Stack Point(S)

The stack pointer is an 8-bit register, which is used to control the addressing of the variable-length stack. The stack pointer is automatically incremented and decremented under control of the micro-controller to perform stack manipulations under direction of either the program or interrupts (/NMI or /IRQ). The stack allows simple implementation of nested subroutines and multiple level interrupts. The stack pointer is initialized by the user’s firmware.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 9/27 MG69L220A Datasheet Version 0.04

6 Memory Organization

There are 144 bytes SRAM, located in address 0000H to 007FH and 1000H to 100FH, in the MG69L220A. They could be used as either working RAM or stacks according to application programs. For the purposes above, the location 0000H to 007FH and 0100H to 017FH overlap. In other words, accessing any locations inside the range 0000H to 007FH is equivalent to access the corresponding ones in the range 0100 to 017FH. All special function registers, SFRs, are located at the region 00C0H to 00FFH. Such an arrangement could benefit from the faster access time of zero-page. There are 8K bytes program / data ROM in MG69L220A. The ROM address from E000H to FFFFH can store program and data. The address mapping of MG69L220A is shown as below Zero Page SRAM SFR SRAM / Stack Area RAM Program/ Table Interrupt Vector Area 0000H~007FH 00C0H~00FFH 0080H~00BFH Share area 0180H~01 FFH 0100H~017 FH 1000H~ 100FH E000H~FFFBH FFFCH ~ FFFFH MG69L220A Memory Map Figure 6-1 Memory Map

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 10/27 MG69L220A Datasheet Version 0.04

6.1 SFR Mapping

The address 00C0H to 00FFH is reserved for special function registers (SFR). The SFR is used to control or store the status of I/O, timers, system clock and other peripheral. ※ All SFRs are not supported by bit-manipulation instructions. Table 6-1 SFR Table SFR (special function register): 00C0H~00FFH Address Content Default Address Content Default 00C2 IRQ_EN / IRQ_ST 0-00000- 00D2 P0port XXXXXXXX 00C3 IRQ_CLR 0-00000- 00D3 P0dir 0000---- 00C4 RESFlag --0X1--X 00D4 P0plh 11111111 00C5 RESOK XXXX---0 00D5 P0opd 0000---- 00C8 TM0 11111111 00D8 P2port 00000000 00CD TM1 11111111 00DD P5port ----0000 Address Content Default Address Content Default

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 11/27 MG69L220A Datasheet Version 0.04

6.2 Write Protect Function Register

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00F9H CWPR PT7 PT6 PT5 PT4 PT3 PT2 PT1 PT0 -  Condition Write Protect flag register (CWPR) is used to protect IRQ_CLR.7 (WDT), PWR_CR.1 (CKC0), SCK_SEL, it must write “78H” to CWPR first. PT7~PT0: Write Protect Pattern. In MG69L220A write protect pattern is “78H” Note: 1. When CWPR is written by firmware, it would be au tomatically cleared by hardware after the “next write action” of firmware. Bit※ -manipulation instructions are not available on this register.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 12/27 MG69L220A Datasheet Version 0.04

7 Interrupt

There are five kinds interrupt source is provided in MG69L220A. The flag IRQ_EN and IRQ_ST are used to control the interrupts. When flag IRQ_ST is set to ‘1’ by hardware and the corresponding bits of flag IRQ_EN has been set by software, an interrupt is generated. When an interrupt occurs, all of the interrupts are inhibited until the CLI or STA IRQ_EN, # I instruction is invoked. Executing the SEI instruction can also disable the interrupts. Table 7-1 Interrupt Vector Table Vector Address Item Flag Properties Memo FFFEH, FFFFH P1 IRQ IRQ_ST.1 Ext. P1.0 ~ P1.4 interrupt vector P0 IRQ IRQ_ST.2 Ext. P0.0 ~ P0.7 interrupt vector TM0 IRQ IRQ_ST.3 Int. TM0 underflow interrupt TM1 IRQ IRQ_ST.4 Int. TM1 underflow interrupt DIV IRQ IRQ_ST.5 Int. Divider carry out interrupt FFFCH, FFFDH RESET None Ext. Initial reset WDT IRQ_ST.7 Int. Watch dog timer reset LVR None Int. Low voltage reset

7.1 Interrupt Register

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00C2H IRQ_EN PDBOR - DIVx TM1 TM0 P0 P1 - -  Program can enable or disable the ability of triggering IRQ through this register. 0: Disable (default “0” at initialization) 1: Enable P0: Falling edge occurs at port 0 input mode P1: Falling edge occurs at port 1 TM0: Timer 0 underflow TM1: Timer 1 underflow DIVx: Divider selected interrupt frequency occurred PDBOR: Power down BOR (0: enable BOR IP 1: disable BOR IP) IRQ status flag Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00C2H IRQ_ST WDT - DIVx TM1 TM0 P0 P1 -  - When IRQ occurs, program can read this register to know which source triggering IRQ. If the interrupt triggering is enabled and the interrupt event is accepted, the correspond IRQ status flag should be cleared by program after the interrupt vector is loaded into program counter. IRQ clear flag Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00C3H IRQ_CLR WDT - DIVx TM1 TM0 P0 P1 - -  Program can clear the interrupt event by writing ‘1’ into the corresponding bit. The IRQ_CLR.7 (WDT) is protected by CWPR.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 13/27 MG69L220A Datasheet Version 0.04 Reset status flag Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00C4H RESFlag - - IAR_F EXTR_F LVPOR LVD   IAR_F: Illegal address reset flag. (reset by POR and LVR) 1:An illegal address reset occurs. 0:This bit is set by hardware and clears by writing ‘1’. EXTR_F: External reset flag (reset by POR and LVR) 1: An external reset occurs. 0:This bit is set by hardware and clears by writing ‘1’. LVPOR: Low voltage reset and POR reset occur. (set by POR and LVR) 1:VDD is under 1.8V or power-on. 0: This bit is set by hardware and clears by writing ‘1’. LVD: Low voltage0 detected. (POR, LVR, BOR, illegal address reset and external reset) 1:VDD is under 2.1V. 0:This bit is set by hardware and clears by writing ‘1’.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 14/27 MG69L220A Datasheet Version 0.04

7.2 Interrupt System

IRQ _ EN.3/4 Interrupt Vector Generator Logic Initial Reset STA IRQ_ EN , # I Enable Initial Reset STA IRQ _ CLR , # I SEI instructionDisable Timer 0/1 underflow signal S R Q CLI instruction IRQ _ EN .2 S R Q IRQ_ST.3/4 IRQ _ ST . 2 DIV 1_IST.4 Divider overflow signal IRQ _ EN .5 FFFEH, FFFFH P0/P 1 DIV 1_IST.13 DIV 1_IST.10 DIV 1_IST.7 Figure 7-1 Interrupt System Diagram

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 15/27 MG69L220A Datasheet Version 0.04

8 Reset

8.1 Low Voltage Reset (LVR)

The MG69L220A provides low voltage reset circuit in order to monitor the supply voltage of the device. If the supply voltage of the device is within the range 0.9V ~ VLVR, such as changing a battery, the LVR will automatically reset the device internally. The LVR includes the following specifications 1. The low voltage (0.9V~VLVR) has to remain in their or iginal state to exceed 1ms. If the low voltage state does not exceed 1ms, the LVR will ignore it and do not perform a reset function. 2. In the LVR mode, the clock source (INT./EXT. OSC) continuous oscillating and the IO status becomes default value.

8.2 Watchdog Timer (WDT)

(The example is base on 32.768KHz and SCK_SEL.1 = 1) Name Bit 8 R W WDT 1.9 (Hz) - - The watchdog timer time-out period is obtained by the equation: (FDIV /512)/512 or (FDIV /4096)/512 select by SCK_SEL.1 (CKS1). Before watchdog timer time-out occurs, the program must clear the 9-bit WDT timer by writing 1 to IRQ_CLR.7. WDT overflow will cause system reset and set IRQ_CLR.7 to high. Watchdog Block Diagram R Write EVTclr Data bus _bit7 = 0 Pulse generator Over flow detection SD C R Q Write EVTclr Hard _ rst WDTevt WDT reset 512 SEL SCK_SEL.1 FWDT F DIV / 512 F DIV / 4096 Data bus _bit 7 Figure 8-1 Watch Dog Diagram

8.3 Reset OK

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00C5H RESOK RK7 RK6 RK5 RK4 - - - IO_RES -  RESOK (Reset OK): If the device reset OK and work well, must write #$90 into this register. For example: Program_start: LDA #10010000b STA $C5 IO_RES: IO reset selector. 0:IO status is reset by WDT, IA reset, LVR and POR, EXT_RESET (Default). 1:IO status is reset by LVR, EXT_RESET and POR.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 16/27 MG69L220A Datasheet Version 0.04

9 Power Control

9.1 Power Control Register

System clock selector (※The Clock Control Register is protected by CWPR.) Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00F0H SCK_SEL CKS7 - - - - CKS2 CKS1 CKS0 -  CKS0: FCPU clock source select. 0: FOSC, 1: FX32 CKS1: Watchdog clock source select. 0: FDIV/4096, 1: FDIV/512 CKS2: De-bounce (awakened from stop mode) time selector. 0: FOSC/16384, 1: FOSC/256 CKS7: Select the input clock source of divider. 0: FOSC, 1: FX32 Power saving control Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00FCH PWR_CR - - - - - CKC1 CKC0 HALT -  ※ CKC1 and CKC0 are protected by CWPR CKC1 CKC0 System clock control 0 0 FOSC enable, FX32 enable (Dual mode) 0 1 FOSC enable, FX32 disable (Single mode) 1 0 FOSC disable, FX32 enable (Slow mode) 1 1 FOSC disable, FX32 disable (Stop mode) Note: Dual mode and slow mode is inhibited when code option is selected to FX32 disable. HALT: FCPU off-line control bit. 1: FCPU off-line, 0: FCPU on-line Program can switch the normal operation mode to the power-saving mode for saving power consumption through this register. There are three power saving modes in this system. Slow mode: (PWR_CR.CKC1 = 1, PWR_CR.CKC0 = 0) The main uC clock (FOSC) stops oscillating. Only very low power is needed for uC to keep running. Stop mode: (PWR_CR.CKC1 = 1, PWR_CR.CKC0 = 1) Both system clocks stop oscillating. The uC can be awakened from stop mode by 4-ways: port 0 falling edge, port 1 falling edge, hardware reset, or power-on reset. When the st op mode is released, only the oscillator, which is providing the uC clock, will be enabled again. If uC clock source is FX32 and system into STOP mode (set PWR_CR[2:1] = 11). The FX32 will be enabled and FOSC still keep same status, when uC waken up by port0 or port1. Halt mode: (PWR_CR.HALT = 1) The FCPU clock in off-line status. The oscillator(s) still k eep same status. The uC can be awakened from halt mode by 3-ways: the interrupt events, hardware reset, or power-on reset.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 17/27 MG69L220A Datasheet Version 0.04

10 Divider

10.1 Divider

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00CCH DIV_SEL - - - - - - DIVS1 DIVS0 -  The divider clock source comes from FX32 (sub-main clock) or FOSC (main clock). Program can select divider interrupt frequency by DIV_SEL register. DIV _L ( 8 - b i t ) DIV_ H (8-bit) DIV FOSC DIVS1 DIVS0 FX32 FDIV SCK _SEL .7 DIVx FDIV /32, /256, /2048, /16384 DIVS1 DIVS0 DIV interrupt occurs status 0 0 F DIV / 16384 0 1 F DIV / 2048 1 0 F DIV / 256 1 1 F DIV / 32

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 18/27 MG69L220A Datasheet Version 0.04

11 Timer

11.1 Timer0

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00C8H TM0 T7 T6 T5 T4 T3 T2 T1 T0   00CAH TM0_CTL STC RL/S - - - TCS0 TKI1 TKI0  Timer 0 is an 8-bit down-count counter. STC: Start/Stop counting. 1: start and pre-load the value to counter, 0: stop timer clock RL/S: Auto-reload disable/enable. 1: disable auto-reload, 0: enable auto-reload TCS0: select the input clock source of timer0. 0:FOSC, 1: FX32 FTM0_DIV FTM 0 _ DIV FOSC FX32 TM 0_ CTL .2 TKI1 TKI0 FTM0_DIV FTM0 TM0(R) TM0 re- load buffer (W) Control Logic MUX Reload _CTL.1 _CTL.0 FTM0 T M0 TM0 over- flow TM0 TM0 TM0_CTL.7 _ CTL.6TM0 FTM0/1 FTM0/4 FTM0/16 FTM0/64 FTM0_UV, can be calculated with the equation: FTM0_UV = FTM0 / (TM0+1), where the FTM0 is the timer input frequency set by TKI1 and TKI0. For example: (if FTM0 = 2.000MHz, TKI1=TKI0=0) TM0 Frequency 00H Reserved 01H 1.000MHz 02H 667kHz … … FFH 7.84kHz TKI1 TKI0 Selected TM0 input frequency (FTM0_DIV) 0 0 F TM0 / 1 0 1 F TM0 / 4 1 0 F TM0 / 16 1 1 F TM0 / 64

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 19/27 MG69L220A Datasheet Version 0.04

11.2 Timer1

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00CDH TM1 T7 T6 T5 T4 T3 T2 T1 T0   00CFH TM1_CTL STC RL/S - - - TCS1 TKI1 TKI0  Timer 1 is an 8-bit down-count counter. STC: Start/Stop counting. 1: start and pre-load the value to counter, 0: stop timer clock RL/S: Auto-reload disable/enable. 1: disable auto-reload, 0: enable auto-reload TCS1: select the input clock source of timer1. 0: FOSC, 1: FX32 FTM1_DIV FTM 1 _ DIV FOSC FX32 TM 1_ CTL .2 TKI1 TKI0 FTM1_DIV FTM1 TM1(R) TM1 re- load buffer (W) Control Logic MUX Reload _CTL.1 _CTL.0 FTM1 T M1 TM1 over- flow TM1 TM1 TM1_CTL.7 _ CTL.6TM1 FTM1/1 FTM1/4 FTM1/16 FTM1/64 FTM1_UV, can be calculated with the equation: FTM1_UV = FTM1 / (TM1+1), where the FTM1 is the timer input frequency set by TKI1 and TKI0. For example: (if FTM1 = 2.000MHz,TKI1=TKI0=0) TM1 Frequency 00H Reserved 01H 1.000MHz 02H 667kHz … … FFH 7.84kHz TKI1 TKI0 Selected TM1 input frequency (FTM1_DIV) 0 0 F TM1 / 1 0 1 F TM1 / 4 1 0 F TM1 / 16 1 1 F TM1 / 64

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 20/27 MG69L220A Datasheet Version 0.04

12 Configurable I/O Ports

12.1 Port 0

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00D2H P0port P07 P06 P05 P04 P03 P02 P01 P00  - Port 0 is combined with 4-bit input port and 4-bit I/O port. P0.7~P0.4 can be programmed as input or output individually. When P0.n (n= 4~7) is configured as an output pin, the P0.n pin would output the logic content of internal P0obuf.n (P0 output buffer). The default value of P0obuf is 0000----b. When the P0.n is configured as output mode, reading P0.n would always read logic ‘0’. When the P0.n is configured as input mode, reading P0.n would always read the logic value from pad. Port 0 Output Buffer Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00D2H P0port P07 P06 P05 P04 - - - - -  This register is used to buffer the output value of P0.7 ~ P0.4 in output mode and it is write-only. ※ Bit-manipulation instructions are not available on this register. Port 0 Direction Register Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00D3H P0dir DR7 DR6 DR5 DR4 - - - - -  P0_DR (Port 0 Direction) P0_DR.n = 0: P0.n is configur ed as an input pin. (Default) 1: P0.n is configured as an output pin. ※ Bit-manipulation instructions are not available on this register. Port 0 Pull-high Control Register Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00D4H P0plh PH7 PH6 PH5 PH4 PH3 PH2 PH1 PH0 -  1: Enable internal pull-high (default); 0: Disable internal pull-high PHn: Control bit is used to enable the pull-high of P0.n pin. ※ Bit-manipulation instructions are not available on this register. Port 0 Open-Drain Control Register Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00D5H P0opd OD7 OD6 OD5 OD4 - - - - -  0: Disable open-drain output (CMOS output); 1: Enable open-drain output ODn: Control bit is used to enable the open-drain of P0.n pin. ※ Bit-manipulation instructions not available on this register.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 21/27 MG69L220A Datasheet Version 0.04

12.2 Port 1

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00D6H P1port - - - P14 P13 P12 P11 P10   Port1 is a 5-bit quasi-bi-directional open drain output with internal pull-high resistors. This register is used to buffer resistors will be temporarily disable if the output value is low. ※ Bit-manipulation instructions are not available on this register. Port 1 Pull-high Control Register Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00D7H P1plh - - - PH4 PH3 PH2 PH1 PH0 -  1: Enable internal pull-high (Default) 0: Disable internal pull-high PHn: Control bit is used to enable the pull-high of P1.n pin. ※ Bit-manipulation instructions are not available on this register.

12.3 Port 2

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00D8H P2port P27 P26 P25 P24 P23 P22 P21 P20 -  Port2 is an open drain output port with internal pull-high resist ors. This register is used to buffer the output value of P2.0 ~ P2.7. The pull-high resistors will be temporarily disable if the output value is low. ※ Bit-manipulation instructions are not available on this register.

12.4 Port 3

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00D9H P3port P37 P36 P35 P34 P33 P32 P31 P30 -  Port3 is open drain output with internal pull-high resistors when segment/OD option select to I/O function. This register is used to buffer out value of P3.0 ~ P3.7. The pull-high resistors will be temporarily disable if the output value is low. ※ Bit-manipulation instructions are not available on this register.

12.5 Port 4

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00DCH P4port P47 P46 P45 P44 P43 P42 P41 P40 -  Port4 is open drain output with internal pull-high resistors when segment/OD option select to I/O function. This register is used to buffer out value of P4.0 ~ P4.7. The pull-high resistors will be temporarily disable if the output value is low. ※ Bit-manipulation instructions are not available on this register.

12.6 Port 5

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00DDH P5port - - - - P53 P52 P51 P50 -  Port5 is open drain output(High Sink Current 16mA) with internal pull-high resistors when COM/OD option select to I/O function. This register is used to buffer out value of P5.0 ~ P5.3. The pull-high resistors will be temporarily disable if the output value is low. ※ Bit-manipulation instructions are not available on this register.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 22/27 MG69L220A Datasheet Version 0.04

12.7 High sink output register

Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 R W 00DAH HSOR HSO - - - - - - PS0 -  HSO pad is a high sink current output pin. The HSO PAD output from HSO or Tone is select by PS0. HSOR.7 Can set up 1/3 or 2/3 duty cycle by using instruction, writer “1”, Through HSOR to PAD output High, until writer “0”, the output status will change to Low ※ Bit-manipulation instructions are not available on this register. PS0 (HSOR.0) can set the HSO pad output source as HSO buffer or tone generator. The HSO output waveform can be programmed to any duty cycle by software. MUX HSO PAD 1Tone HSO bufferTM 0 ( R) TM 0 re- load Control Logic Reload Carrier Generator En TM0 under - flow PS 0 PS 0 HSO PAD output source

1 Tone

TM 0_ CTL .6 TM 0_ CTL .7 HSOR.7 HSOR.0 PS0 If the tone path is selected (PS0=1), the duty cycle of the carrier output is fixed to 50%. . . .TT T = (TM0 + 1) / FOSC The counter underflow frequency of timer0 can be calculated with the equation: FTM0_UV = FTM0 / (TM0reg+1). The FTM0 is Timer0 clock input. For example: FTM0 = 455KHz,TM0reg = 0BH FTM0_UV = FTM0 / (TM0reg+1) = 455K/(0BH+1) = 37.92KHz.

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 23/27 MG69L220A Datasheet Version 0.04

13 Mask Register

Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Fm WDT Bit3: Fm 0 (Fm/2): FCPU clock / 2 1 (Fm): FCPU clock / 1 Bit2: WDT 0 (Disable): Disable watchdog timer function 1 (Enable): Enable watchdog function

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 24/27 MG69L220A Datasheet Version 0.04 MG69 L220A GND VDD X3 2I 32 kHz X3 2O 20pF 20pF P0.0~P0.7 / RESReset Key Key Pad VDD OSCI 10uF+

820 K ohm

@4 MHz @3V 0.1uF 2 ohm VDD HSO High light LED 100 uF P1.0~P1.4 0.1 uF Figure 14-1 Application Circuit - Remote Controller

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 25/27 MG69L220A Datasheet Version 0.04

15.1 Absolute Maximum Rating

Supply Voltage to Ground Potential -0.3 to +5.0 V Applied Input / Output Voltage -0.3 to +5.0 V Power Dissipation 60 mW Ambient Operating Temperature -10 to +50 C Storage Temperature -55 to +150 C Note: Exposure to conditions beyond those listed under Absolute Maximum Ratings may adversely affect the life and reliability of the device.

15.2 DC Characteristics

(VDD-VSS = 3.0 V, FOSC = 4MHz, Ta = 25 C; unless otherwise specified) PARAMETER SYM. CONDITIONS MIN. TYP. MAX. UNIT Op. Voltage V DD - 1.8 - 3.6 V Op. Current 1 I OP Dual mode, No load, LCD on FCPU = 4MHz - 1.8 5.6 mA Halt Current 1 I STB3 Slow mode, HALT, No load, FCPU = 32768Hz, DIVX INT off - 6 8 μA Stop Current I STB1 STOP mode, No load, LCD off - - 1 μA Input High Voltage V IH - 0.7 V DD - V DD V Input Low Voltage V IL - 0 - 0.3 V DD V Port 0 Drive Current I OH1 V OH = 2.4V, VDD = 3.0V 10 - - mA Port 0 Sink Current I OL1 V OL = 0.4V, VDD = 3.0V 16 - - mA HSO Drive Current I OH2 V OH = 2.4V, VDD = 3.0V 10 - - mA HSO Sink Current I OL2 V OL = 1.0V, VDD = 3.0V 250 - - mA P1.0 to P1.4 Sink Current I OL3 V OL = 0.4V, VDD = 3.0V 16 - - mA P2~4 Sink Current I OL4 V OL = 0.4V, VDD = 3.0V 10 mA P5 Sink Current I OL5 V OL = 0.4V, VDD = 3.0V 16 mA P0 Internal Pull-high Resistor R PH1 V IL = 0V 25K 50K 75K  P1~5 Internal Pull-high Resistor R PH2 V IL = 0V 25K 50K 75K  /RES Pull-high Resistor R RES VIL = 0V - 30K -  Low Voltage Detector for uC V LVD0 VDD > 2.1V 2.0 2.1 2.2 V Low Voltage Reset V LVR - 1.7 1.8 1.9 V

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 26/27 MG69L220A Datasheet Version 0.04

15.3 AC Characteristics

PARAMETER SYM. CONDITIONS MIN. TYP. MAX. UNIT Built-in CPU Op. Frequency F CPU RC, V DD = 3.0V 0.5 4 6 MHz Frequency Deviation by Voltage Drop for RC Oscillator f f(3.6V) - f(2.6) f(3.0V) - 3 10  POR Duration T POR F OSC = 4 MHz - 4 1 mS System Start-Up Time T SST Power-up, reset - 16384 - 1/F CPU System Wake-Up Time T SWT Wake-up from STOP mode 256 - 16384 1/F CPU

This document information is the intellectual property of Megawin Technology.  Megawin Technology Co., Ltd. 2011 All right reserved. QP-7300-03D 27/27 MG69L220A Datasheet Version 0.04 Revision Page Descriptions Date V0.01 Datasheet release 2012/02/01 V0.02 Modify halt mode current 2012/03/01