MPC235E2 MEGAWIN [Megawin Technology Co., Ltd], MPC235E2 Datasheet

no-image

MPC235E2

Manufacturer Part Number
MPC235E2
Description
Low-Speed USB Micro-Controller
Manufacturer
MEGAWIN [Megawin Technology Co., Ltd]
Datasheet
General Description........................................................................................................................................ 3
Features .......................................................................................................................................................... 4
Pin Description ............................................................................................................................................... 5
Block Diagram ............................................................................................................................................... 6
Packages ......................................................................................................................................................... 7
Function Description ...................................................................................................................................... 8
Memory Map.................................................................................................................................................. 9
Special Function Register (SFR) .................................................................................................................. 10
Interrupt Vectors ............................................................................................................................................11
Watchdog Timer (WDT)............................................................................................................................... 13
System Control Registers ............................................................................................................................. 14
FCPU selector............................................................................................................................................... 15
Timer ............................................................................................................................................................ 16
USB .............................................................................................................................................................. 17
I/O Ports ....................................................................................................................................................... 27
Programming Notice .................................................................................................................................... 30
Application Circuit ....................................................................................................................................... 31
This document contains information on a new product under development by Megawin. Megawin reserves the right to change or
discontinue this product without notice.
© Megawin Technology Co., Ltd. 2008 All rights reserved.
Interrupt Registers ................................................................................................................................ 12
Power saving control ............................................................................................................................ 14
Release halt mode enable flag .............................................................................................................. 14
Timer 0 ................................................................................................................................................. 16
USB Block Diagram............................................................................................................................. 17
USB register access control.................................................................................................................. 17
USB SFR Category - Descriptions Summary....................................................................................... 18
USB SFR Description........................................................................................................................... 19
Port 0 .................................................................................................................................................... 27
Port 1 .................................................................................................................................................... 27
Port 2 .................................................................................................................................................... 28
Port 3 .................................................................................................................................................... 28
Port 4 .................................................................................................................................................... 28
DPM control ......................................................................................................................................... 29
Normal:................................................................................................................................................. 31
IRQ enable flag............................................................................................................................. 12
IRQ status flag.............................................................................................................................. 12
IRQ clear flag ............................................................................................................................... 12
DCON: Device Control Register .................................................................................................. 19
FADDR: USB Function Address Register.................................................................................... 19
FPCON: Function Power Control Register .................................................................................. 20
FIE: Function Interrupt Enable Register....................................................................................... 20
FIFLG: Function Interrupt Flag Register...................................................................................... 21
IEN1: USB Interrupt Enable Register .......................................................................................... 21
EPINDEX: Endpoint Index Register ............................................................................................ 22
EPCON: Endpoint Control Register (Endpoint-Indexed)............................................................. 22
RXCNT: Receive FIFO Byte-Count Register (Endpoint-Indexed) .............................................. 23
RXCON: Receive FIFO Control Register (Endpoint-Indexed) .................................................... 23
RXDAT: Receive FIFO Data Register (Endpoint-Indexed) ......................................................... 24
RXSTAT: Endpoint Receive Status Register (Endpoint-Indexed)................................................ 24
TXCNT: Transmit FIFO Byte-Count Register (Endpoint-Indexed) ............................................. 25
TXCON: Transmit FIFO Control Register (Endpoint-Indexed)................................................... 25
TXDAT: Transmit FIFO Data Register (Endpoint-Indexed) ........................................................ 26
TXSTAT: Endpoint Transmit Status Register (Endpoint-Indexed)............................................... 26
Low-Speed USB Micro-Controller
MEGAWIN
2008/12 version A4
MPC235

Related parts for MPC235E2

MPC235E2 Summary of contents

Page 1

General Description........................................................................................................................................ 3 Features .......................................................................................................................................................... 4 Pin Description ............................................................................................................................................... 5 Block Diagram ............................................................................................................................................... 6 Packages ......................................................................................................................................................... 7 Function Description ...................................................................................................................................... 8 Memory Map.................................................................................................................................................. 9 Special Function Register (SFR) .................................................................................................................. 10 Interrupt Vectors ............................................................................................................................................11 Interrupt Registers ................................................................................................................................ 12 IRQ enable flag............................................................................................................................. ...

Page 2

USB keyboard: ..................................................................................................................................... 31 Pad Assignment ............................................................................................................................................ 32 MPC235................................................................................................................................................ 32 Absolute Maximum Rating .......................................................................................................................... 34 DC Characteristics........................................................................................................................................ 35 AC Characteristics........................................................................................................................................ 36 Instruction Set Summary .............................................................................................................................. 37 Addressing Mode Table........................................................................................................................ 37 Instruction Set Table ............................................................................................................................. 38 Instruction Set Summary ...................................................................................................................... 39 ...

