How Compile and Run a MPLAB's project

From ErikaWiki

Revision as of 09:29, 31 January 2012 by Salva (Talk | contribs)
Jump to: navigation, search

Introduction

To compile and run the example you should download the MPLAB IDE v8.66 or later. Then please download the compiler C30 (a C version compiler for dsPic). For install MPLAB IDE and C30 Compiler please follow the instructions present on the Microchip web site.

EasyLab Project Packet

We take as example the Easylab Software Packet. It contains the follow files:

  • easy-lab-demo-project.mcp: is the MPLAB's project file.
  • easylab.c: is demo library C file.
  • easylab.h: is demo library header file.
  • main.c: is the project main file where is called the library API.
  • cof: is a directory where is placed an programmable cof file ready to be programmed (without compile the project).

Put these files in a your working project directory.

MPLAB IDE

Now please launch the Microchip Mplab ide from your 'Start Program'.

Microchip Mplab ide

Now click on Open Project and select the project where it was decompressed.

Open the EasyLab demo project

In Menu -> Configure -> Select Device please select the device dsPIC33FJ64MC802.

Open the EasyLab demo project

Now in the Menu -> Project -> Select Language Toolsuite select the Microchip C30 toolsuite and its location in the your file system.

Select Language Toolsuite
  1. Connect your Easylab with supply-communication cable and connect you microstick board with programmer cable to your computer
  2. select dsPIC33FJ64MC802 as target device ([Main Menu] Configure -> Select Device...)
  3. Choose your Toolsuite (Microchip C30 Toolsuite), eventually give the path to the tools if MPLAB IDE is not able to found them by it self.
  4. Create a new Project file browsing for the previously created project directory and giving a name to project file in "Save Project As" dialog.
  5. Add all Easylab Library files at your project.
  6. After click next until the end of wizard you could uncomment all needed compile defines at begin of easylab.h file or add them to your project build options ([Project CONTEXT MENU] (right click on the project) -> [ITEM] Build Options... -> [TAB] MPLAB C30 ->[GROUP] Preprocessr Macros -> [BUTTON] Add) .
  7. Build your project ([Project CONTEXT MENU] -> [ITEM] Build All).
  8. Select Starter Kits programmer ([MAIN MENU] Programmer -> [SUB MENU] Select Programmer -> [ITEM] Starter Kits)
  9. Open a Serial Terminal (e.g. Putty.exe, HTerm.exe). Configure the port, baud rate (115200),data bits(8 bit), stop bits (1 bit) and parity bits (none). DON'T enable CTS. Connet to the channel.
  10. Program your board ([MAIN TOLLBAR] ->[BUTTON] Program (It should have been appeared after you selected the programmer))
  11. Enjoy the kitt effect and a nice stadium choir. :)
  12. Look at your serial teminal, you should get the example instruction on the console.
  13. Have fun with it. :D
Personal tools