PortB Change Interrupts


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    RBC_INT only triggers on chages with PORTB<7:4>

    For PORTB.0, you would use INT0_INT
    PORTB.1 is INT1_INT

    Each one should have it's own handler, so it automatically knows which pin triggered.
    <br>
    Actually, I meant to read from pin 4 and 5. That solves half of the problem.

    I have corrected that in my code, still same problem.

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


    Did you find this post helpful? Yes | No

    Default

    Keep in mind that any changes on PORTB.6 or 7 will also trigger an interrupt. It's best to Not Use 6 and 7 for anything else.
    Code:
    Old_Bits VAR BYTE
    New_Bits VAR BYTE
    
    INCLUDE "DT_INTS-18.bas"        ' Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas"     ' Include if using PBP interrupts
    
    ASM
    INT_LIST  macro    ; IntSource,         Label,  Type, ResetFlag?
            INT_Handler    RBC_INT,  _RBC_handler,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    Old_Bits = PORTB
    @    INT_ENABLE   RBC_INT     ;RB Port Change Interrupt
    
    Main:
      Pause 1000
    GOTO Main
    
    '---[RBC - interrupt handler]---------------------------------------------------
    RBC_handler:
        New_Bits = PORTB
        IF (New_Bits.4 <> Old_Bits.4) THEN
            ; -- PORTB.4 has changed -- 
        ENDIF
        IF (New_Bits.5 <> Old_Bits.5) THEN
            ; -- PORTB.5 has changed -- 
        ENDIF
        Old_Bits = New_Bits
    @ INT_RETURN
    DT

Similar Threads

  1. PICs can do more if use others than delays instructions
    By hardcore in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th February 2010, 19:52
  2. Returning from Int on PortB change
    By sheryl in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th December 2008, 18:09
  3. shifting problem
    By helmut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 31st August 2007, 06:11
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 5th May 2005, 23:29

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