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.

Schematic for Tutorial

LED schematic
III. Apparatus Required
- LED (1)
- 330k resistor (1)
- 5V power supply
- Phillips PDS51 "CE" Development System
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
- Create a folder in the C directory called
tutorial
- Type in the following program into any text editor
(i.e. notepad, wordpad, ...) and save to C:\tutorial
Compiling The Program using the C51 Compiler
- Open a Command Prompt and go to the file location, it
should be at C:\tutorial
- Compile the program by typing:
- If the compilation is sucsessful it should say:
- C51 COMPILATION COMPLETE. 0 WARNING(S), 0
ERROR(S)
If there are any warnings or errors, check the code
you typed against the code provided.
- Upon sucsessful compilation, an object file is created.
Link the object file to create an executable by
typing:
- bl51 tutorial.obj to tutorial.omf
If you have multiple object files you can link them with
the following command:
- bl51 tutorial.obj, file1.obj, file2.obj to
tutorial.omf
- Upon sucsessful completion an execuatable, tutorial.omf,
should be created. You will see the following:
- LINK/LOCATE RUN COMPLETE. 0 WARNING(S),
0 ERROR(S)
You are now ready to emulate your program.
Using The PDS51 Emulation Software
- Start the PDS51 software by double-clicking on the icon
- If the software does not recognize the emulator click
on the "Setup" button
- Under the "Communication" tag
- Com Port->Auto
- Baud Rate->Auto
- Under the "Debugging" tag
- Source Origin->Franklin C
- Load your executable
- File->Load Object File
- Select the File Type as "Franklin C"
- Select the output file created in the previous
section
- Begin emulation
- Run->Run
- There is also an icon on the tool bar which
has the same functionality, it is the black
arrow.
- If everything was done correctly, the LED should start
blinking
- To stop the emulation
- Run->Halt
- There is also an icon located on the tool
bar which has the same functionality, it is the
red hexagon.