FSB23203 - Lab 0
FSB23203 - Lab 0
Lab Module 0
FSB 23203 - Microcontroller
Introduction to microcontroller
[1]
PROCEDURES:
1) 8051 Simulator EDSIM
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]
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
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
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]
i.
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.
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]
Lab Module 0
FSB 23203 - Microcontroller
Introduction to microcontroller
[11]