Megawin 8051 OCD ICE User manual

This document information is the intellectual property of Megawin Technology Co., Ltd. 1
Megawin Technology Co., Ltd. 2014 All right reserved.
MEGAWIN
MAKE YOU WIN
8051 OCD ICE
User Manual, v3.00
Megawin
8051 OCD ICE
User Manual

This document information is the intellectual property of Megawin Technology Co., Ltd. 2
Megawin Technology Co., Ltd. 2014 All right reserved.
MEGAWIN
MAKE YOU WIN
8051 OCD ICE
User Manual, v3.00
Contents
1 Introduction.................................................................................................... 3
Features..........................................................................................................................................3
Description......................................................................................................................................3
2 Hardware Setup............................................................................................. 4
3 Software Setup.............................................................................................. 6
3.1 Install the USB Device Driver for the ICE Adapter...................................................................6
3.2 Install the Megawin 8051 Database in the Keil 8051 IDE Software..........................................6
4 Keil IDE Setup ............................................................................................... 7
4.1 Options- Device.......................................................................................................................8
4.2 Options- Target.......................................................................................................................8
4.3 Options- Output.......................................................................................................................9
4.4 Options- C51...........................................................................................................................9
4.5 Options- Debug.....................................................................................................................10
4.6 Options- Utilities....................................................................................................................11
5 Start Debugging........................................................................................... 12
5.1 Activate the dScope-Debugger Function...............................................................................12
5.2 Introduction to the Debugger Environment ............................................................................13
5.2.1 Reset/Run/Halt/Step/Run-to-Cursor ..............................................................................................14
5.2.2 Source-Level Debugging................................................................................................................14
5.2.3 Breakpoint Setting..........................................................................................................................15
5.2.4 View/Edit the Contents of Peripherals’ SFRs.................................................................................16
5.2.5 View- Disassembly Window...........................................................................................................17
5.2.6 View- Watch Window.....................................................................................................................18
5.2.7 View- Memory Window ..................................................................................................................19
6 Tools, Megawin ICP..................................................................................... 20
6.1 About ICP............................................................................................................................20
6.2 Use ICP...............................................................................................................................20
6.2.1Update Programmer.......................................................................................................................21
6.2.2Update Target ................................................................................................................................26
7 Special Notes............................................................................................... 27
7.1 Register Definition Files.........................................................................................................27
7.2 On-chip XRAM and External Data Memory ...........................................................................27
7.3 Code Optimization and Source-Level Debugging..................................................................28
7.4 “for-Loop” and Source-Level Debugging................................................................................29
7.5 Hardware Option Requirements During Debugging...............................................................29
7.6 Error Message.......................................................................................................................30
7.7 Properly Connect the ICE Adapter to a Host .........................................................................31
Revision History................................................................................................ 32

This document information is the intellectual property of Megawin Technology Co., Ltd. 3
Megawin Technology Co., Ltd. 2014 All right reserved.
MEGAWIN
MAKE YOU WIN
8051 OCD ICE
User Manual, v3.00
1 Introduction
Features
Megawin proprietary OCD (On-Chip-Debug) technology
On-chip & in-system real-time debugging
Two-pin dedicated serial interface for OCD, no target resource occupied
Directly linked to the debugger function of the Keil 8051 IDE Software
USB connection between target and host (PC)
Helpful debug actions: Reset, Run, Stop, Step and Run to Cursor
Programmable breakpoints, up to 4 breakpoints can be inserted simultaneously
Several debug-helpful windows: Register/Disassembly/Watch/Memory Windows
Source-level (Assembly or C-language) debugging capability
Description
The all new “Megawin 8051 OCD ICE”is a powerful development tool for 8051 embedded system. By adopting
the Megawin proprietary OCD (On-Chip-Debug) technology, this ICE provides on-chip and in-system real-time
debugging. The user has no need to prepare any development board during developing, or the socket adapter
used in the traditional ICE probe. All the thing the user needs to do is to reserve a 6-pin connector for the
dedicated OCD interface: VCC, OCD_SDA, OCD_SCL, RST,CLK and GND.
In addition, the most useful feature is that it can directly connect the user’s target system to the Keil 8051 IDE
software for debugging, which directly utilizes the Keil IDE’s dScope-Debugger function. Of course, all the
advantages are based on your using Keil 8051 IDE software.
Note:
“Keil”is the trade mark of “Keil Elektronik GmbH and Keil Software, Inc.”, and “Keil 8051 IDE software”is the
most popular C51 compiler for 8051 embedded system development.

