Tutorial: Using the C51 compiler and the PDS51 Emulation Software
I. Introduction
The goal of this tutorial is to blink an LED using the 8051. Steps are given on how to compile the program using the c51 compiler and emulate the program using the PDS51 emulation software.
II. Schematic
Wire the circuit as shown by the schematic below. It may be
useful to used the 8051
pinout. Make sure the LED is connected correctly or it will
not blink when you run your program. Below is another schematic
which shows how the LED corresponds to it's symbol.
III. Apparatus Required
IV. Program
/* main.c */
#pragma SMALL DB OE
#include <reg51.h>
sbit light = P2^0;
/* Delay Function */
void delay(void){
int i, j;
for(i=0; i<1000; i++){
for(j=0; j<100; j++){
i=i+0;
}
}
}
void main(void){
while(1){
light=0; /* turns light on */
delay(); /* without the delay function the light
would blink to quickly for us to see */
light=1; /* turns light off */
delay();
}
}
V. Procedure
Creating The Program File
Compiling The Program using the C51 Compiler
Using The PDS51 Emulation Software
If there are any warnings or errors, check the code
you typed against the code provided.
If you have multiple object files you can link them with
the following command:
You are now ready to emulate your program.