Megawin MLink OCD8 User manual

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page1/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
OCD8_MLink
User Manual

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page2/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
Index
1. Introduction ............................................................................................................3
2. Install and Uninstall ................................................................................................4
3. Setting.....................................................................................................................5
4. Start Debug .............................................................................................................7
5. ICP8 Programmer....................................................................................................8
5.1. On-Line Mode Update.................................................................................................... 8
5.2. Off-Line Mode Update.................................................................................................. 10
5.3. Other............................................................................................................................. 11
6. Revision History ....................................................................................................12

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page3/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
1. Introduction
OCD8_MLink is an ICE development kit used by megawin in Keil C IDE. It supports
8bit chips of the megawin 8051 series; this kit provides OCD (On-Chip-Debug)
real-time debugging function. Users only need to reserve 6 pins for megawin.
OCD-ICE development tool (MLink) is fine.
In addition, the megawin ICP8_Programmer software is also provided in the package,
which can perform program code, program hardware option and offline mode
functions through MLink.
megawin OCD-ICE development tool (MLink)
Users only need to reserve 6 pins such as CLK, SCL/SWCLK, VCC, SDA/SWDIO, GND
and RST to connect to MLink.
PS. The VCC pin of MLink does not provide power to the user's system board, the
user needs to provide the power by himself!

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page4/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
2. Install and Uninstall
Execute "Setup.exe" in the package directory, and then press "Browse" to find the
directory of Keil C IDE (c:\Keil_v3 in the example in the figure, and then press "Install"
to install.
If the Keil C IDE directory has a package installed, you can click "Uninstall" to uninstall
it.

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page5/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
3. Setting
After the installation is complete, open the Keil C IDE project and enter the project
options (Options for Target…)
Step 1. Set Device
On the Device page, select the Database as "megawin MLink Device Database", and
then you can see the megawin chip part-no supported by OCD8 MLink below; select
the part-no to be debugged.
PS. Due to the Keil IDE problem, when selecting the chip model, the parameters may
not be brought out; it is recommended to select another chip model when selecting
the chip model, and then select the model to be debugged; and check the "Dialog
DLL" below in the next Step 2. "Whether it is "OCD8_MLink.DLL"!

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page6/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
Step 2. Set Debug
On the Debug page, select Use as "megawin MLink", and then tick the two options
"Load Application at Startup" and "Run to main()" below.
PS. Check if the "Dialog DLL" below is "OCD8_MLink.DLL"!

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page7/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
4. Start Debug
Press "Start/Stop Debug Session" to enter the debugging screen.
Registers can see the register value of the current chip.
Memory displays data according to the address settings, as follows:
C: Flash Data
I: iData
X: xData
S: EEPROM (if supported by this part-no)
For other settings and operations, please refer to the instructions of Keil C IDE

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page8/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
5. ICP8 Programmer
You can execute "ICP8_Programmer.exe" directly from the package directory, or by
Tools\megawin MLink ICP8 in Keil C IDE.
5.1. On-Line Mode Update
Step 1. Select Part No
Select a MCU Part No to be updated. If it is found to be incorrect, ID fail will be raised.
After selecting a different Part No, the Code Buffer will be cleared automatically.

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page9/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
Step 2. Load File
Load Bin or Hex file to buffer, after clicking “OK”, users need to choose whether to
place it in the AP area (read into the buffer at 0x00) or IAP (users can define any
location to read into the buffer). Clicking “OK” to see update results in Code Buffer.
Users can Load File repeatedly and overlay files on each other. If users execute Load
File repeatedly, the overlapping file will be overwritten by the last file read. If there is
a blank between the read position of the previous and last files, 0xFF will be filled in.
Check “Clear Buffer” in the “Select Insert Area” dialog. After clicking “OK”, all the
Code Buffer will be cleared and then read into the File.
Step 3. Insert ISP-code
If users need to use ISP function, please click “Insert ISP-code” to insert megawin's
standard ISP code, or choose their own developed ISP code. After clicking “OK”, the
AP will automatically place the ISP code in the address corresponding to the Code
Buffer and set the necessary H/W Options setting concurrently.
Step 4. H/W Options
Customers can set OR setting by themselves. For the description of the setting value,
please refer to the “Datasheet”.
Step 5. Update
Click "Update" to execute programming. Before programming, "Whole Chip Erase"
will be executed, including the hardware options before programming, and then the
code and hardware options set this time will be program.

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page10/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
5.2. Off-Line Mode Update
Step 1. Select Part No
Step 2. Load File
Step 3. Insert ISP-code
Step 4. H/W Options
Step 5. Off-Line Mode
Click “Off-Line Mode”to download setting (flash & H/W options setting) to MLink.
Furthermore, users can also set Max Counter and Serial Number. Max Counter can
control the number of times that MLink can perform off-line programming. Its
default value is 0 (meaning unlimited). After Serial Number Enable, 12 strings and 8
numbers can be set and be placed in any position of the Code Buffer. The Serial
Number function can even be implemented by Auto Increment Number.
Click “Read Info” to read the current Off-Line setting in MLink.

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page11/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
5.3. Other
Save MPJ
Click “Save MPJ”can save MPJ file. The MPJ file records the contents of the Code
Buffer and the current setting of the H/W Option. Users can read the MPJ file
through “Load File” and read back all settings.
Language
Click Logo in the upper left corner of the UI to select the language from “Language.”
Check new AP
By clicking Logo in the upper left corner of the UI, users can open the interface from
“Update ICP8 Programmer”Or they may click “Check” to check if there is a new
version on the official website. If there is a new version, users can directly click
“Download” to download.
Check “Show update message when start”, users can set to automatically detect if
there is a new version when the AP start on.

OCD8_MLink
User Manual v1.2.0.1
This document information is the intellectual property of Megawin Technology Co., Ltd page12/12
© Megawin Technology Co., Ltd. 2020 All rights reserved
6. Revision History
Revision
Description
Date
v1.0.0.7
Initial version
2021/04/16
v1.0.0.11
Support 5D16/5E32/6D16/6D17/6D32/6D64
2021/06/18
v1.1.0.0
Support 82G516/82FL(E)532/82FL(E)564/5A32/5A64/
84FG516/5B08/5B16/5B24/5B32/5C32/5C64
2022/01/11
v1.1.0.1
Update 5Cxx/5Dxx/5Exx/6D16 Header Files
2022/04/06
v1.2.0.0
Support MG82F5Bxx
Support MG82F6B08/001/104
2022/05/30
v1.2.0.1
Update MG82F6B08/001/104 ISP code
Update MLink FW v0.19
2022/06/22
Table of contents