This tutorial attempts to explain how to get started programming PIC microcontrollers in the cheapest possible way. To do this you will need the following:
The cheapic programs are designed to run on a 32.768 KHz watch crystal. While this is great for low power and low cost applications, some prefer to run at the '84s top speed of 4Mhz. The following programs have been modified to run at 4MHz speed and are presented with out pictures or notes as replacements for the original programs.
I'm writing to update the 'CHEAPIC' situation in two areas:
P.H. Anderson, http://www.phanderson.com no longer sells 4 MHz versions of the '84. He now only sells a 20 MHz version, PIC16F84A-20. I have discovered that the COM84 programmer I described in CHEAPIC does not work with the 'A' version. It turns out that the second simple serial programmer I mentioned at http://www.jdm.homepage.dk/newpic.htm does work with 'A' versions. So, if you want a simple serial F84 programmer that doesn't need a power supply, this is the one to build.
Others have mentioned problems programming the new 'A' versions also and suggest adding capacitance, (330 pf), to data and maybe clock lines, (also lowering the value of the ACK resistor). I tried this on a 'classic' Tait parallel port programmer and it still wouldn't handle the 'A' version. I then changed from a simple wall-wart power supply I had built to two 9 volt batteries in series and the thing programmed a 'F84A'. Go figure.
But, why bother with the 'F84A' anyway. It turns out that there is a cheaper and better flash PIC available!
P. H. Anderson sells the PIC16F84A for $4.70. He also sells the PIC16F872 for $3.50. The '872' has twice the program space and more registers. It also has a bunch of extra features including:
A new version of MPASM from Microchip covers the '872' and is free. Get it and you have the ability to create .HEX files from assembly programs. I figured that I could use the programmers I had for the '84' and just make a converter cable from the 18 pin '84' socket to a 'skinny' 28 pin socket for the '872'. I would use the software for the '84' to program the '872'. It didn't work with either of the COM port programmers.
Fortunately, I was able to get the 16F872 programmed with a parallel port programmer. I use a 'Classic' Tait style programmer with a 7407 and pnp transistors. The programmer and software can be found at: http://ubasics.com/adam/pic/archive.shtml The Tait software pp.exe works fine and is faster than most other software I've seen. You do have to remember to set up the Tait version used with the DOS set command, (set ppsetup = 3). I have a feeling that most other '84' programmers will work as well using the converter cable. You will just have to try it to find out if yours works.
If you want to make an adapter cable for a current Tait or other '84' programmer, the connections are listed below. If you have trouble locating a 28 pin skinny DIP, you can use two 14 pin sockets mounted head to tail on a small piece of perfboard. Low profile or machine pin sockets come in versions that can be placed end to end without grinding away some socket. The 'plug' for the '84' socket on the programmer doesn't have to be a full 18 pins. I used a 14 pin machine pin socket, soldering wires to the top side of the pins. The head of the 14 pin socket is then matched with the head of the 18 pin socket when it is plugged in.
Adapter Cable 16F84 plug to 16F872 socket name male 'plug' (14 pin socket) use '872' 28 pin socket RB6 pin 8 clock pin 27 RB7 pin 9 data pin 28 Vdd pin 10 5 volts pin 20 Vss pin 5 ground pin 8 MCLR pin 4 13.5 volts pin 1
All of the programs for the '84 in CHEAPIC should work in the '872 with some slight modifications. At least that was what I thought at first. I started with the 4 MHz versions though the 32 kHz versions should work as well. Here are the changes that I thought necessary:
I went merrily along converting and running the programs until I got to combo4m.asm which reads and writes to data EEPROM. They changed the location of the EEPROM registers! EEDATA and EEADR are now in bank 2 and EECON1 and EECON2 are in bank 3. You also have to specify now if you want data EEPROM or program EEPROM reprogrammed. EEPGD bit in EECON1 must be clear to specify data EEPROM. I followed the data sheet and made the changes, but the program only works for the combination H'FF'. Well I guess I'll just have to keep plugging away at it.
I'm not finished. I need your input. send comments, questions etc to:
ockersSPAM at ~NOSPAM~anl.gov
Says: " updated most of the dead links " +
question... Microchip.com sells an adapter to program PIC chips, but is there an alternative? An uncomplicated cheap-to-make circuit I can slap together? Input would be much appreciated. (I'm new to most of this stuff)James Newton replies: See: PIC Device programmers+
|file: /Techref/piclist/cheapic/index.htm, 14KB, , updated: 2007/10/20 21:48, local time: 2023/5/28 00:34,
|©2023 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://piclist.com/techref/piclist/cheapic/index.htm"> CheaPIC Main Page </A>
|Did you find what you needed?|
PICList 2023 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to piclist.com!