Getting started with Nuvoton W78E052D microcontroller (Tutorial - 1)

INDEX

1. Why to use Nuvoton W78E052D?
2. Downloading the required tools
3. Making the circuit
4. Creating new project in keil 5
5. Type the c program to blink led and generate hex file
6. Upload hex file using Nuvoton's ISP-ICP utility 
7. Video tutorial

1. Why to use Nuvoton W78E052D ?


If you are new to learning microcontrollers, then 8-bit microcontrollers are best to start with. They were popular among electronics engineers in the 80’s and still has not lost it’s place when it comes to designing digital electronics devices. The W78E052D microcontroller by Nuvoton is a reasonably priced 8 bit microcontroller. As the pin diagram is same for all 8051 based microcontrollers, it is a direct replacement for all 8051 based microcontrollers for e.g – P89V51RD2, AT89S51 and AT89S52. The C program can be directly loaded in the chip using free flash software provided by Nuvoton. There is no need of bootloader or linker.

Features of W78E052D:-
  • Four 8-bit bi-directional port (P0, P1, P2, P3)

  • Pin and instruction-sets compatible with MCS-51

  • Wide supply voltage of 2.4 to 5.5V

  • 8 sources 4 level interrupt capability

  • Three 16 bit timer/counters

  • 8KB of flash memory

  • 64KB program memory address space

  • 64KB data memory address space

  • 256 bytes of on chip scratch pad RAM

  • One full duplex serial port

  • watchdog timer

  • Buit-in power management with idle mode and power down mode

  • Code protection


Pin Configuration -
Fig 1 - Pin diagram


2. Downloading the required tools


Step 1 - Download Nuvoton ISP-ICP Utility software -


Fig 2 - Nuvoton's download site


Click on “NuTool ISP-ICP Programmer”. The “Novoton ISP-ICP Utility, v5.02” will be downloaded.


Step 2 - Download keil microvision 5 from the link given below


Fig 3 - Keil download site

Click on C51, Then follow the necessary steps. “Keil microvision 5” will be downloaded.


3. Making the circuit


Step 1- Gather the electronic components.


Components list


Sr no

Component

Quantity

1.

Nuvoton W78E052D DIP , 40 pin

1

2.

Crystal oscillator 16MHz

1

3.

Capacitor 47Pf

2

4.

Capacitor 10uf

1

5.

Resistor 10K

2

6.

Push button switch

1

7.

LED Red 5mm

1

8.

Resistor 470ohm

1

9.

FT232RL USB to TTL module

1

10.

USB cable for TTL

1

11.

5V DC power supply (SMPS)

1


Depending on how you are going to make the circuit. You may need some jumper wires

(male to female) , Breadboard and single core breadboard wires. Purchase accordingly.


Step 2 - Make circuit as per schematic given below:-

Nuvonton W78E052D circuit diagram
Fig 4 - Circuit diagram

Now let’s create new project in Keil IDE.


4. Creating new project in keil 5


Step 1 - Open keil >> Click on Project >> New uVision project


Fig 5 - new project


Step 2 - Give name to project and save.


Fig 6 - save project

Step 3 - Expand “Software packs” >> Select “Nuvoton 8051 Devices”


Fig 7 - Add Nuvoton 8051 devices

Step 4 - Expand “Nuvoton” >> select “W78E052” >> Click on “ok”


Fig 8 - Select W78E052 part no

Step 5 - Click on “yes”.

Fig 9 - Add startup file to project folder


Step 6 - Expand Target >> “Source group 1” >> Add new items

Fig 10 - Add new items to source group


Step 7 - Select “C File” >> give name to c program file >> Click “Add”

Fig 11 - Add C file


Step 8 - Now C file is created, Next >> click on “Target1” >> options for target 1

Fig 12 - Option for Target 1


Step 9 - Click on “Target” >> set frequency to 16Mhz >> Click on “Output” not on “ok”.

Fig 13 - Set crystal frequency to 16MHz


Step 10 - Tick the check box to create Hex file and click on “OK”.

Fig 14 - Create hex file

Now, we are ready, to type our basic C program to blink a led.


5. Type the c program to blink led and generate hex file


Step 1 - Screenshot of the full C program.

Fig 15 - C program to blink led


Step 2 - Click on build >> you should see “ 0 Errors and 0 Warnings” in the Build Output window.


Fig 16 - 0 errors and 0 warnings


The Hex file of the C program is created when you click on build. It’s saved inside the “objects” folder inside the main project folder.


6. Upload hex file using Nuvoton's ISP-ICP utility


Step 1 - Connect the board to the COM port of your PC or laptop.

Step 2 – Open Nuvoton’s ISP ICP utility. Select “ISP by COM Port”. Select the COM Port. It will show up if the USB to TTL module is detected. Then select the proper part no, in our case it’s “W78E(I)052D”. Refer the below given Image.


Fig 17 - Select com port and part no


Step 3 – Click on “Load File” >> Browse to the path where the HEX file is stored >> click on HEX file >> Click on “open”

Fig 18 - load Hex file


Step 4 - Click on “Update Chip”. First it will detect our device then It will display message to reset the board. Reset the board with the push button. Do it quickly before the blue progress bar reaches the end or else upload will fail.

Fig 19 - 8051 detected, blue progress bar


Step 5 - If hex file is uploaded successfully then the pop up will appear as shown in image below. Click on “OK” the board will reset and code will start running.

Fig 20 - "chip successfully updated" pop up 


Once the code initiates. The led will start to blink.


7. Video tutorial





For more info you can download the datasheet

 

If you found this blog useful and want to support me, then you can donate me. The money you give will be used to make more advance electronics projects and setting up better lab.


Comments

  1. I am trying to replicate the setup shown in your blog using the same Nuvoton microcontroller, crystal oscillator, and ceramic capacitors. I’ve followed the connections as closely as possible, but my board is not functioning as expected.

    I repeatedly get the error ' Chip Not Ready ' when attempting to program the microcontroller using a CP2102 USB to TTL module.

    I measured the voltage from the CP2102 module, and it correctly outputs 5V. However, the voltage at the LED connected to P0.1 is only 0.16V to 0.27V (less than 1V), which is insufficient for proper operation. I’ve verified the connections and checked them with a multimeter, but I cannot determine what might be causing this behavior.

    Could you help identify the potential issue and suggest troubleshooting steps?

    ReplyDelete

Post a Comment