please dont rip this site


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 Programs:

  1. bincnt.asm - Count in binary on 4 LEDs
  2. swcnt.asm - Count switch closures.
  3. eggtimer.asm - Countdown timer, displays minutes and 10's of seconds on LEDs
  4. morsenbr.asm - Send numbers 0-9 out on piezo speaker
  5. binclock.asm - A clock which displays hours and minutes in BCD on LEDs at keypress
  6. combo.asm - a combination lock which remembers a selectable combination, even when power is removed
  7. alphabet.asm - Sends ASCII characters to the COM port of a PC for display
  8. worktime.asm - Uses a LCD to display a timer that can be started and stopped by pushbutton
  9. shotmr0.asm - Display TMR0 on a LCD atter counting pulses on RA4 for one second
  10. therm.asm - Display temperature on a LCD using a thermistor as the sensor

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.

  1. alpha4m.asm
  2. binclk4m.asm
  3. bincnt4m.asm
  4. combo4m.asm
  5. eggtim4m.asm
  6. morse4m.asm
  7. swcnt4m.asm
  8. therm4m.asm
  9. tmr04m.asm
  10. wktim4m.asm


I'm writing to update the 'CHEAPIC' situation in two areas:

  1. Problems with PIC16F84A-20
  2. The PIC16F872

Problems withe PIC16F84A's

P.H. Anderson, 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 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!

The PIC16F872

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:

Programming the 16F872

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: 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

Programs for the PIC16F872

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.

Other free Tutorial Material

Input needed

I'm not finished. I need your input. send comments, questions etc to:
ockersspam at




Says: " updated most of the dead links " +



See also:

file: /Techref/piclist/cheapic/index.htm, 14KB, , updated: 2007/10/20 20:48, local time: 2017/2/25 05:50, owner: ter_wong-hotmail-,

 ©2017 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?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF=""> CheaPIC Main Page </A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2017 contributors:
o List host: MIT, Site host, Top posters @20170225 IVP, RussellMc, Van Horn, David, Neil, James Cameron, Sean Breheny, alan.b.pearce, Bob Blick, Denny Esterline, David Duffy (AVD),
* 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!