Vous êtes sur la page 1sur 10

Pic Programmer by Myke Predko

http://www.rentron.com/Myke4.htm

Build Your Own Programmer for the PICMicro with the "ELCheapo"
A Special "Thanks" to Myke Predko for submitting the following project/article. About the Author Myke Predko is the author of "Programming and Customizing the PIC Microcontroller", the "Handbook of Microcontrollers" and "Programming and Customizing the 8051 Microcontroller" as well as the soon to be released "PC PhD" and "PC Interfacing Pocketbook" which are all published by McGraw-Hill. As well as writing books on electronics and programming, Myke works for Celestica, Inc. in the area of New Products Test Engineering. His wife, Patience, and he have three children, Joel, Elliot and Marya. PICMicro Programmer with the "ElCheapo"

Since I first released this circuit for a serial PICMicro programmer, I have been getting lots of feedback from people that have been building it as their first PICMicro programmer. It has been really nice to hear comments from people about their experiences building the "El Cheapo" as well as questions and comments calling for enhanced capabilities. This is the fourth update to this article with a yet again modified version of the circuit to allow Serially Programmed EPROM PICMicros to be processed. The ability to program EPROM devices has been high on a number of people's lists. In the article below, I will be making some comments about what I have found out about EPROM programming versus EEPROM/Flash programming. If you have already built an El Cheapo, you will find that the modifications are very simple to make. Later in the article, I will outline what the changes are. I am anticipating that this is the last modification to the El Cheapo circuit design. This does not mean that the programmer will remain static. Over the next few weeks, I will be releasing the Gerber files for a "Bare Board" version of the programmer and I will be creating a Visual Basic Interface for Windows for the programmer. Please let me know if there is anything else, you would like to see added to this programmer design. If you have built an El Cheapo, I would appreciate it if you could send me some scanned in, or digital pictures of your programmer. I would like to add the pictures to this article to show other people the different ways in which the El Cheapo can be built. The "El Cheapo" PICMicro programmer uses a PC's "Parallel" ("Printer") port port to program and verify the contents of a PICMicro PIC16F84 microcontroller. The features of this programmer includes very low cost, a large amount of independance from differing PC hardware as well as a diagnostic utility to help new builders successfully create their own programmer with a minimum of support. I have heard back from users which have used the programmer with the original PC's (uni-directional) Parallel Ports as well as PC/AT "Bi-Directional" Ports and modern ECP/EPP Ports. I'm happy to say that I have achieved a certain amount of device independance with this design that I was looking for when I was designing the programmer for "Programming and Customizing the PIC Microcontroller". The code has been designed to work with as many of the different parallel ports in as many different implementations as there seems to have been released for the PC. In modern PCs, the Parallel Ports are normally at "base" addresses 0x0378 and 0x0278 of the PC Processor's I/O space. For some parallel ports (especially ones that are integrated with other hardware), port 0x03BC is used as the base address. I have updated the "ElCheapo" and "ElDebug" applications to check the internal tables in the PC for the correct I/O port address for the specified "LPT" number. The El Cheapo has generated quite a bit of interest from people. Checking over my email logs, I have received messages from over fifty people now that have built the programmer. Many of these people have suggested improvements to the programmer and over the last four iterations of the design of the card and the two software applications, quite a few of these changes has been made. The History of these changes are:

You 1 of 10 created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com) 17/03/2012 1:26

Pic Programmer by Myke Predko

http://www.rentron.com/Myke4.htm

Version 1.00 Version 2.00 Version 2.10 -

Initial Release of the Programmer Modification of the Programmer to not use D0 Pin Release of "El Debug" Test Application Modification to "El Cheapo" and "El Debug" software to work with PC Parallel Port "Table" addresses, rather than hard coded addresses Initial Version of the EPROM capable "El Cheapo". This was sent out to a limited number of people to test out the reset circuitry. The design used two 2N7000s and did not require changes to the elcheapo.exe and eldebug.exe applications The second 2N7000 was removed from the circuit and both elcheapo.exe and eldebug.exe were modified to work with reset which is inverted from the original design.

Version 3.00 -

Version 3.10 -

