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

to8Tc   3i



                    The three  registers that conuol PORTB are TRISB, INTCON, and OPTION-REC.
                      OPIION-REG  controls t]le oplional functions of PORTB as follows.


                    a  Bit B0 of OPTION_REG sets  prescalar  value
                    I  BitBI  ofOPTION  REG sets  prescalar  value
                    r  BitB2  of OPTION REG sets  prescalar  value
                    r  Bit83ofOPTION  REG sets  the  prescalar  option  (used  in low-voltage  pogramming)
                    t  Bir B4 of OPTION  REG sets  Timef0 input pulse  edge selection
                    r  Bit B5 ofOPIION  REG sets  the clock selection
                    I  Bit B6 of OPTION  REG sets  edge selection for interupts  (progranming uses)
                    :  Bit 87 of OPTION-REG sets the  pull-ups when cleared  (programming  uses)



                    PORTC


                    PORTC  is a full s-bilwide bidirectional  poft.
                      Al1 the  pins  on PORTC have Schmitt  trigger input bulTers.  This means they are
                    designed to be more inrmune to noise on these  input lines.
                      The altemate  function of the PORTC  pins are defined as fbllows:

                    r  BitC0  VOpinorTimerl  Oscillator output or  Timerl Clock input
                    rBitCl    VO  pin  orTimerl Oscillator  input or Capture  2 input or Compare  2 output
                              or Hardware PWM2 output
                    r  BitC2   yO  pin or Caprure  1 input or Compare I output or Hardware PwM I output
                              yO
                    !  Bit C3     pin or Synchronous  clock for both SPI and I2C  memory modes
                    r  Bit C4  I/O pin or SPI data or data  I/O for I2C mode
                    I  Bit C5  VO  pin  or Synclronous serial  port  data ouQut
                    a  Bit C6  VO  pin  or  USART Asynchronous transmit  ol synchronous clock
                    r  Bit C7  VO pin or USART Asynchronous receive or synchronous data

                       Special care must be taken  when using PORTC'S special  function capabilities,  in that
                     some  of ttrcse functions will  change/set  the  yO  status of certain  other  pins  when  in use,
                    and this can cause unfbreseen complications  in the function of other capabilities. See
                     the datasheet  for details.
                       The rcgister that controls  PORTC is the TRISC register. No other  registers are
                     involved. DEFINES are  used to set or contlol ce{ain PORTC functions.

                     Nole   The speaker on the  IAB-XI  board is con  ected to  pin C I  , so the use of this  pin
                     is linited  becduse the noise  generated  by the speaker i)hen this  pin is used can  be very
                     iffitating  to humans. Since this is one of the lines that allotrs the generatiott  of contin'
                     uous  background  PWM  signals  (HPWM 2), it compromises  the clean use of this pin
                     unless the speaker  is remo|ed or the siSnal  is put thmuqh a gate to clean it up.  (l  rcc'
                     ommend that  Jou  avoid modifcations to the boa l  if  )ou  ca  .) The load of the ti  )
                     speaker loacls the  pin and can compromise ceftain other uses, but in  ost  cases  you can
   37   38   39   40   41   42   43   44   45   46   47