Page 3

General Description The MPC235 is a 65C02 MCU with an embedded 8K bytes ROM, a 256 bytes RAM, a watch-dog timer, a USB and PS/2 combo interfaces, can be implemented via the USB bus line, D+ and D- pins, by ...

Page 4

... Provides remote-wake-up/host-resume from suspend mode. - Built- 3.3V regulator for USB. Built-in low-voltage detector (reset) USB and PS/2 combo interfaces Support suspend/normal mode for power management Operating voltage: 4.35V to 5.5V Operating temperature: 0°C to 70°C Packages: - 28-SSOP: MPC235L - 40-PDIP: MPC235E2 4 MPC235 Data Sheet MEGAWIN ...

Page 5

Pin Description PIN Name I/O Description *1 P0.0~0.3 I/O Bi-directional I/O (sink LED directly) P0.4/-INT0 I/O Bi-directional I/O with external interrupt 1 P0.5/-INT1 I/O Bi-directional I/O with external interrupt 2 P0.6~0.7 I/O Bi-directional I/O P1.0~1.7 I/O Bi-directional I/O P2.0~2.7 I/O ...

Page 6

Block Diagram W65C02 8-bits CPU 256 Bytes RAM 8K Bytes ROM 8-bits Timer Power Control Low-voltage Reset Watch Dog Timer 6 DPM Control USB Control Clock Generator Port 0/1/2/4 Configurable I/O Port 3 Configurable I/O Interrupt Control MPC235 Data Sheet ...

Page 7

Packages MEGAWIN MPC235 Data Sheet 7 ...

Page 8

Function Description Registers PCH PCL 1 S 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 ...

Page 9

Memory Map There are 256 bytes SRAM in MPC235. They are working RAM (0000H to 007FH) and stacks (0180H to 01FFH). Locations 0100h to 017FH and the locations 0000h to 007FH share the same memory block. The address 00C0H to ...

Page 10

Special Function Register (SFR) The address 00C0H to 00FFH and 0200H to 027FH are 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. Symbol Address ...

Page 11

Interrupt Vectors Vector Address Item 8002H, 8003H RESET 8006H, 8007H USB 8008H, 8009H TM0 800AH, 800BH P3 800CH, 800DH P04 800EH, 800FH P05 There are six interrupt sources provided in MPC235. The flag IRQ_EN and IRQ_ST are used to control ...

Page 12

Interrupt Registers IRQ enable flag Address Name Bit 7 00C1H IRQ_EN - Program can enable or disable the ability of triggering IRQ through this register. 0: Disable (default “0” at initialization) 1: Enable USB: USB event TM0: Timer0 underflow P3: ...

Page 13

Watchdog Timer (WDT) Address Name Bit 7 00DEH WDT_ST RSTS 00DFH WDT_CLR CLR WDT[3:0] : Contents of WDT RSTS: WDT reset status, set by hardware when WDT overflows, clear by firmware or hardware reset CLR: RSTS clear and WDT reset ...

Page 14

System Control Registers Power saving control Name Bit 7 Address 0 0200H PWR_CTL Write “0” to Bit 7 When the low-voltage detector is enabled, and it senses the power voltage is lower than V chip would be reset automatically. CKC: ...

Page 15

FCPU selector Address Name Bit 7 0201H FCPU_SR - CKS: FCPU clock source select. 0: FOSC/2, 1: FOSC MEGAWIN Bit 6 Bit 5 Bit 4 Bit 3 Bit MPC235 Data Sheet Bit 1 Bit 0 ...

Page 16

Timer Timer 0 Address Name Bit 7 00C5H TM0 T7 00C6H TM0_CTL - STC: Timer clock disable/enable. 0: disable timer clock, 1: enable timer clock RL/S: Auto-reload disable/enable. 0: enable auto-reload, 1: disable auto-reload TKI2 TKI1 TKI0 ...

Page 17

USB USB Block Diagram EP0: Only for Control Transfer EP1、EP2: Only Support Interrupt IN EP3: Support Interrupt IN and Interrupt OUT USB register access control Name Bit 7 Address 00E0H USB_CTL REGC 00E1H USB_ADDR - 00E2H USB_DI UDI7 00E2H USB_DO ...

Page 18

Read sequence: Write the address of USB register to be accessed into USB_ADDR Write 1 into USB_CTL.URD Read data from USB_DO Write 0 into USB_CTL.URD Whenever USB engine finished a transaction, it will generate an interrupt to acknowledge CPU. User ...