Click HERE for the "Version 3.10" Updated Files in .ZIP Format. The El Cheapo (like all Serial PICMicro programmers) will not work with the PICMicros which require parallel programming (the "Low-End" 16C5x and the "High-End" 17Cxx). For these devices, another programmer will have to be used. I should point out that the El Cheapo is considered by Microchip as a "Developmental Programmer" and not a "Production Programmer". For a programmer to be considered suitable for "Production", it must be able to program and verify the part at different voltage levels. I'm pleased with the versatility of the El Cheapo and how well it has worked for different people. As I indicated above, I think I have finalized the circuit design, but there are two upgrades I will be making in the coming weeks. They are: 1. Designing an embedded circuit board for the El Cheapo. The "Gerber" files for this board will be placed on this web page (as well as my own). The board will be designed for single-sided assembly, but I will be including a "Top Side" pattern for proto-shops like AP Circuits. No decision has been made on selling the boards - but if you are interested, please let me know and based on the interest generated in the boards we'll make a decision on whether or not to sell them. If you send me an email requesting the boards, please identify if you would like a kit of parts as well. 2. Creating a Visual Basic Interface application. This application will encompass both the "El Cheapo" Programmer software as well as the "El Debug" test application. As part of the interest generated by this project, I would be interested in getting photographs of your El Cheapos. If you have built one and have access to a digital camera or scanner, I would love to see one or two pictures of your creations that we will put on this page. The purpose of doing this will be to show the prototyping methods that you have used for others as well as list any modifications that you have come up with for the circuit that might be of use to others. This is the third version of the "El Cheapo" circuit. If you had built the previous version, then the following changes are made to the circuit to bring it up to the Version 3.1 standard: 1. Disconnect U1's (the Voltage Regulator) ground from the circuit ground and add two IN914 diodes between the voltage regulator ground and the circuit ground. These two silicon diodes will each "raise" the ground reference to the voltage regulator by 0.7 Volts. The two of them in series will raise the voltage regultor's ground referency by 1.4 volts. After doing this the voltage regulator will output 13.4 volts relative to circuit ground for the EPROM programming. 2. Disconnect the "_MCLR" (Pin 4) of U2 (The Programmed Part) from the drain of the 2N7000 transistor. Add a 2106a PMOS FET transistor with its drain connected to the 13.4 Volt Regulated Output, its gate to the drain of the 2N7000 (the connection that used to by to U2's _MCLR pin) and its source to U1's _MCLR. In my point to point wired prototype, I was able to make these modifications in about ten minutes. One of the aspects of the PICMicro that makes it very attractive for starting out with microcontrollers is the simple serial interface that is used to program the mid-range EEPROM ("Flash") and EPROM based devices. Along with Vdd (+5V) and Gnd, the Reset Pin ("_MCLR") and two I/O pins are used for programming the device. In the 16F84 (and other serially programmed PICMicros), these two pins are RB6 for "clocking" and RB7 for bi-directional "Data". The operation of the programming is quite simple. To set the device in "Program Mode", the "Clock" and "Data" lines are pulled low and "_MCLR" is driven to +12 Volts. Data is sent with a six bit "Command" and optionally followed by a sixteen bit "Word". This data is sent synchronously, with the "Data" value output before the "Clock" is strobed high. The data consists of the fourteen bit data word with a leading and trailing "0" sent or received to round up to sixteen bits. You can download Microchip's 16F84 programming datasheet from: http://www.microchip.com

You 2 of 10 created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com) 17/03/2012 1:26

Pic Programmer by Myke Predko

http://www.rentron.com/Myke4.htm

This document contains all the information needed to program the 16F84, including timing and the "Command" word definitions. For the programmer described below, this was the only reference that I used. Microchip has also provided Application Note 589 ("AN589") with their design for a simple Parallel Port Programmer which can be downloaded from: http://www.microchip.com along with all of Microchip's other Application Notes. If you don't feel comfortable with designing your own programmer, there are a number of different options that you can look at. These include: 1. 2. 3. 4. Microchip's "PICStart Plus" Programmer Commercial Universal Programmers (such as Needham's line) PICMicro Specific Commercial Programmers such as my YAP Designs from the Internet

When choosing which programmer to use there are a number of issues to consider. The ones that I feel that are most important are: 1. 2. 3. 4. 5. 6. Host device independance User protection Range of devices Complexity Cost Speed

