Note (13 Oct 2003): I recently found out about a PIC programming tool called Odyssey. Odyssey has a big advantage over Broccoli18: It programs all PIC micros, not just the 18F series. Another advantage is its use of the generic ppdev parallel port interface under Linux. (I'm told that the direct port I/O my program uses might cause problems). So if Broccoli18 doesn't work for you, try Odyssey.
Broccoli18 is a suite of PIC18F programming tools. This software will program a Microchip PIC18F-series microcontroller from your parallel port with a minimum of external circuitry. It is released under the terms of the GNU General Public License (GPL). The latest stable version is 0.7. The latest development version is 0.8pre1.
Broccoli18 includes the following programs:
To use this programmer, currently you will need a PC with a parallel port or serial port and a Linux-based or DOS-based operating system. Windows 95/98 will probably work, but Windows NT/2000/XP probably won't. In addition, you will need to put together the parallel port interface. You can do most of the work on a solderless breadboard, but you'll need to solder a little bit to make the parallel port connector. If you are not comfortable using a soldering iron, I'd recommend purchasing one of the commercial PIC programmers instead of using this one.
This software only works on Microchip microcontrollers with a part number that starts with the letters "PIC18F". For example, it will not work with a PIC18C252, PIC16F84, or PIC12F675. Please don't try it. The PIC18C may be supported in the future. The others will probably never be supported.
Specifically, the following chips should in theory work with Broccoli18: PIC 18F242, 18F248, 18F252, 18F258, 18F442, 18F448, 18F452, 18F458, 18F1220, 18F1320, 18F2220, 18F2320, 18F4220, 18F4320, 18F6520, 18F6585, 18F6620, 18F6680, 18F6720, 18F8520, 18F8585, 18F8620, 18F8680, 18F8720.
Broccoli18 has been tested and found to work with the following chips: PIC 18F252, 18F442, 18F452, 18F458, 18F1220, 18F1320, 18F2220, 18F2320, 18F4320, 18LF4320. Please send me a message at email@example.com if you get it working with another chip.
Broccoli18 supports low-voltage and high-voltage ICSP (in circuit serial programming). In low voltage mode, the pins PGM/RB5 and Vpp/MCLR are controlled through the parallel port. If you prefer to program the PIC at high programming voltage, then leave Vpp unconnected to the parallel port, and instead connect a 9V battery between Vpp and ground. If you plan to use only high-voltage mode, PGM/RB5 does not need to be connected to the parallel port either. You do not have to do anything special in software to switch between high-voltage and low-voltage mode. The software always toggles the parallel port lines corresponding to Vpp and PGM, but nothing should be hurt if they are not connected.
By default, the programmer uses the parallel port pins shown in the table below during programming. You may change this pin assignment to suit your needs by editing the file "portcfg.h" and recompiling.
|PC pin name||PC pin number||Function|
You can implement the hardware of your programmer any way you see fit, just by connecting to the appropriate signals of the parallel port. In the case of my parallel port, I was able to get by with the circuit below. You may want to put buffers between the parallel port and the PIC. Be sure to get your connections right since you could zap a parallel port pin or a PIC I/O pin if you aren't careful. The 220-Ohm resistor protects SDATA and D0 when they drive opposite voltages. I calculated the current (3.3/220 = 15 mA), consulted the specs, and decided that the parallel port and PIC could handle it. Be sure to adjust this value if your parallel port or PIC are operating at a different voltage than mine.
Note that the circuit above will not work with everyone's parallel port. If you would like to design your own programmer with correct buffering, David Tait's classic programmer is a good starting point. While that programmer was designed for the 16F84, it will work with the 18F family with a few pin placement changes. I recommend looking at this example of a Tait-style programmer that will work with 12F, 16F, and 18F micros.
Finally, if the simple circuit above works for you, you may also be able to get by with powering the PIC directly from an unused parallel port pin. One user got it working this way. Check the datasheet for your particular chip to make sure that programming mode current won't exceed what your parallel port can handle. Powering the chip this way is potentially dangerous to your hardware so please make sure you know what you are doing first.
Broccoli18 now supports programming through the serial port. If you have Ponyprog or another similar serial programmer, you can edit portcfg.h to match your hardware interface. Download version 0.8pre1 and let me know how it works for you.
The latest stable version is release 0.7. This release adds some requested features like Vdd and tri-state control, and a configurable power-on delay. It also fixes a bug in writepic which would affect you if your hex files don't start at address 0.
There is also an experimental release 0.8pre1 that adds serial port support. So if you use a serial port programmer such as Ponyprog, try it out. Even if you use a parallel programmer, please test it out and let me know how it works for you.
German Schuager contributed a port of Broccoli18 to Windows XP. His port will probably work with some other versions of Windows. You may need another piece of software to allow direct access to the parallel ports. Porttalk, which is non-free software, will do this for you. First get Porttalk then download broccoli18-0.7.zip. You will need to use the "allowio" command before the broccoli18 command name. Example: "allowio 0x378 readcfg.exe". The modified source files are available.
There are also DOS executables of version 0.5 available. Source code is also available. To use the DOS version you may need to get csdpmi5b.zip from DJ Delorie's website. I don't have time to test the DOS versions any more, so I'm not planning to update this zip file with new releases. If someone else wants to maintain the DOS version, let me know.
Send me a message at firstname.lastname@example.org if you have any questions, if you find a bug, or if you want to help. The number one thing you can do to help is trying the software then sending me a message telling me what processor you used, what OS, what kind of connections, and whether you got it working.Back to Dave's software page