1. Date. ………………………
Name: …………………………………………………
Roll No. …………………………….
EXPERIMENT
Burn a Code on a Micro-controller
Objective
1. To burn a code on Atmel AT89C51 using G540 burner.
2. To interface LED with 8051 micro-controller
Equipment
1.
2.
3.
4.
5.
6.
7.
G540 Burner.
11.059 Mhz Crystal.
AT89C51 Mirco-controller
10µF Capacitor.
10k ohm, 330 ohm resistors
LED of any color.
DC Power Supply
Using G540 Burner
Connect G540 Burner with a computer using appropriate cable (USB/Serial) and install
the software. It is recommended to use Windows XP (32-bit) or a 32-bit based Windows
NT OS.
After the installation of the software connect the G540 to your computer and run the
installed software.
MURAD HABIB
2.
A software window should appear like this:
Click on select on the top toolbar and select Atmel AT89C51 as shown below:
After Selection click on Load on the toolbar and locate the HEX file containing your code
generated using Keil or appropriate software. After selection a file information window
will be displayed like this:
MURAD HABIB
3.
This gives you the option on how to fill the blank space on the controller, the offset
address, loading mode and file information.
After clicking OK click on Prog on the toolbar to begin the code burning sequence. The
code will burn in the following sequence:
-Erase
-Blank
-Program
-Verify
-Encrypt
When this sequence is completed your code is successfully burned on the
Microcontroller and is ready to be placed in the circuit.
Interface LED with AT89C51:
AT89C51 is a 40 pin microcontroller which belongs to 8051 series of microcontroller. It has four
ports each of 8 bits P0, P1, P2 and P3.The AT89C51 has 4K bytes of programmable flash. The
port P0 covers the pin 32 to pin 39, the port P1 covers the pin 1 to pin 8, the port P2 covers the
pin 21 to pin 28 and the port P3 covers the pin 10 to pin 17. Pin 9 is the reset pin. The reset is
active high. Whenever the controller is given supply, the reset pin must be given a high signal to
MURAD HABIB
4. reset the controller and bring the program counter to the starting address 0x0000. The
controller can be reset by manually connecting a switch or by connecting a combination of
resistor and capacitor as shown in the circuit diagram. A 11.059 MHz crystal is connected
between pin 18 pin 19. Pin 40 is Vcc and pin 20 is ground. Pin 31, is connected to Vcc as we are
using the internal memory of the controller (see Datasheet for details). LEDs are connected to
the port P0. LEDs need approximately 10mA current to flow through them in order to glow at
maximum intensity. However the output of the controller is not sufficient enough to drive
the LEDs, so LEDs are connected in the reverse order and they run on negative logic i.e.,
whenever 1 is given on any pin of the port, the LED will switch off and when logic 0 is provided
the LED will glow at full intensity. As soon as we provide supply to the controller, the LEDs start
blinking i.e., they become on for a certain time duration and then become off for the same time
duration. This delay is provided by calling the delay function. The values inside the delay
function have been set to provide a delay in multiples of millisecond (delay (100) will provide a
delay of 100 millisecond).
Build the circuit on Proteus and write the code on Keil. Also generate a HEX file using
keil.
Verify your circuit and code on software and then burn the HEX file on AT89C51 using
G540 burner as already explained.
Implement the circuit on Breadboard and show it to your Instructor.
Code:
#include <reg51.h>
//include directives for 8051 microcontroller
void delay(int time){
//Produces delay in msec
int a,b;
for (a=0;a<time;a++){
for (b=0;b<1275;b++){}
//1275 is due to 11.059 MHz crystal
}
}
void main(){
while(1){
//infinite loop
P0=0x00;
//P0 will have a 0 logic means 0 volt. LED will glow
delay(100);
//100msec delay
MURAD HABIB
5. P0=0xFF;
//P0 will have a 1 logic means 5 volt. LED will be off
delay(100);
//100msec delay
}
}
Circuit Diagram:
MURAD HABIB