Routine of an exact second


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1

    Default Routine of an exact second

    Hello forum,

    Can Somebody tell me as obtaining 1 exact second using some routine in pbp?.

    Thank you

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Leonardo View Post
    Hello forum,

    Can Somebody tell me as obtaining 1 exact second using some routine in pbp?.

    Thank you
    start:
    pause 500
    led = 1
    pause 500
    led = 0
    goto start

    Led flashes at 1hz (+ maybe 30 or 60 microseconds if using a 4mhz oscillator)

    Of course like EVERYTHING ELSE that will be mentioned in this thread, and has been mentioned in other threads you have started and/or participated in, a one second clock/timer will only be as accurate as the clock that initially drives the PIC. And as also stated in other threads, using an RTC (Real Time Clock) chip is quite possibly the easiest route to go. There are many WORKING examples (and some not-so-working) in these PICBasic forums and many freely available examples on the internet...provided a person does a search for this and is able to learn and use the language that an example may be provided in.
    Last edited by skimask; - 28th February 2007 at 04:00.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Hello,

    It Happens that I don't want to use an alone RTC I want to use code.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Leonardo View Post
    Hello,

    It Happens that I don't want to use an alone RTC I want to use code.
    Well, then here's some good code for you that take into account the time it takes for the loop and the led statement,....with a 4mhz oscillator

    start:
    pause 499
    pauseus 988
    led = 1
    pause 499
    pauseus 988
    led = 0
    goto start

    Now, how about showing us what you've got written so far, and let us know which PIC you are going to use, what your oscillator source is going to be, etc.etc. We'll help you...but you've got to help yourself...

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    depending of what's around... you may want to use an internal timer, or sim it with your code in MPLAB using StopWatch.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Replies: 4
    Last Post: - 17th December 2009, 00:29
  2. Darrel's latest 16 bit averaging routine?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 17th October 2009, 01:57
  3. Dallas 1-wire search Routine
    By jimbab in forum Code Examples
    Replies: 0
    Last Post: - 7th April 2006, 16:14
  4. RTC 1302 !!! Set time Routine !!
    By uludere72 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th February 2006, 09:28
  5. Software Driven Reset Routine
    By Tissy in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th April 2005, 00:53

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