Академический Документы
Профессиональный Документы
Культура Документы
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.
MOV P2, #00H ;UPON RESET ALL PINs ARE LOGIC HIGH
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.
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.