You are on page 1of 23

LIST OF PRACTICALS

EC311-MICROCONTROLLER BASED SYSTEM


Semester-V-OPS

S. Practical Lab Equipment required performing Lab


No Hou Experiments .
rs
1 To learn, how to use ‘tools of the 0 Personal Computer, windows operating system
trade’ introduction to program 2 KEIL “Microvision2” software package, MDE-
creation, debugging and simulation 8051 Trainer Board, Oscilloscope, DMV, Various
discrete components
2 To learn logic circuit implementation 0 Personal Computer, windows operating system
through microcontroller bit operations 2 KEIL “Microvision2” software package, MDE
8051 Trainer Board, Oscilloscope, DMV, Various
discrete components
3 To learn parallel data acquisition 0 Personal Computer, windows operating system
and processing through 2 KEIL “Microvision2” software package, MDE
microcontroller port structure 8051 Trainer Board, Oscilloscope, DMV, Various
discrete components
4 To design Firmware, that can be controlled
0 Personal Computer, windows operating system
through hardware 2 KEIL “Microvision2” software package, MDE
8051 Trainer Board, Oscilloscope, DMV, Various
discrete components
5 To learn, how to generate pulses by 0 Personal Computer, windows operating system
using delay loop techniques. 4 KEIL “Microvision2” software package, MDE
8051 Trainer Board, Oscilloscope, DMV, Various
discrete components
6 To learn lookup table technique in data 0 Personal Computer, windows operating system
processing 4 KEIL “Microvision2” software package, MDE
8051 Trainer Board, Oscilloscope, DMV, Various
discrete components
7 To Learn, how to use timers of 8051 0 Personal Computer, windows operating system
and simulation of results on an 4 KEIL “Microvision2” software package, MDE
oscilloscope 8051 Trainer Board, Oscilloscope, DMV, Various
discrete components
8 To learn, how to use Serial 0 Personal Computer, windows operating system
communication channel to transmit 4 KEIL “Microvision2” software package, MDE
data 8051 Trainer Board, Oscilloscope, DMV,
Oscilloscope, DMV, Various discrete components
9 To learn, how to activate and utilize 0 Personal Computer, windows operating system
interrupts technique. 2 KEIL “Microvision2” software package, MDE
8051 Trainer Board, Various discrete components
10 To learn, how to interface ADC (analog 0 Personal Computer, windows operating system
to digital converter chip) with Microcontroller
4 KEIL “Microvision2” software package, MDE
Intel 8051 8051 Trainer Board, Various discrete components
11 Mini Project 0 Personal Computer, windows operating system
8 KEIL “Microvision2” software package, MDE
8051 Trainer Board, Soldering station,
Oscilloscope, DMV, Data analyzer, Microcontroller
Programmer and Various discrete components,

2
CONTENTS

1 LAB-1
To learn, how to use ‘tools of the trade’ introduction to program creation, debugging
and simulation
4
2 LAB-2
To learn logic circuit implementation through microcontroller bit operations
5
3 LAB-3
To learn parallel data acquisition and processing through microcontroller port
structure.
6
4 LAB-4
To design Firmware, that can be controlled through hardware
7
5 LAB-5
To learn, how to generate pulses by using delay loop techniques.
8
6 LAB-6
To learn lookup table technique in data processing
9
7 LAB-7
To Learn, how to use timers of 8051and simulation of results on an oscilloscope
10
8 LAB-8
To learn, how to use Serial communication channel to transmit data
11
9 LAB-9
To learn, how to activate and utilize interrupts technique.

12

10 LAB-10

3
To learn, how to interface ADC (analog to digital converter chip) with
Microcontroller Intel 8051
13
Appendix

A Final Mini Project


14
B Procedure to create Assembly language program using KEIL MicroVision2
18
C Procedure to download program ‘hex’ file onto microcontroller by using Windows
Hyperlink facility
19
D Lab Procedures
21

