Getting Started With PIC18F4550 and MPLABX IDE - PIC Controllers
Getting Started With PIC18F4550 and MPLABX IDE - PIC Controllers
Introduction
There are various development environments available for the PIC18f4550 controller.
MPLABX IDE
MikroC
XC8
Hi-Tech
C18
After code development, for loading flash memory we can use this kit
PIC kit1
PIC kit2
PIC kit3
ICD
Here we are going to develop a simple LED blinking project using MPLABX IDE with XC8 compiler and flash the PIC18f4550
chip using PIC kit2.
Here: http://www.microchip.com/mplab/compilers
Here: http://www.microchip.com/mplab/mplab-x-ide
3. There are many hardware Programmer available for PIC like PicKit2, PicKit3, USBPicProg.
Here PIC18 family is used and PIC18F4550 device. After selecting click on next.
8. Window for selecting tool will Pop-up after clicking on next
The source file contains Main Code and other supporting files for a header (optional).
Now in PIC18f4550, we need to configure some registers or bits like WDT, MCLRE’, FOSC, etc.
We can write these configurations in our C code as follows:
But PIC18F4550 has more configuration Registers so they are set to default and the compiler generates warnings for these
registers. So to configure these registers MPLABX provides one simple way which is as follows:
11. Go to Window -> PIC Memory Views -> Select Configuration Bits
Then window Popup as follows:
Configure these bits according to requirement and click on the button “Generate Source Code to Output” given on the bottom
side.
Copy the Generated Source Code and paste it in a header file.
Right Click on Header in project -> Select new -> Select C Header File
Right Click on Source in the project -> Select new -> Select C Main File
To write code in Assembly, select the ASM file.
Program
/*
http://www.electronicwings.com
*/
void main()
while(1)
MSdelay (500);
MSdelay (500);
for(i=0;i<val;i++)
15. Now Build Project.
After building a Project, output Window appears which gives errors and warnings if any otherwise gives message Build
Successful.
After uploading the above program connect LED to the PIC microcontroller, it will start blinking as shown below.
LED Blinking