Page 19

USB SFR Description DCON: Device Control Register Read/Write Default: 0XXX_0X00 Bit Bit Mnemonic Function Number Reserved Write zero to this bit. Reserved Write zero to this bit. Reserved Write zero to this bit. Reserved: ...

Page 20

FPCON: Function Power Control Register Read/Write Default: XX0X_0X00 Bit Bit Function Number Mnemonic Reserved Write zero to this bit. Reserved Write zero to this bit. Function Remote Wake-up Trigger: 5 FRWU This bit is used by ...

Page 21

FIFLG: Function Interrupt Flag Register Read/Write Default: XXX0_0000 Bit Bit Function Number Mnemonic Reserved Write zero to this bit. Reserved Write zero to this bit. Reserved Write zero to this bit. Function Transmit/Receive Done ...

Page 22

EPINDEX: Endpoint Index Register Read/Write Default: XXXX_XX00 Bit Bit Function Number Mnemonic Reserved Write zero to this bit. Reserved Write zero to this bit. Reserved Write zero to this bit. Reserved Write ...

Page 23

RXCNT: Receive FIFO Byte-Count Register (Endpoint-Indexed) Read Only Default: XXXX_0000 Bit Bit Function Number Mnemonic Reserved Write zero to this bit. Reserved Write zero to this bit. Reserved Write zero to this bit. Reserved: ...

Page 24

RXDAT: Receive FIFO Data Register (Endpoint-Indexed) Read Only Default: XXXX_XXXX Bit Bit Function Number Mnemonic Receive FIFO data specified by EPINDEX is stored and read from this 7:0 RD [7:0] register. RXSTAT: Endpoint Receive Status Register (Endpoint-Indexed) Read/Write Default: 0000_0XXX ...

Page 25

TXCNT: Transmit FIFO Byte-Count Register (Endpoint-Indexed) Write Only Default: XXXX_XXXX Bit Bit Function Number Mnemonic Reserved Write zero to this bit. Reserved Write zero to this bit. Reserved Write zero to this bit. Reserved: ...

Page 26

TXDAT: Transmit FIFO Data Register (Endpoint-Indexed) Write Only Default: XXXX_XXXX Bit Bit Function Number Mnemonic Data to be transmitted in the FIFO specified by EPINDEX is written to this 7:0 TD [7:0] register. TXSTAT: Endpoint Transmit Status Register (Endpoint-Indexed) Read/Write ...

Page 27

I/O Ports Port 0 Address Name Bit 7 00D0H P0_BUF BP07 00D8H P0 P07 0240H P0_CR CP07 0241H P0_MR - Port 8-bit I/O port; each pin can be programmed as input or output individually. P0_BUF: Port 0 ...

Page 28

Port 2 Address Name Bit 7 00D2H P2_BUF BP27 00DAH P2 P27 0248H P2_CR CP27 0249H P2_MR - Port 8-bit I/O port; refer to port 0 for more information. P2_BUF: Port 2 output buffer. When P2.n is ...

Page 29

Input/Output Pin --- P0~P4 P0MR.1 Output Buffer DATA Enable P0CR.x BUS LDA P0BUF Instruction P0MR.0 P0CR.x P0MR.1 DPM control Address Name Bit 7 00E8H DPM_CTL - 00E9H DPMO - 00EAH DPMI - DPM_CTL: C1, C0: D+/D- control selector. 0x: controlled ...

Page 30

Programming Notice The status after different reset condition is listed below: SRAM Data CPU Register Special Function Register *: some SFR are unchanged 30 Power on reset CPU RESB pin reset Unknown Unchanged Unknown Unknown Default value Default value (*) ...

Page 31

Application Circuit Normal: Note: The capacitor between RESB-pin and ground must be below 0.1uF. USB keyboard: MEGAWIN MPC235 Data Sheet 31 ...

Page 32

Pad Assignment MPC235 P04 P05 P40 P41 P06 P07 P10 P11 P12 P13 The substrate should be connected to Vss 32 LOGO MPC235 Data Sheet RESB P37 P36 P35 P34 P33 P32 P31 P30 P27 MEGAWIN ...

Page 33

MPC235 Pad Assignment Pad Name X 1 P00 1177.4 2 P01 1047.4 3 P02 937.4 4 P03 827.4 5 VDD 717.4 6 VDD 607 344 8 V33 -110 -565.4 10 VSS -828.8 11 VSS -938.8 12 ...

Page 34

Absolute Maximum Rating Parameter Ambient temperature under bias Storage temperature Voltage on any Port I/O Pin or RST with respect to Ground Voltage on VCC with respect to Ground Maximum total current through VCC and Ground Maximum output current sunk ...

