Sunteți pe pagina 1din 3

Lab 01 |1

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.

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

Golam Sarowar, Assistant Professor, EEE, IUT.


Lab 01 |2

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.

Golam Sarowar, Assistant Professor, EEE, IUT.


Lab 01 |3

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.

Golam Sarowar, Assistant Professor, EEE, IUT.

S-ar putea să vă placă și