AYUCR
Programming a PIC 16F819
Introduction
Even though the AYUCR controllers contain a bootloader that lets you update the firmware using nothing more than the serial port there are times you may need to reprogram the chip using an external programmer. If you are upgrading the bootloader portion of the firmware or programming a blank chip this is the method necessary. It is fairly fast and easy to do and you won't need to do it that often. This article will describe one particularly inexpensive way to do it.
Things You Will Need
- JDM-type programmer and serial cable
- Windows-based PC with real RS-232 serial port
- IC-Prog Prototype Programmer software for Windows
- PIC 16F819 chip to be programmed
- Firmware image (.HEX) file
JDM programmers are serial port programmers based on a similar design. You can get the Olimex PIC-PG2 show below from Olimex and Sparkfun Electronics or any of the various JDM-type programmers available on eBay. They typically cost anywhere from $12 to $25. One disadvantage to the JDM design is it steals power from the serial port. This makes the design simple and inexpensive but it does not seem to work properly with USB to Serial adapters. I suspect they cannot provide the proper voltage levels to reflash the chip. You will need a real RS-232 serial port on you computer for this type of programmer to work. If you only have USB ports you will need to use an externally powered programmer. These are a little more expensive and some links to recommended units appear at the end of this article.
Olimex PIC-PG2
IC-Prog is a free program available from www.ic-prog.com It will program many types of chips and interface with many types of programmers.
You will also need a chip to program, either a blank or an existing chip you want to rewrite and a firmware (.HEX) file. Check the software revisions pages for the latest firmware files.
Programming Process
Download and run IC-Prog. It has no install program. Just unzip it and run the icprog.exe program. You should see a screen similar to the this:
IC-Prog Interface
Notice the circled items. First you should configure the hardware by clicking the yellow-circled button. Select JDM Programmer and the proper COM Port. I usually recommend using Windows API Interface. Leave the other settings alone.
Next choose the correct target, PIC 16F819 using the drop-down circled in red. It is important to do this before reading in the firmware file.
Open and load the desired firmware file by clicking the green-circled buttons
Connect the programmer to an availale RS-232 serial port on your PC using a serial cable. If you would like to test the connection use the Hardware Check option under the settings menu. Toggling the Enable MCLR option should toggle the LED on the programmer. If not check your connections or use a different serial port.
Insert the PIC 16F819 in the programmer oriented so that the chip is aligned as shown below. The programmer has markings showing where an 18-pin chip is placed. The notch on one end of the chip must face the serial port connector.
Click the program button circled in blue. The programming process takes about a minute. The LED on the programmer will light and the progress will be displayed. If there are no errors you are done!
PIC 16F819 being programmed
Troubleshooting
If you have trouble programming the chip check the following:
- Make sure the connection between the computer and programmer is sound
- Make sure the LED on the programmer lights during programming and when using the Hardware Check option
- Make sure you are using a real RS-232 port and not a USB to Serial adapter
- Make sure the chip is inserted into the programmer properly with the notch pointing the right direction
Other Options
If you don't have a real serial port you may use one of the numerous USB programmers available. They aren't as cheap but with serial ports becoming rare on new PCs this may be your only option. Olimex sells a USB programmer as does Micro Engineering Labs. I haven't tried those but I have used the USB programmer sold by MDFly Electronics via their eBay store. The bundled software is very bare-bones but it works fine for programming the PIC 16F819. The unit seems to be a standard "K150" type programmer so it may be possible to get it to work with other programming software. The unit costs about $50 with shipping. There are other USB PIC Programmers sold on eBay as well. I can't vouch for every one but they claim to program the PIC 16F819 device then it should work.