piclist 2001\01\19\021449a >
Thread: INT/RB0 & Stack?
www.piclist.com/techref/microchip/devices.htm?key=pic
flavicon
face BY : Francois Robbertze email (remove spam text)



>I just want to clarify something... when you say that you call a
subroutine, then return to the interrupt >routine, do you mean that you are
calling the interrupt routine directly, and not getting there via an >actual
interrupt?

No, the interrupt gets triggered on a faling edge of RB0. My code looks
something like this:

;************************************ORIGIN*********************************
*
       Org     0
       Goto   Main
       Org     4
       Goto    INT_handler

;*********************************** MAIN
***********************************
Main
       Call     RegulateTemperature
       Goto    Main

;************************ INTERRUPT HANDLER *************************
INT_handler
    movwf   savedW
    swapf   StatusReg, 0
    movwf   savedSTAT

    call IncommingData

    swapf   savedSTAT, 0
    movwf   StatusReg
    swapf   savedW, 1
    swapf   savedW, 0

    bcf IntConReg, 1         ;clear interrupt flag
    retfie
;************************ Regulate Temperature*************************
   Call    SubroutineX
   Return
;*************************** IncommingData*****************************
;Do some things
   Call    SubroutineA
   Call    SubroutineB
   Return
;***************************** SubroutineA ******************************
   Call    Subroutine C
;Do some things
   Return
;******************************SubroutineB*******************************
;Do some things
   Return
;******************************SubroutineC*******************************
;Do some things
   Return
;***************************************************************************
   END

I am now sure I was not overflowing the stack. I think my fault was that in
the RegulateTemperature routine I was waiting for a Dallas 18A20 to respond
with a temperature reading when the interrupt normally occurs. Thus when the
interrupt routine was exit with the RETFIE command, the stack "POPPED"
backed into an endless loop, because it is waiting for the Dallas18A20 to
respond and this thermometer has time out...and back in a idle state.

Regards

Francois

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


<001101c081e8$beaa4700$7ebd1fc4@manager1> 7bit

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) INT/RB0 & Stack?

month overview.

new search...