interrupt question


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    21

    Default interrupt question

    hi,
    question: I have 2 codes for the interrupt to the INTERRUPT vector
    04h, one on RBIE and the other on TOIE.
    If during the execution of the program it occurs the second
    interrupt, as ago the MCU to recognize which of the 2 codes it has
    to perform?

    THX
    chip

    MCU = 16f84a

    ORG 04H


    CODE 1..... (ON RBIE)


    CODE 2......(ON TOIE)

    ----------------------------------------------------

    MAIN PROGRAMM

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Just test your interrupt flag bits in the int handler. These tell you which source generated the interrupt condition.
    Code:
    ORG 0x4
    
     ; save state if needed here
    
    ISR
      btfss INTCON,T0IF ; if TMR0 interrupt, handle it 
      goto RB_INT       ; else skip to RB_INT
    
    T0_INT
      ; CODE 2......(ON TOIE)
      bcf   INTCON,T0IF ; clear TMR0 int flag, and run handler
    
      ; insert your timer0 int handler here
    
    RB_INT
      ; CODE 1..... (ON RBIE)
      bcf   INTCON,RBIF ; clear RB int flag, and run handler
    
      ; insert your RB int handler here
    
    ISR_EXIT
      ; restore state if needed here
    
      retfie
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Dec 2005
    Posts
    21


    Did you find this post helpful? Yes | No

    Default Thx

    Tank you Bruce!!!!!

    Best regard
    chip15

Similar Threads

  1. Interrupt question
    By ultiblade in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th November 2009, 20:12
  2. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  3. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 18:14
  4. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07
  5. Interrupt question
    By stone in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 25th January 2005, 23:11

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