MPLAB C18 Tutorial - Setting up a new C18 project and creating an application - Creating a new project

Creating a new project

Once you have the IDE installed, run it.

First thing we will do is create a new project.

Untitled-4

Figure 1 - MPLAB IDE and its Project Wizard

 

On the Project Wizard, click

next

to proceed to Step One.

 

bg_18f452

On the Step One dialog window, select your device. Again please notice in figure 2 that 18F452 is selected for this tutorial.

Untitled-5a

Figure 2 - Project Wizard Step One: Select a Device

 

Once you selected your device, click

next

to proceed to Step Two.

 

Here is where you select your Active Toolsuite. Make sure Microchip C18 Toolsuite is selected in the Active Toolsuite window. For me it was selected by default.

Untitled-5b

Figure 3 - Project Wizard Step Two: Select an Active Toolsuite

 

Click

next

to proceed to Step Three.

 

For now, we will use this step to create a new project file. This is where it gets a bit tricky so please make sure you follow these steps carefully. Make sure the option to Create New Project File is selected. Once that is done, the field under that option will show the project file name. As you can see in Figure 4, there is only a file name with no extension and no path information. This is very important because if the path information is left out, the project file could be created in another location other than where we want it. This is where the folder structure we created earlier becomes important and where we will tell the project that the project file needs to be in that location.

It can be done with either of two ways. You can manually type in the path before the file name OR you can use the browse button to have the wizard help you find that location and build the path for you.

Untitled-5c

Figure 4 - Project Wizard Step Three: Create a New Project

 

Clicking

browse

will open the Save Project As file dialog window.

Untitled-5d

Figure 5 - Project Wizard Step Three: Save Project As dialog window

Notice in Figure 5 the folder structure I mentioned earlier. Remember that we are trying to keep the path as short as possible, which is why I created a folder structure close to the root.

Also please note this is on my system where I keep all my projects on a Linux network share. For beginners, or single system users, creating the mcu folder on their Windows install drive is quite alright, I.E. "C:\MCU".

 

Untitled-5e

Figure 6 - Project Wizard Step Three: Save Project As dialog window

 

Once you selected the proper folder, enter the file name as seen in Figure 6 and click

save

 

Notice that the path is now included in the file name. Now the project and all the files can be neatly contained in its own sub-folder.

Untitled-7

Figure 7 - Project Wizard Step Three: Path is now included

 

Click

next

to proceed to Step Four.

 

Since this is our first project, there are not any existing files we need to add to our project. It's worthy to note however that this step is very useful for future projects. For example, if you happen to write a header file that sets your configuration bits and are developing multiple projects for the same device, you can add that file to new projects without rewriting them. I use this technique extensively for all my projects which helps when you want to use special features with a device and have written proven code in the past for those features. Some careful coding of these header files can make them perform like building blocks for future applications and help speed development.

Untitled-5f

Figure 8 - Project Wizard Step Four: Adding Files

 

Click

next

to proceed to the Summary.

 

Untitled-5g

Figure 9 - Project Wizard Summary

 

Review the summary then click

finish

to create the project.