Professional Documents
Culture Documents
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
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.
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.
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.
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.
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
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.
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.
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.
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
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:
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
Design a micro controller based system that includes software, circuit design schematics,
and fabrication.
The project should incorporate at least following blocks.
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
17
EC311 Microcontroller Based System
NUST/PNEC-Karachi
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)
Week-4
Final report need to be submitted (40 points)
Project demonstration (60 points)
Written test (30 points)
Final grading
18
Appendix-B
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.
19
Feb 8th, 2006
Appendix-C
1. Connect the Serial 1 of the 8051 Trainer board connecter to COM port of the PC
using DB-9 cable
4. Connect the PC COM Port to MDE 8051 serial port-1 via D9-serial cable.
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
20
b.) Ready the board to load with the following.
>L
d.) When the dialogue appears select all files and navigate to your HEX file to be
sent to the trainer.
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
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
22
Your personal observations and procedural adjustment/ difficulties
Hardware schematic
Results
Data sheets
23