Inicializing to Interrupt World


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Inicializing to Interrupt World

    Hi

    I dug up some old code I did on a pic16f819. Maybe it will help? I did not see Intcon.7 set in your code?

    Place this above your variable declaration
    Code:
    OPTION_REG.6 = 0        'INTERUPT PORTB.0 ON 1 = RISING EDGE 0 = falling
    INTCON.4 = 1            'ENABLE RBO INTERUPT
    Sleep
    Code:
    SLEEPLOOP:
        'OPTION_REG.7 = 0        'ENABLE PULLUP RESISTORS PORTB
        INTCON.7 = 1    'ENABLE GLOBLE INTERUPTS
    @ SLEEP             ;ASSEMBLY SLEEP COMMAND - TURNOFF uP CLOCK
    
        INTCON.7 = 0    'ON INTERUPT DISABLE GLOBLE INTERUPTS
        INTCON.1 = 0    'RESET INTERUPT FLAG

  2. #2
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Inicializing to Interrupt World

    I don’t know how PBP interrupts work, but yes you do have to clear the interrupt flag.
    Code:
    if INTCON.1 = 1	then		' check if portb.0 interrupt occurred
    ‘ do the thing you wanted portb.0 interrupt to make happen
    INTCON.1 = 0			' clear portb.0 interrupt flag
    endif
    This is in a case where the interrupt could have been triggered by more than one event.
    Last edited by Art; - 24th November 2015 at 18:03.

  3. #3
    Join Date
    May 2012
    Posts
    18


    Did you find this post helpful? Yes | No

    Default Re: Inicializing to Interrupt World

    Thanks everyone.

    The major problem, was a pull down button RB0, that was not working correctly.

    Thanks,
    Nuno

Similar Threads

  1. Hello World help please 18F14K50 config
    By Bonxy in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 4th August 2011, 17:35
  2. Welcome into PIC world
    By shafi008 in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 29th April 2009, 06:51
  3. Remote Control World !
    By iugmoh in forum General
    Replies: 4
    Last Post: - 22nd April 2008, 23:03
  4. (noob)hello world?
    By m4gill4 in forum mel PIC BASIC
    Replies: 2
    Last Post: - 30th November 2007, 00:23
  5. wired world
    By jcleaver in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th February 2007, 16:23

Members who have read this thread : 0

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