Docsity

Microprocessor Systems and Interfacing Lab #4, Study Guides, Projects, Research of Microprocessor and Interfacing

Partial preview of the text

Download Microprocessor Systems and Interfacing Lab #4 and more Study Guides, Projects, Research Microprocessor and Interfacing in PDF only on Docsity!

Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish)

LAB#

I/O Port Programming

Objectives:

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

Introduction:

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 parallel devices such as printers, or, each line can operate independently in interfacing to single-bit devices such as LEDs. 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. 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. 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. 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

Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish) TASK FLOWCHART:

Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish) TIME DELAY CALCULATION : TASK CONCLUSION : In this task we learned how we can Toggle Port 1 of the 8051 Microcontroller with a delay of ¼ seconds. Instruction Machine Cycles (A) Repeatetion (B) C= AxB MOV R0,#11 1 1 1 H3:MOV R1,#248 1 11 11 H2:MOV R3,#255 1 2728 2728 H1: DJNZ R2,H1 2 695640 1391280 DJNZ R1,H2 2 2728 5456 DJNZ R0,H3 2 11 22 RET 1 1 1 END 1 1 1 Total^1399500 Total Time in u Sec 112482554 MC90ns^ 250430us Total Time in Sec 250430us*1.08x^10 −^6 0.250s

Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish) TASK FLOW CHART

Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish) TASK PROTEUS SIMULATION: TASK CONCLUSION: From this task we learned how we can create a circuit using 8051 which will react to the codition of the switch to turn off or turn on the LED,furthermore we have used keil proteus for this task causing our understanding of the software to improve also we are having a more clear idea of the port based programing and application based programing.

Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish) TASK DEBUGGER: TASK PROTEUS SIMULATION:

Submitted By: (Zaheer ul Islam) (M.Bilal Arshad) (Rehmat Faraz Danish) TASK FLOWCHART: