MPLAB X IDE PROJECTS 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 68
MPLAB X IDE Projects What is a project? Definition A Project is defined by a collection of files within a specific directory structure used by MPLAB X IDE to keep track of all files, settings and configurations required for the development of an embedded application. Output of a Project is a programmable HEX file for a single PIC MCU Projects inputs include source files, header files, and --- libraries A project is a hierarchical set of directories which ---- contain, or point to directories containing, all the information needed to create a single PIC MCU HEX file 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 69
What is in a project Files kept and specified by MPLAB X IDE projects: Source files (code and headers) Intermediate build files Files used for Debugging Finished HEX output file(s) Miscellaneous project configuration details Instructions for building the Project 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 70
How a Project is Stored Example My Documents Embedded Tutorial Sample_Project.X build dist nbproject Makefile Project Location =...\Embedded Tutorial\ Project Directory = Sample_Project.X Intermediates Directory (*.o files) Output Directory (*.hex and *.elf files) Project Settings Directory Instructions to buld the project build and dist directories are created when the project is first built 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 71
Project Source Files Example of Placing Source files INSIDE of a project directory.. Sample_Project.X build dist nbproject Makefile Source Files do not have to be kept in the project directory source files can be anywhere!! Adding Source files to the project directory can facilitate backup and distribution. Source Files 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 72
Project Source Files Example of Placing Source files OUTSIDE of a project directory.. Sample_Project.X build dist nbproject Source Files do not have to be kept in the project directory source files can be anywhere!! Makefile Source Files 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 73
Project Creation MPLAB X IDE Projects require the following information: The PIC MCU to be used Location where the project directory will be created Software tool needed to build the project The programmer/debugger used The source files Code, Headers and Libraries 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 74
Project Creation Starting the process Select the New Project Icon 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 75
Project Creation Project Types Select the Microchip Embedded from Categories Select Standalone Project from the Projects Window 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 76
Project Creation Device Selection Select the PIC MCU being used for the Device menu Mechatronics board uses the PIC16F917 Select Next 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 77
Project Creation Debug Header If you require a debug header you will asked to select one. The PIC16F917 Does Not require a debug header Select Next 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 78
Project Creation Hardware Tool Click on the serial number below the name of the tool you are using. Select the Simulator if no Debugger programmer connected If you don t see a serial number under a PICkit3, ICD or Real ICE then it either isn t connected to the system or there is a problem with the driver. Select Next 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 79
Project Creation Compiler Selection Select the mpasm assembler. Later projects will use the XC8 compiler. Select Next 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 80
Project Creation Project Location 1) Browse to the desired project location 3) Select Finish 2) Enter the name of the new project Project Folder will auto-populate 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 81
Directory Structure after Project Creation You should now see a project tree under the Projects tab. This project tree will have no source files 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 82
Directory Structure after a Project has been Created Empty Project Tree System Files Lab1.X You should now see a project tree under the Projects tab. This project tree will have no source files 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 83
Directory Structure after a Project has been Created Empty Project Tree System Files Lab1.X You should now see a Adding a file to the project tree under the Project Directory Projects tab. This DOES NOT add it project tree will have no to the project source files 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 84
Adding Source Files to a Project Right click on the Source Files folder and select Add Existing Item from the popup menu 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 85
Adding Source Files to a Project Select the file source placed in the project directory and click Select 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 86
Adding Source Files to a Project File is Added to the Project Tree 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 87
Removing Files From a Project secondfile.c.c is unwanted file Right click on the File you wish to remove from project then select Remove from Project from the popup menu 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 88
Removing Files From a Project File is Removed from Project Tree 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 89
Modifying Project Properties Open the project's properties Right click on the top node of the project in the project tree Select Properties from the popup menu Bottom of world's longest popup menu 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 90
Modifying Project Properties Project Properties Window show the properties which can be modify Commonly modified properties include: The MCU used The Compiler (with version) being used Programmer - debugger being used MPLAB X IDE simulator and Lab Center s Proteus Software simulator are both listed under Hardware Tools 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 91
Invoking the Editor You should now see the Source file listed in the project tree under the Source File directory. x2 Double-click on the source file to open it in the editor 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 92
Editing a File The file will open in the Editor Window User types changes to the code Code changes are saved in one of two ways: 1) The Save All Files button is pushed 2) The project is built 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 93
Building a Project 1) Push Build or Clean and Build 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 94
Building a Project 2) Results of build process displayed in Output Window 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 95
Correcting a Build Error If an error is found during a build Double Click on the error message 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 96
Correcting a Build Error The Editor Window will open up showing the line with the error Error Stripe shows relative position in file of all errors and warnings Active Parser shows errors in red before compilation Parser shows all warnings in 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 97
Question: Knowledge Check After a project has been built, in which subdirectory will you find the production HEX file? Answer: the dist sub-directory 2013 Microchip Technology Incorporated. All Rights Reserved. 17002 DEV Slide 98