When I wrote "Programming and Customizing the PIC Microcontroller", I worked through two previous designs for the PICMicro programmer that was included in the book before I settled on the "YAP" design. The reason why I went through the iterations was to try and come up with a design which would work on a large number of hosts (which is my term for PCs and workstations). The "YAP" is an interesting design because it can work with any device capable of sending RS-232 serial data. The programmer itself uses a "Voltage Stealing" RS-232 interface (the Dallas Semiconductor DS275) and provides an "intelligent" interface to a host which can be accessed by any terminal emulator that has a "Text" download capability. This allows the "YAP" to be used with any workstation that can create PICMicro ".hex" files and is useful if the workstation has a "PC Emulation" mode (like the Mac's "SoftWindows"). When I say "User Protection", I am referring to features which prevent the user from screwing up and not programming the device in the way in which they intend. When I first started working with the PICMicro, I was using the Microchip "PICStart 16B" programmer which forced the user to select different configuration flags for their application and did not pick up the configuration information from the .hex file. The default values were simply the flags left unprogrammed (in the "1" state) which is not very useful for virtually all applications. I found that I often forget to correctly set the flags and ended up having to go back and reburn the chip. When you're new, this is a real problem because you don't know if it is the application that is not working, the hardware or the programming. By providing an interface that automatically puts in the configuration bits as specified in the software, this potential problem is eliminated as a variable when you are trying to figure out why your application doesn't work. Along with the "YAP", the MPLAB-PICStart Plus combination provides this capability along with a number of the commercial programmers. Another area of "User Protection" I consider important is the restriction of making simple code changes or "patches" to an application. When I was first taught microprocessor programming, patches were discussed as an integral part of application debug/development. It is definitely true in this environment because application code was downloaded onto an audio cassette tape and then loaded into the microcomputer and was accurate about 25% of the time. For microcontrollers in a modern environment, I don't believe that this is still true. It is not substantially more difficult to burn the whole device with a changed application than it is to just change a few words. By changing the application, what you are trying out is explicitly and automatically documented. This means that when you find something that works, you have the code already changed. It also means that you will have to be very organized in how you try out different things to get an application to work. But, this is a good skill to develop. This is strictly my own opinion I would be interested in hearing if anybody else feels differently (and why). "Range of Devices" can be a very important point for selecting a device as well. Along with the "low-end" (which requires twelve bit output), I am now seeing more and more people start working with the PICMicro using the eight pin (12Cxxx) devices, instead of the eighteen pins which are traditionally used. The eight pin devices, use the same serial programming protocol as the 16F84. With the latest updates to the El Cheapo, you now have the flexibility to program all the Low-End and Mid-Range devices that have the five pin serial programming capability. Complexity is obviously a big issue if you are going to build the device yourself. The complexity of the "YAP" programmer is the reason why that it was decided that the "YAP" would only be available as an assembled and tested kit. I have worked with a number of people that have built their own versions and found it to be more difficult than most of them expected. If you are new at electronics, make sure that your interest in the PICMicro doesn't die with trying to get a programmer working. The cost of the programmer is a major concern for most hobbyists and many companies (both small and large). I have put this parameter so far down the list to make sure that the requirements for the programmer are well understood. Money and time is not well spent if you end up having to buy or build another programmer because the first one doesn't meet your complete set of requirements. In this regard, I always remember the old adage: "You get what you pay for and you pay for what you get".

You 3 of 10 created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com) 17/03/2012 1:26

Pic Programmer by Myke Predko

http://www.rentron.com/Myke4.htm

