You are on page 1of 1

fb tw yt

HOME ELECTRICAL › ELECTRONICS › COMMUNICATION › ROBOTICS PROJECTS › GENERAL ›

Expert Outreach Communication Giveaways IC › Infographics Projects › Tools › White Papers

How to Program a PIC Microcontroller to Build a


Project
PIC 32 COMMENTS

The recent trends in the advanced technology are helpful in developing most advanced electronic gadgets. Most of  these
electronic devices are developed using microcontrollers. The microcontroller is an electronic component, which is programmed
to perform various control operations. There are various kinds of microcontrollers available, such as 8051, AVR, ARM, and PIC
microcontrollers, etc., which are programmed by using the integrated development tools.
SEARCH

SPONSORED SEARCHES

rubber vape rings

vape smoke change color

python offline tutorial


PIC Microcontroller Programming Steps
fine wooden boxes

PIC Microcontroller study of arduino

The PIC is a family of the microcontroller, which is manufactured by the di erent companies such as NXP, microchip, etc. The
PIC stands for “peripheral interface controller”, which contains memories, timers/counters, serial communication, interrupts
and ADC converters built into a single integrated chip.

RECENT POSTS

Labview Projects for Engineering


Students
Need electronics ICM-20608-G Specifications and
solutions? Applications

APDS-9960 Specifications and


We can provide the most Applications
suitable solutions from TDK
Group's wide range of products MATLAB Projects for Engineering
TDK Corporation
Students

What is Attenuation : Different Types & Its


Causes
The PIC microcontrollers are found in most electronic devices such as alarm systems, tra ic control systems and RFID based
security systems, etc. The PIC microcontroller programming can be carried out to perform the huge range of tasks. Even though AT Commands Tutorial
there are many types of PIC microcontrollers , the best and basic microcontroller is PIC16f877a. Electromagnetic Spectrum (EM
Spectrum) Working & Its Applications
PIC Microcontroller Programming Procedure Color Sensor – Working and Applications
The PIC microcontrollers is programmed by the  embedded C language or assembly language by using appropriate dedicated Satellite Communication System
so ware. Before going to build a PIC microcontroller project, we must become aware of developing a basic microcontroller (like
Electronic Communication and Its Types
8051) based project. Once you get the idea, this controller based project building becomes easy, so let us  look at the basic steps
to build a PIC microcontroller based project.

Before going to program the PIC microcontroller, first we have to select the right project that you are going program the
microcontroller. As of now, consider the LEDs flash light system.

Theory:
SPONSORED SEARCHES

PIC16F84A Price in India


The LEDs flashlight  uses a set of light emitting diodes, and these are advanced to the
Colorful Smoke Vape Juice
traditional incandescent lights which consumes more energy and have very less life time. The
LED lights on the other hand, consume less energy and have longer life.

Basic Idea of this Project Behind the Design:

The microcontroller generates the output logic pulses so that the LED light is switched ON and OFF at certain intervals. It is a 40
pin microcontroller. The Crystal interfaced to the input pins of the microcontroller  provides  accurate clock signals at the crystal
frequency.

Circuit Designing
The PIC microcontroller transmit and receive the data with respect to clock pulses, the PIC microcontroller operates with 4MHz
crystal frequency. Two capacitors are connected to the crystal oscillator with range of 20pf to 40pf which is used to stabilize the
clock signals. At some times, the PIC microcontroller goes to block state or missing time calculation,at that time we need to
reset the microcontroller. If a microcontroller is reset for 3sec time delay, 10k resistor and 10uf capacitor are connected to the
respective pins.

Circuit Components

MOST READ POSTS


Hardware Components
Half Adder and Full Adder with Truth
Yellow LEDs Table
Crystal
MOSFET Basics, Working Principle and
Reset
Applications
PIC Microcontroller
Capacitors Latest Electronics Project Ideas
Resistors
How Does a PID Controller Work? -
Structure & Tuning Methods
So ware Components
New 100+ Top Electrical Projects Ideas
MPLAB Compiler
Proteus software
Embedded C language

Circuit Connections

The 5v DC supply is given to the 11 pin of the microcontroller which  drives  the circuit. The crystal  is connected to the 13 and 14
pins of the microcontroller. The reset circuit is interfaced at 1 pins of the microcontroller. The Yellow LEDs is connected to the
PORTB of the microcontroller.

Circuit Diagram
This circuit is designed with the help of Proteus so ware. The Proteus is a circuit designing so ware that contains a database of
components, which we can use to build the circuit. Each and every component is available in the component library. X

PIC Microcontroller Project Circuit Diagram

Open the Proteus software. A window with a menu bar appears.


