Sie sind auf Seite 1von 12

1.

1 Lab 1

2 Introduction to Keil uVision® IDE and Labcenter Proteus® Simulation

GROUP NUMBER 000


FULL NAME REGISTRATION
SUBMITTED BY
FULL NAME REGISTRATION
MICROPROCESSOR SYSTEMS AND INTERFACING (LAB)
ENGR. SHAHAB YOUSAFZAI

Rubrics for CLO#1 (Basic Engineering Knowledge) Marks

Knowledge Base for Engineering Mathematical and Scientific Terms:

Rubrics for CLO#4 (Tool Usage) Marks

Tool Usage Understand Tools:

Total Marks:

Grades

Unsatisfactory [1-5]

Average [5-7]

Meets expectations [7-9]

Exceeds expectations [9-10]


3 Lab 1:

4 Introduction to Keil uVision® IDE and Labcenter Proteus® Simulation


4.1 OBJECTIVES:

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.

4.2 KEIL UVISION IDE:

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.

The µVision IDE combines project management, run-time environment, build


facilities, source code editing, and program debugging in a single powerful
environment. µVision is easy-to-use and accelerates your embedded software
development. µVision supports multiple screens and allows you to create
individual window layouts anywhere on the visual surface.

1. Features of Keil uVision:


1. When starting a new project, simply select the microcontroller you use from
the Device Database and the µVision IDE sets all compiler, assembler, linker,
and memory options for you.

2. Numerous example programs are included to help you get started with the
most popular embedded 251 devices.

3. The Keil µVision Debugger accurately simulates on-chip peripherals (I²C,


CAN, UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and
PWM Modules) of your 251 device.
Figure 4:1 Keil uVision IDE

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

4.3 LABCENTER PROTEUS:

The Proteus Design Suite is a proprietary


software tool suite used primarily for
electronic design automation. Proteus
combines ease of use with powerful
features to help you design, test and
layout professional PCBs with nearly 800
microcontroller variants ready for
simulation straight from the schematic
featuring auto-router included as Figure 4:3 Labcenter Proteus front panel

standard.
4.4 IN-LAB TASKS:

1. Create a project in Keil uVision for


AT89C51.

2. Write a LED blinking code for


AT89C51 MCU in uVision Kiel,
generate hex file and simulate the
circuit in Proteus.

Figure 4:4 Flow Chart for In Lab task 2

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

2. The 8051 Microcontroller and embedded system using assembly and C by M.


Ali Mazidi

3. http://www.keil.com/

4. Keil Quick Start Tutorial


4.6 Lab 2

5 Pinout and I/O interfacing with Microcontroller

GROUP NUMBER 000


FULL NAME REGISTRATION
SUBMITTED BY
FULL NAME REGISTRATION
MICROPROCESSOR SYSTEMS AND INTERFACING (LAB)
ENGR. SHAHAB YOUSAFZAI
5.1

Grades

Unsatisfactory [1-5]

Average [5-7]
Rubrics for CLO#1 (Basic Engineering Knowledge) Marks

Meets expectations [7-9]

Exceeds expectations [9-10]


Knowledge Base for Engineering Mathematical and Scientific Terms:

Rubrics for CLO#4 (Tool Usage) Marks

Tool Usage Understand Tools:

Total Marks:
6 Lab 2:

7 Pinout and I/O interfacing with Microcontroller


7.1 OBJECTIVES:

The objective of this session identify pins and know it’s working. And also
interface a LED with the I/O device of microcontroller.

7.2 THE PINOUT:

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

Figure 7:1 Pinout Diagram of MCU AT89C51

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.

7.3 INTERNAL STRUCTURE OF PINS:

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

7.4 IN-LAB TASK:

1. Write Assembly code to store your registration number (decimal) into


register A.

2. Write an assembly code for AT89C51 MCU in Keil to check if switch


connected to Port1.0 is ON, blink an LED connected to Port 1.1 otherwise
stay idle.

7.5 POST-LAB TASK:

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.

Table 1 Post-Lab Task Explanation

Switch 1 Switch 2 LED Light Bulb status

0 0 OFF

1 0 ON
0 1 ON

1 1 OFF

Assembly Code Simulation Circuit Diagram

Figure 2: Task 1 Assembly code in Keil

Figure 2: Task 2 Assembly code and simulation circuit diagram

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?

2. How Data-pointer register (DPTR) is is different form the reset of registers?

3. In At89c51 there are how many register banks.

4. The 8051, what are the addresses of RAM locations? Is it bit-addressable or


not?

Das könnte Ihnen auch gefallen