Timer Usage with 18F252


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2008
    Posts
    7

    Default Timer Usage with 18F252

    I'm trying to implement a simple timer with PBPro using the 18F252. I need to know when 30 minutes are up after a given event. I figured I'd use the timer function to give me a 1 sec or 6 second "overflow" and use that to increment a software counter until I get to the desired time lapse.

    I understand the concept of pre-loading the TMR0L and TMR0H bytes. I'm using a 4MHz oscillator. Not clear what clock rate the Timer is operating at (1 MHz?)

    Also does the prescaler basically reduce this clocking frequency by the prescale value, for example if I use a prescale of 100, would the frequency into the time become the clockrate/32?

    Thanks...Chris Shatara
    [email protected]
    Chris Shatara

  2. #2
    Join Date
    Dec 2005
    Location
    So Cal and loving it
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Your right

    Hi Chris,

    You are right on with your thought process, all you have to do is put it together and try it out. The basic clock freq for the timer is 1uS for a 4MHz osc (fosc/4).
    You will find plenty of code examples by searching the forum, use the better search under the FAQ thread. Also do a search for DTs (i think) inturrupt and PWM calculator, it will help you decide which values to use for everthing. There is also a good example of a clock that has code for tracking seconds minutes and hours somewhere on here.

    Good luck.

    Paul
    +-------------------------------------------------------------------+
    | PBP 2.47/2.50 | MCS+ 3.0.0.5 | U2 Prog | Vista x64 | NO SLEEP!!!!!!! |
    +-------------------------------------------------------------------+

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    http://www.mister-e.org/pages/utilitiespag.html

    misterE has the above. Most everything you need in one package!
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Jul 2008
    Posts
    7


    Did you find this post helpful? Yes | No

    Smile Thanks All

    Thanks for the prompt reply. I'll try it out later and get back if there are any questions.

    /chris
    Chris Shatara

  5. #5
    Join Date
    Dec 2005
    Location
    So Cal and loving it
    Posts
    40


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    http://www.mister-e.org/pages/utilitiespag.html

    misterE has the above. Most everything you need in one package!
    Humble appologies to Mister-e , it was a long time ago I saw the util......

    Paul
    +-------------------------------------------------------------------+
    | PBP 2.47/2.50 | MCS+ 3.0.0.5 | U2 Prog | Vista x64 | NO SLEEP!!!!!!! |
    +-------------------------------------------------------------------+

  6. #6
    Join Date
    Jul 2008
    Posts
    7


    Did you find this post helpful? Yes | No

    Smile Thanks again

    Downloaded the program and quite impressed with the tool. Takes all the drudgery out of coming up with the preload numbers.

    Thanks to all of you for your help...Chris
    Chris Shatara

Similar Threads

  1. Single button function
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 40
    Last Post: - 4th April 2020, 18:33
  2. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  3. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  4. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  5. timer interupt help 16f73
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2005, 08:41

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts