I've been watching all the babble about the "PIClist Beginners Kit" (PBK) going back and forth. Mostly I've kept my mouth shut because I don't intend to contribute towards its design. (I think the collective resources spent will exceed the cost of a Picstart+ for everyone who will buy a PBK). I also doubt it will ever be produced because everyone wants it to be according to their own vision. The discussion already seems to be going in circles with everyone talking, nobody listening, and nothing being decided. (Yes, Byron, we know you think it should be boot loader based. I figured that out after the first 10 times you said it. Point noted. Do we really need to hear it an 11th time?) Anyway, all this talk of programmers made me wonder what it actually takes to program a PIC. So far I've always used a Picstart+ for development and a bootloader once when the customer wanted field upgradeable firmware. I've got some projects coming up that will probably require one PIC to program one or more others, so I had added reason to look into it. To start with, I made a list of the reasonable "hobby" PICs. These are PICs that are suited for small volume personal use accross multiple projects. For that kind of application, it makes sense to get the full feature versions. There is no point in saving $.50 on a stripped down PIC when you only buy 5 of them, and you might want to use it in a different project next month. Hobby PICs are therefore mostly the biggest bestest you can get in the various DIP package sizes. The hobby PICs are: 16F628 - Most capable flash part with 18 pins. 16F876 - Best 16F part with 28 pins. 16F877 - Best 16F part with 40 pins. 18F252 - Best 28 pin PIC actually available. 18F452 - Best 40 pin PIC actually available. I included the 16F876 and 877 only because a great deal of existing code and support is available for them. I expect they would be dropped from the list as the 18F parts become more common. So, how are these parts programmed? It turns out that these 5 parts require 3 different algorithms and have 2 different pinouts. If you can program these 5 parts, you can actually program any 16F62x, 16F87x, 18Fxx2, 18Fxx8, and possibly others but I haven't looked. It would be nice if any of the supported parts could be plugged into the same 40 pin ZIF socket and programmed without the user needing to switch jumpers or the like. To see if this is possible, I made a list of all the pins used accross all the parts. Fortunately none of the pins collide in an incompatible way. Since unused pins are set to high impedence and ignored during programming, the various pins used for the same thing accross parts can just be wired together. The only gotcha is that MCLR is on pin 1 except for the 16F628 where it is on pin 4. Pin 4 isn't used by the other parts during programming, but MCLR must be raised to 13V, which would damage any pin except MCLR. The programmer needs to detect this case and drive the appropriate pin to 13V. With all this in mind, I wanted to see what kind of hardware it would take to implement a basic programmer. The schematic I came up with is at http://www.embedinc.com/pic/prog.pdf. I'd be interested to hear if I missed any gotchas from those who have been down this road before. THEORY OF OPERATION The programmer is controlled by a 16F628 (IC3) which talks to the host over a serial line via a standard RS-232 converter chip (IC4). Serial line is the only viable choice for a simple programmer, mostly because it's the easiest to control from app level software. The vast majority of machines have serial ports, and those that don't can easily and cheaply add a USB serial port. I envision the controller taking care of the specific programming details, and the host sending mostly address/data information. This information gets used on the fly and is not stored. The bandwidth of the serial port greatly exceeds the flash programming bandwidth, so this does not reduce performance. Q5 and Q4 (top right corner) form a circuit to test whether anything is plugged into pin 10. This is to distinguish between 18 pin devices and larger devices. The only supported 18 pin devices are the 16F62x which require the programming voltage on pin 4. All the other chips are larger and require the programming voltage on pin 1. If a PIC is plugged in at pin 10, then the protection diode of that pin will drop the pin voltage to a bit over 5V. This causes Q5 and then Q4 to turn on. Q4 drives RB0 low, which has the internal pullups enabled. The net effect is that RB0 is high for chips with more than 18 pins and low for chips with 18 or fewer pins. IC1A and IC1B each form a separately controllable 13V source. The firmware enables at most one of these at a time, depending on what kind of chip is plugged in. Q3 and R6 limit the current to around 100mA as specified by Microchip. The power line (VDD) to the chip being programmed can be continuously controlled from 0 to 5V. This is done using the PWM output RB3. This is low pass filtered by R13, C1, R14, and C2, then unity amplified to low impedence by IC2A and Q6. The purpose of this is to allow the firmware the option of verifying the programmed data at different supply voltage levels. Microchip strongly recommends that the data be verified accross the operating voltage range, although they only do this in the Promate programmer and not in the Picstart+. The firmware could ignore this and simply set RB3 high to power up the chip. The extra few parts to allow varying the supply voltage are so cheap that it doesn't seem worth leaving them off. The chip is programmed using the PGC (clock) and PGD (data) lines. These are connected between the controller and the chip being programmed by 10K resistors. This is to limit the current thru the protection diodes when the chip being programmed is being operated at a different supply voltage from the controller. This will slow the rise and fall times a bit, but overall performance won't be effected much because it is dominated by the flash programming time. Sean, if you're still reading this far down, I'm curious what kind of production cost you think a board like this would take. Most of the parts are generic and can be substituted for locally available similar parts. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu