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

22a   CREA I|O ACCUR/ITE TNTERVALS W|lH fltf,ERs  tHE lllETROllOlllES



                    Timer2


                    Timer2 is discussed on  page  59  in the datasheet.
                      Basic description: Timer2 has 8 bits, and both  a pre-  and  postscalar.  It uses the
                    internal clock only and shares the  prescalar  with the watchdog timer. It can be tumed
                    on and off but  cannotbe used as a counter lt cannot be used as a  counter because it does
                    not have a  pin on which it can receive the counter signals.
                      Timer2  i  s an 8-bit timer with both a  prescalar  and a  postscaiar.  The  prescalar  can be as
                    greatas16,aodthepostscalarcanb€asgreatas16,foratotalscalingofl6x16=256,
                    which is the same as  for Timero. However not d]l 256 scalings are available as  they are
                    for Timeo  Oecause  the  prescalar  can only be set to l, 4, or 16).
                      The Timer2 is identilied as register TMR2.
                      The control registers for Timer2 are INTCON, T2CON,  PIEI, and PIR1. The biis in
                    these registers  control Timer2 as foilows:
                      T2CON.1 and  T2CON.0 set the value of the  prescalar  as tbllowsl

                      Bil value          Prescalar value selected
                      00                  I, No  prescalar  is used

                      01                 4
                      1x

                    The  postscalar  is specified by the 4 bits from T2CON.6 toT2C0N.3 as follows:

                      Bit value      Postscalar value selected
                      0000           l, No prescalar  is used

                      0001           2
                      0010           3
                      0011           4

                      0100           s
                      0101           6
                      0ll0           1
                      o l l t        8

                      1000           9
                      1001           r0
                      l0l0           l l

                      1011           t2
   226   227   228   229   230   231   232   233   234   235   236