Interruptus Frustratus


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Alain, Darrel, Jerson, thanks very much! You guys are great!

    Sooo... if "Disable" & "Enable" don't work with DT_INT, what keeps interrupts from occurring during the interrupt handler? I assume that DT_INT must "protect" it's own handler?

    Is there a way for me to disable the interrupts during certain subroutines?
    When I get the rest of this put together there will be several places where I need to kill the interrupts to perform time sensitive tasks. Is that possible using DT_INT ?
    Do I simply turn the interrupts on and off with the GIE bit when I want to? (INTCON.7 = 0) ?

    Darrel, thanks for catching the TMR0 interrupt with no handler. I don't know why I keep doing that. I had to change the Timer resource from TMR2 to TMR0 and I enabled it's interrupt unnecessarily. Thanks! Turning TMR0 interrupt off helped but didn't completely cure the problem.

    Jerson, please print yourself a pretty gold star and pin it to your shirt for the day!
    The call to gosub "ServiceHardw" was indeed the big culprit. I assume that I just had so much stuff inside my interrupt handler that I ran out of time to do anything else before the next interrupt ?
    I set a bit to tell when a button is pressed and check it in my main code as you suggested, and it works MUCH better now!

    There's clearly a few bugs still to work out before I start adding the rest of my code back in, but it's looking pretty hopeful now.

    Thanks again to all of you. What a great resource!


    Steve

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


    Did you find this post helpful? Yes | No

    Default

    Enable/Disable are for PBP ON INTERRUPT GOTO

    For DT-INTS you have
    @ INT_ENABLE IntSource
    and
    @ INT_DISABLE IntSource

    You could disable all interrupt by clearing INTCON GIE too. Used with care this could work.
    Steve

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

  3. #3
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Enable/Disable are for PBP ON INTERRUPT GOTO

    For DT-INTS you have
    @ INT_ENABLE IntSource
    and
    @ INT_DISABLE IntSource

    You could disable all interrupt by clearing INTCON GIE too. Used with care this could work.
    AHA! Thanks Steve!

    When using @ INT_DISABLE to protect a subroutine, does it also protect nested gosubs, or do I need to disable interrupts in each nested subroutine to protect them all from interrupt?

    Thanks!

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


    Did you find this post helpful? Yes | No

    Default

    It protect what's in between DISABLE and ENABLE, so yes if your Gosub are in between them, they will be "protected" as well.
    Steve

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

  5. #5
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    It protect what's in between DISABLE and ENABLE, so yes if your Gosub are in between them, they will be "protected" as well.
    Excellent. Thanks!




    Steve

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Woohoo! Go TEAM Go!

    And just to add more info ...
    When a 16F PIC is servicing an interrupt, no other interrupts can occur until the current one is finished. The GIE bit is cleared automatically by hardware at the start of the interrupt. Global ints are then re-enabled when it executes a RETFIE (return from interrupt) at the end of the handler.

    So there's no need to try to keep a handler from being interrupted, because it can't.

    With ON INTERRUPT, the actual Hardware INTERRUPT was serviced long before it gets to the handler, so you need to disable/enable with those.
    DT

  7. #7
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Shucks, last week I cudnt even spel PIC, and now I are programin one!

    Data Sheets and Application Notes are wonderful things, but sometimes there's no substitute for a good teacher(s) to help explain things, fill in the details, or to just shove me over a hurdle that I can't find my way around...

    I really appreciate ALL the folks who've taken time to help... but especially Darrel for creating good things like DT_INTS and then having the patience to put up with all the silly questions we newbies will certainly have about it!
    THANKS!

    It's been a good day. I learned a lot.


    Steve

  8. #8
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Byte_Butcher View Post
    Alain, Darrel, Jerson, thanks very much! You guys are great!
    ...snip...
    Jerson, please print yourself a pretty gold star and pin it to your shirt for the day!
    ...snip...
    Thanks again to all of you. What a great resource!
    Steve
    Wow, I am thrilled for that. Thank you. I'm sure many more will learn from your problem as they browse this resource. I myself have used this website to learn from DT, Steve (bow) many times before I began to return the favour. It's my hope that you will be able to soon. :thumbs up:

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