This document information is the intellectual property of Megawin Technology Co., Ltd. 4
Megawin Technology Co., Ltd. 2014 All right reserved.
MEGAWIN
MAKE YOU WIN
8051 OCD ICE
User Manual, v3.00
2 Hardware Setup
For debugging, the user should connect the target system to a PC via the ICE adapter, as shown below. The ICE
adapter is a bus-powered USB device, and therefore there is no need of a power adapter for it.
Hardware Connection Diagram
Note: Refer to Section 6.5 for more information.
OCD ICE Interface Pin Number
Part No.
Package
OCD_SCL
OCD_SDA
RST
CLK
MPC82G516
40-pin DIP
29
30
N/A
N/A
44-pin PLCC
32
33
N/A
N/A
44-pin QFP
26
27
N/A
N/A
MG82FL(E)532/564
44-pin QFP
26
29
4
5
48-pin LQFP
28
32
5
6
MG84FG516
48-pin LQFP
26
27
25
N/A
64-pin LQFP
34
35
33
N/A
MG82FG5A32/5A64
48-pin LQFP
26
27
25
N/A
64-pin LQFP
34
35
33
N/A
MG82FG5Bxx
28-pin SOP
27
28
26
N/A
32-pin LQFP
18
19
17
N/A
MG82FG5Cxx
48-pin LQFP
26
27
25
N/A

This document information is the intellectual property of Megawin Technology Co., Ltd. 5
Megawin Technology Co., Ltd. 2014 All right reserved.
MEGAWIN
MAKE YOU WIN
8051 OCD ICE
User Manual, v3.00
64-pin LQFP
34
35
33
N/A
MG82FG5Dxx
16-pin SOP
15
16
14
N/A
20-pin SSOP
19
20
18
N/A
**N/A : No need to connect

This document information is the intellectual property of Megawin Technology Co., Ltd. 6
Megawin Technology Co., Ltd. 2014 All right reserved.
MEGAWIN
MAKE YOU WIN
8051 OCD ICE
User Manual, v3.00
3 Software Setup
This section tell the user how to do software setup before using the OCD ICE.
3.1 Install the USB Device Driver for the ICE Adapter
The user just needs to plug the ICE adapter into any USB port in a PC. There is no need to install any device
driver for the ICE adapter.
3.2 Install the Megawin 8051 Database in the Keil 8051 IDE Software
Activate the “Setup.exe”in the folder [Database Installer] to open the Database Installer Application Program to
install the Megawin Database into the Keil 8051 IDE software. Of course, you should have installed the Keil 8051
IDE software, either μVision2 or μVision3, in your PC previously.
After opening the Database Installer, please follow the steps shown in the following GUI figure.
Step1) Click the Browse button to specify where the Keil software has been installed.
(Normally, when you install the Keil 8051 IDE software, the default install-path is "C:\KEIL".)
Step2) Click the Install button to start installing the Megawin Database into the Keil software.
GUI of the Database Installer

This document information is the intellectual property of Megawin Technology Co., Ltd. 7
Megawin Technology Co., Ltd. 2014 All right reserved.
MEGAWIN
MAKE YOU WIN
8051 OCD ICE
User Manual, v3.00
4 Keil IDE Setup
Before using the dScope-Debugger function of the Keil IDE, the user should do some proper settings in the Keil
IDE. First, open the μVision project you would like to debug. Then, move cursor to “Target-..”and click the
mouse’s right button to invoke the “Options for Target”, as shown below.

This document information is the intellectual property of Megawin Technology Co., Ltd. 8
Megawin Technology Co., Ltd. 2014 All right reserved.
MEGAWIN
MAKE YOU WIN
8051 OCD ICE
User Manual, v3.00
4.1 Options- Device
Select the “Megawin Device Database”and the target part number.
4.2 Options- Target
Enable the “Use on-chip ROM”and the “Use on-chip XRAM”.

This document information is the intellectual property of Megawin Technology Co., Ltd. 9
Megawin Technology Co., Ltd. 2014 All right reserved.
MEGAWIN
MAKE YOU WIN
8051 OCD ICE
User Manual, v3.00
4.3 Options- Output
Enable the “Debug Information”. It is necessary for creating an absolute OMF file for source-level debugging.
4.4 Options- C51
Disable the code optimization by selecting “Level 0: Constant folding”. Refer to Section 6.3 for more information
about this setting. Note: This setting is optional.

This document information is the intellectual property of Megawin Technology Co., Ltd. 10
Megawin Technology Co., Ltd. 2014 All right reserved.
MEGAWIN
MAKE YOU WIN
8051 OCD ICE
User Manual, v3.00
4.5 Options- Debug
Select the “Megawin On-Chip-Debug Driver”.
And, enable the “Load Application at Startup”and all the Cache Options.
Table of contents
Other Megawin Computer Hardware manuals
Popular Computer Hardware manuals by other brands

EMC2
EMC2 VNX Series Hardware Information Guide

Panasonic
Panasonic DV0PM20105 Operation manual

Mitsubishi Electric
Mitsubishi Electric Q81BD-J61BT11 user manual

Gigabyte
Gigabyte B660M DS3H AX DDR4 user manual

Raidon
Raidon iT2300 Quick installation guide

National Instruments
National Instruments PXI-8186 user manual













