
Pinouts related to the bootloader for the PIC16LF819 chip and 
the 2-wire serial connection to the host PC.


                        16LF819
                        Top View
               ,___________  _____________
               |           \/             |
               | 1 RA2             RA1 18 | 
               |                          |
               | 2 RA3             RA0 17 | 
               |                          |
               | 3 RA4             RA7 16 | 
               |                          |
               | 4 RA5/Vpp/MCLR*   RA6 15 |
               |                          |
               | 5 Gnd             Vdd 14 |
               |                          |
               | 6 RB0         RB7/PGD 13 |
               |                          |
               | 7 RB1/SDA     RB6/PGC 12 |
               |                          |
               | 8 RB2             RB5 11 |
               |                          |
               | 9 RB3/PGM     RB4/SCL 10 |
               `--------------------------'


   My preference is for the bootloader to use RA5 (on pin 4) as the
   serial input.  One problem with the /MCLR pin is that the PC's
   serial port's start/zero bit might be high enough to be mistaken
   for a valid Vpp and thus put the PIC in (hardware) high-voltage
   programming mode.  We could work around that with a voltage divider
   to scale the PC's serial voltage to a maximum of 5 volts.



 RS232  DTE (male) DB9 from PC
        pin 2 Rx   not used
        pin 3 Tx   --> connect through voltage divider to PIC pin 4
        pin 4 DTR  not used
        pin 5 Gnd  --> connect to PIC ground, e.g. PIC pin 5

 Connect it to the PIC 16LF819 


 A fixed-resistor voltage divider could be used (or, if you use a PC
 whose serial port's maximum voltage is only perhaps 5 or 6 volts, it
 could be omitted altogether).  Instead, I use a small 10K or 20K
 potentiometer, not on the PIC development board side, but on the
 serial, so it can be adjusted just once for the particular host PC's
 serial port.

 I adjust it statically, with the PC's serial port in the idle state
 (putting out a steady negative voltage) before connecting the serial
 port to the PIC.  I adjusting the pot for approximately -5 volts.  I
 figure if the negative and positive excursions are symmetrical, this
 will limit the positive voltage to approximately 5 volts.  All that
 matters is that the positive voltage is not so high that the PIC will
 mistake it for the signal to go into high-voltage programming mode.
 The negative side of the PIC's RA5/MCLR* pin is diode clamped but the
 positive side is not.  Because of the clamp, the pot should be
 adjusted with the serial port *not* connected to the PIC.



 Note, the bootloader does not use the line shown below from the PIC's
 transmit to the PC's receive.  However some of the example programs
 do use it, so it is included in the diagram below.  The 300 ohm
 resistor is just a safety measure and could be omitted.  The PIC
 serial output pin choice is arbitrary and can be changed if you
 change the sample programs to match (look for the TXPIN, TXPORT, and
 TXTRIS equates).

                                300 ohm
  PC serial in pin2    <-------------/\/\/\---- PIC serial out pin 18 RA1

  PC serial out pin3   ----/\/\/\---.
                                    |
                          10K pot   x-----> PIC serial input pin 4 RA5/MCLR*/Vpp
                                    |
  PC serial gnd pin5 -x----/\/\/\---'
                      |
                      `------------------------ PIC Gnd              

