Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Experiment#3

Interfacing LED with PIC microcontroller


Materials:
 Proteus Simulation Software
 MPLABX Integrated Development Software (v5.20)
 Micro-controller (PIC18F458)
 LEDs
 Resistor
 Breadboard
 Connecting wires

Theory Overview:
Interfacing Light Emitting Diodes (LEDs) with a PIC (Peripheral Interface Controller)
microcontroller is a common and fundamental task in embedded systems. LEDs are widely
used for visual indication and feedback in electronic circuits. This theory section will discuss
the basic principles and considerations involved in interfacing LEDs with a PIC
microcontroller.

PIC Microcontroller:
A Microcontroller in general is a compressed micro-computer manufactured to control the
functions of embedded systems in office machines, robots, home appliances, motor vehicles,
and a number of other gadgets. It comprises components like memory, peripherals and most
importantly a processor.
PIC is a Peripheral Interface Microcontroller which was developed in the year 1993 by the
General Instruments Microcontrollers that consists of a CPU, memory (RAM and
ROM/Flash), input/output peripherals, timers, and other features. The microcontroller is
programmed to execute a set of instructions to. It is controlled by software and programmed
in such a way that it performs different tasks and controls a generation line like control
external devices, such as LEDs, based on specific conditions.

Interfacing LEDs with PIC Microcontroller:


Interfacing a PIC (Peripheral Interface Controller) microcontroller with LEDs involves
connecting the microcontroller to one or more LEDs to control their state (on or off) through
software. This process typically includes selecting appropriate microcontroller pins,
configuring those pins as outputs, and then writing code to control the state of the pins, thus
controlling the LEDs.

Procedure:
Building a circuit on Proteus Simulation:
Step1. Firstly, select the PIC microcontroller of the model PIC18F458.

Fig 3.1

Step2. Then select from the components the LED that can be any like bllue, yellow or Biggi.
Connected its one end to the ground and other one 34 pin of the microchip.

Fig 3.2
Then select the voltage source or Sine wave shown below. Attach to the pin 1.

Fig 3.3

At the end, the circuit is ready to be interfaced.

Fig 3.4
Interfacing with MPLABX
Step1. First of all, the software is opened, then by clicking on the new project we get the
following file from which we will select the standalone project of the category microchip
embedded since a microcontroller is a part of embedded system.

Fig 3.5

Step2. Then the device is selected in which the family of advanced 8-bit
microcontroller is chosen.

Fig 3.6
Step3. Since we are using PIC microcontroller of module 18F458 available in the, we’ll
select that particular device and go for the next option.

Fig 3.7

Step4. We’ll select the tool that is the optional step, but pickit3 will be chosen.

Fig 3.8

Step5. After that, the compiler is selected for the low level programming language known as
assembly language used to for interfacing i.e. in our case is mpa.s.m. file.
Fig 3.9

Step 6. The project and the project location is selected. The location can be the new folder
saved on the desktop or any drive of the computer as shown below, here, the project location
is the desktop.

Fig 3.10
Step7. The file is opened as shown below. Below the file location is the navigator etc.

Fig 3.11

Step8. Go to the source files and click right on the cursor. A new menu is opened, select new,
go to the other option. We’ll get a new tab where the file type is chosen and project name is
written.

Fig 3.12
Step9. The name for the project is written. The assembler category is chosen due to low level
language and then the asm file type is selected and next option is clicked.

Fig 3.13

Step10. The folder is chosen that is the debug one or dlist can be any. Click on the finish and
you are ready to go with your new asm file.

Fig 3.14 Fig 3.15


And then you’ll ready to program the microchip by writing a code and selecting
the suitable pins that are used in the proteus.

Fig 3.16

Compile the code using an integrated development environment (IDE) such as MPLABX.
Program the microcontroller with the compiled code using a suitable programmer.

Saving of the Proteus File:


Right click on the microcontroller and select edit properties.

Fig 3.17
Go to the program file, location of the folder that has been created for MPL interfacing and
then that particular folder is opened i.e. proteus for that lab.

Fig 3.18

Then select the program file created by using the MPLab software.

Fig 3.19

Then go for the dlist option.

Fig 3.20
After that default file is opened.

Fig 3.21

Then production file is opened.

Fig 3.22

choose hex file and click on open. Then run the circuit the LED is glown and you have
successfully interface the simulation with the microcontroller.

Fig 3.23
Results:

Conclusion:

You might also like