0% found this document useful (0 votes)
47 views3 pages

Islamic University of Technology (Iut)

This document provides instructions for an experiment to write a simple program to control an LED using a microcontroller. The program will: 1. Initialize the microcontroller and set the LED pin to off. 2. Toggle the LED pin on and off by setting the pin high, waiting briefly, setting it low, and waiting again before repeating in a loop. 3. The program is written in assembly code and simulated in Proteus before implementing on a breadboard with the microcontroller and LED. Troubleshooting tips are also provided.

Uploaded by

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

Islamic University of Technology (Iut)

This document provides instructions for an experiment to write a simple program to control an LED using a microcontroller. The program will: 1. Initialize the microcontroller and set the LED pin to off. 2. Toggle the LED pin on and off by setting the pin high, waiting briefly, setting it low, and waiting again before repeating in a loop. 3. The program is written in assembly code and simulated in Proteus before implementing on a breadboard with the microcontroller and LED. Troubleshooting tips are also provided.

Uploaded by

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

ISLAMIC UNIVERSITY OF TECHNOLOGY (IUT)

THE ORGANIZATION OF ISLAMIC CONFERENCE (OIC)


DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

Course: EEE 4620 (Peripherals and Microprocessor Based Design Lab)


Experiment No.: 01
Name of the experiment: Simple program to start with.

Objective:
Write a simple program to control a led. To be introduced with the assembler MIDE51, and
simulation software Proteus.

Introduction:
1. Algorithm
 Structure the program using flow chart.
Start

Microcontroller
Initialize

At the start turn the led off

Send Logic high to pin P2.0

Time Delay

Send Logic low to pin P2.0

Time Delay

2. Code Writing
 In assembler MIDE51 write down the program.
 Assemble to generate the hex file.

Prepared By: Golam Sarowar, Assistant Professor, EEE, IUT. Page 1


ORG 00H ;PROGRAM STORE LOCATION

MOV PSW, #00H ;SELECT BANK 0


MOV SP, #70H ;STACK POINTER STARTING ADDRESS SHIFTED

MOV P2, #00H ;UPON RESET ALL PINs ARE LOGIC HIGH

AGAIN: SETB P2.0


LCALL DELAY
CLR P2.0
LCALL DELAY
LJMP AGAIN

DELAY: MOV R7, #10 ;Delay Routine


L3: MOV R6, #100
L2: MOV R5, #100
L1: DJNZ R5, L1
DJNZ R6, L2
DJNZ R7, L3
RET

END

Simulation
1. Use Proteus to draw the circuit.
2. Load the assembled hex file to the microcontroller.
3. Run and watch the simulation result.

Design Aspect:
To connect a LED to a port pin following questions need to be answered:
1. The current requirement for the LED for better illumination?
2. How much current microcontroller pin can actually provide?
3. How to control excess current?

Practical Work
1. Construct the circuit in bread board.
2. Load the program in microcontroller.
3. Provide power supply and watch the result.

Prepared By: Golam Sarowar, Assistant Professor, EEE, IUT. Page 2


Figure: Circuit Diagram of the experiment.

Troubleshooting Tips:
1. Pin 40 connected to VCC (+5V).
2. Pin 20 connected to GND (0V).
3. Crystal is connected between pin 18 and pin 19.
4. In RST pin (pin 9) 0V is available during operation.
5. If the internal Program Memory is used then pin 31 (EA) is connected to VCC.
6. Check whether the crystal frequency is supported by the microcontroller.
7. Check whether the I/O ports are configured properly.
8. Default stack pointer (SP) is 07H. Make sure the saved returned addresses are not overlapping the
temporarily saved data in RAM.
9. With power failure the temporary data will be lost so that can hamper the program.
10. Upon reset all port pins are set i.e., contains 0FFH.
11. Before receiving external data through ports, all port pins or a particular pin has to be configured as
input.

Prepared By: Golam Sarowar, Assistant Professor, EEE, IUT. Page 3

You might also like