09-06-2012, 11:35 AM
UAV DevBoard: Getting Started with PIC Programming
UAV DevBoard.pdf (Size: 95.43 KB / Downloads: 0)
Download and install the IDE and C compiler
You should install the IDE before you connect the ICD2 to your computer, otherwise plugand-
play will get confused and will try to install the ICD2 without having the drivers that it needs.
After you install MPLAB IDE, download and install MicroChip’s C compiler. It is available
under the same area as the IDE, under MPLAB C compilers. Click on MPLAB C compilers, and
scroll to the bottom of the downloads list. Download and install “MPLAB C Compiler for dsPIC,
Evaluation Version”. This is a free download. To get it, you will need to register with MicroChip.
The only difference between the free evaluation version of the compiler and the purchased
version is that after 60 days, the optimization options turn off. However, you do not need the
optimization options, so it does not matter. You should also download the reference manual for
the compiler. You can find it under the Design->Technical Documentation->User Guides,
“MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs Users Guide.” Depending on how
deeply you intend to get into the programming of the dsPIC, there are also reference manuals on
the dsPIC30F4011 hardware and programming model that you can download.
Programming the UAV DevBoard
You are now ready to program your board. It is shipped with self-test firmware already
installed. To do something more interesting, you will probably want to program it with something
else. There are several programs available on the main page of UAV DevBoard, including demos,
MatrixNav, and AileronAssist. Decide which one you want to start with, download it, and unzip
it. Then, do the following. Some of the steps can be done in a different order, as you gain
experience, it will become clear to you which ones can be shuffled around. Much of it is
“common sense”.
Writing and debugging your own firmware
At some point you may want to write your own firmware, in which case you will want to do
some debugging. The process is similar to that of programming, except that you select DEBUG
instead of RELEASE in the IDE toolbar, and you work from the debugger menu instead of the
programmer menu.
There are two debugging functions available to you that you can select from the debugger
menu, either MPLAB SIM or MPLAB ICD2. MPLAB SIM allows you to debug your firmware
without using any hardware. It is very useful in the early stages of firmware development,
particularly when you just want to validate your math. MPLAB ICD2 debugs your firmware
while it is running in your hardware. You can set breakpoints, start and stop your program, and
read and write to memory locations.