Guide to Programming the PIC16F628 originally by Sheldon Chan, modified by Jim Paris I. The PIC Programmer Hardware ------------------------------ Part 1: Understanding the Circuit The schematic for our low-voltage PIC programmer is available from http://web.mit.edu/6.131/www/pic.shtml It takes advantage of software control of the PC parallel port to control the timings and signals to read and program the PIC16F628. The 7404-inverter chip is used to buffer the signals coming to and from the parallel port. The LED is used to indicate that power has been applied. The various resistors are to limit current into the LED and parallel port pins. Part 2: Assembling the PCB version of the PIC Programmer There are several components on the PCB board that are sensitive to which direction they are soldered onto the board. Please always double check the direction or polarity of each device to make sure it matches the labeled direction on the board. Please also note that the capacitor's positive terminal should face away from the parallel port connector; the 7404 should be plugged into the machine socket with the top facing towards the parallel port; and the 7805 should be oriented so that the quarter inch screw and nut will secure it to the PCB. II. PIC Programmer Software --------------------------- Part 1: Installing the Software The software is already installed on all machines in the 6.131 lab. To install it elsewhere, download the CD package from http://web.mit.edu/6.131/www/pic.shtml Log into Windows as an administrator (if NT/2K/XP), uncompress the archive to a directory, and run install.bat. The batch file should install a copy of the Hi-Tech C Compiler and the jimpic Programmer software needed to compile and burn programs on your 16F628. If you're running Linux, you can download the source code for jimpic from the same place and compile it yourself. The Hi-Tech C Compiler is not available for Linux, so we recommend running it under DOSEmu or WINE. The TAs can't offer any help with this; if you're having trouble, just come into lab and use the Windows machines. Part 2: Compiling a Simple Program In this example, we will compile a simple C program into a hex file that can be programmed onto the 16F628 chip. This assumes that your program files are stored on a floppy disk. You can download a sample program blinky.c from the 6.131 webpage. 1. Open a console window, and type the following: a: (to go to your floppy disk) c:\picc\pcc blinky (or blinky.c, to compile the program) This should compile your program and generate a corresponding file that ends in .hex that will be stored on your disk as well. Part 3: Programming the PIC Chip 1. Insert a PIC16F628 into the ZIF socket with the bottom of the chip in the closest slot to the parallel port connector. 2. Lock the PIC into place. 3. Attach a +7-20V power supply and ground to the terminal block. 4. Open a command console and type a: (to go to your floppy disk) c:\picc\burnpic blinky (or blinky.hex, to burn the file to the PIC) 5. Turn off the power source and remove the chip. Congratulations! If all has gone well, your PIC16F628 chip is now programmed and ready to be used.