Lab 4 Simulating I/O Ports: Lab Manual For "The 8051 Microcontroller and Embedded Systems" LAB 4
Lab 4 Simulating I/O Ports: Lab Manual For "The 8051 Microcontroller and Embedded Systems" LAB 4
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
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.
5. Write a program to monitor P2.4 continuously. When it becomes low, it sends 55H to P1.