4
Lab#1
Objectives: To learn, how to use ‘tools of the trade’ introduction to program
creation, debugging and simulation

NUST, PNEC
EC311

Task:
Install KEIL software “MicroVision2 “in your computer. Use Hello.c program from
‘Example folder’ to perform simulation and debugging.

Build a new project: Modify Hello.c source code file by adding three new source code
lines. Build, simulate and debug this new project.

Submit your report with program list file.

Pre-Lab Report should include the following


 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram

Material to be studied for pre lab report:

 KEIL “MicroVision2” User guide


 Appendix “A” of ‘EC-311’ Lab Manual

Post lab report should include the following:

 Source code file


 Program list file with comments
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets

Name P/G # Late Entry Tools Pre Lab- R Assessment Post Lab-R TOTAL

5
Lab#2
Objective: To learn logic circuit implementation through
microcontroller bit operations.
NUST, PNEC
EC311

Task:

Write a short program in assembly language for MCS-51, that implements the following circuit.
P1.0
P1.1 P2.7

P1.2
Reads the status of bit P0.1, P1.1, and bit P1.2 then perform logic AND operation, the result
should appear on pin P2.7. Display this result on an LED.

Simulate your firmware by using KEIL simulation utility on the PC, then down load the ‘hex’
file into the microcontroller located on the experiment board to display the data on an LED, also
test the output wave shape and frequency that is appearing on Microcontroller pin P2.7 by using
an oscilloscope.

Pre-Lab Report should include the following


 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram

Material to be studied for pre lab report:


 KEIL “MicroVision2” User guide
 Appendix “B” of ‘EC-311’ Lab Manual
 Appendix “C” of ‘EC-311’ Lab Manual
 Article 1.11 (Mackenzie)

Post lab report should include the following:


 Source code file
 Program list file with comments
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets
Name P/G # Late Entry Tools Pre Lab- R Assessment Post Lab-R TOTAL

6
Lab#3
Objectives: To learn parallel data acquisition and processing
through microcontroller port structure.

NUST, PNEC
EC311

Task:

Write a short program in assembly language for MCS-51, that reads the status of port-1
that is attached to a switch panel to change logic levels, perform the logic AND function
between lower nibble and higher nibble of the data byte and send the result to port -0 that
is attached to a set of LED’s/solenoids.

Use the experiment board to simulate your firmware and verify the results.

Pre-Lab Report should include the following


 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram

Material to be studied for pre lab report:

 Assembly language manual ‘A251’


 Chapter #2 Mackenzie

Post lab report should include the following:

 Source code file


 Program list file with comments
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets

Name P/G # Late Entry Tools Pre Lab- R Assessment Post Lab-R TOTAL

7
Lab#4
Objective: To design Firmware, that can be controlled through
hardware

NUST, PNEC
EC311

Task:

Write a short program in assembly language for MCS-51, that rotate a set of LED’s in a
positive or negative direction depend on the switch input, that it receives on pin #7 of
port-3.

Built and test your firmware in the lab.

Pre-Lab Report should include the following


 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram

Material to be studied for pre lab report:

 KEIL “MicroVision2” User guide


 Appendix “B” of ‘EC-311’ Lab Manual
 Appendix “C” of ‘EC-311’ Lab Manual
 Instruction set (Mackenzie)

Post lab report should include the following:

 Source code file


 Program list file with comments
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets

Name P/G # Late Entry Tools Pre Lab- R Assessment Post Lab-R TOTAL

8
LAB#5
Objective: To learn, how to generate pulses by using delay loop
techniques.
NUST, PNEC
EC311

Task:
Part-1
Write and load a short program on Intel8051 to generate continues pulses of
a) Five micro second duration
b) Five-millisecond duration
Create pulse On/Off time by using delay loop.

Part-II
By using Oscilloscope study and compare the following pulses/frequencies on the screen by
using 2/4-channel scope off Intel8051 control bus
a) Crystal clock
b) Read/Write pluses
c) ALE Clock
o Capture these images and show them to Lab demonstrator
o Add these images to your lab report

