0% found this document useful (0 votes)
115 views

Lab 4 Simulating I/O Ports: Lab Manual For "The 8051 Microcontroller and Embedded Systems" LAB 4

This lab document outlines three activities to simulate I/O ports using an 8051 microcontroller simulator. The first activity has students write a program to toggle all bits of ports P0, P1, and P2 by sending data and introducing a time delay. The second activity has students single-step through the delay subroutine and adjust register values to change the delay. The third activity has students write a program to read a byte from port P1 and send it to ports P0, P2 and registers R0-R2. The document also includes a worksheet with short questions about 8051 port configuration, addressing, and reading/writing.

Uploaded by

sohail amin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views

Lab 4 Simulating I/O Ports: Lab Manual For "The 8051 Microcontroller and Embedded Systems" LAB 4

This lab document outlines three activities to simulate I/O ports using an 8051 microcontroller simulator. The first activity has students write a program to toggle all bits of ports P0, P1, and P2 by sending data and introducing a time delay. The second activity has students single-step through the delay subroutine and adjust register values to change the delay. The third activity has students write a program to read a byte from port P1 and send it to ports P0, P2 and registers R0-R2. The document also includes a worksheet with short questions about 8051 port configuration, addressing, and reading/writing.

Uploaded by

sohail amin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

LAB 4

SIMULATING I/O PORTS

OBJECTIVES:
 To examine the I/O port operation using a simulator.
 To trace through a CALL subroutine using a simulator.

REFERENCE:
 Mazidi and McKinlay, “The 8051 Microcontroller and Embedded Systems,” Chapters 3 and 4.

MATERIALS:
 8051 assembler and simulator.

ACTIVITY 1

Write and assemble a program to toggle all the bits of P0, P1, and P2 continuously by
sending 55H and AAH to these ports. Put a time delay between the "on" and "off" states. Then
using the simulator, single-step through the program and examine the ports. Do not single-step
through the time delay call.

ACTIVITY 2

Using a simulator, single-step the program in Activity 1. Single-step through the delay
subroutine. Examine the registers of the delay subroutine and make the delay shorter or longer
by changing the register values.

ACTIVITY 3

Using a simulator, write a program to get a byte of data from P1 and send it to P0 and
P2. Also, give a copy of it to registers R0, R1, and R2. Single-step the program and examine the
ports and registers.

Lab Manual for “The 8051 Microcontroller and Embedded Systems” LAB 4
LAB 4
WORKSHEET

Name: Date: Class:

1. Upon reset, all the ports of the 8051 are configured as ______ (input, output).

2. To make all the bits of a port an input port we must write ____ hex to it.

3. Which ports of the 8051 are bits addressable?

4. What does it mean for port to be "read-modify-write"?

5. Write a program to monitor P2.4 continuously. When it becomes low, it sends 55H to P1.

LAB 4 Lab Manual for “The 8051 Microcontroller and Embedded


Systems”

You might also like