SlideShare a Scribd company logo
MPLAB IDE
Starter Guide
By: Karim El-Rayes
Software to be installed
• MPLAB IDE from Microchip®, its free of charge and you can
download from Microchip® website.
• C18 or C30 or C32 compiler according to the microcontroller
family you are using, you can download Trail version or Lite
version for students from Microchip® website.
• Notes:
For PIC18 family you will need C18 C – compiler.
For PIC24 and PIC33 families you will need C30 C – compiler.
For PIC32 family you will need C32 C – compiler.
• PIC18F4550 was used as an example in many cases, but
most of the material is applicable for all PIC18F family of
microcontrollers.
Step 1
Click next
Step 2
Select microcontroller
you will use from this list,
then click “Next”
Step 3
Select compiler C18 from the list, don’t forget to select the other
settings, then click “Next”
Step 4
Choose place to save your project, then click “Next”
Add any files to the project if you want, then click “Next”
Click “Finish”
Step 5
Click “New file” button
to start writing your
first code
Write your code here
then click “Save file”
button
Choose place to save your code and don’t forget to save it in *.c
Step 6
Right click on
“Source Files” and
select “Add Files”
Choose your code *.c file you saved it
Step 7 (optional)
Right click on “Linker
script” and select “Add
Files”
Go to
C:MCC18binlkr
And select linker
script file of the
microcontroller you
are using in your
project
(in this example
we are using
microcontroller
PIC18F4550)
In C18 compiler
Version 3.36 and
higher, the linker
scripts are in
C:MCC18binLKR
Step 8
Select “Release” if you want to
download the generated .hex file
on the microcontroller
Step 9
Click “Project” then
go to “Build
options” then
select “Project”
Select “Library Search
Path” from the
directories drop list
Click “New”
then write here the
libraries file path
then click “Apply”
then “Ok”
Step 10
Click “Build All” button to build and compile your project
Check your program either “Build succeeded” or watch the errors here
Hints: Setting microcontroller clock
Click “Configure” then select “Configuration Bits”
If you want to
make settings
from this
window and
not in your
code don’t
check this
mark.
If you are using crystal
higher than 4MHz
choose “HS-PLL
Enabled”.
If you are using 4MHz
crystal choose XT.
Disable
“Watchdog
timer” if you
are not using it.
Hints: settings for PIC18F4550
Set the crystal
you are using
If you are using a crystal higher than
4MHz select “HS” or “HS+PLL” Disable watchdog timer if
you are not using it.
How to Program your PIC
Choose programmer
device from here (here
we chose PICKit 3)
How to Program your PIC (cont.)
Step 1: Choose
“Release” Option
Step 2:
“Build” project
Step 3:
“Program” the PIC
Note: After you program the PIC, disconnect the PIC programmer
hardware from the microcontroller.
How to Debug your PIC
Choose debugger
device from here (here
we chose PICKit 2)
How to Debug your PIC (cont.)
Step 1: Choose
“Debug” Option
Step 2:
“Build” project
Step 4:
“Run” to start debugging
Step 3:
“Program” the PIC
Hardware example: Connecting PICkit 2/PICkit 3
programmer/debugger to PIC18F4550 microcontroller
+5v
Ground
Notes:
• Pin 2 in PICkit2/3
“VDD/Target” has to be
connected to the
microcontroller VDD supply, if
you are using +3.3v supply
based microcontrollers then VDD
= +3.3v, and the same for +5v
supply.
• Pin 6 in PICkit 2 is
“Not connected”, while in PICkit 3
is Low Voltage Programming pin
“LVP”, leave it not connected in
most cases if you are not using it.
Circuit schematic for PIC18F4550 microcontroller with
USB module connection to PC
Notes:
• VCC = +5v, you can power the PIC
from the USB port itself.
• You can replace the 8 MHz
crystal with any value depending
on your configuration.
• The two 100nF capacitors on
Pin 18 can be replaced with one
470nF capacitor.
Example code 1:
Simple digital output using PIC18F4550
// In this example we will configure port D as output and send some data to be
//output on it
#include<p18f4550.h>
void main()
{
TRISD = 0x00; //set port D to output , also can be written 0b00000000
LATD = 0x00; //set latch of port D to 0x00
while(1) //while(1) loop is used to run the application forever
{
PORTD = 0x0f; // output 00001111 on port D pins
}
}
Example code 2:
Simple digital input using PIC18F4550
// In this example we will configure port D as input and read some data from and
//store it to variable “i”
#include<p18f4550.h>
int i = 0;
void main()
{
TRISD = 0xff; //set port D to input, also can be written 0b11111111
LATD = 0x00; //set latch of port D to 0x00
while(1) //while(1) loop is used to run the application forever
{
i = PORTD; // read port D and save read value to variable i
}
}
Using PIC32 Starter kit or
PIC32 microcontrollers
PIC32 Starter kits
PIC32 Ethernet Starter kit PIC32 USB Starter kit II
Connecting PIC32 ESK board
PIC32 Ethernet Starter kit
PIC32 USB Starter kit II
Selecting PIC32 starter kit for debugging
Select “PIC32 Starter kit” from the debuggers list
Debugging
Step 1: set the debugger to “Debug” mode
Step 2: “Build” project Step 3: “Program” the
PIC microcontroller
Step 4: “Start” debugging