There are really two aspects of "speed" that you should be concerned with. The first is the speed of the programming operation. The minimum amount of time you can reasonably expect for a 16F84 to be completely programmed is less than 11 seconds. Many programmers take significantly longer than this due to data transmissions issues and explicit loops to ensure the application does not violate any of the programming specifications (for the 16F84, the programming operation of each word takes 10 ms). The second aspect of "speed" is the speed of the PC or workstation that you are working with. Modern Pentium architectures execute instructions out of different caches or memory, can run instructions in parallel or run at different clock speeds for different circumstances. As well, different PC architectures provide different internal interfaces to the programmer. This means that there is no reliable way of timing application execution in a PC. To counter this, the programmer must generate an internal timebase or use a standard timebase available to the interface. In the "YAP", I used the data speed coming in (1200 bps) to provide the 10 msec delay. This makes the programming quite a bit slower than the 11 second target, but it is reliable under all circumstances. For very simple programmers, ensuring that there are no timing problems, special timing operations are placed in the code to ensure that the programmer will work on all PCs. For many of these programmer designs, software updates have to be issued when new classes of PC processors become available. With the different issues discussed, I just wanted to take a moment and review a few of the different programmers that are available on the market before presenting a very simple one you can build in an evening with many parts you probably have around your workbench. Microchip's "PICStart Plus" programmer is probably the best programmer for somebody who wants to get into PICMicro programming. It is somewhat expensive, but can be bought at a cheaper price at Microchip's yearly seminars. The PICStart Plus (aka "PSP" and "PS+") can program all the PICMicro devices available and is continually updated with firmware updates from Microchip. The PICStart Plus also interfaces directly with Microchip's "MPLAB", which makes an excellent addition to the IDE. Another issue with the PICStart Plus is that it does not program Microchip's Serial EEPROMs, which is an annoyance for many people. I should point out that MPLAB is only designed to work with Microchip programmers, but this restriction seems to be loosening with third party devices becoming available with MPLAB device drivers. Commercial Universal programmers can be excellent, but tend to be quite costly (often $500 USD or more) and may not support new devices as quickly as the Microchip solutions. They are the preferred solution if devices other than PICMicros need to be programmed. Third-Party PICMicro programmers tend to be cheaper - typically in the $100 USD or less range with both assembled and tested programmers and kits available. These programmers can range in quality as well as ease of use. They are generally targetted for the 16F84 EEPROM (Flash) devices, but there are some available for other devices as well. There is a certain amount of "Buyer Beware" for these devices with cabling and power supplies having to be provided by the customer. Throughout this article, I have been discussing aspects about it and I should point out that along with the programmer, it includes all the parts needed to work through the "Experiments" Chapter of "Programming and Customizing the PIC Microcontroller" including a breadboard prototyping system and a "Wall Wart" Power Supply and Serial Cable. The last type of programmer available is one which you assemble from plans from magazines or the internet. This is the type of device that you will have to be most wary of. As I indicated above, many of these programmer's software has to be modified with new versions of the Pentium come out and maybe the author will get bored with supporting them. As well, there are quite a few available with the most famous being the "COM84":

You 4 of 10 created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com) 17/03/2012 1:26

Pic Programmer by Myke Predko

http://www.rentron.com/Myke4.htm

This programmer is clever because it "Steals" power from the PC's serial port. Software for this programmer can be found on David Tait's page (which I reference above). The issues with this type of programmer center around the variances in different PC and Workstation hardware. This circuit will not work for many people due to their PC's serial port not driving enough current to the PICMicro for it to program, problems with voltage output (RS-232 is a very loose specification) or timing differences in different PCs. For the rest of the article, I want to present my "ElCheapo" programmer (which is shown at the top of the article). This device only uses four more parts than the "COM84", although it does require a separate power supply. Its advantages are: Very low cost. I bought all the parts, except for the "Wall Wart" and Parallel Port Extension Cable from a surplus house in Toronto for less than $5.00 Canadian. You should be able to use either a surplus "Wall Wart" or one for less than $5.00. The "Parallel Port Extension Cable" that I used was a DB-25 Male to DB-35 Female "Straight Through" cable which cost me $7.00 Canadian. Many of the parts are available in hobbyist's parts bins. Very Simple. You should be able to assemble it in an hour or so. Reasonably Device independent. As I will discuss below, there is an RC network on the card that provides a time base for the programmer's operation. Reasonably Fast. To program a 16F84 completely, about one minute is required. This may seem like a lot of overhead to the 11 seconds I quoted above, but I wanted to make sure that no minimum timings were violated regardless of what kind of PC was running the application (from a 4.77 MHz 8088 to a 700 MHz Pentium III). EPROM Programming capability. Many programmers (like the "COM84" circuit shown above) and the initial versions of the "El Cheapo" cannot supply enough current to reliably program EPROM PICMicros. The circuit is quite simple, but there are a few surprises in it and parts that probably don't seem obvious. I will explain the circuit's operation below.

You 5 of 10 created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com) 17/03/2012 1:26

Pic Programmer by Myke Predko

http://www.rentron.com/Myke4.htm

For different PICMicro Pinouts, the pins to connect (with sample parts) are: Signal -----Vcc Gnd _MCLR Data Clock 8-Pin 12C5XX 1 8 4 7 6 14-Pin 16C505 1 14 4 13 12 18-Pin 16F84 15 5 4 13 12 28-Pin 16C73 20 8,19 1 28 27 40-Pin 16C74 11,32 12,31 1 40 39

Parts list for the "Version 3.10" Programmer

