always go to interrupt


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302

    Default always go to interrupt

    i have a problem with below code.
    always go to interrupt.Why;
    i use pic16f88
    i have pull-ups resistors to rb4-rb7

    Code:
        
        INTCON = %10001000          ' %10001000  enable interrupts on RB4 through RB7
    
        SW1 var PORTB.4
        SW2 var PORTB.5
        SW3 var PORTB.6
        SW4 var PORTB.7
    
        LED1 var PORTA.0
        LED2 var PORTA.1
        
        On Interrupt goto inter    ' Define interrupt handler
        
        TRISA=%11110000         'PA3-PA0=output
        TRISB=%11110000         'PB7-PB4=input, PB3-PB0=output
        PORTA=0                 'Turn off all LEDs
        
    Loop: 
        High PORTA.0
        Pause 500
        Low PORTA.0
        Pause 500    
        goto Loop
    
         Disable                ' No interrupts past this point     
    inter:
    
    '*** Blinking routine ***
    
        High PORTA.0
        Pause 500
        Low PORTA.0
        Pause 500
        High PORTA.1
        Pause 500
        Low PORTA.1
        Pause 500
        
        INTCON.0=0       ' Clear interrupt flag
        Resume           ' Return to main program   
        Enable  
        
        End
    Last edited by savnik; - 25th March 2007 at 19:28.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Section 5.2 of the 16F88 datasheet, mainly the 3rd paragraph

  3. #3
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Check this out

    Hi,
    INTCON.0=0 ' Clear interrupt flag
    You need to use INTCON = $80 to clear interrupt flags. Also the portb mismatched condition is cleared when you read it.
    Regards

    Sougata

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  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. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

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