Silicon ChipThree Do-It-Yourself PIC Programmer Kits - April 2003 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Thunderstorms - nature's monster light show!
  4. Subscriptions
  5. Feature: IMAX: The Giant Movie Screen by Barrie Smith
  6. Feature: Silent Running: Building A Quiet PC by Peter Humphreys
  7. Project: Video-Audio Booster For Home Theatre Systems by Jim Rowe
  8. Project: A Highly-Flexible Keypad Alarm by John Clarke
  9. Project: Telephone Dialler For Burglar Alarms by Leon Williams
  10. Project: Three Do-It-Yourself PIC Programmer Kits by Jim Rowe
  11. Project: Electric Shutter Release For Cameras by Julian Edgar
  12. Weblink
  13. Product Showcase
  14. Feature: Soldering: A Closer Look by Maurie Findlay
  15. Project: The PICAXE, Pt.3: Heartbeat Simulator by Stan Swan
  16. Vintage Radio: The AWA R154 battery console by Rodney Champness
  17. Notes & Errata
  18. Market Centre
  19. Advertising Index
  20. Book Store
  21. Outer Back Cover

This is only a preview of the April 2003 issue of Silicon Chip.

You can view 29 of the 96 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Video-Audio Booster For Home Theatre Systems":
  • A/V Booster PCB pattern (PDF download) [02104031] (Free)
  • Panel artwork for the A/V Booster (PDF download) (Free)
