18.4 WDT during Power-Down and Idle.........................................................................................88
18.5 WDT Initialized by Hardware Option......................................................................................88
19 Interrupt System........................................................................................... 89
19.1 Interrupt Sources....................................................................................................................89
19.2 SFRs Associated with Interrupts............................................................................................ 91
19.3 Interrupt Enable......................................................................................................................93
19.4 Interrupt Priority......................................................................................................................93
19.5 How Interrupts are Handled ................................................................................................... 93
19.6 External Interrupts..................................................................................................................94
19.7 Single-Step Operation............................................................................................................94
20 ISP, IAP and ICP.......................................................................................... 95
20.1 Embedded Flash....................................................................................................................96
20.1.1 Flash Features ..............................................................................................................................96
20.1.2 Flash Configuration.......................................................................................................................96
20.2 ISP Operation.........................................................................................................................97
20.2.1 SFRs for ISP .................................................................................................................................97
20.2.2 Introduction to the ISP Modes.......................................................................................................99
20.2.3 How to Implement In-System Programming ...............................................................................102
20.2.4 Notes for ISP...............................................................................................................................104
20.2.5 ISP Tools Provided by Megawin.................................................................................................105
20.3 IAP Operation.......................................................................................................................107
20.3.1 Update the Data in the IAP-memory...........................................................................................107
20.3.2 Demo Code for IAP.....................................................................................................................108
20.3.3 Notes for IAP...............................................................................................................................109
20.4 About ICP.............................................................................................................................110
20.4.1 The “Megawin 8051 ICP Programmer”.......................................................................................110
21 Power Saving Modes ................................................................................. 111
21.1 Idle Mode .............................................................................................................................111
21.2 Power-Down Mode............................................................................................................... 112
21.2.1 Wake-up from Power-Down Mode..............................................................................................112
21.3 Slow-Down Operation .......................................................................................................... 113
22 System Clock ............................................................................................. 114
22.1 Built-in Oscillator ..................................................................................................................114
23 Power Monitoring Function ........................................................................ 115
23.1 Power-on Detection..............................................................................................................115
23.2 Brownout Detection..............................................................................................................116
24 Reset Sources............................................................................................ 117
24.1 Power-On Reset...................................................................................................................117
24.2 Hardware Reset from RST-Pin.............................................................................................117
24.3 Watchdog Timer Reset ........................................................................................................ 117
24.4 Software Reset.....................................................................................................................118
24.5 Brownout Reset from Power Monitor ...................................................................................118
25 MCU’s Hardware Option ............................................................................ 119
26 Instruction Set ............................................................................................ 121
26.1 Arithmetic Operations...........................................................................................................123
26.2 Logic Operations..................................................................................................................124
26.3 Data Transfer .......................................................................................................................125
26.4 Boolean Variable Manipulation ............................................................................................126
26.5 Program and Machine Control .............................................................................................127
27 Application Notes ....................................................................................... 128
27.1 Power Supply for 3.3V, 5V and Wide-Range Systems ........................................................128
27.1.1 Power Supply for a 3.3V System ................................................................................................128
27.1.2 Power Supply for a 5V or Wide-Range System..........................................................................129
27.2 Reset Circuit.........................................................................................................................129
27.3 XTAL Oscillating Circuit ....................................................................................................... 130
3
MPC82G516A Data Sheet
MEGAWIN