RB Change Interrupt understanding


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68

    Default RB Change Interrupt understanding

    The 18F252 datasheet contains the following reference to the RB change interrupts:
    "This interrupt can wake the device from SLEEP. The
    user, in the Interrupt Service Routine, can clear the
    interrupt in the following manner:
    a) Any read or write of PORTB (except with the
    MOVFF instruction). This will end the mismatch
    condition.
    b) Clear flag bit RBIF.
    A mismatch condition will continue to set flag bit RBIF.
    Reading PORTB will end the mismatch condition and
    allow flag bit RBIF to be cleared."


    Here is what I think this means:

    When one of the monitored ports changes, a mismatch occurs and the RBIF flag gets set. The mismatch remains until a read or write to that port occurs.

    If so, the ISR should first read or write the port to clear the mismatch and then reset the RBIF flag. That way the RBIF will stay reset until somethng else on the monitord ports changes.

    Have I got this right?
    PickyBiker says, "Riding a motorcycle eases programming frustration".

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default

    Hi,
    That's how I interpret it as well. If you reset the RBIF without reading the port it would simply get the set again because the mismatch condition persists. Read the port to clear the mismatsh, then reset the RBIF.

    /Henrik.

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    You need to read the port in order to give the device a sample that it can use for later comparison.
    Charles Linquist

  4. #4
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Thanks Henrik and Charles. I am gradually getting an understanding of these PIC devices. This particular issue was troubling me because I wasn't sure if I was interpreting the datasheet correctly.

    Thanks again.
    PickyBiker says, "Riding a motorcycle eases programming frustration".

Members who have read this thread : 1

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