Escolar Documentos
Profissional Documentos
Cultura Documentos
EXPERIMENT 3
TITLE: LIGHT A LED USING PIC HARDWARE TRAINER
OBJECTIVE :
AT THE END OF EXPERIMENT STUDENT SHOULD:
Explain verbally the basic function for Mplab software and PROTEUS 7.4 function.
Write and compile to get the HEXADECIMAL code from assembly code using Mplab
software.
Know how to draw and analyze the embedded system circuit using PROTEUS 7.4 software
Know how to compile the hex code and the schematic to make LED blink at desired time
frame.
APPARATUS:
Mplab software version 8.63
Proteus 7.4
THEORY/BACKGROUND :
Good starting place for anyone new to micro's.. Well not completely new, as a general
knowledge of what micro controller is and basic electronic knowledge is assumed. Just in-case; LED's
are Light Emitting Diodes - like a traditional lamp but more efficient and "cutting edge". They can
only be powered when biased correctly, that is, one lead is a positive and the other is negative (also
known as anode and cathode). Here's what an LED looks like in a wiring diagram;
Experiment 1
An LED needs some sort of current limiting device in series as without it, the LED will "burn out", or
be over-driven. A standard LED is generally rated for about 20mA, and depending on the forward
voltage drop of the LED, well you can calculate how big the resistor should be. It's safe to say that 470
ohm or greater will be suffice for most LED's. OK, back to the programming. I've chosen to use the
ever so popular 16F628 PIC micro. It's cheap, got lots of on-board features, one of them being the
internal oscillator that runs at 4Mhz. Keeping in mind that PIC's physically run at 1/4 the OSC speed,
this means that with the internal oscillator setup, the PIC will run at 1Million Instructions Per Second
(1 MIPS). To turn the LED on and off in a continual loop would not even make it look like anything
was happening, so a delay needs to be incorporated to "burn cycles". This amongst other program
features is heavily commented below;
PROCEDURE:
Experiment 1
Exercise 1
Open Mplab software and choose PIC 18f4550 as a main controller, and write the code
(APPENDIX A) for C in C18 and APPENDIX B for Assembly language, and compile the code
to get the hex code.
Using Proteus software draw the circuit diagram 1.1 below.
Observe the output and make sure the result will indicate the D1 LED to blink.
Try to vary the speed of the blink by altering the code.
Exercise 2
Use the code at APPENDIX B for the circuit diagram 1.2 and observe the both output to blink
with different timing just like running light.
Experiment 1
As a assignment Draw 8 output of LED from RD0 to RD7 and make sure all 8 output are
blinking like running light start from RD0 and end RD7 and loop back to play a same routine.
RD0
ON
OFF
ON
RD1
ON
ON
ON
RD2
OFF
OFF
ON
RD3
OFF
ON
OFF
RD4
ON
OFF
ON
RD5
ON
ON
ON
RD6
OFF
OFF
ON
RD7
OFF
ON
OFF
DISCUSSION:
Give your observation and assumption based on theory along the experiments
CONCLUSION:
Give a conclusion obtained from the experiment
REFERENCE:
(Please refer to APA format, see example below)
William, S. (1997). Data and Computer Communication, 5th ed,
Eaglewood cliffs, NJ: Prentice Hall. 230-251
Experiment 1