More Related Content

What's hot (20)

PDF
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
Revathi Subramaniam
 
PDF
8259 Programmable Interrupt Controller
abhikalmegh
 
PDF
8085 microprocessor ramesh gaonkar
SAQUIB AHMAD
 
PPT
Programming 8051 Timers
ViVek Patel
 
PPTX
Introduction to FPGAs
Sudhanshu Janwadkar
 
PDF
Serial Communication Interfaces
anishgoel
 
PPS
What is Arduino ?
Niket Chandrawanshi
 
PPT
Adc interfacing
Monica Gunjal
 
PPTX
Basics of open source embedded development board (
Dhruwank Vankawala
 
PDF
Keypad Interfacing with 8051 Microcontroller
Sudhanshu Janwadkar
 
PDF
ARM Processor Tutorial
Embeddedcraft Craft
 
PDF
8051 microcontroller
Gaurav Verma
 
PDF
8051 Architecture and PIN Configuration.pdf
Srikrishna Thota
 
PPSX
8051 architecture
sb108ec
 
PPT
UNIT III PROGRAMMABLE PERIPHERAL INTERFACE
ravis205084
 
PPTX
Arduino
Jerin John
 
PPTX
Keyboard Interfacing .pptx
livaunnoor
 
PPTX
Digital Electronics - Counters
Jayakrishnan J
 
PPTX
INTRODUCTION TO MICROCONTROLLER
Ankita Jaiswal
 
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
Revathi Subramaniam
 
8259 Programmable Interrupt Controller
abhikalmegh
 
8085 microprocessor ramesh gaonkar
SAQUIB AHMAD
 
Programming 8051 Timers
ViVek Patel
 
Introduction to FPGAs
Sudhanshu Janwadkar
 
Serial Communication Interfaces
anishgoel
 
What is Arduino ?
Niket Chandrawanshi
 
Adc interfacing
Monica Gunjal
 
Basics of open source embedded development board (
Dhruwank Vankawala
 
Keypad Interfacing with 8051 Microcontroller
Sudhanshu Janwadkar
 
ARM Processor Tutorial
Embeddedcraft Craft
 
8051 microcontroller
Gaurav Verma
 
8051 Architecture and PIN Configuration.pdf
Srikrishna Thota
 
8051 architecture
sb108ec
 
UNIT III PROGRAMMABLE PERIPHERAL INTERFACE
ravis205084
 
Arduino
Jerin John
 
Keyboard Interfacing .pptx
livaunnoor
 
Digital Electronics - Counters
Jayakrishnan J
 
INTRODUCTION TO MICROCONTROLLER
Ankita Jaiswal
 

Viewers also liked (20)

PDF
Introduction to Arduino
Karim El-Rayes
 
PDF
An introdution to MPLAB
Emanuele Bonanni
 
PDF
Lab 1 microcontroller
mkazree
 
PDF
Programming with PIC microcontroller
Raghav Shetty
 
PDF
Embedded system (Chapter 3) io_port_programming
Ikhwan_Fakrudin
 
PDF
Mplab user guide_51519c
Capuchino HuiNing
 
PDF
Computer conversions vme_specsheet
Electromate
 
PPT
Universal plug & play
Raghu Juluri
 
PPTX
Biochar Bathrooms
Sai Bhaskar Reddy Nakka
 
PPT
Community Based Ground Water Management field observations
Sai Bhaskar Reddy Nakka
 
PPTX
Introduccion mplab
Miguel Angel Corona Lòpez
 
PDF
Shortcut key
Metlogint
 
PDF
Build your own electronics lab
Karim El-Rayes
 
PDF
2015-10-21 - Arduino workshop
trygvis
 
PDF
Module 1 getting started with altium designer
Aris Gardelis
 
PDF
Electronic Measurement Beginner's Guide
Karim El-Rayes
 
PDF
Capacity Building and Sustainability
Sai Bhaskar Reddy Nakka
 
PDF
Tutorial dec0604(print24) Programming a PIC
Muhammad Khan
 
PDF
28683892 Practica1 1
carlos
 
PPT
Introducción PICs
guest0ce7f8
 
Introduction to Arduino
Karim El-Rayes
 
An introdution to MPLAB
Emanuele Bonanni
 
Lab 1 microcontroller
mkazree
 
Programming with PIC microcontroller
Raghav Shetty
 
Embedded system (Chapter 3) io_port_programming
Ikhwan_Fakrudin
 
Mplab user guide_51519c
Capuchino HuiNing
 
Computer conversions vme_specsheet
Electromate
 
Universal plug & play
Raghu Juluri
 
Biochar Bathrooms
Sai Bhaskar Reddy Nakka
 
Community Based Ground Water Management field observations
Sai Bhaskar Reddy Nakka
 
Introduccion mplab
Miguel Angel Corona Lòpez
 
Shortcut key
Metlogint
 
Build your own electronics lab
Karim El-Rayes
 
2015-10-21 - Arduino workshop
trygvis
 
Module 1 getting started with altium designer
Aris Gardelis
 
Electronic Measurement Beginner's Guide
Karim El-Rayes
 
Capacity Building and Sustainability
Sai Bhaskar Reddy Nakka
 
Tutorial dec0604(print24) Programming a PIC
Muhammad Khan
 
28683892 Practica1 1
carlos
 
Introducción PICs
guest0ce7f8
 
Ad

Similar to Introduction to MPLAB IDE (20)

PDF
An introduction to_programming_the_microchip_pic_in_ccs_c
Suresh Murugesan
 
PPT
Picmico
loges91
 
PDF
Microcontroladores: programación de microcontroladores PIC de 8 bits en C
SANTIAGO PABLO ALBERTO
 
PPTX
Embedded system (Chapter 5) part 1
Ikhwan_Fakrudin
 
PPTX
Embedded system (Chapter )
Ikhwan_Fakrudin
 
PPT
Chapter+1 +the+adventure+begins
noor020202
 
PPTX
Pres
johnkashap
 
PPTX
Pres
johnkashap
 
PPT
8-bit PIC Microcontrollers
Premier Farnell
 
PDF
Microcontroladores: Programación con microcontrolador PIC
SANTIAGO PABLO ALBERTO
 
PDF
PIC Programming and Concept for P184550 Book
prateekjain415709
 
PDF
this is lab 1 of course embedded system.
hiraambreen2002
 
PDF
MC_module_3_2022.pdf
maheshwaran79
 
PPT
Microcontroller 8051 gs
Moorthy Peesapati
 
PPTX
pic microcontroller unit 5 detailed .pptx
arlandge04
 
PPTX
MICROCONTROLLER.pptx
fiqrie mohd
 
PDF
Unit III ARM Interface and ARM Programming
Dr. Pankaj Zope
 
PPTX
embedded-systems-for-beginners
mohamed gaber
 
PDF
PIC18F458_Ritula Thakur.pptx.pdf
AvinashJain66
 
PDF
Pic18f4550 microcontroller based projects _ PIC Microcontroller.pdf
Ismailkhan77481
 
An introduction to_programming_the_microchip_pic_in_ccs_c
Suresh Murugesan
 
Picmico
loges91
 
Microcontroladores: programación de microcontroladores PIC de 8 bits en C
SANTIAGO PABLO ALBERTO
 
Embedded system (Chapter 5) part 1
Ikhwan_Fakrudin
 
Embedded system (Chapter )
Ikhwan_Fakrudin
 
Chapter+1 +the+adventure+begins
noor020202
 
8-bit PIC Microcontrollers
Premier Farnell
 
Microcontroladores: Programación con microcontrolador PIC
SANTIAGO PABLO ALBERTO
 
PIC Programming and Concept for P184550 Book
prateekjain415709
 
this is lab 1 of course embedded system.
hiraambreen2002
 
MC_module_3_2022.pdf
maheshwaran79
 
Microcontroller 8051 gs
Moorthy Peesapati
 
pic microcontroller unit 5 detailed .pptx
arlandge04
 
MICROCONTROLLER.pptx
fiqrie mohd
 
Unit III ARM Interface and ARM Programming
Dr. Pankaj Zope
 
embedded-systems-for-beginners
mohamed gaber
 
PIC18F458_Ritula Thakur.pptx.pdf
AvinashJain66
 
Pic18f4550 microcontroller based projects _ PIC Microcontroller.pdf
Ismailkhan77481
 
Ad

Recently uploaded (20)

PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 

Introduction to MPLAB IDE

  • 2. Software to be installed • MPLAB IDE from Microchip®, its free of charge and you can download from Microchip® website. • C18 or C30 or C32 compiler according to the microcontroller family you are using, you can download Trail version or Lite version for students from Microchip® website. • Notes: For PIC18 family you will need C18 C – compiler. For PIC24 and PIC33 families you will need C30 C – compiler. For PIC32 family you will need C32 C – compiler. • PIC18F4550 was used as an example in many cases, but most of the material is applicable for all PIC18F family of microcontrollers.
  • 5. Step 2 Select microcontroller you will use from this list, then click “Next”
  • 6. Step 3 Select compiler C18 from the list, don’t forget to select the other settings, then click “Next”
  • 7. Step 4 Choose place to save your project, then click “Next”
  • 8. Add any files to the project if you want, then click “Next”
  • 10. Step 5 Click “New file” button to start writing your first code
  • 11. Write your code here then click “Save file” button
  • 12. Choose place to save your code and don’t forget to save it in *.c
  • 13. Step 6 Right click on “Source Files” and select “Add Files”
  • 14. Choose your code *.c file you saved it
  • 15. Step 7 (optional) Right click on “Linker script” and select “Add Files”
  • 16. Go to C:MCC18binlkr And select linker script file of the microcontroller you are using in your project (in this example we are using microcontroller PIC18F4550) In C18 compiler Version 3.36 and higher, the linker scripts are in C:MCC18binLKR
  • 17. Step 8 Select “Release” if you want to download the generated .hex file on the microcontroller
  • 18. Step 9 Click “Project” then go to “Build options” then select “Project”
  • 19. Select “Library Search Path” from the directories drop list
  • 20. Click “New” then write here the libraries file path then click “Apply” then “Ok”
  • 21. Step 10 Click “Build All” button to build and compile your project
  • 22. Check your program either “Build succeeded” or watch the errors here
  • 23. Hints: Setting microcontroller clock Click “Configure” then select “Configuration Bits”
  • 24. If you want to make settings from this window and not in your code don’t check this mark. If you are using crystal higher than 4MHz choose “HS-PLL Enabled”. If you are using 4MHz crystal choose XT. Disable “Watchdog timer” if you are not using it.
  • 25. Hints: settings for PIC18F4550 Set the crystal you are using If you are using a crystal higher than 4MHz select “HS” or “HS+PLL” Disable watchdog timer if you are not using it.
  • 26. How to Program your PIC Choose programmer device from here (here we chose PICKit 3)
  • 27. How to Program your PIC (cont.) Step 1: Choose “Release” Option Step 2: “Build” project Step 3: “Program” the PIC Note: After you program the PIC, disconnect the PIC programmer hardware from the microcontroller.
  • 28. How to Debug your PIC Choose debugger device from here (here we chose PICKit 2)
  • 29. How to Debug your PIC (cont.) Step 1: Choose “Debug” Option Step 2: “Build” project Step 4: “Run” to start debugging Step 3: “Program” the PIC
  • 30. Hardware example: Connecting PICkit 2/PICkit 3 programmer/debugger to PIC18F4550 microcontroller +5v Ground Notes: • Pin 2 in PICkit2/3 “VDD/Target” has to be connected to the microcontroller VDD supply, if you are using +3.3v supply based microcontrollers then VDD = +3.3v, and the same for +5v supply. • Pin 6 in PICkit 2 is “Not connected”, while in PICkit 3 is Low Voltage Programming pin “LVP”, leave it not connected in most cases if you are not using it.
  • 31. Circuit schematic for PIC18F4550 microcontroller with USB module connection to PC Notes: • VCC = +5v, you can power the PIC from the USB port itself. • You can replace the 8 MHz crystal with any value depending on your configuration. • The two 100nF capacitors on Pin 18 can be replaced with one 470nF capacitor.
  • 32. Example code 1: Simple digital output using PIC18F4550 // In this example we will configure port D as output and send some data to be //output on it #include<p18f4550.h> void main() { TRISD = 0x00; //set port D to output , also can be written 0b00000000 LATD = 0x00; //set latch of port D to 0x00 while(1) //while(1) loop is used to run the application forever { PORTD = 0x0f; // output 00001111 on port D pins } }
  • 33. Example code 2: Simple digital input using PIC18F4550 // In this example we will configure port D as input and read some data from and //store it to variable “i” #include<p18f4550.h> int i = 0; void main() { TRISD = 0xff; //set port D to input, also can be written 0b11111111 LATD = 0x00; //set latch of port D to 0x00 while(1) //while(1) loop is used to run the application forever { i = PORTD; // read port D and save read value to variable i } }
  • 34. Using PIC32 Starter kit or PIC32 microcontrollers
  • 35. PIC32 Starter kits PIC32 Ethernet Starter kit PIC32 USB Starter kit II
  • 36. Connecting PIC32 ESK board PIC32 Ethernet Starter kit PIC32 USB Starter kit II
  • 37. Selecting PIC32 starter kit for debugging Select “PIC32 Starter kit” from the debuggers list
  • 38. Debugging Step 1: set the debugger to “Debug” mode Step 2: “Build” project Step 3: “Program” the PIC microcontroller Step 4: “Start” debugging