Bill of Materials Part Number R1 R2-R5 R3-R4 C1 C2, C4 C3 CR1 CR2, CR3 Q1 Q2 U1 Value/Comments 220 Ohms 1/4 Watt 10K 10K Ohms 1/4 Watt 1K Ohms 1/4 Watt 10 uF 25 Volt Electrolytic 0.1 uF 35 Volt Tantalum 0.01 uF Ceramic 5.1 Volt 1 Watt Zener IN914 Silicon Diode 2N7000 NMOS FET 2106a PMOS FET 78L12 Voltage Regulator Digi-Key Part Number 220QBK-ND 10KQBK-ND 1.0KQBK-ND P6248-ND P2053-ND P4922-ND 1N4733AMSCT-ND 1N4148DICT-ND 2N7000P-ND ZVP2106A-ND LM78L12ACZ-ND

You 6 of 10 created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com) 17/03/2012 1:26

Pic Programmer by Myke Predko

http://www.rentron.com/Myke4.htm

U2 CR1 J1 J2 ----

18 Pin IC Socket 5.12 V/1 Watt Zener Diode 2.5 mm Power Plug DB-25F Solder Cup Connector "Wall Wart", 14+ Volts Supply with2.5 mm Power Plug Prototyping Card/Breadboard 6' "Straight Through" DB-25M to DB-25F

A9318-ND CP-202B-ND 125F-ND

AE1012-ND

I have included the Digi-Key Part Number because some people have had trouble finding the parts. The parts for this programmer cannot be found at "Radio Shack" (as many people have found out). Make sure that you use a 2106a PMOS FET Transistor. One of the people I sent the initial circuit to tried to substitute and ended up having a lot of problems. If you look at the Digi-Key prices, you'll see that for some of these parts, they're pretty ridiculous (28 Cents for each resistor in "1s" quantity for example). If you were going to buy all the parts from Digi-Key, as I write this, the cost would be $8.46 (Not counting the cable, prototype card, and Wall Wart). Look for the parts from local sources (ie you should be able to buy a kit of resistors from Radio Shack for the same price as the four resistors here) and only buy what you can't find.When I built the programmer, I pushed the DB-25 connector onto the card with the connectors "straddling" the card. To secure the connector, I used 30 guage wire to tie it to the prototype card's mounting holes. The "Wall Wart" power connector was passed through one of the mounting holes in the card as well. This resulted in a very simple package for the programmer with no drilling. The Digi-Key toll-free number is 1-800-344-4539. You can also purchase parts on-line at http://www.digikey.com Wiring on my prototype consisted of "point to point" wiring, although any prototyping method could be used.

In the circuit, there are a number of points that I would like to mention. First off is how power is distributed to the PICMicro. In the "El Cheapo", I used a +12 Voltage Regulator with two level shifting silicon diodes to provide the +13.4 Volts to "_MCLR" for putting the PICMicro into "Programming Mode". This is somewhat different from other programmers which use "parasitic power" from RS-232 for the Vpp programming voltage, but it ensures that up to 100 mA is available to the PICMicro in the circuit either as +5 Volts ("Vdd") or as Vpp. To produce the +5 Volts, a current limiting resistor and a 5.1 Volt Zener diode is used to drop the 13.4 Volts to 5.1 for the PICMicro's Vdd. The 220 Ohm current limiting resistor will allow a maximum of 31 mA to be sourced at 5.1 Volts. This is enough for the PICMicro as well as the Delay Timing Circuit's RC Network. The 31 mA maximum driving current allows the PICMicro to be pulled out and pushed in without having to turn off the power without fear of damaging the PICMicro or the programmer (I use a small, flat bladed screwdriver for the task). For the programming voltage, I control the voltage through the PMOS FET transistor (Q2). When the PMOS transistor's gate has a "high" (13.4 Volts), it does not allow voltage to be passed to the PICMicro. Internal pull downs in the PICMicro's "_MCLR" keeps this line low when the PMOS transistor's gate is "low" (Ground Potential), the transistor is turned on and provides the 13.4 Volts to the device being programmed. Using the 78L12 as the 13.4 Volt power supply means that any time more than 100 mA is drawn, the 78L12 will shut down, preventing dangerous short circuit conditions which could damage the circuit, the "Wall Wart", your PC or the PICMicro being programmed. The circuit can be built on a variety of platforms. As the picture at the bottom of this article shows, it can be built on a spring loaded "breadboard", "point to point" wiring, wire wrapping or on an embedded card. The circuit itself is fairly low speed and with the voltage filtering capacitors, quite robust. One area that many people look to "improve" upon is the power supply circuitry. The +5 and +12 Volt supply circuit shown in the schematic is extremely cheap to build and very reliable. It also has the advantage of current limiting to prevent damage to the programmer, power supply or PICMicro if something gets shorted to ground. I have received more than five emails from people who felt they could do better and have wound up having problems (including one person that burned out his PC's power supply). If you are unsure of how power works in this circuit, please trust me when I say it works well and don't change it to something you're more familiar with. I used the Parallel Port rather than the serial port because I wanted to check what was programmed into the PICMicro and this requires that data is read back. The PC's parallel port eight bi-directional data bits are not used in this circuit for programming. This