Click the file menu.
Select ‘new design’ from the drop-down menu.
Click the library menu.
Select ‘pick devices/symbol’ from the drop-down menu.
Select the relevant comment by double clicking it, so that the electronic components list appear on the window.
Add all the components and draw the circuit with the proper connections as shown above.

Program the PIC Microcontroller


The PIC microcontroller programming is performed through  ‘MP-Lab’ so ware. First instal the MP-Lab so ware, then select and 
install the compiler like CCS, GCC compiler, etc. Here ‘CCS C compiler’ is used for building the program.

Controllers for DC brushless motors. 24


- 48VDC, up to 50 A. RS-485 or 0-5V…
Ad Manufacturer. Fast shipping. Technical support.
Ad Analog 0-5V or RS485 speed control.
Smart Motor Devices

Learn more

First open the MPLAB software. This shows the menu bar with file, edit, view, project and tools option.
Select the project option and select the ‘project wired option’ from the drop-down menu. This will show the project
wired window.
Select a microcontroller for your project. Here ‘PIC16f877A’ microcontroller is selected.
Select the compiler and path location for your project. Here ‘CCS C compiler’ is selected for the PIC microcontroller,
then select the ‘browse’ option from the project wired window to select the ‘ccsloader’ in the PICC folder from the
program files. A folder with the name ‘source group’ is created in the ‘target’ folder.
Give a name to the project and click on ‘NEXT’ button to save the project. A folder with the name ‘source group’ is
created in the ‘target’ folder.. Click on the ‘file’ menu on the menu bar. Select ‘new file’ from the drop- down menu.

PIC Microcontroller Programming Code

The LED Flash Program:

#include<pic16f877x.h>
void delay(int);
sbit a=PB^2;
sbit b=PB^3;
sbit c=PB^4;
sbit d=PB^5;
void main()
{

TRISB=0x00;
a=b=c=d=0x00;
delay(10);
a=b=c=d=0xFF;
}
void delay(int a )
{
unsigned char c;
for(c=0;c<a;c++)
for(c=0;c<250;c++);
}

Load the Code to PIC Microcontroller


The code loading process of microcontroller is called dumping. The microcontrollers understand only the machine level
language, which contains ‘0 or 1s’. So we need to load the hex code into the microcontroller. There are many so wares available
in the market for loading the code to the microcontroller. Here we have used ‘PICFLSH’ programmer so ware to dump the code
to the PIC  microcontroller. The programmer kit comes with the hardware kit along with the so ware.

This so ware needs to be installed into the computer. The microcontroller placed in the hardware kit, which comes  with the
socket. Here are the steps to load the code onto the microcontroller.

Code Dumping Device

Interface the hardware (programmer kit) to the computer through a serial cable
Place the microcontroller in the socket of the hardware kit. Press the lock button to ensure the microcontroller is
connected to the board.
Open the software installed in the computer. This shows the menu bar with file, functions, open, save and setting
options.
Select the ‘open’ option from the drop-down menu and select the ‘load file’ .
Click on the ‘load’ button so that the hex file is loaded into the microcontroller.

Code Loading to PIC Microcontroller

Simulating the Circuit


The simulation is a decision analysis and support tool, which is used to know the performance of the circuit. The hardware is the
cost-e ective  equipment, so the  proposed action cannot be directly observed by the hardware. The simulation so ware allows
you to know the circuit performance and find & rectify the errors of the program. There are di erent types of simulating
so wares available in the market for checking the circuit performance.  Here Proteous so ware is used to check the circuit
performance.

Open the project in the Proteus software.


Click on the ‘Debug’ menu.
Select the ‘start debugging’ option. The LED starts blinking, which indicates the circuit is running.
After some time, select the ‘stop debugging’ option. The LED will now stop blinking.

These are the necessary steps for PIC microcontroller programming to develop simple project. Hope that you might have got a
basic idea on this topic. Any further assistance to build the PIC based projects or any microcontroller based projects you can
contact us by commenting below.

DC brushless Difference between Renesas RX65N Cloud Basics and Structure of


controllers AVR, ARM, 8051 and… Kit Embedded C Program…
Ad Smart Motor Devices elprocus.com Ad Renesas elprocus.com

Embedded Systems C PIC Microcontroller Latest Electronics Mini Latest PIC Projects List
Programming Tutorial… Basic and Projets for… Projects for… | Top PIC…
elprocus.com elprocus.com elprocus.com elprocus.com

Build a Career in ML and Artificial Intelligence.


upGrad | Sponsored

417% rise in demand for Data Scientists in India 3 bed in a 5.75 acre gated estate in Prabhadevi
(Source: ET) starting ₹7.96Cr*(All Incl)
upGrad & IIIT Bangalore | Sponsored Rustomjee Crown, Prabhadevi | Sponsored

