sub routine question


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Is there any way I can talk someone into integrating the above that Dwayne contributed into this working code? I've tried several ways and only complicate the errors. Tried the COUNT command but don't know how to make it integrate into it to go to the sub routine. The counter will work perfectly for what I need but I am not experienced enough with PBP to make this addition. Thanks again Emmett
    Last edited by emmett brown; - 22nd July 2006 at 04:22.

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


    Did you find this post helpful? Yes | No

    Default

    From what i understand, you want to execute a Subroutine at every 15minutes right?

    The only thing that spring to mind without adding extra hardware is a Timer interrupt.. or measure the mainloop time, execute it untill it reach the 15Minutes, then execute the Subroutine. Once you know the time of the main program, you just calculate the amount of time you'll have to repeat it.

    If you don't know the time... you can even use a extra i/o and measure it with a scope or whatever else.

    Snip
    High ExtraI_O
    'mainRoutine
    Low ExtraI_O

    Assuming you must loop 'x' time

    Code:
    Start:
        for Repeat=0 to x
            ' MainLoop
            Next
    
        'Do your Subroutine here
        GOTO Start
    Steve

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

  3. #3
    Join Date
    Jun 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Yes every 15 minutes or so no matter what the time length for the main program. I see what you mean, if the main took longer to execute then the counter wouldn't decrease in the same amount of time. Either way would simply need to be adjusted after running the program an hour or so. I'm still lost as to how or where to plug it into my program though. Yes, It stinks that I am relatively new at this. Thanks again, Emmett

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


    Did you find this post helpful? Yes | No

    Default

    well the timer interrupt is still valid.

    Is it going to be a battery powered device or you can access easy to the line AC signal?

    If so you can use a Counter overflow Interrupt. OR, by what i feel of, the Darrel Taylor's Elapsed timer could be another solution.
    Steve

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

  5. #5
    Join Date
    Jun 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    It'll be battery powered

  6. #6
    Join Date
    Jun 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    I believe I have it tackled Thanks so much for the invaluable input! Emmett

  7. #7
    Join Date
    Jun 2006
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Yep, it works ! Thanks much to Dwayne and Mister E without which it wouldn't have happened. The best pic forum on the net! Emmett

Similar Threads

  1. Replies: 4
    Last Post: - 17th December 2009, 01:29
  2. Timer0 Instant Interrupts Question
    By wmarchewka in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th December 2009, 06:29
  3. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 22:07
  4. IOC question
    By Adrian in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st April 2008, 20:21
  5. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 07:49

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