Aim
To install and practise using the Keil µVision IDE and the Nuvoton ISP utility for developing, building and executing 8051 programs.
Learning objectives
Create a µVision project, select the correct device and add source files.
Set the crystal frequency and enable HEX file generation.
Read the Build Output: errors, warnings, program size and HEX creation.
Use the debugger: run, step, breakpoints, registers and ports.
Program the W78E052D APROM through the Nuvoton ISP tool and verify it.
Change a program and see the change on the board.
What this experiment demonstrates
- The full embedded tool chain: source → object → absolute → Intel HEX → flash.
- How the same program behaves in the simulator and on the board.
- Why device selection, crystal and output settings matter.
Sub-tasks
- 5.1 A LED blink (assembly)
- 5.1 B LED blink (Embedded C)
Tool chain
The 8051 / W78E052D
The W78E052D is a Nuvoton 8051-compatible MCU: 8 KB flash (APROM), 256 bytes RAM, 4 × 8-bit ports, 3 timers and a UART. Its LDROM boot code can reprogram the APROM over the serial port (ISP). That is what the Nuvoton utility uses.
Machine cycle
11.0592 MHz is chosen because it divides exactly to standard baud rates (9600, 19200).
Intel HEX format
Keil options to check
| Where | Setting | Why |
|---|---|---|
| Device | Nuvoton ▸ W78E052D | Correct SFRs, memory size, simulator |
| Target | Xtal 11.0592 MHz | Simulator timing and the stopwatch |
| Output | ☑ Create HEX File | The ISP tool needs the .hex file |
| STARTUP.A51 | No for asm, Yes for C | C start-up code |
Apparatus & environment
| Item | Specification | Qty |
|---|---|---|
| PC with Keil µVision | C51/A51 tool chain (evaluation version is fine) | 1 |
| 8051 trainer board | Nuvoton W78E052D, 11.0592 MHz crystal | 1 |
| Nuvoton ISP-ICP utility | APROM programming over USB-UART (CH340) | — |
| USB cable | USB-A to the board's serial/ISP port | 1 |
| Power supply | +5 V regulated (board adapter) | 1 |
Safety rules & good practice
- ⚡ Switch the board off before connecting or removing modules, ribbon cables or jumpers.
- 🔌 Check the supply: +5 V only. Reverse polarity or more than 6 V destroys the controller.
- 🧲 Handle ICs by the edges and touch a grounded surface first (ESD).
- 🔁 Do not drive a port pin connected to a switch with 0 while the switch is pressed to VCC. Read inputs only after writing 1s.
- 🔥 If a component gets hot or smells, switch off immediately and inform the instructor.
Procedure (hardware / real tools)
- Install Keil µVision (C51) and the Nuvoton ISP-ICP utility. Install the CH340 USB-serial driver.
- Project ▸ New µVision Project. Choose a folder without spaces and name it EXP5.
- Select the device Nuvoton ▸ W78E052D. Answer No to "Copy STARTUP.A51" for an assembly project.
- File ▸ New, type the LED program, save it as main.a51, and add it to Source Group 1.
- Options for Target: Xtal = 11.0592 MHz. On the Output tab tick Create HEX File.
- Build (F7). Check "0 Error(s)" and "creating hex file".
- Debug ▸ Start/Stop Debug Session. Open Peripherals ▸ I/O Ports ▸ Port 1, then run and step through the program.
- Open the Nuvoton ISP tool, select the COM port, press Connect and reset the board.
- Load the .hex into APROM, tick Erase, press Start and wait for "Program OK / Verify OK".
- Reset the board, observe the LEDs, then change the delay, rebuild and re-program.
Doing it in this virtual lab
- Follow the Guided workflow at the top of the Simulator tab. Each step is a mock Keil/Nuvoton dialog that gives hints when you choose wrongly.
- At the Build step use the µVision window below the workflow.
- After programming, the board runs your code. Edit the delay or pattern, rebuild, and program again.
- Switch to the C version (5.1 B) and compare the code size and timing.
Pre-Lab Test 6 questions · diagnostic
Check your prerequisite knowledge. Each answer gets instant feedback. Score at least 4/6 before using the simulator.
Observation table
Rows are added by ● Record in the simulator: inputs, the expected (theoretical) value and the simulator result. Type your own hand calculation in "Your value" to check it. Add rows by hand for hardware-bench readings. The table is saved in this browser.
| # | Sub-task | Inputs | Expected | Simulator | Your value | Check | Note |
|---|
Edge cases to test
- Untick "Create HEX File" and build: what is missing in Build Output?
- Choose N76E003 or AT89S52 in the device dialog and read the hint.
- Delete
SJMP MAINin 5.1 A: what happens after the second DELAY? - Switch the core to 1T: how much faster does the LED blink?
- Change the crystal to 12 MHz: compare the period.
- Load the .lst file instead of the .hex in the ISP tool.
Analysis & conclusion
Post-Lab Test 9 questions · instant hints
A wrong answer shows a hint so you can try again. Only first attempts count towards the score.
Self-evaluation
Tick what you can now do confidently.