Interrupts Identification (handling)


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2007
    Posts
    65

    Question Interrupts Identification (handling)

    Hello all again;

    In a program I want to do, I want to handle more than an interrupt source, so I enable theese interrupts:
    -RB Port Change Interrupt
    -Timer1 Overflow Interrupt

    in the ON INTERRUPT part, ¿How can I identify which interrupt was triggered?

    (if relevant, PIC is a 16F628A)

    regards
    Rod
    "Beethoven had his critics too, see if you can name 3 of them"

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Post

    Hi,

    Just check if corresponding interrupt flags are set ... before clearing them !

    that's all !

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    Just check if corresponding interrupt flags are set ... before clearing them !

    that's all !

    Alain
    LOL so simple ! thank you.
    -something like:
    Code:
    ...
    ON INTERRUPT GOTO IntHandler
    ...
    ...
    IntHandler:
      If PIR1.0=1 then
         PIR1.0=0 'Clear flag
         ..do my thing...
         RESUME
      EndIF
    
      If INTCON.0=1 then
         INTCON.0=0 'Clear flag
         ..do my thing...
         RESUME
      EndIF
    but.. if I have 10 interrupts enabled and the last interrupt checking ('If' statement) was the triggered, will I always have to check the previous 9 each??, sounds like it will.

    PD: ENABLE & DISABLE are optional, am I ok?
    "Beethoven had his critics too, see if you can name 3 of them"

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,820


    Did you find this post helpful? Yes | No

    Default

    Why not use Darrels Interrupts?

    Ioannis

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by RodSTAR View Post

    LOL so simple ! thank you.
    -something like:
    [code]
    ...
    ?
    Yess ... so simple

    Quote Originally Posted by RodSTAR View Post

    but.. if I have 10 interrupts enabled and the last interrupt checking ('If' statement) was the triggered, will I always have to check the previous 9 each??, sounds like it will.
    ?
    You see anther way to check which has triggered ???

    it's a Pic specifics !!!

    Quote Originally Posted by RodSTAR View Post

    PD: ENABLE & DISABLE are optional, am I ok


    ?
    heuuuuu, disable before the interrupt stubb !!! or it will be fun ...

    Ioannis ( hello ...) is right ... BUT if your device shows ~> 2K prog space min. ( say ~> 100 SRAM Bytes ...). The 12F683 is the minimum size to allow something "usable" ...

    Alain
    Last edited by Acetronics2; - 21st April 2008 at 13:19.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,820


    Did you find this post helpful? Yes | No

    Default

    Hi Alain. He stated that the device is F628, so it might fit the budget! But on the other hand, On Interrupts, depending on the length of the PBP program might consume RAM too.

    Ioannis

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  3. Handling External/Timer Interrupts
    By Tacky3000 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd December 2008, 11:09
  4. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  5. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10

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