Pre-Lab Report should include the following


 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram
Material to be studied for pre lab report:
 Assembly language manual ‘A251’
 Chapter # 1 Mackenzie
 Ref book: Mazidi

Post lab report should include the following:


 Source code file
 Program list file with comments
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets

9
Name P/G # Late Entry Tools Pre Lab- R Assessment Post Lab-R TOTAL

LAB#6
Objective: To learn lookup table technique in data processing

NUST, PNEC
EC311

Task:

Develop Intel 8051 firmware that converts a four bit binary number into a hex digit by
using a lookup table technique; show the result on a seven-segment display.

Simulate your program on an experiment board and test the output.

Pre-Lab Report should include the following


 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram

Material to be studied for pre lab report:

 Assembly language manual ‘A251’


 Article # 3.3.3.3 Mack
 Ref book: Mazidi

Post lab report should include the following:

 Source code file


 Program list file with comments
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets

Name P/G # Late Entry Tools Pre Lab- R Assessment Post Lab-R TOTAL

10
Lab#7
Objectives: To Learn, how to use timers of 8051and simulation of
results on an oscilloscope.
NUST, PNEC
EC311
Task:
Part-I
Write and load a short program on Intel8051 using timer-0 in mode-1 to generate square
wave of 5 KHz frequency on pin #P1g.1. examine the frequency by using Oscilloscope; if
it is required adjust the counter value to generate the exact frequency. Discuss this
process and reasons in your report.
Part-II

Write and load a short program on Intel8051 using timer-1 in mode-2 to generate square
wave of 10 KHz frequency on pin #P2.1. Examine the frequency by using Oscilloscope;
If it is required adjust the counter value to generate the exact frequency. Discuss this
process and reasons (why you had to modify the counter value) in the lab report.

Pre-Lab Report should include the following


 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram

Material to be studied for pre lab report:


 Assembly language manual ‘A251’
 Chapter # 4 Mackenzie
 Ref book: Mazidi

Post lab report should include the following:


 Source code file
 Program list file with comments
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets

Name P/G # Late Entry Tools Pre Lab- R Assessment Post Lab-R TOTAL

11
Lab#8
Objective: To learn, how to use Serial communication channel to
transmit data

NUST, PNEC
EC311

Task:

Write and load a short program on Intel8051 that transmit your name through its serial
port.

Transmit each character of your name after every two-second. Use 8N1 format to
transmit your data on asynchronous full duplex line, also develop a technique to display
this data on a video or LCD screen.

At the end of the Lab period show your work progress to the Lab demonstrator for
assessment.

Pre-Lab Report should include the following


 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram

Material to be studied for pre lab report:

 Assembly language manual ‘A251’


 Chapter #5 Mackenzie
 Ref book: Mazidi

Post lab report should include the following:

 Source code file


 Program list file with comments
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets

12
Name P/G # Late Entry Tools Pre Lab- R Assessment Post Lab-R TOTAL

LAB#9
Objectives: To learn, how to activate and utilize interrupts
technique.

NUST, PNEC
EC311

Task:

Develop a firmware to generate 10 KHz and 25 KHz square waves with 50% duty cycle
simultaneously by using timer interrupts

Simulate the generated waveforms on an oscilloscope by utilizing both channels.

Pre-Lab Report should include the following


 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram

Material to be studied for pre lab report:

 Assembly language manual ‘A251’


 Chapter #6 Mackenzie
 Ref book: Mazidi
Post lab report should include the following:

 Source code file


 Program list file with comments
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets

Name P/G # Late Entry Tools Pre Lab- R Assessment Post Lab-R TOTAL

13
LAB#10
Objective: To learn, how to interface ADC (analog to digital
converter chip) with Microcontroller Intel 8051

NUST, PNEC
EC311

Task:

Develop firmware to interface National Semiconductor ADC804 with Intel-8051, that