Page 35

DC Characteristics (VDD-VSS = 5.0 V, FOSC = 6MHz unless otherwise specified) PARAMETER Op. Voltage Op. Current Suspend Current Input High Voltage Input Low Voltage Port drive current Port 0.4~0. ...

Page 36

AC Characteristics PARAMETER SYM. CPU Op. Frequency FCPU POR duration TPOR 36 CONDITIONS MIN. VDD = 5.0V FOSC = 6 MHz MPC235 Data Sheet TYP. MAX. UNIT 0 MHz MEGAWIN ...

Page 37

Instruction Set Summary Addressing Mode Table Address Mode 1 Absolute a 2 Absolute Indexed Indirect (a,x) 3 Absolute Indexed with X a,x 4 Absolute Indexed with Y a,y 5 Absolute Indirect (a) 6 Accumulator A 7 Immediate # 8 Implied ...

Page 38

Instruction Set Table ADC Add memory to accumulator with Carry AND "AND" memory with accumulator Arithmetic Shift one bit Left, memory or ASL accumulator BBR Branch on Bit Reset BBS Branch of Bit Set BCC Branch on Carry Clear (Pc=0) ...

Page 39

Instruction Set Summary MEGAWIN MPC235 Data Sheet 39 ...

Page 40

A: Accumulator X: Index Register X Y: Index Register Y zp: Address8 or zero page a: Adress16 s: Stack r: Relative i : Implied 40 MPC235 Data Sheet MEGAWIN ...

Page 41

Symbol Description ACC: Accumulator (ACC): Contents of Accumulator ACC.n: Accumulator bit n X: Index Register X Y: Index Register Y SP: Stack Pointer Register PC: Program Counter #data: Constant parameter C: Carry Flag Z: Zero Flag I: Interrupt Disable Status ...

Page 42

Arithmetic Operations Mnemonic Operand(s) (ACC) ← (ACC) + #data + (C) ADC #data (ACC) ← (ACC) + (addr8) + (C) addr8 (ACC) ← (ACC) + [(addr8)] + (C) (addr8) (ACC) ← (ACC) + [addr8 + (X)] + (C) addr8, X ...

Page 43

X (X) ← (X) – 1 DEX (Y) ← (Y) – 1 DEY CMP #data (ACC) – #data addr8 (ACC) – (addr8) (addr8) (ACC) ...

Page 44

Logic Operations Mnemonic Operand(s) (ACC) ← (ACC) ∩ #data AND #data (ACC) ← (ACC) ∩ (addr8) addr8 (ACC) ← (ACC) ∩ [(addr8)] (addr8) (ACC) ← (ACC) ∩ [addr8 + (X)] addr8, X (ACC) ← (ACC) ∩ {[addr8 + (X) →16]} ...

Page 45

X [addr16 + (X).(n+1)], (C) ← [addr16 + (X).0] (C) ← (ACC.7), (ACC.(n+1) ) ← (ACC. n), ASL A (ACC.0) ← 0 (C) ← (addr8.7), ...

Page 46

Data Transfer Mnemonic Operand(s) (ACC) ← #data LDA #data (ACC) ← (addr8) addr8 (ACC) ← [(addr8)] (addr8) (ACC) ← [addr8 + (X)] addr8, X (ACC) ← {[addr8 + (X) →16]} (addr8, X) (ACC) ← [(addr8→16) + (Y)] (addr8), Y (ACC) ...

Page 47

TSX (SP) ← (X) TXS [(SP)] ← (ACC), (SP) ← (SP) – 1 PHA [(SP)] ← (P), (SP) ← (SP) – 1 PHP [(SP)] ← (X), (SP) ← (SP) – 1 PHX [(SP)] ← (Y), (SP) ← ...

Page 48

Program and Machine Control Mnemonic Operand(s) Operation description (PC) ← label; the label may be address or JMP addr16 variable. (PC) ← (label) (addr16) (PC) ← {[label + (X) →16]} (addr16, X) (PC) ← (PC)+addr8 BRA addr8 (PC) ← (PC)+addr8 ...

Page 49

Package Dimensions 40-pin DIP 28-SSOP MEGAWIN MPC235 Data Sheet 49 ...

Page 50

Revision History Version Date 0.1 2003/9 1.0 2004/8 1.1 2005/1 A2 2005/7 19~34 A3 2008/6 A4 2008/12 50 Page Description Initial document 1,44 Revised the operating voltage from 4.35V to 5.5V 41 Application circuit has been modified. Revised USB SFR ...

Related keywords