SETTING UP/CHANGING A PROJECT

4.7 SETTING UP/CHANGING A PROJECT

You can use the following steps to create a new project manually (using the Project Setup Wizard is recommended) or change an existing project's settings.

• Create a New Project • New Project Window • Setting Up a Project – Set Up Language Tools • Setting Up a Project – Choose Toolsuite • Setting Up a Project – Add Files • Setting Up a Project – Set Build Options • Setting Up a Project – Save and Build

4.7.1 Create a New Project

To create a new project in the current workspace: • Using Windows Explorer, create a directory for your project (e.g. C:\Proj1).

• In MPLAB IDE, select Project>New. The New Project dialog will open asking you the name and location of the new project.

• Enter the Project name, e.g., Proj1. • Enter the path to your new project. Click Browse to locate your directory. • Hit OK. The Save Workspace As dialog will open.

To save the workspace with the new project in it: • Enter the Workspace name, i.e., cnt452.

• Hit OK. MPLAB IDE will create a project file with the extension .mcp and a workspace file with

the extension .mcw.

4.7.2 New Project Window

If it is not already open, open the Project window by selecting View>Project. The workspace name should be visible in the top bar of the Project window. The name of the project should be visible inside the Project window at the top of the display. A tree structure listing file types will appear below.

FIGURE 4-2:

EXAMPLE PROJECT WINDOW

DS51519A-page 68

 2005 Microchip Technology Inc.

Projects and Workspaces

4.7.3 Setting Up a Project – Set Up Language Tools To add language tools for use in the project, select Project>Set Language Tool

Locations or right-click on the project name in the Project window and select Set Language Tool Locations from the pop-up menu.

• Click on a registered tool in a toolsuite to select it. • Type in the “Location” or browse to the location of the tool executable by clicking

Browse. • Repeat this for each tool you wish to use in the project. • When you are finished, click OK.

Now you will need to assign a toolsuite to the project.

4.7.4 Setting Up a Project – Choose Toolsuite

To select a toolsuite for use in the project, select Project>Set Language Toolsuite or right-click on the project name in the Project window and select Set Language Toolsuite from the pop-up menu.

• Select your project toolsuite from the “Active Toolsuite” list. • Click OK.

The toolsuite you use will depend on the device for which your are developing code. • Microchip language tools – for PICmicro MCU, Microchip memory and K EE L OQ

devices • dsPIC language tools – for dsPIC devices • Third Party tools – for various Microchip devices

4.7.5 Setting Up a Project – Add Files

You will now add files to the project. The basic types of files that are included in a project may be seen by clicking on the “+” sign to the left of the project name in the Project window.

Note: You may enter the name of a file that does not yet exist. However, before you can build the project, you must create the file with a text editor such as MPLAB Editor.

To insert files in the project, select Project>Add Files to Project or right-click on the project name in the Project window and select “Add Files” from the pop-up menu. Additionally, if you know the type of file you will be adding, you may right-click on that type in the project window and select “Add Files” from the pop-up menu.

• The Add Files to Project dialog will open. • Click on a file or enter its name to select it for insertion. If you do not see your

file(s) listed, open the drop-down list under Files of Type to select the appropriate type of file. If you are unsure, select All Files (*.*).

• To select multiple files for insertion, use either Shift-Click to select a continuous

range or Control-Click to select several discontinuous files. • Click Open.

 2005 Microchip Technology Inc.

DS51519A-page 69

MPLAB ® IDE User’s Guide

4.7.6 Setting Up a Project – Set Build Options

MPLAB IDE has default settings for tools and files contained in a project. However, you may want or need to modify these settings.

To set build options, select Project>Build Options>Project or right-click on the project name in the Project window and select Build Options from the pop-up menu.

• The Build Options dialog will open. • Click the General Tab and enter or Browse to paths for output files, include files

library files or linker script files. Note: These are MPLAB IDE paths. Not all language tools use this information.

• Click a specific language tool tab (e.g., MPASM Assembler) and set up operational features for that tool.

• Click OK. To override project settings for a particular project file, e.g., ProjFile1.asm, select

Project>Build Options>ProjFile1.asm or right-click on ProjFile1.asm in the Project window and select Build Options from the pop-up menu.

• The File Settings dialog will open. • Click a specific language tool tab (e.g., MPASM Assembler) and set up

operational features for that tool. • Click OK.

4.7.7 Setting Up a Project – Save and Build

At this point you should save your project by selecting Project>Save or right-clicking on the project name in the Project window and selecting “Save Project”.

Now you are ready to build your project. Right-click on the project name in the Project window and select “Build All” from the pop-up menu.

• For MPASM assembler, a status window will open showing you the progress and final outcome of the build. It will close when complete.

• The Output window will also open. This will contain information about the build, including any errors encountered

If your project does not build successfully, please check the following items and then build the project again:

• Check the spelling and format of any code you entered in the editor window. If there are reported errors in the Output window, double-clicking on an error will indicate the corresponding line in your source code with a green arrow in the gutter of the source code window.

• Check that the correct language tool is being used for the project and for the project files.

Upon a successful build, the debug file ( *.cod or *.cof) generated by the language tool will be loaded. This file allows you to debug using your source code and view your

variables symbolically in Watch windows.

DS51519A-page 70

 2005 Microchip Technology Inc.

Projects and Workspaces