reads an analog value and display it in digital form by using LED’s or LCD devices.

Simulate your program on an experiment board and test the circuit.

Pre-Lab Report should include the following


 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram

Material to be studied for pre lab report:

 Assembly language manual ‘A251’


 Ref book: Chapter # 12 /Mazidi
 National semiconductor data sheet-ADC0804

Post lab report should include the following:

 Source code file


 Program list file with comments
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets

Name P/G # Late Entry Tools Pre Lab- R Assessment Post Lab-R TOTAL

14
Appendix-A

15
Final Mini Project
NUST, PNEC- Karachi
EC-311-LAB

Group Project: (60 marks will be distributed as explained below)

Design a micro controller based system that includes software, circuit design schematics,
and fabrication.
The project should incorporate at least following blocks.

A micro controller 8051


A stepper motor
A motor speed controller device/circuit

Project description:

Design a micro controller 8051 based system to drive a stepper motor, this will require to
design hardware interface circuitry and software program. A rotary switch with
interfacing circuitry may be installed as input to micro controller to control the motor
speed. Test your firmware repeatedly.

Use your knowledge and learning from the classroom to enhance this project to earn extra
marks by including additional features.

Basic Marks 30
To earn minimum thirty marks, this project should be operational in its basic form and
be submitted with schematics, drawings, material list, cost analysis, source codes, and
software list file.

Additional marks 30
To earn extra marks; one must need to add additional features in the basic design.

Each additional feature is worth of 10 marks, these 10 marks will be divided evenly to all
those projects that will have the similar feature submitted by your fellow class meats, up
to maximum of thirty marks (the final out come will be counted as feature not the way
how it accomplished)

None operational projects: None operational project submitted with all other required
items would earn only 15 marks.

16
Additional features:
1. Motor directions
2. Keypad instead of rotary switch
3. 7-segment display device to show speed
4. 7-segment display device to show speed, time
5. 7-segment display device to show speed, time, temperature
6. LCD speed display device to show speed
7. LCD speed display device to show speed, time
8. LCD speed display device to show speed, time, temperature
9. Speed limits indicators
10. Motor protection (auto shut down)
11. Alarmed that motor speed is in dangerous zoon
12. Control speed by feed back (encoder)
13. Motor always indexed at zero point before restart
14. Previous last 10 stop recalls
15. Showing the motor performance on the video screen
16. Computer linked with micro controller
17. Wireless motor control
18. Wireless feed back on the screen showing motor speed
19. Delay motor start

Following work may be substituted as three additional features toward your


project.

1. Development of software Algorithm for 8051 to measure distance with 100%


accuracy on millimeter scale.
2. Development of software technique to stop stepper motor at designated angle.
3. Development of software to read resistance value
4. Development of software to read data from serial port and display it on the video
a video screen.
5. Development of any original software module.

17
EC311 Microcontroller Based System
NUST/PNEC-Karachi

Mini Project Dead Lines

Assessments will be done each week on the weekly accomplishments

Week-1
Report need to be submitted that include the following items (20 points)
1. Design strategy
2. Preliminary design
3. Block diagrams
4. Detail of each block
5. Parts list
6. Software development planning
7. Planning of software design
Lab session:
1. Start developing software
2. start putting components together

Week-2
Refine report of the final design need to be submitted (10 points)

Lab session: (10 points)


1. Installation of all components on the bread board according to the circuit
schematics
2. Software development
Week-3
No report needed
Lab session: (20 points)
1. Firmware must be ready to test (10 points)

Week-4
Final report need to be submitted (40 points)
Project demonstration (60 points)
Written test (30 points)
Final grading

18
Appendix-B

Procedure to create Assembly language program using Keil


MicroVision2

 Write assembly language codes by using text editor


 Save this source code file with extension .a51 <filename.a51>
 Open Keil “uv2” application software (a new screen will appear)
 From the tool bar select “project” then ‘New project’
 Now in the ‘File name’ space write down any name that you prefer and then
