Page 29 - DEC40053 Ebook_Timer
P. 29

Example







               Find the value T0CON if we want to program Timer0


               in 16-bit mode, no prescaler. Use PIC18 Fosc/4 crystal;

               oscillator for the clock source, increment on positive-

               edge.




                 TMR0ON = 0 (default value)

                 T08BIT = 0 (16-bit mode)

                 T0CS = 0 (Internal clock Fosc/4 XTAL oscillator)

                 T0SE = 0 (Positive increment => rising increment)

                 PSA = 1 (no prescaler)

                 T0PS2:T0PS0 = 000 (don't care value)





                               T0CON = 0b00001000






              What is T0CON value with same setting as above but

              with 64 prescaler value?



                 All other bit are same except for bit 3:0 (prescaler)




                 PSA = 0 (Timer0 come from prescaler)

                 T0PS2:T0PS0 = 101 (Prescaler value 1:64)




                               T0CON = 0b00000101












                                                          -21-
   24   25   26   27   28   29   30   31   32   33   34