Timer Interrupts


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Timer Interrupts

    One other thing.

    You use the example of 2 timers, 1 HP and 1 LP. Keep in mind these could be any of the components capable of raising an interrupt, such as...
    EUSART Receive Interrupt, CCP1 Interrupt, A/D Converter Interrupt, High/Low-Voltage Detect Interrupt, Etc.
    Any of these can be enabled and set either to HP or LP. Also, more than one can be set to HP or LP.

    Imagine you had two of them set to LP, and 1 to HP. A/D and HLVD set to LP. TMR1 to HP.
    So the A/D triggers. Program jumps to LP ISR. While executing the LP ISR, the HLVD interrupt occurs. What happens?
    The LP ISR just continues as if no other interrupt occured because the LP enable bit was cleared when it first entered the ISR. When the RETFIE command (return from interrupt command) is executed the LP enable bit is set again. Assuming the A/D flag was reset, but not the HLVD, the program would immediately branch back to the LP ISR again. In these cases, where you have more than one item that can raise an interrupt, the ISR needs to check which flag was set so it knows what to do.

    Now, at ANY time (in this example), if the TMR1 interrupt occurs, it jumps to the HP ISR, executes the ISR, then jumps back.

    Hope I didn't make things even more muddy.
    Last edited by SteveB; - 19th August 2011 at 05:18. Reason: typos

  2. #2
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default Re: Timer Interrupts

    Many thanks SteveB, i understood perfectly.

    Thank you everyone!
    Thanks and Regards;
    Gadelhas

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


    Did you find this post helpful? Yes | No

    Default Re: Timer Interrupts

    Quote Originally Posted by SteveB View Post
    Hope I didn't make things even more muddy.
    It's my job to do so

    Nice explanation!
    Steve

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

Members who have read this thread : 1

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