Know The Real Reason Behind Excessive Hair Fall!


KENT RO Systems Ltd. | Sponsored

Dubai Property Expo at Inorbit Mall Hitech City, 5 Reasons Why Har Paani Ki Bottle Bisleri Nahin!
Hyderabad. from 11 AM - 9:30 PM Bisleri | Sponsored

99acres | Sponsored

Create Wealth of Rs.1 Crore @ Just Rs.8,000* p.m. Know More!


Coverfox.com | Sponsored

3 BHK Apartment @42Lacs Yelhanka bangalore Hotels in Maldives Might Actually Surprise You
Provident Welworth City | Sponsored Maldives Holiday | Search Ads | Sponsored

This unhappy kfc employee from Telangana quit his job in the best possible way
GoldMatcher | Sponsored

The most intelligent hearing aid - now in Hyderabad Luxury Hotels in Dubai - Lowest price guarantee
Soundrise | Sponsored Dubai Hotels | Search Ads | Sponsored

Instrumentation Amplifier: Circuit Diagram, MQ2 Gas Sensor - Working Principle & Its
Advantages, and Applications Applications
Elprocus Elprocus

SHARE THIS POST:

Facebook Twitter Google+ LinkedIn Pinterest

‹ PREVIOUS NEXT ›

Introduction to Fiber Optic Sensors and their Introduction to Screenless Displays with Their
Types with Applications Types

RELATED CONTENT

ADC (Analog to Digital AC Power Measurement Meter PIC32 Based Microcontroller PIC Microcontroller Projects for
Converter) Module in PIC using PIC Microcontroller Development Board Final Year Engineering
Microcontroller Students

32 Comments

Rahul Tripathi Says: REPLY


at
I am trying to develop a x-y axis motion system on PIC16f877a. I have the hardware and the proteus and Mplab software. But I
dont know how to start and how many number of ICs I require for achieving this. Any and every help is appreciated.
Thank you.

Tarun Agarwal Says: REPLY


at
Hi Rahul
If you have any ideas or any queries regarding a project please email us on team@elprocus.com
For more technical information please visit our site https://www.elprocus.com

Awesh Awadhya Says: REPLY


at
Hii sir, I am student and I have given project based on pic microcontroller,by using pic we control the speed of DC motor by
producing pwm..but I have problem that is to control the pwm by using andriod phone.SO. i need help..plz reply sir

Ibrahim Oluwanishola Says: REPLY


at
I don’t know if i can learn diz C prorgramming code from the starch.. am just a beginner and i am really interested in learning
this code, probably if there is any online class for it. i will really appreciate if u reply me

Tarun Agarwal Says: REPLY


at
HI Ibrahim Oluwanishola
Sorry to inform you that we cannot provide you, online classes,
Thank you so much for your feedback
But if you have any technical queries please email us on team@elprocus.com and our technical team will help you.

Manthan Raval Says: REPLY


at
Hello,
thank you for the article, gets basic understanding on pic microcontroller.
Am working on one project which requires the functionality as when we give one pulse(analog) then counter should increase on
display and timer enables for certain amount of time (0-99 ms).
Please suggest what steps need to take.

Tarun Agarwal Says: REPLY


at
Hi Manthan
Thank you so much for your feedback.
Please mail all your queries to team@elprocus.com and our technical team will help you.

Awesh Awadhya Says: REPLY


at
please can you help me on my project.The project is to control the speed of 220 v dc motor using pic microcontroller with help
of pwm.And future we have to contol the duty cycle of pwm with the help of android phone via wii or bluetooth module.Sir
please help me sir.

Tarun Agarwal Says: REPLY


at
Hi Awesh
Please refer the following link for DC motor speed control projects
Thank you so much for your feedback
And once again please visit our domestic website https://www.elprocus.com

Solo Says: REPLY


at
where can i get the programmer kit(code dumping device)

Tarun Agarwal Says: REPLY


at
Hi Solo
You can purchase in electrical shops or PCB’s shops
Thank you so much for your feedback
And if you need any customized project you can drop an email to team@elprocus.com

Lawrence Says: REPLY


at
Hello I’m using Proteus for the first time. The program does not work on for me. Can some help and correct?

Tarun Agarwal Says: REPLY


at
HI Lawrence
Thank you so much for your feedback
For any technical queries please email us on team@elprocus.com and our technical team will help you.

NAZIM Says: REPLY


at
hi I learn basic .of that .but i wanna do a project names power factor controller. by PIC ..can you help me

Tarun Agarwal Says: REPLY


at
Hi Nazim
Thank you so much for your feedback
Check out the link for the latest PIC projects.
If you have any technical queries or if you need a customized project from us please email us on team@elprocus.com