You 7 of 10 created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com) 17/03/2012 1:26

Pic Programmer by Myke Predko

http://www.rentron.com/Myke4.htm

is a major deviation from this circuit and most other low-cost Parallel port PICMicro programmers Instead, I drive data out through an available digital output (pin 17) and "read back" data through an available digital input (pin 13). Note that the digital output is driven through a 10K resistor which is used a "current limiting" device when the PC and PICMicro are driving the line at different levels. The 10K resistor will act as a load for the two drivers and allow the PICMicro's output to take priority over the PC Parallel Port's driver. Originally, the circuit was designed to use one of the eight data bits of the parallel port, but this was found to be unreliable in some PCs. This version of the circuit should work on all PCs dating back to the first one to the latest eight-Pentium III Xeon server. If you find any problems with your PC even after checking it out with "eldebug", then please let me know - I want this circuit to be as reliable and as universal as possible, mainly so I'm not supporting problems into my dotage. The "Delay Timing Circuit" consists of two Resistors (R2 and R3) and a capacitor (C3). The Parallel Port "_Auto FDXT" Pin (Pin 14) is used to control the voltage level on the capacitor through the resistor. Because many parallel ports built into PC's cannot source more than a mA or two, I used the +5 Volt regulated source for charging the capacitor. This circuit will charge and discharge in about 5 usecs. When I built my circuit, I used a 0.01 uF tantalum cap simply because I had one hanging around. Any type of capacitor (ceramic disk, polyester or tantalum) can be used for this application. The "Delay Timing Circuit" is used to ensure that the clock operations to the PICMicro in the programmer do not exceed the minimum timing specification and is used to generate the 10 msec delay for the word programming operation. In the source code for the "El Cheapo", you will see that I loop for 2000 delay cycles for a measured 30 msec delay. Because of the tolerances of the parts used in the RC Delay circuit and the variances in PC Parallel Ports, I wanted to make sure that there was no possibility that a less than 10 msec programming timing delay would occur. When I first created the programmer, I found that with a "computed" 10 msec delay, I ended up with only delaying 7.5 msec, which wasn't enough for a reliable programming operation. To make sure that others wouldn't have any problems with the delay, I extended the operation to 30 msecs on my hardware. Obviously, the code could be "tuned" to get an exact 10 msec delay and this would drop the programming time to around 20 seconds, but I feel that this could be problemmatical with different hardware and will cause potential problems later. By going three times more than the specified value, the circuit won't have any tolerance problems. The code itself is compiled for 16 Bit MS-DOS, so it will work in all incarnations of MS-DOS and Microsoft Windows except for Windows NT. I have run this code on MS-DOS 3.3, 5.0, Windows 3.1, Windows 95 and Windows 98 - so there shouldn't be any issues with it running on different PCs. To program a part enter: elcheapo FileName[.ext] [/1|/2] [/V] [/E] on an MS-DOS Command Line ("Command Prompt" under Windows). "FileName" is the name of the .hex file to be programmed into the PICMicro. "/1" and "/2" are the Parallel Ports to be used ("/1" or "LPT1" is the default). "/V" will cause the program in the part to be "Verified" and not "Programmed". "/E" is used to select an "EPROM" part which uses a different programming algorithm than EEPROM/Flash (ie the PIC16F84) PICMicros. To program the PICMicro's "Configuration Fuses", the "__Config" command should be entered into the Assembler source code. This will cause the configuration information to be stored in the .hex file and it will be recognized and programmed into the PICMicro by the El Cheapo software. To find out more about "__Config", look at the "MPASM" "Help" in "MPLAB".

Elcheapo Build Debugger


