16F876 Bootloader v5-2

**************************
How to use this bootloader

This is an updated form of the bootloader supplied by Hi-Tech C, incorporating a 
number of bugfixes and enhancements.

Advantages over Hi-Tech C bootloader:

- bugfix: doesnt overwrite program memory if config word at 0x2007 is specified
- bugfix: doesnt overwrite program memory if ID word is specified
- bugfix: works with EEPROM data in .hex file
- bugfix: resets all regs to defaults on restart
- doesnt need a special button on RB0 to work (see below)
- its all been tested, and works beautifully

1.  Plug in a serial board adaptor with a MAX232/MAX3222/SIPEX232 etc to connect 
the serial port of the computer to pins RX/TX on PIC.  See the attached .gif and 
Protel 99 .sch files. You only need one serial port - ignore the M2_xx lines as 
they are not needed for this.

The FAQ at http://www.workingtex.com/htpic has the same schematic diagrams, plus a 
troubleshooter guide for non-working serial ports.

2.	Select the correct .hex file.  You must get the crystal speed correct.  
Options are 3.6864, 4, 16 and 20Mhz for the 16F873 or 16F876.  As far as 
programming goes, the 16F873 is the same as the 16F874, and the 16F876 is the 
same as the 16F877. For example, a 16F876, 16Mhz, downloading at 19200 baud 
would be "61619 - bootldr-16F876-77-16Mhz-19200bps.hex".

3.  Program the target pic micro with this .hex file.

4.  Run "pic_downloader.exe", and choose 19200bps, write eeprom, and the .hex 
file to download.  Again, get the crystal speed correct.  For example, for a 
16Mhz crystal, choose "test_serial_19200baud_16Mhz.hex".

5.  Reset PIC micro now.  The bootloader is active for 4 seconds after reset.

6.  Click 'write' within 4 seconds of PIC reset, and the program is downloaded 
into the PIC micro.  This takes a few seconds.

7.	The test program simply prints out a single text message @ 19200 baud on 
powerup, run '19200-com1.ht' to see it.  Remember to close "pic_downloader.exe" 
first, because the program reserves the serial port for itself.

8.  In future, after powerup, bootloader times out in 1/2 sec and then runs the 
target program normally.  Reset the PIC micro now, and you should see it pause 
for 1/2 sec, then start printing serial.


(c)2000 Shane Tolmie, shane@keyghost.com
see http://www.workingtex.com/htpic for more projects like this and a huge FAQ on Hi-Tech C.