Page 50 - DEC40053 Ebook_Timer
P. 50

example:-






               Assume XTAL=10MHz.

                  1. Find the clock period fed into Timer0 if the

                     prescaler option 256 is chosen.


                  2. Show  the  largest  time  delay  that  can  be


                     obtained using this prescaler option.






               Answer:-






               1) 1/4 x 10MHz = 2.5MHz and

                  1/256 x 2.5MHz = 9762.625 Hz due to 1:256

                  prescaler and


                  T = 1/9765.625Hz = 1024us = 1.024ms





               2) To obtain the largest delay, make TMR0H

                   and TMR0L both 0. It will count from 0000


                   till FFFFh, roll over to raise the TMR0IF flag.

                   Time delay = (65535 - 0) + 1 x 1024us


                   Time delay = 67.109s














                                                          -41-
   45   46   47   48   49   50   51   52   53   54   55