Which interrupt ?


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: Which interrupt ?

    I like the idea but its weird as to what happens. I push the button which generates the interrupt. I watch the status of the "HoldB" variable which is the first statement in the ISR - and it does change to reflect the change on pin 2 or 3 (what ever is pressed) but then HoldB immediately switches back to reflect POrtB again. I don't get it?

    Example:

    - Push button
    - bit 3 of Port B changes from high to low causing interrupt
    - Goes to ISR
    - HoldB grabs PortB status
    - Pin 2 switches back to high state
    - HoldB automatically changes also (this is the part I don't understand)

    Here is the sample code I used:

    Disable

    MyISR:
    HoldB = PortB ' copy Port B into HoldB

    Pause 100
    CV = CV + 1
    endif
    INTCON.0 = 0

    Resume

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Which interrupt ?

    Are you using ON INTERRUPT GOTO ?
    If so did you DISABLE and Enable interrupts during your ISR ? it sounds as if it is repeatedly interrupting before action is taken. I E Fast interrupt, slow finger . . . You can wait to re-enable the interrupt until after your subprogram does it's job . . .
    Last edited by Archangel; - 8th July 2013 at 00:15.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Feb 2012
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: Which interrupt ?

    It's saving PortB in HoldB but after the pin goes back to its high state. In other words, Pin 2 is changing back to it's high state before it goes to ISR - at least it seems that way.


    Disable Interrupt

    MyISR:
    HoldB = PortB
    ' Interrupt service routine
    Pause 100
    CV = CV + 1

    INTCON.0 = 0

    Resume
    Enable Interrupt

Similar Threads

  1. Need help with interrupt
    By mbox in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th August 2010, 17:48
  2. RX interrupt
    By Arciure in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 5th March 2010, 18:23
  3. on interrupt help
    By cphillips82 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 25th April 2008, 16:48
  4. always go to interrupt
    By savnik in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 26th March 2007, 04:31
  5. Replies: 0
    Last Post: - 27th August 2004, 08:20

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