Where to place DISABLE/ENABLE INTERRUPT


Results 1 to 4 of 4

Threaded View

  1. #3
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Where to place DISABLE/ENABLE INTERRUPT

    Thanks Henrik,

    I knew that ENABLE/DISABLE were compiler directives but the PBP manual wasn't clear to me on whether each block of code needed the directive or if you could group several unrelated subroutines and then place the directive just once at the beginning and end of the block.

    Which leads me to ask is it necessary to have them in matched pairs?? I'm guessing not.
    That if you have a block of subroutines at the end of your code you could just place an ENABLE at the beginning of the block and assume that all the following code will have interrupts enabled.

    I guess it's time for me to dig into Darrel's INSTANT INTERRUPTS as I am seeing jitter in the timing of my interrupt service routine. I believe it is due to the interrupt not happening until the current statement finishes.

    I toggle a PortPin in the ISR and look at it on an o-scope. Based on my settings for TIMER1 it should INT every 5 msecs but instead of the the square wave being fairly solid it wanders slightly.

    here is the code for my ISR handler...

    Code:
    '***************************************************
    '  interrupt service routine
    '      H & L size determine INT timing
    '      INT should happen every .005 seconds
    '***************************************************
    disable interrupt
    MyInt:
        IntFlag=1             ' INT has fired so set this flag for Main code usage
        TMR1H = $FB       ' reset timer1h  
        TMR1L = $27        ' reset timer1l  
            
        toggle PortA.0      ' used for determining INT timing  
        PIR1.0 = 0           ' clear timer1 overflow flag 
    resume                   'to Main
    enable interrupt
    '=============================================================
    Last edited by Heckler; - 19th February 2016 at 23:25.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

Similar Threads

  1. Disable/Enable DT interrupt
    By aratti in forum PBP3
    Replies: 10
    Last Post: - 16th June 2018, 16:50
  2. Disable/Enable in Interrupts
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th June 2015, 07:47
  3. PIC 16F616 Interrupt Enable/Disable?
    By Tobias in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 17th May 2009, 08:17
  4. Enable and Disable in Interrupts
    By stevecrunch in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th October 2007, 01:10
  5. Is there any place for a new section???
    By mister_e in forum Forum Requests
    Replies: 7
    Last Post: - 27th January 2005, 18:08

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