Instant Interrupts - Revisited


Results 1 to 40 of 773

Threaded View

  1. #11
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Many thanks Darrel.

    I have a problemetette - my program runs fine, but then when I press a switch (to generate an IOC), an interrupt *is* triggered, but it then seems to loop in my interrupt handler (it's actually becuase the INTCON.0 bit seems to be staying at 1, which keeps it jumping to the interrupt handler constantly)

    Any ideas, why the IOC_FLAG = 0 entry towards the end of the interrupt handler doesn't appear to be taking affect?

    Code:
    IOC_FLAG VAR INTCON.0 ' Alias RABIF interrupt flag bit
    debug_out var byte
    SW1    VAR PORTA.5
    on_status var byte
    Green_LED VAR PortC.1 
    
    ASM
    INT_LIST  macro ; IntSource,    Label,         Type, ResetFlag?
        INT_Handler  IOC_INT,  _Switch_Interrupt,  PBP,  YES 
        endm
        INT_CREATE       ; Creates the interrupt processor
    ENDASM
    
    Check:                        
      'Check switches before enabling/re-enabling IOC   
      WHILE SW1 = 0 : WEND  ' Wait until all switch inputs = 1 
     IOC_FLAG = 0          ' Clear the int-on-change flag bit
    
    @ INT_ENABLE IOC_INT   ; Enable 'Int On Change' interrupts
    on_status = 0
    Low GREEN_LED
    
    
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Switch_Interrupt:
    hserout ["trap ", dec IOC_FLAG, 13, 10]
    
    @ INT_DISABLE IOC_INT  ; Disable further IOC interrupts
    
    
            pause 10
            IF sw1 = 0 THEN
            if on_status = 1 then 
            on_status =0
            Low GREEN_LED
            else
    
            High GREEN_LED
            on_status =1
            endif
            endif
            pause 20
    
    
            WHILE SW1 = 0 : WEND
            pause 25
            IOC_FLAG = 0
    @ INT_ENABLE IOC_INT
    @ INT_RETURN

    This is almost certainly something I'm doing wrong, but then again, it's pretty much a direct what was working fine my functioning 16F690 IOC routine?
    Last edited by HankMcSpank; - 21st November 2010 at 18:10.

Similar Threads

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

Members who have read this thread : 4

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