Since the article has been out for the "El Cheapo" programmer, I have gotten a few questions from people who have had problems with getting the programmer to work. In response, here is a little MS-DOS application (which I call "El Debug") which is designed to just use a voltmeter to make sure the El Cheapo is built properly. As well, I wanted to list a few of the problems other people have encountered with the El Cheapo to help you avoid them. Click HERE for the EL Debug Software El Debug is a "Real Mode" MS-DOS application which will guide you through checking the five interface lines as well as the RC Delay Network. The interfaces to the El Cheapo hardware use exactly the same code as the "ElCheapo.exe" application so there should not be any differences there. The program has been run by a number of people and the version for download seems pretty bulletproof. The only comment I would make about it is that you should make sure that you have the right parallel port selected before changing any lines. With some printers (my HP "DeskJet" for one) if you use the wrong port, you will get a page out with some invalid characters. As for problems that other people have had: 1. The Power Supply circuitry (the 78L12 and Zener Diode) seems to be a particular target for "improvements". Some people do

You 8 of 10 created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com) 17/03/2012 1:26

Pic Programmer by Myke Predko

http://www.rentron.com/Myke4.htm

have bench supplies capable of providing these voltages and don't want to incur the expenses of these parts. I do not recommend using other methods of supplying power. Along with the person that has reported that they burned out their PC's power supply trying to improve on this, I have also heard from somebody that kept tripping the overcurrent protection on their bench power supplies trying to produce +5 and +12 voltages. The power supply circuit shown in the schematic above is very cheap (new parts for this cost me eighty cents Canadian (about fifty cents USD) and a used wall wart can be found for a dollar at a surplus store or new for three or four dollars from Wall Mart), very reliable and very safe. If you find that there are problems with the power supply (ie "El Debug" points to a problem with the reset voltages), check: a) Make sure more than 13.4 Volts is being input into the 78L12. The 78L12 may output nothing (or a strange voltage) if it does not get enough voltage in. Also check the voltage in under load. A source capable of at least 200 mA should be used to power the circuit. b) Make sure there are no shorts from power to ground in your circuit. c) Check the zener diode and make sure it is installed with the band around the part away from ground. d) Check the operation of the NMOS transistor to see that it is providing a signal of 0 and 13.4 volts (and nothing else). If you want to use a power supply that you are more familiar with (or the one your Uncle Elmer, who's always been good with radios, suggests) instead of the circuit in the schematic, don't come to me for problems. Power supply design is an art unto itself - if you use something different and your programmer doesn't work, I will insist that you change it to my design before I'm willing to answer any questions. 2. Make sure you don't delete the 10 uF filter capacitor and 0.1 uF Tantalums. As well, make sure C2 (0.1 uF Tantalum) is physically very close to the PICMicro. If you look at the pictures of my prototype above, you'll see that I connect the 0.1 uF tantalum cap across the programmer socket pins. The PICMicro is somewhat sensitive to decoupling voltage spikes and having a capacitor far away connected by wires will cause problems. 3. Use a commercially available 25 Pin "Straight Through" cable for your El Cheapo. A few people have tried to make up there own or have modified a 25 Pin to 36 Pin "Centronics" cable but have had noise problems on the lines (which are pretty hard to find). Most commercially available cables are shielded and are quite low cost (I bought mine at a surplus store for six dollars Canadian). I have also received one comment that cables longer than six feet won't work. I'm surprised to hear this, but if you are using a cable longer than six feet from your programmer and you are having problems (even though "El Debug" indicates everything is okay) then try a six foot (or less cable). If you do find this helps, please drop me an email so I can indicate that this is more than just one person's experience. Here's a photo submitted by Nathan Bean after he built his "EL Cheapo" PIC Programmer

Thanks Nathan..... In the next article, I will be presenting what I think is a good first application along with a number of ways to create it.

Myke
Copyright and Warranty Statement This article is presented on an "AS IS" basis. I have tested the circuit and code that I have presented here and I am confident that it works on the hardware that I have used. Different hardware may result in different results.

You 9 of 10 created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com) 17/03/2012 1:26

Pic Programmer by Myke Predko

http://www.rentron.com/Myke4.htm

The information contained here cannot be reproduced without the author's permission. Program the PIC in simple BASIC using the PicBasic Compiler. Visit: http://www.rentron.com/PicBasic2.htm

10 ofYou created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com) 17/03/2012 1:26 10

Vous aimerez peut-être aussi