fast timer block other interrupts?


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007
    Posts
    65

    Default fast timer block other interrupts?

    Hello

    I have a pretty fast timer(1) running to draw graphics(POV), interrupt about every 1msec on a 48Mhz PIC (18F2550).
    I'd like to be able to change some parameters while this run, but so far I just can't make it respond. Currently testing with DT Instant Int.
    I have tried two type of interrupts to stop the Timer1 processing, INT2 and RX_INT, but they get ignored, even if I put a stopper in the Timer routine!?

    This is the stopper I have in the Timer1 routine:
    Code:
    if INTb2_RxInc = 1 then   ; stop INTERUPTS if incoming Rx
      Timr1Start = 0
    @   INT_DISABLE   INT0_INT     
    @   INT_DISABLE   INT1_INT     
    @   INT_DISABLE   TMR0_INT     
    @   INT_DISABLE   TMR1_INT  
      ledRFpriority = 1
    @  INT_RETURN   ; Return to program, (humm that looks clever for instants Ints!!)  
      ; Should add a watch dog for restart
      endif
    my last resort will be to have a 12F PIC killing the 18F with it's MCLR pin...but that feel weird.
    Last edited by flipper_md; - 9th November 2010 at 01:05. Reason: clean code

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


    Did you find this post helpful? Yes | No

    Default

    A PIC (16F or 18F) can do 1mS interrupts in it's sleep. No pun intended.
    Really, that's extremely slow.

    Once in the interrupt, another interrupt cannot occur (assumming the first one wasn't Low Priority). So disabling the others doesn't help.

    There must be something else going on.
    Is there more code available?
    DT

  3. #3
    Join Date
    Jul 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    disabling all other interrupts was done assuming that after exiting the current INT routine, no other interrupt would occur except RX_INT...

    the thing that bother me is that once wheel speed is too slow for POV display, I have the same TImer1 interrupt routine to draw less complex graphics,
    so it execute a bit faster,
    and then It let me update any parameters I want thru RX_INT.

    This is as if the PIC won't even read a PIN status when the Timer1 routine is too busy.

    I have tried low/high priority INT, but then my timer was behaving poorly


    since I have you here Darrel, is it right to put @INT RETURN in a if condition, to exit an interrupt faster than normal?

    Code:
    ;--- SIGNAL from Hall Fx sensor B ----------------------------
    int1_halfxb:
    if INTb2_RxInc = 1 then   ; stop INTERUPTS if incoming Rx
      Timr1Start = 0
    @   INT_DISABLE   INT0_INT     ; state of interrupts at start
    @   INT_DISABLE   INT1_INT     ; state of interrupts at start
    @   INT_DISABLE   TMR0_INT     ; state of interrupts at start
    @   INT_DISABLE   TMR1_INT     ; state of interrupts at start  
      ledRFpriority = 1
    @  INT_RETURN   ; Return to program, (humm that looks clever for instants Ints!!)  
      ; Should add a watch dog for restart
      endif
    LEDC1 = 1
    cled = 0   
    FinishedPixel = 0
    redrawLoop = 0
    doDoneTxt = 1 ; this will enter txt display first
    ledpattern = 0
    pattern_repeat = 3
    
    TMR1H = $00  : TMR1L = $00  ; reload preload max value, we want a little delay
    
    pauseus SensorB_offset  ;  for fine tuning
    
    if (NoDisplay = 0) and (INTb2_RxInc = 0) then Timr1Start = 1  ; enable pixel timer 
    
    @  INT_RETURN   	        ; Return to program




    code need a bit of cleanup, I will try to make it more readable soon

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