This is only a preview of the December 2005 issue of Silicon Chip. You can view 37 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Building The Ultimate Jukebox; Pt.1":
Articles in this series:
Articles in this series:
Items relevant to "Universal High-Energy Ignition System; Pt.1":
Items relevant to "Build A MIDI Drum Kit; Pt.2":
Items relevant to "433MHz Wireless Data Communication":
Items relevant to "PIC In-Circuit Programming Add-On Adaptor":
Purchase a printed copy of this issue for $10.00. |
PIC In-Circuit
Programming
Add-On
By KEITH ANDERSON
Does your PIC programmer have provision
for in-circuit programming? Some such
as Microchip’s PICSTART Plus don’t but
you can add this useful function to your
programmer by building a simple adaptor!
O
FTEN, THE EASIEST way to program a PIC is to remove it from its
circuit and plug it into an appropriate
programmer. However, when developing new projects, this can become a
real chore and so professional developers use a range of tools that allow
programming and even debugging
without removing the micro from the
application circuit. Microchip refers
to this method of programming as
In-Circuit Serial Programming (ICSP).
WARNING!
This adaptor was designed and
tested for use with Microchip’s PICSTART Plus programmer, which
allows all PICs to be inserted with
pin 1 aligned to pin 1 of the programming socket.
Some low-cost programmers
lack this flexibility and require the
smaller PICs to be inserted with
pin 1 in some location other than
the socket’s pin 1. This unit will not
work with this type of programmer!
96 Silicon Chip
While not all low-cost programmers support in-circuit programming,
some can be modified to do so. Hobby
programmers are usually supplied as
kits, so it is often possible to solder
wires to appropriate places within the
circuit for connection to the application circuit’s ICSP header. However,
this method is not general to all programmers.
The method used here is to plug
an adaptor into the socket on the programmer. The adaptor picks off the
programming signals and makes then
available for connection to the application circuit, just like a “real” ICSP
programmer. The programmer still
“thinks” it is programming a PIC in the
socket, when in fact it is programming
the PIC in the application circuit.
connections, which are: DATA, CLK,
MCLR/VPP, VDD, and GND. The suggested connector layout (Fig.1) uses
a 6-pin dual-in-line header (Farnell
302-1427), with a spare pin available
for other uses.
The circuit example in Fig.2 shows
how the connector might be hooked
into your PIC-based designs. Note that
a switch must be inserted in series with
the positive supply (VDD) to the PIC,
so that either the application circuit
or programmer can provide power. By
controlling power to the PIC micro,
the programmer is able to generate the
necessary supply sequencing during
the programming cycle.
A 3-pin jumper could be used in
place of the switch to save money
and minimise use of board space.
The switch (or jumper) must be
downstream from all filter/decoupling
capacitors and positioned as close as
possible to the PIC’s VDD pin.
ICSP adaptor
The circuit for the adaptor is shown
in Fig.3. The large 28-way header
Adding programming support
If your PIC-based project is to support in-circuit programming, then you
must include a suitable connector
on the PC board to accept the ICSP
signals from the programmer. A minimum of five connections is required
to carry the ICSP and power/ground
Fig.1: if you want to program your
PIC in-circuit, you must include an
ICSP header on your board. Here
are the recommended pinouts for
the header.
siliconchip.com.au
Fig.2: this simplified circuit shows how to include the ICSP
header in your projects. If the RB6 & RB7 port bits are used
as inputs or to drive low-impedance outputs, some form of
isolation will be required, otherwise the CLK and DATA signals
from the programmer will be overloaded. In some cases, this
can be as simple as two 1kW resistors. If possible, don’t use
RB6 & RB7 for any other purpose in your design – that way,
you won’t need to add isolation circuitry.
Fig.3: the circuit for the adaptor. Note
that the ICSP signals for each family (8,
18 & 28/40-pin) originate from different
pins on the programming socket.
(comprised of J1 & J2) plugs into
the programmer’s socket, with the
ICSP signals made available on
one of three 6-pin headers (J3-J5)
for connection to the application
circuit, depending on the type of
PIC in use.
Somewhat fortuitously, Microchip assign the pins required for
This view shows how the 28-way header
the ICSP functions consistently, so
pins protrude through the PC board.
that most of the range of PICs can
be grouped into just three families:
8-pin, 18-pin and 28-pin (to the
very simple; just make sure that you
programmer, 40-pin PICs look like
insert the 6-pin headers (J3-J5) into
28-pin PICs).
the PC board the right way around.
A 6-pin header is provided on the The arrow on the header must line up
adaptor for each family type. Con- with the square pad (pin 1) on the PC
nection to the application circuit is board in each case.
made with a short length of 6-way IDC
A cunning trick is needed to install
cable, terminated on each end with a the two 20-way SIL header strips (J1 &
6-way IDC socket (Farnell 302-2109). J2) when using a single-side PC board.
Unlike some ICSP adaptors, the use of Insert each header “upside down” in
a specific header (rather than jumpers its holes, so that the long ends of the
or switches) for each family of PICs pins protrude from the underside of
provides a simple visual indication the PC board (see photo).
of correct device selection!
A little extra pin length can be obtained by pushing each pin through
Assembly
the plastic until the top is flush
A PC board (coded 07112051) is with the top of the plastic. Obviavailable for this design. Assembly is ously, this must be done before the
siliconchip.com.au
Fig.4: overlay diagram and full-size
PC-board pattern for the adaptor.
Ideally, the adaptor should be
produced in double-sided, platedthrough PC board technology, but it
can also be assembled on a singlesided board with a little trickery.
pins are soldered to the PC board.
The ICSP cable must not be more
than 300mm long, although 190mm
is recommended for best results. The
prototype was tested with a PICSTART
Plus programmer and a couple of repSC
resentative circuits.
December 2005 97
|