Site hosted by Build your free website today!

Temporary page

This is another temporary page that doesn't fit in with the rest of the site because I wrote it by hand and didn't integrate it with my site-management software (which awaits a rewrite before I do more with it). When I've sorted that out, it'll end up in another part of the site, at which point I'll put a link here to its new location.


Most of my electronics experimentation so far has been with a smallish breadboard, which is pretty handy for putting together simple circuits very very quickly (ok, quickly apart from bending up new wire links which is tedious, but at least you can reuse them). On the other hand, I'm now wanting to experiment with my PIC chips, and the first one I can really work with is the PIC16F873 (much much easier for me to program ATM- for one thing there's a woeful dearth of PIC programming software for Linux, and most of what there is either doesn't work with my programmer circuit or doesn't work with the other PIC chips I bought; I intend to sort that out after I've worked with this one).

Unfortunately, for various reasons that particular PIC chip would not really work well plugged straight into the breadboard (for starters, it's half as long as the board, which is a bit of a problem). And yet it remains the sort of chip that would be nicely suited to general experimentation and prototyping etc. So my plan, is to make a small stripboard-based circuit which holds the PIC chip itself and fulfills the various requirements that it needs to work (described later). Then the ordinary I/O pins that would usually be all you want to work with for a project, are brought out to either a header or a SIL socket or just a bunch of wires soldered in (the latter option would be kinda inflexible though).

Then, whatever pins you want to use for a project, you connect straight to where you want them in the breadboard circuit, and don't have to worry about whether the PIC itself has everything it needs to work, nor about pins you don't want to use interfering with random parts of the circuit that happen to be in that part of the board.

The initial version described here will probably suck quite badly, but the idea is just to get started. And I'm putting the page up partly for querying the PIC forums about whether it seems reasonable, partly for notes for myself, and partly for any other newbies that might find the design worthwhile. So it's a bit long. For the benefit of those other newbies though, I'll point out that the PIC 16F873 is apparently pin compatible with the 16F876 (the latter just has more memory). I'm not sure if they're also pin-compatible with the 873A and 876A chips though.

Things the circuit must do

I mentioned that the PIC chip has various requirements. These include (I may have forgotten some):

Here's a little block diagram-cum-schematic I knocked together in XFig for the board. It's a bit rough but it gives you the general idea for the initial version. Overall it's more like a simplified version of the pin diagram in the datasheet with some extra bits tacked on, but this circuit doesn't exactly do much.

Version 1 of the Experiment Board

I also drew it before I thought very hard about the !MCLR problem, so it shows it set up to give a reset button. I guess it might still be compatible with the programmer when the switch is open, if the resistor is big enough, but otherwise I'd probably replace that part with just a jumpered link to Vdd.

Supply Pins

As mentioned already, various things must be done with the supply pins: Both grounds must be joined together, and the ground and Vdd must have a bypass capacitor put across them as close to the chip as possible. Unfortunately with stripboard, this is still a bit awkward, and I had to think about it a bit even after asking on a forum (I think maybe I didn't word my question very well). But I came up with this after a while.

Supply pin detail

Bypass caps

This version features two bypass capacitors- one for each ground pin. That might be overkill, I really couldn't say. If only using one capacitor, then where should it go? The one at the top right of the diagram would be mechanically sound but a bit far from the other ground pin. One between the DIL rows (like the one shown or positioned higher up) should be electronically better, but mechanically awkward, having to be on the track side of the board. Apart from the question of it making the board need feet to prevent it sitting on the capacitor, it could be somewhat tricky to solder.

As the message from people in the Microchip forum seemed overwhelmingly to be along the lines of "don't sweat the small stuff", I'm going to take the approach of using just the one capacitor on the component side of the board, and then adding in another on the other side later if troubles seem to crop up. As the PIC goes in a socket, I should be able to take it out again when I do the soldering.

The usual value chosen for bypass caps seems to be around 100nF- and I'm going to choose exactly that, because I have no other sizes of ceramic capacitor above 10nF but that. I have a bunch of poly film caps at 68nF each, but their leads are too far apart for these tracks. Actually, the 100nF's leads are really at a 0.2" pitch rather than 0.1", so even they will be quite awkward to fit...

In fact, in the course of writing this I've realised that I can only just about fit these caps in diagonally if I want the pins to go in adjacent holes. Trying to get them into horizontally adjacent holes would contort the leads of the capacitor far too much. So in fact, I might as well just put the cap on the bottom of the board after all! Hopefully it won't be a problem.

The link

Note that the wire link connecting the ground pins together, is on the component side of the board, where it lies just under the DIL socket- so it can't be too thick. It might even be worth trying to cut a tiny bit of a groove into the board to help recess the wire, but that might be too much bother.

The diagram also shows on the left, the path that the link would have to follow if it was on that side of the board: if it went directly, it would almost certainly short to the Vdd track. Even if it went the way illustrated, it could easily short against the other surrounding tracks, as the breaks in stripboard are rarely very wide. And no, insulation on the wire would not really work out here- the wire's too short, and the solder would be right next to the insulation. You'd simply end up with a rubbery mess and a short.

The Oscillator

RC Oscillators in PIC seem to have frequencies that are not quite so directly based on the RC time constant like with 555 timers- or perhaps I've just misunderstood the graphs- but they still go faster as you reduce the resistance or capacitance. Unfortunately aside from the stability issues with them, it seems they're only considered workable within a fairly limited range of component values, and the PIC datasheets say that going above 4MHz with such an oscillator is not recommended (even though you can go quite a bit higher with other types).

So I picked a 68pF capacitor to be reasonably fast but not too unstable, and a 4K7 resistor even though that's sorta pushing what they recommend, because the next higher I have past that would be 10K and that'd be pretty slow. The graphs suggest, based on the figures shown for values around the ones I chose, that this might give a clock speed of about 2MHz. If it was simply 1/(R*C) Hz, then it'd be about 3.1 MHz instead. Either way, this is fast enough to be comparable to the standard processing speed of most PICs, and slow enough that there's little risk of overclocking it (the 873 can go up to 20MHz).

Other possible issues

Apparently it's not a good thing to have supply tracks form very large loops, because then when the currents flow in them they act more inductor-like! Or aerial-like. Or something. Anyhow, because of this it seems they recommend keeping supply tracks together rather than on opposite ends of the board like breadboard designs tend to do. I think this sort of thing may be hard to avoid very well, but I guess it's probably worth trying a bit.

Building the damn thing

I should get around to that really. When I have I think I'll put some photos up perhaps. Next though, I have to properly make a design for the whole stripboard before I go cutting tracks.

Last edited: Thursday August 10th, 2006