Kit - First Microcontroller Project - 8051
Making an LED Blink
Step 1.) The first step is to
build the circuit. At this point you should be
familiar with the parts used (2 resistors, 3
capacitors, 1 LED). You can either put these parts
together using a breadboard or wirewrap. This design
is intended for use with an Atmel 89C51. Most
microcontrollers (such as a normal 8051 or 8751) can
not handle the current required to turn an LED on
and off but the ATMEL part has this capability.
Vcc = 5V and Gnd
only thing we want to do with this project is to
make the LED blink. By doing this, you will be able
to learn the basic process of compiling a program
written in assembly language and then programming
the resulting file into the microcontroller. If you
would prefer to work in C then click here.
First we will assume we already have the assembly
code written. ledtest.asm is the assembly language
program we are going to use. (This file is included
with TASM )
Step 2.) Compiling the Code
Move the assembly language program (ledtest.asm) to
the directory where you have TASM. Bring up a DOS
prompt, change to the directory where the TASM files
are, and compile the code using the command
tasm -51 ledtest.asm ledtest.hex
This will create a file called ledtest.hex.
Close the DOS prompt window now.
Step 3.) Downloading the code to the
Make sure the serial cable and the power supply are
connected to the PG302 programmer.
Put your microcontroller into the PG302 programmer.
From the Setup Menu, select the type of device
(microcontroller) you are using
From the Setup Menu, select the Comm port you are
Press PROGRAM DEVICE.
Find ledtest.hex and click on it (single click).
Press OK to select the file.
Press OK to program the file into the
Now the program should be loaded into the
Make sure the power is off for the circuit you have
Move the microcontroller back to the circuit you
Turn on the power to the circuit. If the LED starts
blinking, then you have succesfully built your first