8051-Based MCU
MG87FE/L04
Data Sheet
Version: A1
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. 2012 All rights reserved.
2014/03 version A1
2
MG87FE/L04 Data Sheet
MEGAWIN
Features
80C51 Central Processing Unit
MG87FE/L04 with 4KB flash ROM
Operating voltage: 4.5V~5.5V for MG87FE04 ; 2.7V ~ 3.6V for MG87FL04.
Operation frequency : Internal RC-oscillator (default 22.118MHz@12T) with +/- 4% frequency drift @ -40 ~
85℃
IAP capability; 2KB IAP memory size
On-chip 256 bytes data RAM for MG87FE/L04
Code protection for flash memory access
Two 16-bit timer/counter
PWM-Timer for PWM generator or normal 8-bit timer, selectable interrupt source
Enhanced UART, provides frame-error detection and hardware address-recognition
15 bits Watch-Dog-Timer with 8-bit pre-scalar, one-time enabled by CPU or power-on
Power control: idle mode and power-down mode, Power-down can be woken-up by INT0 (P3.2), INT2
(P4.3), and other I/O.
I/O port list, P1.5 (P3.5/T1), P1.3 (P4.3/INT2), P1 [1:0] and P3 [2:0].
Built-in analog comparator with selectable interrupt on INT2. AIN0(V+) on P1.0 and AIN1(V-) on P1.1,
output on P3.6(internal port)
Package type: MSOP-10
Order Information:
Items
MG87FE04
MG87FL04
Package Type
MSOP-10
MSOP-10
IC Marking
MG87E04S
MG87L04S
MEGAWIN
MG87FE/L04 Data sheet
3
4
MG87FE/L04 Data Sheet
MEGAWIN
Content
Features ............................................................................................................ 3
Content .............................................................................................................. 5
1. General Description .................................................................................... 7
2. Block Diagram ............................................................................................ 8
3. Pin Configurations....................................................................................... 9
3.1. Package Instruction .............................................................................................................9
3.2. Pin Description (MSOP-10) ...............................................................................................10
4.
8051 CPU Function Description ................................................................ 11
4.1. CPU Register ....................................................................................................................11
4.2. CPU Timing .......................................................................................................................12
4.3. CPU Addressing Mode ......................................................................................................12
5.
6.
7.
Memory Organization................................................................................ 13
5.1. On-Chip Program Flash ....................................................................................................13
5.2. On-Chip Data RAM ...........................................................................................................14
Special Function Register ......................................................................... 15
6.1. SFR Map ...........................................................................................................................15
6.2. SFR Bit Assignment ..........................................................................................................16
Configurable I/O Ports .............................................................................. 17
7.1. IO Structure.......................................................................................................................17
7.1.1. Port 1/3/4 GPIO Structure ...........................................................................................17
7.2. Port1 Register ...................................................................................................................17
7.3. Port3 Register ...................................................................................................................17
7.4. Port4 Register ...................................................................................................................18
7.5. GPIO Sample Code ..........................................................................................................19
8.
9.
Interrupt .................................................................................................... 20
8.1. Interrupt Structure .............................................................................................................20
8.2. Interrupt Register ..............................................................................................................21
Timers/Counters ....................................................................................... 24
9.1. Timer0 and Timer1 ............................................................................................................24
9.1.1. Mode 0 Structure ........................................................................................................24
9.1.2. Mode 1 Structure ........................................................................................................24
9.1.3. Mode 2 Structure ........................................................................................................24
9.1.4. Mode 3 Structure ........................................................................................................25
9.1.5. Timer0/1 Register .......................................................................................................26
9.2. Timer0/1 Sample Code .....................................................................................................27
9.3. PWM-Timer .......................................................................................................................29
9.3.1. PWM-Timer Structure .................................................................................................29
9.3.2. PWM-Timer Register ..................................................................................................30
9.4. PWM Sample Code ...........................................................................................................32
10. UART ........................................................................................................ 33
10.1. UART Structure .................................................................................................................33
10.2. UART Register ..................................................................................................................34
10.1. Serial Port Sample Code ...................................................................................................36
11. Analog Comparator ................................................................................... 37
11.1. Analog Comparator Structure ............................................................................................37
11.2. Analog Comparator Register .............................................................................................37
12. Watch Dog Timer (WDT) .......................................................................... 39
MEGAWIN
MG87FE/L04 Data sheet
5
评论