This is only a preview of the January 2001 issue of Silicon Chip. You can view 34 of the 96 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 "The LP Doctor: Cleaning Up Clicks & Pops; Pt.1":
Items relevant to "The WaveMaker: An Arbitrary Waveform Generator":
Items relevant to "2-Channel Guitar Preamplifier, Pt.3":
Items relevant to "Digital Reverb - The Missing Pages":
Items relevant to "PIC Programmer & TestBed":
Purchase a printed copy of this issue for $10.00. |
Got a concept you’d like to try before building a full
prototype? New to microcontrollers but want to learn more
about them? This combined PIC programmer and test bed
could be just what you’ve been looking for.
PIC TestBed
Easy PIC programming and prototyping.
Design by Barry Hubble
Article by Peter Smith
Please note: The PicProg software described in this article is outdated
and will not work on recent model PCs. A suitable alternative is WinPIC,
which can be obtained from http://people.freenet.de/dl4yhf/winpicpr.
html. Before use, configure WinPIC to use an interface type of “COM84
programmer for serial port” and select the correct COM port from the
drop-down list. These settings can be found on the “Interface” tab.
LO RES TO BE
REPLACED
I
f you’re a regular reader of Silicon
Chip, you’ll have noticed more and
more microcontroller-based projects appearing in our pages – especially
those using PIC microcontrollers.
76 Silicon Chip
These little devices are extremely versatile, allowing much more
functionality to be packed into less
space than is possible with traditional components. Just as importantly,
they’re cheap and easy to obtain, and
are well supported with a wealth of
free development tools and example
applications.
Back in the March 1999 issue, we
described a simple PIC programmer
all? One reason might be to really slow
PIC can sink and source up to 25mA at
that has proved very popular. Although
down the action so that you can “see”
its port pins (PICs rule, OK?).
it includes a LED chaser circuit that
what is happening on the PIC’s I/O
To accommodate the two popular
can be used to demonstrate PIC opport pins. This could be very handy
LCD hardware interfaces, the PC board
eration, it really is little more than a
for tracking down elusive bugs or even
has been designed to allow installation
programmer.
for learning PIC basics.
of single or dual row headers (CON3
This new design integrates a proTo ensure orderly startup each time
and CON4). The pinouts are compatigrammer with support for several
power is applied, the PIC includes
ble with the “Hitachi” standard as used
popular I/O (input/
on virtually all alphanumeric LCD
output) devices, along
modules. Trimpot
with header pins givVR3 provides disFeatures
ing access to each
Supports PIC16C84, PIC
play contrast (also
16F84 and PIC16F84A mic
rocontrollers
individual port pin.
Simple programming via
called
viewing anWindows-based software
Space prevents
gle) adjustment.
ZIF (zero insertion force)
socket provides easy PIC
us from describing
Note that no provichip insertion & removal
Clock source can be crysta
PIC microcontrollers
l, resonator or variable RC
sion
has been made
oscillator
Header pins allow easy acc
in detail, so we’ve
ess to all port lines
for connecting LCD
Basic serial (RS232) inte
assumed that you
back-lighting, as this
rface included
have at least a baLCD module support
tends to vary consic knowledge of
siderably between
8 LEDs for PIC outputs (RB
0-RB7), jumper selectabl
the subject. If we
e
manufacturers.
Variable voltage on RA0
(fo
r PICs with A-D inputs)
lose you, don’t be
RA0 (pin 17) and
Push button input on RA
disillusioned; vast
1
RA1 (pin 18) of the
Reset button
quantities of (free)
PIC have been nomiinformation for exnated as receive (RX)
perts and beginners
and transmit (TX)
alike is available on the Internet (see
internal reset circuitry. Our circuit
data for the serial inlink list below). If you prefer hardcopy,
adds an external RC network and
terface. Alternatively,
the larger technical bookshops can
pushbutton switch (S2) so that you
these pins can be configured as variable
often help, too.
can reset the chip without having to
voltage and momentary switch inputs,
You might also like to review the
remove power each time you want to
depending on the positions of JP13
Silicon Chip March 1999 PIC Prorestart your program. Diode D2 isolates
and JP14.
grammer project, which describes the
the reset circuit from the programming
Whoa, what’s the variable voltage
PIC16F84 in a little more detail. This
interface but more on that shortly.
input for? Let’s just say that it can be
issue is still available – see page 75 for
used for other 18-pin PICs, such as the
ordering details.
Input and output devices
PIC16C71X series, which include onA whole string of jumper pins on
board A-D converters. The programCircuit description
the board allows selection of one of
ming software doesn’t support these
For ease of description, let’s break
two functions for most of the PIC’s
devices, however.
the PIC TestBed circuit into three secinput/output pins. In addition, the
Connection to the serial interface
tions, as follows:
jumper pins can be used to gain easy
is made via an on-board 9-pin ‘D’
1) Life support (power, reset and
access to the port lines for connection
connector (CON2). We’ve called it a
oscillator)
to prototyping circuits, etc. Jumper
“simple” serial interface because it
2) Input and output devices
wires for this purpose can be fashioned
doesn’t support hardware handshak3) Programming interface
from matrix pin sockets, heat-shrink
ing. RTS/CTS (pins 7 & 8) and DSR/
tubing and light-gauge hookup wire.
DTR (pins 6 & 4) are simply looped
Life support
Alternatively, you can purchase the
back to signal an “always ready” conReferring to Fig.1, you can see that
ready-made Basic Stamp jumper kit
dition. Conversion between the +12V
a typical 3-terminal regulator (REG1)
from Dick Smith Electronics (Cat
and -12V levels on the RS232 lines and
together with a sprinkling of filtering
K-1406) or MicroZed Computers.
the PIC (which works on 0-5V levels)
capacitors and a polarity protection
Port pins RB0 - RB7 can be indiis achieved with IC1, a MAX232. The
diode (D1) provides 5V power to the
vidually jumpered to drive the LEDs
MAX232 includes an on-chip charge
circuit.
(LED1 - LED8) or in conjunction with
pump voltage converter to boost the
PICs have an internal clock oscilpins RA2 - RA4, an LCD (Liquid Crystal
+5V supply to the higher RS232 levels,
lator that requires only an external
Display) module. Note, however, that
eliminating the need for separate +12V
crystal, resonator or RC network. All
it is possible to have both the ‘a’ and
and -12V supplies.
three of these options are provided for
‘b’ jumpers installed together, as the
on the Test Bed, with JP12 selecting
Programming interface
PIC can drive both the LEDs and LCD
between the crystal/resonator and the
without problems.
The most important feature of the
RC network. Trimmer pot VR2 allows
As you can see, the LEDs are conPIC programmer we described in the
you to quickly tune the RC network to
nected directly to the PIC’s port pins
Silicon Chip March 1999 issue was its
the desired frequency.
(via jumpers JP4 - JP11) without drivers
simplicity. In fact, the designer calls
Why bother with an RC network at
or buffers. This is possible because the
it the “No Parts PIC Programmer”. Of
·
·
·
·
·
·
·
·
·
·
·
January 2001 77
78 Silicon Chip
Fig.1: the PIC programmer and test bed. It’s
easy to build and just as easy to use!
LO RES TO BE
REPLACED
Fig.2: follow this component overlay as an aid in assembly. The order is given in the text.
course, it does have a few components.
In fact, it has more than this design!
First up, we should mention that
PICs are programmed in a serial data
format, requiring only two signal
lines and a programming voltage. To
enter programming mode, the MCLR
pin is raised to 12-14V. Data to be
programmed is then presented in a
serial stream (one bit at a time) on RB7
and clocked in with pulses on RB6.
The data format and timing used is of
course important and is described in
detail in Microchip’s “In-Circuit Serial
Programmers Guide”.
Microchip calls this programming
method “ICSP”. All this means is that
PICs can easily be programmed (or
reprogrammed) while they are plugged
in to the end product.
On the PIC Test Bed, the MCLR, RB6
and RB7 pins are routed to a 5-pin
header (CON5). In programming mode,
these become the VPP, CLK and DATA
signals, respectively. 5V (VDD) and
GND (VSS) are also made available on
the header. A number of commercial
programming adapters are available
that will plug directly into this header.
This not-quite-same-size pic (no pun intended!) can be used in conjunction with
the component overlay above when constructing the PIC TestBed.
Fig. 3, the artwork for the board label which can be photocopied and glued to
the board, as seen above.
January 2001 79
Parts List: PIC Test Bed
1 PC board, code 07101011, 124 x 172mm
1 SPST PC-mount pushbutton switch
1 SPST tactile switch
1 2.5mm PC mount DC socket
1 9-pin female right angle PC mount ‘D’ connector
2 40-way dual row 2.54mm headers
1 40-way single row 2.54mm header
1 40-way header socket (Altronics cat P-5390 or sim.)
1 single row machine pin socket strip (6-way or larger)
24 jumper shunts
1 16-pin IC socket
1 18-pin ZIF (zero insertion force) IC socket
1 9V or 12V DC 300mA plugpack
Semiconductors
1 MAX232A RS232 driver/receiver (IC1)
1 PIC16F84, PIC16F84A microcontroller (IC2)
1 78L05 5V regulator (REG1)
9 5mm red LEDs (LED 1 - LED9)
1 1N4001, 1N4004 1A diode (D1)
1 1N5819 Schottky diode (Altronics Cat Z-0040) (D2)
1 4MHz parallel resonant crystal (X1)
Resistors (0.25W 1%)
1 100kΩ
3 4.7kΩ
1 470Ω
9 390Ω
1 100kΩ miniature horizontal trimpot (VR2)
1 10kΩ miniature horizontal trimpot (VR3)
1 5kΩ miniature horizontal trimpot (VR1)
Capacitors
1 470µF 25V PC electrolytic
1 10µF 16V PC electrolytic
1 0.47µF monolithic ceramic
8 0.1µF monolithic ceramic
2 15pF ceramic
But we’ve got an easier way!
A tiny adapter board containing just a header plug and
three resistors are all that we need (see Fig.4). The adapter
board also provides termination for a serial cable that connects to your PCs serial port.
How does such a simple scheme work? Well, the 12V
signal levels on the RS232 interface are just what we need
for the programming voltage. But what about the CLK and
DATA signals, which should only be 5V maximum? The
PIC clamps its port pins internally and with the aid of the
4.7kΩ resistors, current flowing into the pins in limited to
a safe level.
The Microchip people would surely frown on this method of programming their chips but we’re assured that in
practice it works just fine (at least, in a hobbyist situation).
A word of warning, though. Some serial ports, such as
many found on older model laptops, do not generate true
RS232 voltage levels. Signal levels may only reach between
about 5V to 10V, which is clearly too low for the PIC programming voltage.
The remainder of the magic is performed by Windows-based software, which reads your assembled PIC
program code and drives the serial port lines in the necessary
sequence to perform the programming.
By the way, you will need to remove jumpers from JP10
and JP11 before connecting the programming adapter so as
not to overload the signal lines. This also prevents potential
damage to the LCD from the higher voltage levels present.
Assembling the board
Begin by checking the board for defects, in particular
around CON3 where the tracks and pads are quite tightly
Additional parts for programming adapter
1 PC board, code 07101012, 20 x 45mm (optional, see
text)
1 9-pin or 25-pin female ‘D’ connector
5-core data cable, length as required
1 small cable tie
Heatshrink tubing
Additional parts for LCD (optional)
1 alphanumeric LCD module
150mm 14-way rainbow or IDC ribbon cable (see text)
2 14-way IDC sockets (Altronics Cat P-5314) (see text)
Fig.4: here’s the circuit for the programming
adaptor which can be built on the PC board
as illustrated below (Fig. 5), or even as
part of the cable (as shown
overleaf).
Misc.
200mm 0.71mm tinned copper wire
6 4G x 12mm wood screws or self tappers
1 190mm x 140mm wooden photo frame
4 small stick-on rubber feet
Where to get the parts
The only part that could present a problem is the 18-pin
ZIF socket. We found a source at Futurlec (www.futurlec.
com). A good selection of PIC chips, crystals and resonators can be found at MicroZed Computers. Jaycar,
Dick Smith Electronics and Altronics also list a few
types of PICs as well as LCD modules.
80 Silicon Chip
Fig.5: the component overlay for the programming adaptor.
Fig.6: samesize artwork
for the adaptor PC board.
Table 1: Useful PIC Resources On The Internet
www.microchip.com
The PIC manufacturers.
Check here first!
www.geocities.com/SiliconValley/Way/5807
Very comprehensive PIC
resource list.
home.iae.nl/users/pouweha/index.shtml
How to control an LCD
(the source of the LCD code
in TESTBED.ASM)
www.microzed.com.au
Commercial site (Australian)
www.dontronics.com
Commercial site (Australian)
spaced. Using Fig.2 as a guide, install
the five wire links, followed by the
resistors, diodes and capacitors.
Note that capacitor C1 forms part of
the RC oscillator and can be socketed
for easy replacement. On the prototype,
we snapped off a 3-pin section of a machined-pin socket strip for the job, then
cut off the bottom of the middle pin.
The crystal (X1) can also be socketed
in the same manner.
If you intend using a ceramic resonator rather than a crystal, you will
note that there is no connection for the
middle (ground) pin of the three-legged
variety. No problems were found using
resonators up to 10MHz without the
ground connection.
The socket for IC1 can be installed
next, but don’t plug in the MAX232
chip just yet. Follow this with all
LEDs, trimmer pots, switches and the
3-terminal regulator (REG1).
All the jumper pin sets, as well as
the LCD and ICSP connectors need to
be made by cutting sections from the
longer header strips shown in the parts
list. The jumper pins (JP1 - JP14), as
well as the pins marked “GND” (next
to JP14), are made by cutting off two
pairs of pins for each jumper pair.
For the LCD interface, either CON3
(dual row header) or CON4 (single row
header) can be installed, depending
on which type of connector your LCD
module supports.
To hook up the LCD, a short length
of ribbon cable (no more than about
150mm) is required. For single-row
connector styles, you can make up the
cable using a length of rainbow cable
and two 14-pin header sockets. Once
again, these are cut down from the
40-pin length shown in the parts list.
For dual-row connector styles, use IDC
ribbon cable and IDC sockets instead.
Observe antistatic precautions when
handling LCDs as they are particularly
static sensitive.
Install the ZIF socket (IC2) as the
final step. Before plugging in IC1,
apply power and use a multimeter to
check that the 5V supply rail is OK. A
good place to do this is between pin
15 (GND) and pin 16 (VCC) of the IC1
socket.
The parts list specifies a MAX232A
Fig.7: same-size artwork for the PC board, as viewed from the copper (ie, non-component) side.
January 2001 81
Table 2: Some Of The Relevant Literature Available From Microchip
Document No.
DS30262C
DS30277C
DS35007A
DS51025D
AN555
AN587
Description
PIC16F8XX EEPROM Memory Programming Specification
In-Circuit Serial Programming Guide
PIC16F84A Data Sheet
MPLAB IDE, Simulator, Editor User’s Guide (includes tutorial)
Software Implementation of Asynchronous Serial I/O
Interfacing to an LCD Module
for IC1. The ‘A’ at the end essentially
means that the four charge pump
capacitors (C2-C5) can be as small as
0.1µF, whereas on the non-‘A’ version,
they are usually about 10µF. However,
the non-‘A’ version works fine with
0.1µF capacitors up to around 64kb/s.
also try TESTBED.ASM, which combines the LED chaser with an LCD test.
It also provides an excellent example
of how to program LCDs.
So far we’ve only mentioned the
.ASM, or assembly language versions
of these programs, which must first be
assembled into machine code before
they can be programmed into a PIC.
Despair not, we’ve also included
the assembled versions (DEMO.HEX
and TESTBED.HEX), all ready to be
“burnt”. Which leads us to the programming software.
A freeware program called PicProg
handles the programming side of
things (see Figs.9 and 10). PicProg
runs on Windows 3.x and Windows
95/98, on any hardware with a 486DX
processor and above.
There are no special installation requirements; simply unzip PICPRG06.
ZIP into your folder of choice, and set
up a shortcut to the PICPROG.EXE file.
By the way, all of the software mentioned (with the exception of MPLAB)
The programming adapter
The only parts needed for the programming adapter are three 4.7kΩ
resistors, a length of 5-core cable, a
9-pin (or 25-pin) female ‘D’ connector
and a 5-pin header socket.
If you wish, you can use a PC board
to mount the resistors and the header
socket and to terminate one end of
the cable.
Alternatively, you can dispense with
the PC board altogether and solder
the resistors “in-line” with the header
socket and cable. Figures 5 and 8 show
how to construct the adapter using
either method.
As shown in our photos, we used
a rather unconventional method to
“house” the prototype; a wooden photo
frame fitted with rubber feet! If you
don’t like this idea, you could use plastic stand-offs or even large rubber feet.
It’s a good idea to label the jumper
pins, too. We’ve included a simple
label (Fig.3) that you can photocopy
and stick on.
Software
The software of choice for PIC
program development is MPLAB, a
complete collection of all the tools you
need to edit, assemble and debug PIC
code. Best of all, it is available free of
charge from Microchip, on the web at
www.microchip.com
If you don’t have a lot of PIC programming experience, you might
like to use the little programs we’ve
adapted for testing the completed
board. First of all, there’s DEMO.ASM,
a simple LED chaser that will check
out the 8 LEDs.
If you’ve connected an LCD, you can
82 Silicon Chip
Fig.8: alternative programming adaptor, with no PC
board required. Be sure to insulate all components!
Experienced PICers Read This!
PicProg was developed as a
16C84 programmer. There are a number of small but important differences
between the 16C84 and the newer
16F84 and 16F84A PICs that need
to be considered.
The most obvious differences
exist in the Configuration word. The
polarity of the PWRTE bit is inverted
in the F84/F84A, so selecting this
fuse in PicProg (ticking the “PWRTE”
box) when programming a F84/F84A
causes the Power-up Timer to be
disabled.
Bits 4-13 of the Configuration
word are designated as Code
Protection bits in the F84/F84A.
However, on the C84, only bit 4 is
significant.
We’re unsure how PicProg handles undefined bits, so selecting the
Code Protect fuse may not result
in protection. You can, of course,
perform a read after programming; if
the resultant data is invalid (all zeros,
for example) then code protection is
working.
We were able to successfully
code protect our test PICs.
The different Configuration
word masking also means that
PicProgs checksum computation
will be incorrect on both the F84
and F84A. Most would consider this
insignificant.
The author has no intention of updating PicProg to specifically support
the F84/F84A.
However, we are aware of a
second freeware programmer,
called ICProg, which does support
the newer PICs and is compatible
with the TestBed. We were amazed
by the enormous range of options
provided by ICProg, but in use found
that it was unable to successfully
program EEPROM data memory
in a PIC16F84A (we tried version
1.03A).
If this problem is ironed out,
ICProg could be well work a look.
Check it out at www.h2deetoo.
demon.nl
’Nuff said. Our tests convinced
us that PicProg effectively programs
both types of chips!
Fig.9: the main programming screen: you should see this
when you run the PicProg.exe program. As you can see, all
parameters are set from this screen . . .
is downloadable from the SILICON CHIP
website, www.siliconchip.com.au
After launching PicProg, select Setup from the main menu and choose
which serial port you’ve connected
to the TestBed (see Fig.10). Next, load
the code (.HEX) file that you want to
burn, then select the appropriate Fuse
options. These are fully explained in
. . . except the port parameters which are shown
on this screen (fig. 10). It gives you the option of
changing the port – and it also remembers which
port you’ve set next time around.
the PIC data sheets (hint: select “XT” if
you’re using a 4MHz crystal). Finally,
hit the Program Chip button, and if all
goes well, programming will complete
in a matter of seconds!
PicProgs on-line help includes a
couple of useful tips, so check these
out if you get stuck. Note that the
Test Bed programmer is compatible
with the “LudiPipo” programmer
mentioned throughout the PicProg
documentation.
All credits for PicProg go to Tord
Andersson, who has been kind enough
to make his software available to all for
non-commercial use.
Well, that’s about it for this project.
SC
Happy PICing!
OMPONENTS
Order by phone: 08 9479 4850
RADIAL ELECTROLYTICS
(16V)
1-9
10+
1uF
$0.26
$0.22
2.2uF
$0.26
$0.22
3.3uF
$0.26
$0.22
4.7uF
$0.28
$0.24
10uF
$0.30
$0.26
22uF
$0.32
$0.28
33uF
$0.35
$0.28
47uF
$0.38
$0.30
100uF
$0.38
$0.30
220uF
$0.40
$0.32
330uF
$0.50
$0.45
470uF
$0.55
$0.50
1000uF
$0.70
$0.55
2200uF
$0.90
$0.70
3300uF
$1.35
$1.10
4700uF
$1.50
$1.20
AXIAL POLYESTERS
(630V)
1-9
10+
0.001uF
$0.60
$0.50
0.0022uF
$0.65
$0.55
0.0047uF
$0.65
$0.55
0.01uF
$0.70
$0.60
0.022uF
$0.85
$0.75
0.033uF
$1.40
$1.25
0.047uF
$1.55
$1.35
0.1uF
$1.70
$1.45
0.22uF
$1.85
$1.60
0.47uF
$2.50
$2.20
RADIAL ELECTROLYTICS
RADIAL ELECTROLYTICS
(25V)
1-9
10+
(50V)
1-9
10+
4.7uF
$0.22
$0.18
10uF
$0.22
$0.18
10uF
$0.22
$0.18
22uF
$0.22
$0.18
22uF
$0.22
$0.18
33uF
$0.38
$0.30
33uF
$0.33
$0.26
47uF
$0.38
$0.30
47uF
$0.38
$0.30
100uF
$0.60
$0.50
100uF
$0.42
$0.32
220uF
$0.75
$0.60
220uF
$0.55
$0.45
330uF
$0.80
$0.70
330uF
$0.60
$0.50
470uF
$1.20
$1.00
470uF
$0.65
$0.52
1000uF
$1.50
$1.20
1000uF
$0.90
$0.70
2200uF
$2.80
$2.00
2200uF
$1.30
$1.00
4700uF
$4.30
$3.75
3300uF
$1.85
$1.45
4700uF
$2.60
$2.00
Fax: (08) 9479 4417 Email: capacitor<at>bigpond.com
Snail mail: PO Box 437, Welshpool, WA 6986
Aust. Post – $0-50 = $5.00; $51-100 = $7.50; $101-500 = $9.50
ABN: 70-032-497-512
Air Express: <3kg = $11.00; 3-5kg = $16
RADIAL POLYESTERS
(630V)
1-9
10+
0.001uF
$0.35
$0.32
0.0022uF
$0.35
$0.32
0.0047uF
$0.35
$0.32
0.01uF
$0.38
$0.32
0.022uF
$0.42
$0.38
0.033uF
$0.65
$0.55
0.047uF
$0.65
$0.55
0.1uF
$0.90
$0.80
0.22uF
$1.00
$0.90
0.47uF
$1.25
$1.10
24-hour online ordering: www.direct-components.com
MAINS CABLE
– BROWN COTTON COVERED
1-9 PRICE
10+ PRICE
$2.80
$2.20 per metre
DIAL CORD – 0.6mm Per mtr
1-9 PRICE
10+ PRICE
$0.75
$0.50
PLAIN VALVE BOXES
SMALL
MEDIUM
LARGE
Order by phone: 08 9479 4850
$0.30
$0.35
$0.40
AXIAL ELECTROLYTICS
1-9
10+
10uF <at> 450 volt
$2.60
$2.00
22uF <at> 450 volt
$3.35
$2.80
47uF <at> 450 volt
$7.44
$6.30
22uF <at> 50 volt
$0.55
$0.50
Don't put up with poor service,
poor prices and poor range:
Direct Components gives you
exceptional service, the best
possible price and huge range.
Try Direct Components once:
you won't be disappointed!
Contact me for Personalised
Service.
Kevin Chant,
Direct Components
$0.27
$0.32
$0.37
24-hour online ordering: www.direct-components.com
Order by phone: 08 9479 4850
24-hour online ordering: www.direct-components.com
IRECT
[ COMPARE OUR PRICES to your current supplier!
[ LET US PROVE TO YOU that we will save you $$$$!
[ 100% AUSTRALIAN OWNED – AND PROUD OF IT!
[ RETAILER/RESELLER ENQUIRIES WELCOME!
24-hour online ordering: www.direct-components.com
24-hour online ordering: www.direct-components.com OR CALL (08) 9479 4850
January 2001 83
|