Items relevant to "A Highly-Flexible Keypad Alarm":
  • PIC16F84(A)-04/P programmed for the Keypad Alarm [KEYPAD.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the Keypad Alarm [KEYPAD.HEX] (Software, Free)
  • Keypad Alarm PCB pattern (PDF download) [03104031] (Free)
Items relevant to "Telephone Dialler For Burglar Alarms":
  • PIC16F84(A)-04/P programmed for the Alarm Dialler [ALARM.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the Alarm Dialler [ALARM.HEX] (Software, Free)
  • Alarm Telephone Dialler PCB pattern (PDF download) [03204031] (Free)
  • Panel artwork for the Alarm Dialler (PDF download) (Free)
Articles in this series:
  • PICAXE: The New Millennium 555? (February 2003)
  • PICAXE: The New Millennium 555? (February 2003)
  • The PICAXE: Pt.2: A Shop Door Minder (March 2003)
  • The PICAXE: Pt.2: A Shop Door Minder (March 2003)
  • The PICAXE, Pt.3: Heartbeat Simulator (April 2003)
  • The PICAXE, Pt.3: Heartbeat Simulator (April 2003)
  • The PICAXE, Pt.4: Motor Controller (May 2003)
  • The PICAXE, Pt.4: Motor Controller (May 2003)
  • The PICAXE, Pt.5: A Chookhouse Door Controller (June 2003)
  • The PICAXE, Pt.5: A Chookhouse Door Controller (June 2003)
  • The PICAXE, Pt.6: Data Communications (July 2003)
  • The PICAXE, Pt.6: Data Communications (July 2003)
  • The PICAXE, Pt.7: Get That Clever Code Purring (August 2003)
  • The PICAXE, Pt.7: Get That Clever Code Purring (August 2003)
  • The PICAXE, Pt.8: A Datalogger & Sending It To Sleep (September 2003)
  • The PICAXE, Pt.8: A Datalogger & Sending It To Sleep (September 2003)
  • The PICAXE, Pt.8: The 18X Series (November 2003)
  • The PICAXE, Pt.8: The 18X Series (November 2003)
  • The PICAXE, Pt.9: Keyboards 101 (December 2003)
  • The PICAXE, Pt.9: Keyboards 101 (December 2003)

Purchase a printed copy of this issue for $10.00.

The K149 kit is supplied with the FT232BM USBinterface chip presoldered in place on the underside of the PC board. The new K149 PICmicro programming kit features both serial RS-232C and high speed USB interfacing. It currently supports some 61 different PICmicro chips, including the 16F84/A, the 16F627/8, the 12C508/9, the 16C63A and many others. As well as releasing new Windows software and updated documentation for its existing low cost K81 parallel-port PIC16F84 programmer kit, DIY Electronics has also produced a completely new PICMicro programming kit (K149) which offers both serial RS-232C and high speed USB interfacing. Here’s a hands-on look at both kits. By JIM ROWE M ICROCONTROLLER CHIP maker Microchip Technology Inc has been phenomenally successful with its low-cost PICmicro family in the last few years. PICs are now probably used in more applica­tions than any other family, as well as being embedded in a high proportion of smart cards. Small wonder that many people are keen to learn how 58  Silicon Chip to program them and get themselves a programmer. The most popular kind of programmer is one that’s driven from a PC, probably because Microchip Technology has made avail­able (for free downloading) an excellent suite of program devel­opment software called MPLAB which runs under Windows. So with a PC-driven programmer, you can develop your PIC firmware on the PC using MPLAB and then program it into a chip with a minimum of hassle. A PC-driven programmer is the way to go then and the easi­est and cheapest way to get one is to assemble one of the many kits that are now available. In this article, we’re taking a look at two such kits from Hong-Kong based DIY Electronics, which are available in Australia from Ozitronics. One is an updated version of DIY’s existing low-cost introductory kit designed specifically for the very popular PIC16F84 chip. The other is a completely new kit which can not only be used to program many different PIC chips but also offers a choice of either RS-232C or high-speed USB interfacing to the PC. The simpler kit DIY’s PIC16F84 Programmer & Exwww.siliconchip.com.au Fig.1: the circuit details of the K81 PIC16F84A Pro­grammer & Experimenter. IC1, a 74LS07 hex inverter, provides the interfacing between the PIC’s programming socket and the PC’s printer port. The test section is shown at bottom right – it flashes five LEDs, depending on the program loaded into the PIC’s EEPROM. perimenter kit (K81) was first released a few years ago and has been very popular. As well as providing a lowcost programmer which interfaced to the PC via a standard parallel printer www.siliconchip.com.au port, it came with some DOS-based programming software, a sample PIC­16F84 chip and some simple programs. These programs demonstrated just how easily the PIC16F84 could be used as a simple LED chaser/flasher. You could easily check out the operation of these programs too, because the programmer board included a “test circuit” area on the side, with a PIC April 2003  59 Fig.2: here’s how the parts are installed on the K81 programmer’s PC board. It’s fairly simple and should only take about 30 minutes to build. socket connected to a row of LEDs. With these features, K81 made an excellent kit for anyone just getting into PIC programming and wanting a low-cost PC-based 16F84 programmer. That’s still true, although in the last couple of years there’s been a growing number of people who only have experience with Windows-based software and who also have little experience assembling electronic kits. Understandably, these people found the DOS-based software a little unfriendly and required more guidance with the kit assembly. As a result, DIY has produced a revamped version of K81, with new and easy-to-use programming software running under Win9x/NT/2000 and an expanded 49-page manual. This not only gives detailed assembly instructions for the programmer but also works through the source code details of the four test programs, to help you understand how they operate. The kit’s hardware remains unchanged – it uses a well-proven circuit which is just as suitable for programming PIC16F84/A devices today as it was when first released. It uses Microchip’s serial method of programming the chip’s EEPROM, wherein the programming voltage (Vpp) is applied to the MCLR pin (4), serial programming data is applied to (and read back from) the RB7 pin (13) and programming clock pulses are applied to the RB6 pin (12). How it works (K81) Fig.1 shows the circuit details of the K81 PIC16F84A Pro­ grammer & 60  Silicon Chip Experimenter. It’s really quite straightforward. First of all, power for the programmer is derived from an external plugpack, which can be either a 17-30V DC type or a 13-20V AC type. A bridge rectifier is used both to protect against reverse polarity damage and also to rectify incoming AC. Regula­tor REG1 is then used to provide the +5V Vdd supply rail, while REG2 is “piggybacked” on this 5V rail to provide a +13V Vpp rail. Interfacing between the chip’s programming socket and the PC’s printer port is provided via IC1, a 74LS07 hex inverter. This allows the PC software to control the Vdd voltage switching via pin 5 of CON1, inverter IC1a and transistor Q2. Similarly, the Vpp voltage switching is controlled via pin 4 of CON1, IC1f and Q1. In addition, programming clock pulses are sent to the chip socket via pin 3 of CON1 and IC1b, while the programming data is sent to the socket Fig.3: this is the user interface you get when you fire up the DIYK81.EXE program. The top four buttons are used to access the main programming functions: Program, Read, Verify and Erase. via pin 2 of CON1 and IC1e. Finally, it can also read back data from the chip’s EEPROM via inverter IC1d and pin 10 of CON1. Note that because the inverters are of the open collector type, pullup resistors R7 and SIL1a/b are used to ensure correct operation. At the bottom right of Fig.1 is the test circuit section of the K81 board. There are five LEDs connected between the SIL2 current limiting resistors and pins RB2-RB6 of the PIC socket, while the 3.9kΩ resistor and 22pF capacitor form a simple RC timing circuit for the PIC’s internal clock. Depending on the program you’ve loaded into the PIC’s EE­PROM, the LEDs either count up or down in binary fashion, glow in sequence from left to right and back again, or the LED connected to RB2 simply flashes on and off alone. Trying it out DIY sent us a fully assembled K81 kit, so we were able to try it out with a minimum of fuss. However we did look through the assembly instructions, which form the first few pages of the kit’s new 49-page manual. These are quite clear, so if you’ve built electronic kits in the past you shouldn’t have any problems with this one. The PC board overlay details are shown in Fig.2. It should only take you 30 minutes or so to assemble it. Software (K81) The software for the kit must be downloaded from the DIY website (www.kitsrus.com) and comes zipped in a single 1.32MB file (DIYK81.ZIP). When you unzip this to a temporary folder, it provides the necessary files, including a setup file, to install the main DIYK81.EXE program in any folder you nominate. By the way, it’s only when you have installed the main pro­gram that you discover the file K81.PDF, the electronic version of the kit’s 49-page manual. This is one of the files that are unpacked during installation. So the next step is to open up the PDF file with Adobe’s trusty Acrobat Reader and print it out to guide you the rest of the way. In the same folder, there’s also a file called DRIVER.TXT. This is a guide to installing the software drivers which allow the main DIYK81.EXE program to communicate with and control www.siliconchip.com.au the K81 hardware via a printer port. For systems running Win9x, all you have to do is right-click on another file called SETUP_9X.INF and then select “Install”. This causes the appro­ priate driver files to be copied to the windows\system folder and away you go. When you fire up DIYK81.EXE, it presents you with the small user interface shown in Fig.3. There are basically just eight control buttons, with the top four used to access the main functions: Program, Read, Verify and Erase. The remaining four buttons are for selecting the printer port address, testing for correct communication with the K81 hardware, opening the on-line help file and stopping the pro­gram­ ming prematurely. A small “pro­gress bar” below the buttons shows that operations are proceeding. It’s all very straightforward and easy to use. Initially, though, I couldn’t get the program to “find” the K81 hardware, even though it was connected to the right port and powered up. I then realised that I had sent various documents to the printer via the same port, earlier in the same session. This can cause problems with other devices that interface via the printer port, as I discovered recently when developing my EPROM Programmer. I rebooted the PC and suddenly the DIYK81 software could now “see” the hardware. After that, it was all plain sail­ing. The sample PIC16F84 programs that come with the software are supplied in both hex and assembler source code form, so it’s very easy to program the sample PIC using any of the hex files. You do this simply by clicking on DIYK81’s “Program” button and selecting the hex file you want from the dialog that appears. This then erases the PIC’s EEPROM and programs it with the new hex file instead – an operation that only takes a few seconds. Writing your own PIC16F84 software for programming via the DIYK81 software is quite straightforward too, if you follow DIY’s advice and download a copy of the MPLAB software suite from the Microchip website (www.microchip.com). MPLAB is quite a big file (the current version 6.10 is about 25MB) and it has to be downloaded in floppy-disk sized chunks. But it’s well worth getting, www.siliconchip.com.au The K81 PIC16F84A Pro­grammer & Experimenter will take you next to no time to assemble. The test section of the board is at bottom right. because it’s a complete IDE (integrated development environment) which includes a source code editor, an assembler and linker, a simula­tor and a debugger. It also includes programming software for Microchip’s own PIC programmers, but the DIYK81 software performs this function with the K81 programmer. Overall then, the K81 kit and its matching Windows-based software are very easy to use, and provide a low cost entry path for would-be PIC16F84 programmers. The new 49-page man­ual also provides a lot of good tutorial information, not just about building the kit but also on the basics of PIC assembly language programming, using the K81 sample programs as examples. Considering that the K81 still costs less than $A40 from Ozitronics, this surely makes it excellent value for money. USB PIC programmer (K149) Good though it is, though, the K81 kit does have its limi­tations. For example, it only handles the popular Where To Buy The Kits Kits for the K81, K149 & K160 PICmicro programmers are avail­able in Australia from Ozitronics (www.ozitronics.com) for the following prices: K81 Parallel Programmer ............$37.40 each (includes postage & GST). K149 USB/Serial Programmer ...$73.70 each (includes postage & GST). K160 Serial Programmer ............$28.60 each (includes postage & GST). Contact Ozitronics as follows: phone (03) 9434 3806; mail 24 Ballandry Crescent, Greensborough 3088; email sales<at>ozitronics.com; website www.ozitronics.com More information on these and other kits from DIY Electronics is available on their website: www.kitsrus.com You can also con­tact the company by email at peter<at>kitsrus.com, if you have any suggestions to make regarding these or other kits. Note that copyright of the PC boards and software source code for both the K81 and K149 kits is retained by the designers. April 2003  61 62  Silicon Chip www.siliconchip.com.au Fig.5: the K149 USB/RS232C PIC Program­mer is built on a double-sided PC board. This board is supplied with FT232BM USB interface chip (IC4) alrea­dy soldered in place on the underside. PIC16F84/A chips, so it’s not much use if you want to program one of the many other PIC micros. The printer port interface may also be a problem with some late-model PCs, which often don’t have a “legacy” parallel print­er port at all. Apparently, it’s assumed that you’ll be either using a USB printer or printing via a network printer. It’s these limitations which have prompted DIY to develop the new K149 programmer kit, using hardware and software designed by Tony Nixon – www.bubblesoftonline. com This kit will provide you with a much more “serious” programmer, which can currently support about 61 different PIC micro models. These include the 16F84/A, the 16F627/8, the Fig.4 (left): the K149 USB/RS232C PIC Program­mer features both RS232 (MAX232) and USB (FT232BM interfaces. These forward and receive data to and from a pre-programm­ed PIC-16F628 (IC3), depending on the position of switch S1. IC3, in company with IC2, also provides the pulses to the programming socket. www.siliconchip.com.au 12C508/9, the 16C63A and of course many others. The K149 doesn’t just support a lot more PICs, though. It’s also DIY’s first kit programmer with a USB interface, so it should be fully compatible with virtually any of today’s (or tomorrow’s) PCs. It also offers an alternative RS232C serial interface, which you can select by flicking an on-board switch. So as well as coping with a wide range of PIC chips, the K149 should be useable with virtually any PC, old or new. As you can see from the photo, the K149 programmer has a bit more in it than the K81. For starters, it’s on a double-sided PC board about 50% larger than its little brother, with space for a wide-slot 40-pin ZIF socket for the devices to be programmed. The kit actually comes with three 20-pin IC sockets to be installed on the board, but 40-pin ZIF sockets are available separately for those who expect to be doing a lot of programming. These ZIF (or “zero insertion force”) sockets allow chips to be inserted and removed very easily, with much lower risk of pin or device damage. USB interface To provide it with the new USB interface, the K149 takes advantage of a fairly new “USB UART” chip from Scottish firm Future Technology Devices International (FTDI). The FT­ 232BM chip provides all of the circuitry required to transfer data between a USB port and a high speed asynchronous serial data line, in both directions and at speeds up to 3Mb/s (megabits per second). The full details of this chip can be downloaded from FTDI’s website at www.ftdichip.com The FT232BM is in a very compact 32-pin LQFP (low profile quad flat pack) surface-mount package, with leads spaced only 0.8mm apart. However, to save inexperienced constructors from getting into strife soldering this tiny chip’s leads, DIY Electronics supplies the K149 board with the FT232BM chip alrea­dy pre-soldered in place on the underside copper. All you have to do is mount the larger parts on the top of the board. To allow the K149 programmer to cope with the various PIC chip models, its control circuitry is based on a pre-programmed PIC16F628 chip. This takes the data and control instructions coming to the programmer via either the USB or RS-232C interfaces and controls the programming/ April 2003  63 Fig.6: this is the main user interface for the K149 programmer. As well as the control buttons (arranged along the bottom), there’s also a large text box where you can examine hex program listings – either before programming or read back from a programmed PIC. There’s also a picture box (far right) which shows you how to plug the selected PIC into the K149’s programming socket. verifying/reading operations accord­ ingly. Circuit details Fig.4 shows the circuit of the K149 USB/RS232C PIC Program­mer. The RS-232C serial interface is provided by IC1, which is an ICL232 level translating transceiver device very similar to the well-known MAX232. The USB interface is provided by the FT232BM (IC4), which uses a 6.0MHz crystal to lock its USB clock oscillator (multiplied to 48MHz via an internal PLL). IC3 is the pre-programmed PIC16F628, which receives the incoming serial data at its RB1 pin (7) and provides return data via it RB2 pin (8). As you can see, these pins are both switched using S1 to communicate via either IC1 or IC4 – ie, S1 provides the USB/RS232C mode selection. Inverters IC2a-IC2c (74LS06) are used to control transis­ tors Q1, Q3 & Q2 respectively. These switch the Vcc supply and the Vpp supply (x2) to various pins on the programming socket. This all takes place under the direction of IC3, via pins RB5-6-7. LEDs2-4 are used to indicate when these voltages are being applied to the socket. Inverter IC2e is used with diodes D1 & D3 to form an OR gate. This allows the PC software to reset the 64  Silicon Chip programmer’s 16F628 (IC3) when desired via the interface (USB or RS232) that’s is being used. As shown, IC2e’s output is connected to the MCLR-bar input of IC3 (pin 4). The remaining two inverters inside IC2 (IC2d & IC2f) are not used and have their inputs tied high. The power supply section is very similar to that used in the K81, with piggybacked 7805 (REG1) and 7808 (REG2) regulators to provide the +5V and +13V rails. The only difference is that they’re fed via a single series protection diode (D2), instead of a fullwave bridge rectifier. This means that the K149 should only be powered from a nominal 18V DC plugpack. Trying out the K149 DIY again supplied us with a pre­ assembled K149 kit, so we could try it out with minimum hassle. As before, we looked at the assembly instructions and although fairly brief, they should be quite adequate for anyone who has previously assembled electron­ics kits. Fig.5 shows the parts layout on the double-sided PC board. Trying it out We decided to test the K149 using the USB interface, be­cause this is probably the most interesting feature of this kit. There weren’t any real problems, although there was initially a minor hassle in connecting the programmer up to a USB port of the PC we were using for evaluation. That’s because we had to get a special USB cable to link them up, as the programmer is fitted with a USB Type A socket – ie, the “flat” type normally used only for the host PC ports in a USB network or the output ports of a hub. This means that you can’t use a standard USB cable with a Type A plug at one end and a Type B “square” plug at the other – instead, you have to use a special cable with Type A plugs at both ends. However, these cables are readily available from a number of local suppliers. We obtained one and were then able to connect the K149 to one of the PC’s USB ports. The main software to operate the K149 again needs to be downloaded via the web, in this case from www. crowcroft.net/kitsrus/ It’s a single 1.7MB file called K149DISK.ZIP. When you unzip this file, it produces two smaller zip files which then have to be unzipped in a temporary folder. This gives a set of files (including SETUP.EXE), after which you can install the main software files on a folder of your own choosing. The main program is called MicroPro.EXE, which currently runs under Win9x/ NT/2000. If you’re going to be using the USB interface, you also need to download and install the USB drivers which allow Windows to communicate with the programmer’s FT232BM chip. These must be downloaded from the FTDI website at www.ftdichip.com/ FTDriver.htm The drivers to get are called “VCP Drivers for Win98/2000/ ME/XP (without PnP support)” and they come zipped up in a single file. While you’re at the FTDI site, it’s also a good idea to get the installation notes which are in PDF format. These are at www.ftdichip.com/FTApp. htm – be sure to get the one for your particular operating system. Once you have downloaded the USB drivers, you unzip the files into a “USB” subfolder, just below the one where you in­stalled the MicroPro software. When you subsequently power up the K149 board and connect it to one of the PC’s USB ports, Wind­ows senses its presence and prompts you to install the appro­priate USB driver – it’s just a matter of going to the \K149\ www.siliconchip.com.au USB folder, where you just unzipped the drivers. This basically installs the programmer on a high-speed USB-supported “virtual serial port”, which in my case turned out to be COM4. When you fire up the MicroPro software, it can then communicate with the programmer once you select that port. K160: PIC16F62x Experimenter & Programmer The K149 software Not surprisingly, the MicroPro software that comes with the K149 is more complex than that supplied for the K81. That’s because it has to cope with a wide range of PIC chips. However, it’s still quite friendly and easy to use. Fig.6 shows the main user interface. It has a similar set of programmer control buttons along the bottom but now there’s also a large text box where you can examine hex program listings – either before programming or read back from a programmed PIC. To the right of this box, there’s also a picture box where you first see an image of the K149’s programming socket. At first, I was a bit confused about the correct placement of a PIC to be programmed in the K149’s socket, because this wasn’t indicated either on the K149 board itself or in the docu­mentation. Nor could I find where you selected the type of PIC to be programmed on the MicroPro user interface (it wasn’t evident on any of the top pull-down menus, for example). It was then that I discovered the purpose of the small uncaptioned drop-down list box near the bottom right-hand corner, just above the Cancel button. Clicking on its drop-down arrow brings up a list of all supported PICs – and when I selected one, the picture in the box above changed to show the correct way to plug that device into K149’s programming socket. It’s a very neat feature – except for the lack of a caption on the drop-down list box. After that, I had no problems at all using the K149 and MicroPro to program PICs. And thanks to the USB interface, it programs them very quickly and efficiently. It turns out that MicroPro even provides a “Fly Window” option, to allow you to program PICs directly from MPLAB once you’ve written a program and assembled it. When you select the Fly Window option, Microwww.siliconchip.com.au Also recently introduced by DIY Electronics is the K160 PIC16F62x Experimenter & Programmer kit, designed for programming the PIC16F62x series of PIC chips (ie, 16F627, 16F627A, 16F628 & 16F628A). The 16F628-04/P chip is used in the kit. As well as programming PIC16F62x chips, the kit is also designed to teach you the basics of programming. It comes complete with the following: •  a Windows 9x/NT/2000/XP user interface; •  Five detailed code examples to flash LED’s; and •  A 40-page PDF (Adobe Acrobat) file which introduces the MPLAB program from Microchip for program development and assembly. The K160 Programmer connects to the serial port of the PC. You simply program the 16F628 using the user software provided. The software then runs immediately and flashes the LEDs on the board. Fully-commented source code is provided for the example programs: binaryup.asm, binarydn.asm, binarylr.asm and flash.asm. These programs flash the LEDs in a variety of patterns. The compiled object code is also provided (ie, the hex files). Kits for the K160 IC16F62x Experimenter & Programmer are available from Ozitronics – see price panel. For further information on the kit itself, visit the DIY Electronics website at www.kitsrus.com Pro produces a little “remote control” dialog and minimises itself. Then, when you’re in MPLAB, the small dialog allows you to access MicroPro’s Program and Verify functions – which is also very neat. Summary My impressions of DIY’s new K149 programmer are very fa­vourable indeed, apart from those little niggles about the need to get a special USB cable and the software’s unmarked list box to select the PIC device you want to program. Those points aside, it gives every evidence of being well-designed and it is very easy to use. So if you’re after a fast and convenient PC-driven program­mer for most of the commonly used PICs, the K149 can be recom­mended. It’s also a very cost-effective way to get yourself such a programmer, because the K149 sells in Australia for only $73.70 (including postage & GST). The pricing panel has SC all the details. April 2003  65