‘save’
 (It will take you to a new screen where you can select the device on which the
program will be burned, select ‘Generic’ then ‘ 8052’)

 Again double click on ‘project’ then select ‘Target, Groups, Files’ (It will take
you to the next screen)
 Double click on ‘Target1’ then press onto ‘Set as current Target’ then ‘Select
Group/Add Files’
 Double click on ‘SourceGroup1’ then ‘Add Files to Group’
 Now select file ”Source code file (<filename.a51>” that you had created from the
directory where it was saved earlier, then press ‘Add’
 Close all small windows, then select “project” from the tool bar and then from
sub menu double click on ‘Built Target’
 If the program is functioning correctly the “ 0-error, 0-warning “ message will
be displayed on the bottom of the screen
 You are successful
 Congratulation!!!!!!

 To execute the program, just double click on ‘Debug’ on the menu bar then select
‘Go’

 To create ‘Hex’ file: Double click on ‘project’ then select ‘Options for Target’.
Now on the screen checked out the box saying ‘create the hex file’ and then
rebuilt the project.

By: Ikram R. Qureshi

19
Feb 8th, 2006

Appendix-C

Procedure to download program ‘hex’ file onto microcontroller by


using Windows Hyperlink facility

Establishment of communication between PC and the trainer board:

1. Connect the Serial 1 of the 8051 Trainer board connecter to COM port of the PC
using DB-9 cable

2. Click on Hyper Terminal in the Start Menu of the MS Windows.

3. Create and Name a new connection.

4. Connect the PC COM Port to MDE 8051 serial port-1 via D9-serial cable.

5. Configure HyperTerminal for the following settings.


Baud rate 9600, 8n1 with no hardware flow control.

6. Connect the power to the Trainer board.

7. Put the Switch on the SW-1 on the trainer board to ‘PRG’.

8. Open windows HyperTerminal module by selecting. ‘All Programs’ >


Accessories > Communications > Hyper terminal and then press enter.

9. The connection would be established now and following message will appear on
the screen
DS89C420 LOADER VERSION 1.0 COPYRIGHT (C) 2000 DALLAS
SEMICONDUCTOR

How to Load and Run Programs on 8051 Trainer board:

a.) Clear the ROM by entering the following.


>K

20
b.) Ready the board to load with the following.
>L

c.) Using HyperTerminal send a text file to the trainer.

d.) When the dialogue appears select all files and navigate to your HEX file to be
sent to the trainer. 

e.) Click here to download toggle hex file

f.) You should see a series of G's if you see anything but a G an error has occurred
during the load and you should repeat from step ‘a’.

21
Appendix-D

Lab Procedures
Micro Controller Based System
EC311-PNEC

Ten Labs and One Mini project will be conducted in these Lab secessions
(Each Lab has 25 point, Final Mini Project will be worth of 60/30 points)
Five marks will be taken off from the total for over 10 minutes of late entry
Guidelines:
 Marks distribution is arranged in such a way to make sure that students
should be prepared before coming into lab to perform the experiment.

 Each student should have personal 3” flat blade screw driver, 4” cutting pliers
and 20 pieces of 10” long solid phone wires. 2 points

 Pre-Lab Report should be submitted before starting of each lab with no


exceptions 5 points (with in time), 2 points(late submission)

 Work assessment will be performed by the instructor in final 10 minutes of each


lab session 10 points(Functional), 4 points(None Functional)

 Post-Lab report should be submitted any time before the start time of the next
lab session 8 points(with in time), 4 points(late submission)
Pre-Lab Report should include the following (5 Points)
 Objective
 Brief theory
 Possible steps to achieve the objective
 Software program
 Hardware Block Diagram

Post Lab Report (8 Points)


Should be attached to the Pre-lab report and include the following

 Source code file


 Program list file with comments

22
 Your personal observations and procedural adjustment/ difficulties
 Hardware schematic
 Results
 Data sheets

23

You might also like