Alternative titles:
Getting started: PIC18F67J60 using MPLAB IDE X and C18 compiler ;
Getting started: Olimex PIC-P67J60 using MPLAB IDE X and C18 compiler
Getting started using MPLAB X IDE
I have recently started a project using Microchip’s PIC18F67J60, and to use that I have bought myself an Olimex PIC-P67J60, which is a development board based around the PIC18F67J60. More information about it, pictures as well as buying information can be found at the following address:
https://www.olimex.com/Products/PIC/Proto/PIC-P67J60/
As I was trying to set the project up, I realized that the board as well as the MPLAB IDE X environment lacks a good ‘Getting started’ guide. So I thought I would write a bunch of tutorials to guide me as well as others in setting the process up. I also noticed that most of the PIC related advice is based around the older MPLAB IDE versions, mostly MPLAB IDE 8.xx.
Here are the items you will need to get the project going:
- Olimex PIC-P67J60
- Something to power the board. The board can be powered using a 9V Battery adapter, which can be bought easily or built using these instructions: http://www.instructables.com/id/9-Volt-battery-adapter-for-Arduino/. The link also includes a buying source, so you can buy them pre-assembled. However, this is a very common part and should be easily available from any electronics supplier.
- The MPLAB IDE that can be downloaded from the following link: http://www.microchip.com/pagehandler/en-us/family/mplabx/
- A programming device that will allow you to install the firmware/program on to the PIC. I am using the PICKIT3.
- And obviously, a computer that will allow you to install the software on it as well as provide you with a USB/serial port to allow to interface with the device.
- I have also bought and downloaded the C18 compiler, and installed it. More information and options on the compilers can be found at the following link. The C18 LITE compiler is free and offers most functionality: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en534868&redirects=compilers
and more information on the compiler itself can be found here:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010014
Once you have downloaded and installed MPLAB IDE X, it is advisable to plug in the programmer to make sure that the hardware drivers are installed for the programmer as well.
Now, to finally get started, run MPLAB IDE X.
First thing to do is to start a New Project. This can be done by using the ‘Getting Started’ section, clicking on the New Project icon (shown below) or going to File > New Project.
This brings up a new Window which allows you to set a new project up. Follow the following steps:
-
Choose Project > Microchip Embedded > Standalone Project. Hit Next
-
Choose your device. Under Device, scroll down or type PIC18F67J60. Hit Next
-
Under Header, choose None. Hit Next
-
Select Tool > PICKIT3. Choose a different programmer if you have a different programmer.
-
The above means that the JTAG Plugin Board will be skipped.
-
Select Compiler > C18. If you chose to install the C18 Lite compiler, choose that instead.
-
Select a suitable name for your project and a location, and hit Finish.
-
Your project is now ready to be used, and on the left you will see a Toolbar with your project name and options under it such as Header, Important Files, Linker, Source, Libraries, Loadable.
First thing to do is to right click on Source Files and add a new file. To do this, right click on ‘Source Files’, go to New > C Source File. Enter a suitable name for the file. -
Add a header file to your project. This is done by Right clicking on Header > , ‘Add Existing Item’ and browse to where the ‘P18F67J60.h’ file is. This is found under where you installed your C18 compiler. For me it exists under \Program Files\Microchip\MPLABC18\V3.42\h\.
-
Last but not the least, you have to add a Linker file for your project. This is found under the same directory section in the following path: \Program Files\Microchip\MPLABC18\V3.42\bin\LKR\ and choose the file 18F67J60_g.lkr.
Now your project is ready to take code in, but before then, the PICKIT needs to be connected to the board. The design means that either a pin to pin connection can be made between the two, or the PICKIT can actually slide on to the connector (some pushing is required), making sure that the arrow (indicating pin number 1) is near the resistor R17.
This should cover all the software and hardware set up to run this project. The next few posts will cover some software aspects.