Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Just simple advice

    This is my first try with DT interrupts to implement a 4hz timer ticks.

    I'm probably being a bit thick but do the instant interrupts preserve all the variables and return to exactly the same place in program after execution?

    Also i have some serin2 code that i don't want interrupting, i can't find the command that enables/disables the interrupts temporarily?

    Code:
    	SERIN2 Bcm, 8276, 250, Main, [WAIT($87), STR BCM87\11]	'Receive $87 (12) byte data packet on BCM Bus
    I don't want the above interrupted. ? Thanks

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by retepsnikrep View Post
    I'm probably being a bit thick but do the instant interrupts preserve all the variables and return to exactly the same place in program after execution?
    Yes it does.

    Also i have some serin2 code that i don't want interrupting, i can't find the command that enables/disables the interrupts temporarily?
    Code:
        INTCON.7 = 0
    	SERIN2 Bcm, 8276, 250, Main, [WAIT($87), STR BCM87\11]	'Receive $87 (12) byte data packet on BCM Bus
        INTCON.7 = 1
    But that will throw off your 4hz timing.

    If possible, use the USART with HSERIN, and you won't need to disable anything.
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    I think i'll have to go back to something which leaves the timer running in the background i can poll the timer overflow flag and just count 4 ticks myself. Hmm?

    Does your intcon just stop/start the timer?

    I can't use hserin as chip is 12F683

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


    Did you find this post helpful? Yes | No

    Default

    Polling the timer won't help, since it's the time it takes to execute the SERIN2 statement that causes the delay in responding to and reloading the timer. It can't do anything else until that statement is finished, and with a WAIT() in there, who knows how long it will take.

    And INTCON.7 is the GIE bit (Global Interrupt Enable).
    Setting it to 0 disables ALL interrupts, but does not affect the timer other than delaying the Interrupt Service Routine (ISR), which needs to reload the time to keep it accurate.

    Depending on what your 4hz interrupt is doing, ... you may not need to worry about it interrupting the SERIN2. If the ISR is fast enough, it won't cause a problem.
    DT

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 22:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 21:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 21:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 07:32
  5. Replies: 1
    Last Post: - 1st November 2006, 04:11

Members who have read this thread : 4

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