Hello friends, welcome to this exciting tutorial were we will begin our journey with latest PIC18F micros from Microchip Technologies. This tutorial will give you information on what software/hardware you will require and basic steps on how to get, install, configure and use them. After going through this tutorial you will have a complete setup and knowledge to experiment with these powerful chips !
What you will learn ?
- MPLab as a powerful IDE.
- HI-TECH C for PIC18 MCUs as a powerful C Compiler.
- Creating a new HI-TECH C project in MPLab.
- Write a C Code to blink LED and compile it to get a HEX code.
- Configure the MCU for proper oscillator selection.
- Basic Use for PIC development board from eXtreme Electronics
- Burn the HEX code to MCU using eXtreme Burner PIC from eXtreme Electronics.
- Use the programmed MCU to actually blink the LED !
So lets get started !!!
First get these stuffs
- Microchip’s MPLab IDE or Integrated development Environment. This is the central tool from where you can access most of other tools, like the C Compiler. This also lets you create and edit program files and projects. Download this from Microchips Web site and Install it in your computer.
- HI-TECH C Pro for PIC18 MCUs – This is will compile the high level human readable programs (in C Language) to Machine Language Instructions (contained in a HEX file). You will not interact directly with this software instead the MPLAB will use it internally. Actually this is a commercial software but a fully functional demo is available. The demo has only restriction that codes are not highly optimized. Not a problem for startup hobbyist!
- eXtreme Burner PIC – This hardware + software tool is used for burning(uploading) the HEX file to the microcontroller chip. This is a USB Based programmer with GUI interface so it is very easy to install and use.
- If you have made a Simple Serial Port Based PIC Programmer as discussed here then you need this nice program from Mr Christian Stadler. This is similar to eXtreme Burner PIC but serial port based and the hardware can be made easily.
Creating your first project with MPLAB + HI-TECH C.
After installing the above tools open MPLAB IDE from desktop Icon or Start Menu. You will get a main screen similar to this.
From the Project Menu Select Project Wizard.
The Project Wizard will come up that will help you easily create a C Project. Click Next.
On the next screen select the Microcontroller you want to use. in our case select “PIC18F4550” and Click Next.
After that select what tool suit you want to use this project. There are many C Compilers for PIC18 (from different vendors) and also many people use assembly language, so this step is required.
As we will be working will HI-TECH C, select that from the list. Do not touch any other fields in this dialog. Just select Active Tool Suit = HI-TECH Universal ToolSuit. as shown in image below.
Now Select select a suitable folder for your new project. I recommend create a Folder Named MPLAB (To save all MPLAB project in one place) and then create subdirectories in this folder for each new project. Like use C:\Your Name\MPLAB\LED\ for this led blinky demo. Now show the project wizard the path to this folder so it can create a project file here. See the next image.
For more detail: PIC Development Board – Hello World Project