INTCON Register - GIE set to ON or OFF- same result: T0IE still works ?!


Results 1 to 5 of 5

Threaded View

  1. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: INTCON Register - GIE set to ON or OFF- same result: T0IE still works ?!

    Quote Originally Posted by flotulopex View Post
    To me, setting INTCON = $80 is like 000000 meaning the interrupts are switched ON.
    Setting it to $80 does keep the "Global Enable" (GIE, INTCON.7) enabled, and this is required to keep ON INTERRUPT from thinking an interrupt occured.
    But it also clears the "Peripheral Interrupt Enable" (PEIE, INTCON.6), so no peripherals can trigger an interrupt.

    The manual should have added to disable the interrupts that are not "Peripheral" like TMR0 and the INT pin, but it didn't.
    *Added* Or I guess it did, T0IE and INTE are in INTCON in the 16F's, so clearing INTCON would also clear them.
    *Added* But with 18F's there are more non-peripheral interrupts like INT2IE in INTCON3.

    The PBP3 manual has expanded the information on interrupts, and the $80 statement isn't there anymore.
    It recommends clearing each enable bit for all interrupts being used.
    It also describes DISABLE INTERRUPT and ENABLE INTERRUPT.

    But there are two ways of thinking about it, and your application dictates which method to use.

    Clearing the enable bits allows a section of code or the entire program to proceed without being interrupted, but it still checks between every line of code for an interrupt. Which does allow for selective disabling of individual interrupts.

    Using DISABLE INTERRUPT/ENABLE INTERRUPT stops the checking between each line which makes that section run faster and use less code space.
    DISABLE/ENABLE only affects the code it surrounds and can't turn interrupts off for the whole program.

    The method used really depends on what your program needs.

    HTH,
    Last edited by Darrel Taylor; - 30th May 2012 at 04:55. Reason: *Added*
    DT

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