Standalone pic12c508 programmer for the Amiga Developed by Dennis van Weeren (d.vanweeren@worldonline.nl) on the amazing A1200T. 1998 This Package is CARDWARE Please read this document entirely before building or using this programmer! ***************************IMPORTANT!********************************** This Software and Hardware description is provided "as is". I do not take any responsibility for any damage caused to you,your computer or your goldfish. Toasted harddisks, burnt CPU'S, exploded PIC's or burnt fingers, it's not my responsibility! So use this entirely at YOUR OWN RISK! ************************************************************************** Contents: 1)Introduction 2)Hardware description 3)Building the Hardware 4)Adjusting the voltages. 5)Operating the Programmer 6)Standalone Programming. 7)Status LED explanation 8)Assembler 10)The Calibration location 11)Disclaimer 12)Author and Bug reports 1)Introduction This Archive contains the schematics and software for a standalone programmer for the PIC12C508 microcontroller from MICROCHIP. It has been designed to operate indepently from the Amiga and to be fully complient to the programming specifications as layed down by MIRCOCHIP. It's main features are: -Production Quality Programming algorithm -1200 baud serial interfacing with Amiga -Standalone operation makes it possible to program large series while leaving the Amiga free. -on board EEPROM with 16bit checksum to store programfile for maximum reliability -automatic handling of the Calibration value at 0x1ff for foolproof operation. -supports standard INHX8M HEX-files. This archive should contain: Connections.pic ;ic layouts Connections.pic.info Control12 ;download utility PIC12.inc ;PIC12C508 assemble include file PIC16C84.hex ;HEX file for the PIC16C84 Power.pic ;schematics of powersupply Power.pic.info Programmer.pic ;main schematics Programmer.pic.info Readme ;this document Readme.info 2)Hardware description The Hardware is rather complex because of the standalone function and the production grade powersupply but anyone who has worked with pic's before should be able to build it. The PIC16C84 forms the heart of the circuit, it holds the programming algorhitm, I2C routines and the RS-232 routines. The MAX232/ICL232 translates the Amiga's serial port logic levels (+/-12V) to the standard logic levels of 0 and +5V as used by the PIC16C84. The 24C16 is an 2K*8 serial EEPROM which is connected to the PIC16C84 through an I2C-bus. It is used to store the ProgramFile for the PIC12C508. The 74LS145 together with an LM317T and a BC547B forms the programmable VDD powersupply for the PIC12C508. The 74LS145 is a bcd to decimal decoder with 15V open collector outputs (you MUST use this type, no ls45, ls445 or HC/HCT types !). It can select four voltages: 0V (off) ,VddMIN(typ 3V), VddP( 5V) and VddMAX (typ 5.5V). The circuitry connected to pin RA4 is used to switch VPP (Programming voltage) on and off. The circuitry connected to pin RB7,RB6,RB5 is used for the serial communications with the PIC12C508. The opamp CA3130 is necassery to interface to the PIC16C84 because of the programmable VDD, I'm sorry I couldn't find a cheaper replacement for this, I tried several other opamps, but this was the only one which worked properly. Only two parts remain, the 7805 which is used to provide a fixed +5V powersupply and the LM317T, which is used to provide +13.25V for the VPP(programming voltage). 3)Building the Hardware Building is straightforward, all needed info is included in this archive. The power needed is about 16-17volts at a current of 100mA I have not tested the current consumption so this is just a guess), you can always use a non-regulated AC plug adapter at 12V beacause these usually deliver a much higher voltage. The maximum input voltage is about 30 Volts. A couple of things need attention when building: -Use a socket for at least the PIC16C84 for easy upgradeability and easy adjustment of the power supply. -The power regulators don't need a heatsink, the 7805 can become warm but not hot. -Use multilayer or sibatit types if posible for the 100nF decoupling capacitors. -If you can get hold of a ICL232, it is to be preferred above a MAX232 (MAX232's can be very picky about their powersupply's!). -Last note: most IC's used are CMOS types, so take ESD precautions ! 4)Adjusting the voltages. Adjusting the VPP is fairly straightforward, just place a multimeter at the output of the LM317T and adjust it with the trimmer to +13.25V The VDD supply is a little bit more complicated. Adjusting the programmable Vdd supply Step 1: Switch on power without the PIC16C84 inserted. The 74LS145 will now output a 'low' on the Q3_NOT output because a TTL-input goes to a logic one when left open. Now adjust the output of the LM317T (associated with the VDD supply) to VddMAX with the 500Ohms trimmer connected to Q3_NOT.(typ. 5.5V) Step2: Connect a wire between input A of the 74LS145 and ground. The selected input code is 10 which is Q2_NOT. Adjust the output of the LM317T (associated with the VDD supply) to VddP with the 500Ohms trimmer connected to Q2_NOT.(5.0V) Step3: Connect a wire between input B of the 74LS145 and ground. The selected input code is 01 which is Q1_NOT. Adjust the output of the LM317T (associated with the VDD supply) to VddMIN with the 250Ohms trimmer connected to Q1_NOT.(typ. 3.0V) After these adjustments have been made, switch of power (!) and insert all other IC'S. Be sure to program the PIC16C84 before inserting! 5)Operating the Programmer Included in this archive is a utility called "Control12". It's a small cli (GUI is on the way) program used to download .hex files to the programmer. It is also used to perform a blank check (To see if a PIC is empty) and to program a pic online. Downloading: Select d. The program will ask for a .hex file. After loading the hex file the program will ask you the settings of the config register. You must select: -Codeprotection on/off. -MCLR pin enable/disable. -Watchdogtimer on/off. -Oscillator type. After typing 'y' to confirm, the program will download the .hex file and the configuration to the programmer. (Be sure it is swtiched on and online!) You can always abort by ctrl_c. If the program reports "contact made" everything is going well. Downloading is rather slow at the moment because of the 1200baud connection and the heavy handshaking, but it is reliable, so please be patient when downloading. The status LED will light up green while downloading. Blank Test: Select 'b', the status LED will light red and the program will report the result of the test. Online Programming: Select 'p', the status LED will light red and the programming begins. The program will report: 1) Blank Test result. 2) Programming result. 3) VddMIN verify result. 4) VddMAX verify result. ›5) Configuration Programming result. If an error occurs, the status LED will flash red and the program will report the failure. If a fatal hardware error occurs, the status led will flash green and the program will hang. abort with ctrl_c. 6)Standalone Programming. Because this is a standalone programmer, it can be used indepently from the Amiga. When there is a valid .hex file in the programmer's eeprom memory, you can program a PIC12C508 simply by pressing the start button. The LED will light red during programming, when it lights green again, programming was OK, when it flashes red, a programming error occurred. You can insert and remove PIC's with the programmer switched on, as long as the LED is green, flashing red or flashing green. So when the LED is continueosly red, the programmer is accessing the PIC and you can't remove the PIC. 7)Status LED explanation The status LED indicates the programmer's status red: the programmer is accessing the PIC (programming or blank testing). green: the last action was succesfull. flash green: A hardware error occurred (eeprom checksum failed or I2C error) you need to reset the programmer in this case. flash red: the last action was not succesfull 8)Assembler You'll be missing one important thing in this archive: the assembler! That's right, I've not written an assembler for it. This is because there are already very good PIC assemblers out there. Any assembler capable of handling PIC16C5x processor's can handle the PIC12C508 too. Just set the assembler (by example) to PIC16C54 and tada! the generated code is directly compatible with the PIC12C508. The PIC12C508 is based on the PIC16C5x family and therefore has the same 12bit core. I've included a .inc file with all declarations and settings needed to use a PIC16C5x assembler for the PIC12C508. 9)The Calibration location As you know the PIC12C508 has a calibration value programmed at location 0x1ff. The programmer will leave this location untouched, even when you have used this location in your program. However, if the programmer can't find a valid retlw 0xXX instruction (erased by UV light in the windowed version by example), it will program a retlw 0x00 instruction at location 0x1ff. 10)Disclaimer This package is CARDWARE which means you may use and distribute it freely, as long as you don't change the archive. If you like it and use it, I would like it very much to receive a postcard from you (maybe a nice tourist card ?). MICROCHIP and PIC12C508 are registered trademarks of Microchip Technologies Inc. 12)Author and Bug reports I am a 20 year old electrical engineering student from the Netherlands. I was not very good in english class so this document has probably lot's of errors. my Adress (for the postcard off course) is: Šennis van Weeren Reina Prinsen Geerlingsdreef 59 2135 HS Hoofddorp The Netherlands My email adress is: d.vanweeren@worldonline.nl If you have bug reports or other troubles or suggestions, feel free to email me. Happy Programming with the smallest MCU in the world!