Search this site (

CCS C Compiler for Microchip PIC micros

Your ad here


Tips to reduce development time by 20% and programming errors by 10%

There are two pieces of hardware that will make your PIC programming style a lot more powerful. Of course, the first one is an in-circuit-debugger, such as the MPLab-ICD or the MPLab-ICE2000. The benefits of these are well known. You can place breakpoints at any point, and have a look at variable values, and what program paths are taken. I will not talk too much about this, as everyone knows how useful they are.

The second piece of hardware is extremely useful.

In my experience, this piece of hardware has been instrumental in reducing errors in my code by 10%, and development time by 20%. Heres what this piece of hardware can do for you:

        ·         Turn any spare pin on your PIC micro pin into a detailed debugging tool.
        ·         Allow you to download a new program into your PIC16F87x in 15 seconds, in-circuit.

Can you guess what this piece of hardware is? Its an RS232-to-PIC serial adaptor.

Reducing development time by 20%

A bootloader is a lot quicker than a chip programmer. Instead of waiting a few minutes for a PICStart Plus to program, you can program it in-circuit in 15 seconds. It also reduces wear and tear, you dont have to take the chip out of the circuit each time for programming.

Check out a more detailed explanation of the bootloader page.

In my experience, the extra feedback reduced bugs by 10%

You simply use statements like:

putst("Variable x is ");putchdec(x); //send output to computer
c=getch(); //get keyboard input from computer

The result is shown in the screenshot below.

The advantage of printing debugging messages is that it gives a history of whats been going on in a program. You can also easily get a lot of data out of the program, for example an EEPROM dump. This is difficult to do with an emulator.


For development, use a combination of an in-circuit emulator, and a serial link.

The Software

The bootloader page contains the bootloader software.

For debugging, you need is to connect the PIC micro to a serial port on your computer. To get examples of source code for serial comms routines, go to the bootloader page and download the bootloader file. Its got examples of source code in it.

The Hardware

You can build the hardware yourself. Here is the PAS12 serial adaptor page.

This site is non-profit. Ad revenue almost covers hosting costs.

We welcome any suggesions or comments! Send them to Shane Tolmie on This site is a completely separate site to, and is maintained independently of Microchip Ltd., manufacturers of the PIC micro. All code on this site is free for non-commercial use, unless stated otherwise. Commercial use normally free, however, it is prohibited without contacting for permission. All content on this site created by Shane Tolmie is copyrighted by Shane Tolmie 1999-2009. Click to advertise on this website - $29.90 for a banner ad which will reach 55,000 user sessions per month. One months free trial!