Beruflich Dokumente
Kultur Dokumente
1 Lab 1
Total Marks:
Grades
Unsatisfactory [1-5]
Average [5-7]
The objective of this session is to introduce how to use uVision Keil for writing
codes of microcontroller and debug the code in Keil to rectify errors.
The session also introduces the circuit simulating environment Proteus. After
completing the lab, student will be able to write code for microcontroller and
simulate the circuit.
Keil uVision development tools for the 251 Microcontroller Architecture support
every level of developer from the professional applications engineer to the
student just learning about embedded software development.
2. Numerous example programs are included to help you get started with the
most popular embedded 251 devices.
2. µVision® Debugger:
The µVision Debugger provides a single environment in which you may test,
verify, and optimize your application code. The debugger includes traditional
features like simple and complex breakpoints, watch windows, and execution
control and provides full visibility to device peripherals. The logic analyzer can
provide the output waveform just like oscilloscope.
Figure 4:2 Keil Debugger
standard.
4.4 IN-LAB TASKS:
ORG 000
Again:
SJMP DELAY
CPL P1.0
SJMP Again
DELAY:
MOV R0,#0FFH
Figure 4:5 Self-Assessment Task 1
WAIT:
DJNZ R0,WAIT
RET
4.5 POST-LAB TASKS:
1. Draw the computer block diagram and briefly introduce each block.
3. References:
1. The 8051 Microcontroller by Scott Mackenzie
3. http://www.keil.com/
Grades
Unsatisfactory [1-5]
Average [5-7]
Rubrics for CLO#1 (Basic Engineering Knowledge) Marks
Total Marks:
6 Lab 2:
The objective of this session identify pins and know it’s working. And also
interface a LED with the I/O device of microcontroller.
The 8051's 40 pins function as I/O port lines. However, 24 of these lines are dual-
purpose. Each can operate as I/O, or as a control line or part of the address or
data bus. The eight lines in each port can be treated as a unit in interfacing to
parallel devices such as printers, or, each line can operate independently in
interfacing to single-bit devices such as LEDs.
4. Port 0:
Port 0 is a dual-purpose port on pins 32-39 of the 8051 IC. In minimum-
component designs, it is used as a general purpose I/O port.
5. Port 1:
Port 1 is a dedicated I/O port on pins 1-8. The pins, designated as P1.0, P1.1,
P1.2, etc., are available for interfacing to external devices as required. No
alternate functions are as signed for Port 1 pins; thus, they are used solely for
interfacing to external devices.
6. Port 2:
Port 2 (pins 21-28) is a dual-purpose port serving as general purpose I/O, or as
the high-byte of the address bus for designs with external code memory or more
than 256 bytes of external data memory.
7. Port 3:
Port 3 is a dual-purpose port on pins 10-17. As well as general-purpose I/O, these
pins are multifunctional, with each having an alternate purpose related to
special features of the 8051.
Writing to a port pin loads data into a port latch that drives a field-effect
transistor connected to the port pin. The port latch must contain a 1, in this case,
otherwise the FET driver is ON and pulls tile output low. Note that the pull-up
resistor is absent on Port 0 and external pull up resister may be needed.
Figure 1: Internal structure of I/O ports in 8051 MCU
1. Repeat the above task for 8 LED’s on Port 2 and single switch on Port 1.0.
2. Write assembly code for AT89C51 MCU to control LED light bulb installed in
Stairway using the following two toggle switch.
0 0 OFF
1 0 ON
0 1 ON
1 1 OFF
8. Reading assignment:
1. The 8051 Microcontroller by Scott Mackenzie (section 2.2-2.3, 2.5)
9. Review-Questions:
1. What cause overflow flag?