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

IrI{DEFSTAIDIIIG THE COUITERS:  COUilTI G  AFEIES





































                    Wretffiffi     wiring setup to test  the sen-
                     sitivily ol the phototransistor  response.


                    Special Notes for Timerl Usage


                    Some of the succeeding  paragraphs  are fiom the datasheet.


                    TIMERI  OPERATION IiI  ASYI{CHROI{OUS  COUI{TER IIIODE
                    The following is what we use for our marble counting exercise.
                      ff control bit T1S\AnC  (TICON<2>)  is set, the extemal clbck input is not  synchro-
                                                                 to the  intemal  phase  clocks. The
                    nized. The  timer continues to inuement asyncbrcnous
                    timer  will continue to nm durirg sleep and can  generate  an interrupt on overflow, which
                    \ ill wale  up lhe  processoi  Houe\er.  \pecial precduuons
                                                                      in soflware are needed to
                    reaaywrite  the timer  (Chapter  6.4. 1  of the datasheet). In asynchronous countet modq
                    Timerl cannot be used as a time-base  for capture or compare opemtions.

                    READII{G AI{D WRITING TIITIERI II{ ASYI{CHROI{OUS  COUI{TER
                    ll|oDE
                    Readiry TMR lH or TMR lL while the timer is running liom an extemal asynclfonous
                    clock will guarartee  a valid  read  (taken  care ofin hardware), Howevet the user  should
   253   254   255   256   257   258   259   260   261   262   263