On Interrupt & Gie


Closed Thread
Results 1 to 3 of 3
  1. #1

    Default On Interrupt & Gie

    Hi
    Suppose that I want to disable interrupts after ON INTERRUPT command.
    I read below suggestion in a book:
    We shuldn't disable interrupts after ON INTERRUPT command with clearing GIE because
    clearing this bit declares to PBP that an interrupt's happened and PBP jumps to ISR.
    Instead of above we should use INTCON=%10000000
    IS it True? Why?
    Regards.

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


    Did you find this post helpful? Yes | No

    Default

    Hi yasser,

    It's half right, and the solution is half wrong.

    When using ON INTERRUPT, you can not "Disable" the interrupts by clearing the GIE bit. Clearing GIE tells PBP that an interrupt has occured.

    In suggesting INTCON=%10000000, perhaps they were only considering the peripheral interrupt sources. Which means the global interrupts can still trigger.

    For ON INTERRUPT, If you want to make sure interrupts can't happen in a section of code, you need to wrap DISABLE / ENABLE statements around the affected code.

    Doing so also reduces the "Code Bloat" from checking interrupts in-between each and every line of code.
    <br>
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default Thanks

    Hi dear Darrel Taylor
    Thank you very much for your really helpful reply.

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