Instant Interrupts - Revisited


Results 1 to 40 of 773

Threaded View

  1. #11
    Join Date
    Jan 2010
    Location
    PHILADELPHIA, PA - USA
    Posts
    34


    Did you find this post helpful? Yes | No

    Default Understanding RBC_INT... or not

    Hi,

    I've been trying vary to fully understand the RBC_INT interrupt handler in DT_INTS-18.pbp.

    So I wrote this little program, Created a simulator circuit model and also a similar hardware circuit.

    Here is the Code:
    Code:
    ' RBC TEST.BAS
    ' PIC 18F6480
    ' MPLAB IDE V8.40
    ' PBP V2.60
    ' Build Options: [-ampasmwin]
    ' RB4  Momentary Contact Button Goes High on Press,  10K Resistor to Ground
    ' RB5  Momentary Contact Button Goes High on Press,  10K Resistor to Ground
    ' RB6  Momentary Contact Button Goes High on Press,  10K Resistor to Ground
    ' RB7  Momentary Contact Button Goes High on Press,  10K Resistor to Ground
    ' RC6  22K ohm to RX on 57600-N-8-1 Serial Terminal
    
    INCLUDE "DT_INTS-18.bas"		; Include Darrel Taylor's Base Interrupt System for PIC18F [Version:3.4 (NOV 04, 2009)]
    
    DEFINE OSC 20
    DEFINE DEBUG_REG PORTC	
    DEFINE DEBUG_BIT 6 			
    DEFINE DEBUG_BAUD 57600
    DEFINE DEBUG_MODE 1 
    DEFINE  SHOWDIGITAL 1
    
    TRISB=%11111111
    ADCON0=%00000000
    ADCON1=%00001111
    
    BTN	  VAR	BYTE
    
    ASM
    INT_LIST  macro ; IntSource,  Label,      Type,  ResetFlag?
            INT_Handler RBC_INT, _DO_RBC_INT,   ASM,  yes	
        endm
        INT_CREATE
    ENDASM
    
    @  INT_ENABLE   RBC_INT
    
    DEBUG "INTERRUPT CREATED",10,13
    DEBUG "INTERRUPT ENABLED",10,13
    
    HOLD_HERE:
    DEBUG "WAITING FOR INTERRUPT",10,13
    PAUSE 2500
    GOTO HOLD_HERE
    
    DO_RBC_INT
    DEBUG "############### RBC INTERRUPT ACTIVATED #################",10,13
    
    MENU:
    PAUSE 200
    DEBUG "MENU - READ BUTTONS",10,13
    If PORTB.4 = 1 Then PAUSE 250: Goto DO_ENABLE
    If PORTB.5 = 1 Then PAUSE 250: Goto DO_DISABLE
    If PORTB.6 = 1 Then PAUSE 250: Goto DO_RETURN
    If PORTB.7 = 1 Then PAUSE 250: Goto DO_CLEAR
    GOTO MENU
    
    DO_ENABLE:
    DEBUG "RUNNING DO_ENABLE",10,13
    @ INT_ENABLE RBC_INT
    Pause 250
    GOTO HOLD_HERE
    
    DO_DISABLE:
    DEBUG "RUNNING DO_DISABLE",10,13
    @ INT_DISABLE RBC_INT
    PAUSE 250
    GOTO HOLD_HERE
    
    DO_RETURN:
    DEBUG "RUNNING DO_RETURN",10,13
    @ INT_RETURN
    PAUSE 250
    GOTO HOLD_HERE
    
    DO_CLEAR:
    DEBUG "RUNNING DO_CLEAR",10,13
    @ INT_CLEAR RBC_INT
    PAUSE 250
    GOTO HOLD_HERE
    
    END
    Here is the Circuit:


    There are 4 buttons connected to PORT B <4.7>
    Here are my observations:

    The first press of any button activates the RBC Interrupt and sends program to DO_RBC_INT subroutine, then on to MENU where it checks for button presses. This behaves exactly as I would expect it to.

    Now...After that....

    Pressing Button RB.4 [ENABLE] Runs the DO_ENABLE subroutine then the HOLD_HERE subroutine. At this point, the Interrupt handler seems to shut down as no Port B inputs activate the interrupt handler. I would expect the Interrupt to remain active.

    Pressing Button RB.5 [DISABLE] Runs the DO_DISABLE subroutine then the HOLD_HERE subroutine. The Interrupt handler is now disabled as expected.

    Pressing Button RB.6 [RETURN] Runs the DO_RETURN subroutine then the HOLD_HERE subroutine. It then sends program to DO_RBC_INT subroutine, then on to MENU. I would expect it to return to HOLD_HERE which is wherr the interrupt was originally activated

    Pressing Button RB.7 [CLEAR] Runs the DO_CLEAR subroutine. At this point, the Interrupt handler seems to shut down as no Port B inputs activate the interrupt handler. I would expect this to just clear the interrupt then await another RBC trigger.

    So it seems I can only activate the interrupt one time.

    It doesn't seem to matter whether I use ASM or PBP types or set Resetflag to yes, or no

    Can anyone shed light on what I'm doing wrong, or am I simply misinterpreting the function of the INT_* utilities.

    I'm just not sure if I've got a mistake, am staying up too late working on this stuff, or just really don't get it.

    Thanks,
    Bob
    Attached Images Attached Images  
    Attached Files Attached Files
    Wozzy-2010

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 20:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 06:32
  5. Replies: 1
    Last Post: - 1st November 2006, 03:11

Members who have read this thread : 5

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts