Page 41 - Making PIC Microcontroller Instruments and Controllers
P. 41

iECH||O!OGY'S  PIC i6Fa7?A:  A DESCBIPIIOI{
            30   U  DERSIAI{Dn{G IVIICROCHIP                                OF THE iilCu


                     All the  pins  have  TTL level inputs  and full CMOS  level output drivers.  This makes
                   il casy  to connecl these  lines direclly to standard  logic components  (meaning  that r,t&-
                   dlh  no intermediate  rcsistors  are needcd between  components  if TTL or CMOS com
                   ponents  are  interconnected).
                      PORTA  (tetisnations  are somewhat  complicated.  Pins A0, A 1  ,  A2, A3  '  (skip  A4)' and
                   Pin A5 can be  configured as analog  inpuls by setting  rhe ADCONI register appropri_
                   ately.  Pin A3 is also  used as a voltage  input fbr comparing  with the  analog  voltage
                   inputs  on other  pins.  Pin PORTA4,  is used as input  for the timerTIMERo.lt is called
                   ToCKlforTimer0clocklnput.ThisisPin6oflhcPlCandisusedastheinputpjnlor
                   TIMERo  only when configured  as such.  It is a Schmitt  trigger input  with open drain
                   ourput. Open  drain means  it acts like the contacts  of a liny relay Scbmitt trjggered  inputs
                   have increased  noise immunity  (becausc  of the hystelesis between  state changes)
                     The two  registers that control  PORIA arc  TRISA and ADCONI
                     ADCON1 controls  theA to-D  and voltage reference  functjons  of PORTA  The set
                                                                                    jn
                   ting  of the  vadous  bits  select acomplicated  set ofconditioN  that are  described  detail
                                        and in this book.  (Inlhcpreceding discussjon,
                   in atablein the datasheet                                  whenADCONl
                   was  setto 7.00000111,  we were accessing  this feature.)
                     Pitr  A4 hds speciel  needs when useA as  an output.lt  can be  pulled  down  low but will
                   fioat when  ser high. lt must be  pulled  up with a  (  LoK to I 00K) resislor to tie it high when
                                  This  pin has an open drajn output  rather  thar the usual  bipolar state
                   this is necessary.
                    of the other  pins.  As noted earliet  this  pin is skipped  in the  A-to-D conversion  table.
                    (Ignoring  this  fact is a source olmany common mistakes,  so keep  this in mind.)



                    PORTB


                    PORTB  is a full 8 bjt-wide  bidireclional  po|t.
                      Intcmal  circuitry  (meaning  built into the  MCU) allows  all the  pins  on  PORTB to be
                    pulled up to a high slate  (very weakly) by  setting  pin 7 of t}le option register
                    (OPTION REG.?)  to 0. Only those  pins  designated  at iDputs are  affected.  These  pull
                    ups are disabled  on starlup and on reset.
                      Pins 83. 86. and  87 are useal  for the low voltage  programning ofthe PlC.  Bit 3 in
                    TRISB  mustbe cleared  (set  |o 0 or  pulled  down to 0)  to negate the  pull up on this  pin
                    to allow  programning  to take  place.  See  pages  42 and 142 in the datasheet  fbr more
                    infomation  regarding thc 93  pin. This is wry  inportant.
                      Pins 84 to B? will cause an  intefupt 10 occur  when lhcir state  changcs  if they are
                    configured  as inputs  and the appropriate  irltelTupts are  configured.  Any of these  four pins
                    that  are conligured  as outputs will be  excluded fiom the intelrupt leature Thc intenxpts
                    are  controlled by the INTCON (interupt  control) register. This PORTB interupt  capa
                    bility has the special  feature oflelting it be used to awalen a sleeping  MCU.
                      Pin B0 has spccjal  inteffupi  functions that are controlled tbrough the INTEDG  bit'
                    which is bit  6 of the OPTION-REG.  See  datashect for  more intbrmation  rrt?/dl
                    interrup  arc  nuted tu the  PIC through this  pin.Extemal inteffupts are  those that are
                    created bv events  outside the  PIC MCU.
   36   37   38   39   40   41   42   43   44   45   46