From Mech
Jump to navigationJump to search

The installation CD will walk you through installing 6 software components.


ICD in-circuit debugger and programmer

To program the PIC you need a USB device called an ICD-U40; ICD is an in-circuit debugger (and programmer). Download and install the drivers for the ICD from the CCS web page on the ICD-U40

The development cycle

The development cycle is quick. Write your source code (yourcode.c file) using the built-in editor. Compile it with Compile/compile. Load it onto the PIC with Compile/ProgramChip/ICD. That's it.

Don't start from scratch. Start with a simple program that works, such as FlashingLights.c

The CCS compiler does not keep good track of projects and source files, or at least not in a clear way. It is easy to think you are working on source file newcode.c while the compiler is still working with oldcode.c. To avoid such pitfalls, make a new folder for each C program you write. Put all the code, including interrupt routines and functions (subroutines), in just one ".c" source file. Do not use "save as" to change the name of the file you are working with, even for such a worthy purpose as saving along-the-way versions. Instead, close the compiler, make a new folder with your source code in it (and with a new name if you wish) and restart the compiler by double-clicking the source code file.

FAQ for the ICD

Often when programming a PIC repeatedly, the "program PIC" function will fail to find the ICD device on its USB port, and ask you to choose a COM port instead. Close the dialog, disconnect and then reconnect the ICD's USB cable, and now the "program PIC" function should work again. Annoying.

Sometimes the PIC will run when the ICD is connected, but inexplicably not run when the ICD is not connected. If this happens, try adding the NOBROWNOUT fuse at the top of your program, with the other fuses. We think this has something to do with a small change of supply voltage.

That short cable from the ICD to the PIC has 6 conductors, unlike telephone (4) or ethernet (8). It has to be short, or it won't work. The clips on the ends are on the same face of the flat cable; won't work if on opposite faces.