Hope Shamim Says: REPLY


at
hello
that is good project but
thank u for more explanations but can i get program of power factor improvement using pic micro controller??
please

Tarun Agarwal Says: REPLY


at
Thank you very much for telling me how much you have enjoyed reading my column. We can’t provide code
unless you buy a project.
For customization of projects please email us on team@elprocus.com

Spowna Says: REPLY


at
hi
how to automate tha forest fire control

Tarun Agarwal Says: REPLY


at
Hi Spowna
Thanks for the response.
Please go through the following links as per your query. Hope these links will give you the answer.
https://www.elprocus.com/projects-on-fire-fighting-robotic-vehicle/
https://www.elprocus.com/robots-used-dangerous-situations/
For customization of projects or for technical queries please email us on team@elprocus.com

Dennison Nicholas Says: REPLY


at
Hi, can you help me program a solar energy charger with LCD to show the percentage charged and LED as load

Dinu T S Says: REPLY


at
Please can you help me to program pic16f877a for automated plant irrigation system

Tarun Agarwal Says: REPLY


at
Hi Dinu T S
We have related projects based on your requirement, so please follow the below link
https://www.elprocus.com/?s=irrigation+projects
Hope this link will help you and give you an answer.

Jonus Says: REPLY


at
Hi,
I am new to this so please excuse if this sounds a little stupid. I have a K150 pic programmer and a couple of brand new
pic16f627a. The programmer is already attached to my pc and already working. I’ve got the microbrn software running on my
desktop and can open and read the IC’s.
I would like to use the pic IC’s for FM radio broadcast in the following two frequencies: 62.2mhz and 62.5mhz. I also have the
physical transmitter circuit but damaged the PIC IC (pic16f627a) through a short circuit.
What I need to know is how to program each new IC to one frequency each? Do I need a HEX code builder or an FM
Transmitter circuit diagram simulator to design the circuit and produce the Hex codes? Would you be able to generate the HEX
codes for me?

Tarun Agarwal Says: REPLY


at
Hi Jonus
Thanks for the response.
If you have any technical queries please email us on team@elprocus.com and our technical team will help you.

Superlove Says: REPLY


at
if i using Mac what software you recommend for me? Thank you..

Tarun Agarwal Says: REPLY


at
Hi Superlove
Thanks for the response and if you have any technical queries please email us on team@elprocus.com

Sonam Tobgay Says: REPLY


at
Please can you help me how to program a PIC16f877a for PIR sensor and LDR for automatic street light.

Tarun Agarwal Says: REPLY


at
Hi Sonam Tobgay
Thanks for the response. Check out the links below for the street light projects.
https://www.elprocus.com/auto-intensity-control-of-street-lights-circuit/
https://www.elprocus.com/street-light-glows-on-detecting-vehicle-movement-circuit/
https://www.elprocus.com/solar-powered-led-street-light-control-circuit/
https://www.elprocus.com/ldr-light-dependent-resistor-circuit-and-working/
Hope you will the solution from these articles.
For customization of projects please email us on team@elprocus.com

Saddam Nechavava Says: REPLY


at
may you please forwad me texts on microcontroller programming

Tarun Agarwal Says: REPLY


at
Hi Saddam Nechavava,
Please follow the link: http://youtu.be/kojgGmnikC4 to know how to program a Microcontroller. Also check the user
friendly website https://www.elprocus.com for project ideas on all the latest technologies.

Pyrecis Says: REPLY


at
i need videos to program a micro controller to open and close a garage door or u can send me a mail

Tarun Agarwal Says: REPLY


at
Hi Pyrecis,
click the links below for help:
https://www.edgefxkits.com/atmega-based-garage-door-opening
https://www.edgefxkits.com/cell-phone-based-dtmf-controlled-garage-door-opening-system
Raji (Mobile: +91 9959178000)

Add Comment

Comment:

Name *

Email *

Website

Post Comment

CATEGORIES RECENT COMMENTS FOLLOW ON FACEBOOK

Home Tarun Agarwal on Basics of Embedded C


Program and Programming Structure for
Popular posts
Beginners
Project Ideas
Tarun Agarwal on Different Types of Level
Electrical Sensors and their Workings

Electronics saiguptha on Basics of Embedded C


Program and Programming Structure for
Robotics Beginners

Technology Deviprasad a on Different Types of Level


Sensors and their Workings
Download Projects list
Tarun Agarwal on ECE Projects Ideas for
Electronics Engineering Students

Advertise With Us Disclaimer Report Violation Image Usage Policy Privacy Policy Contact Us

Copyright 2013 - 2019 © Elprocus

You might also like