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.
Conclusion
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.
|