You are on page 1of 11

LAB 0

INTRODUCTION TO MICROCONTROLLER SIMULATOR


OBJECTIVES:
1) Expose students to the utilization of two microcontroller simulators which are:
a. 8051 EDSIM Simulator
b. PROTEUS
LAB OUTCOMES:
1) Students will get familiar with how to use EDSIM as simulator for 8051
microcontroller.
2) Students will understand the important of using PROTEUS to design the circuit and
simulate the result.
TOOLS / MATERIALS:
1) Software:
a. 8051 EDSIM;
b. Proteus;
c. MIDE;
d. Silicon Laboratories IDE
DURATION:
2.5 hours

Lab Module 0
FSB 23203 - Microcontroller

Introduction to microcontroller
[1]

PROCEDURES:
1) 8051 Simulator EDSIM

Figure 1 - 8051 EDSIM Simulator

The top left box gives the user access to all the 8051's registers, data memory
and code memory.

In the centre is a textbox where the user either loads an assembly program
(from the local disk) or writes the code directly. Shown above is a program
being single-stepped (execution is currently at location 002CH in code
memory - hence that line is highlighted).

On the right is a list of the 32 port pins and what each one is connected to.
The current value of the port pin is displayed here.

The bottom panel shows all the peripherals that are connected to the 8051.

This simulator allows student to code a program into the microcontroller and
visualize directly the expected result. However, students must be aware of the
EDSIM schematic design (see next page) where all the peripherals are
connected to the fix ports and cannot be modified.

Lab Module 0
FSB 23203 - Microcontroller

Introduction to microcontroller
[2]

EDSIM Schematic Design


Lab Module 0
FSB 23203 - Microcontroller

Introduction to microcontroller
[3]

Exercise:
Use the 8051 simulator to run the assembly code below:
Press Assm (Assemble) and steps to observe the simulator compile step by step.
MOV
MOV
MOV
MOV
MOV
MOV

R0,
A,
DPTR,
16H,
40,
P1,

#5AH
#8
#7CF1H
#11010001B
#0x3F
#11111000B

a. What do you observe?


2) Proteus
Proteus Virtual System Modelling (VSM) combines mixed mode SPICE circuit
simulation, animated components and microprocessor models to facilitate cosimulation of complete microcontroller based designs.
Exercise:
You are required to design a circuit of LED blinking.
a. Open the software ISIS from the folder PROTEUS.

Lab Module 0
FSB 23203 - Microcontroller

Introduction to microcontroller
[4]

b. You need to pick the components that you need for the design by clicking
P

c. You will have another window pop up on your screen.

Lab Module 0
FSB 23203 - Microcontroller

Introduction to microcontroller
[5]

d. You can search for the component you need by typing the name or
reference of the component in the Keywords textbox. For example, we want
to search for the 8051 microcontroller (80C51).

e. Double click on the device that you want to pick or simply select the device
then click on OK. You will then notice that the device is now available on the
device list.

Lab Module 0
FSB 23203 - Microcontroller

Introduction to microcontroller
[6]

f.

Repeat the steps from b to e until you have the following components in you
devices list.

g. Now, before you start to design your own circuit, you need to have at least
this schematic design to start with. (You can find ground and power in the
device list after clicking on
)

Lab Module 0
FSB 23203 - Microcontroller

Introduction to microcontroller
[7]

h. The complete circuit of LED blinking is as the following:

i.

Before start coding, we need to configure the frequency of crystal and


microcontroller IC which should be equal to each other. Lets say we put it at
11.0582 MHz. To configure this, just double click on those components (crystal
and microcontroller IC).

Lab Module 0
FSB 23203 - Microcontroller

Introduction to microcontroller
[8]

j.

Now, lets coding. To do so, we will use the software called MIDE.

k. Click on File > New, we will then have a blank page where we will write the
code for our program.

Lab Module 0
FSB 23203 - Microcontroller

Introduction to microcontroller
[9]

l.

Lets type this program:


ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
START: SETB
CALL
CLR
CALL
SJMP

P1.0
DELAY
P1.0
DELAY
START

DELAY:
DLY1:
DLY0:

MOV
MOV
MOV
DJNZ
DJNZ
DJNZ
RET

R2,
R1,
R0,
R0,
R1,
R2,

#10
#10
#10
$
DLY0
DLY1

END
m. Save the code with the extension .asm (important).
n. Build it by clicking on Build>Build or simply click on the icon
. If there is no
error, a file with the extension .hex will be generated at the same location as
.asm file.

Lab Module 0
FSB 23203 - Microcontroller

Introduction to microcontroller
[10]

o. Go back to ISIS and double click on microcontroller IC.


p. Browse the location of .hex file as the following:

q. Run the program by clicking on the icon


side. You will then see the led blinking.

Lab Module 0
FSB 23203 - Microcontroller

which is at the left-bottom

Introduction to microcontroller
[11]