piclist 2001\04\26\080610a
>
Thread:
Interrupts in a PIC16F84
www.piclist.com/techref/microchip/ints.htm?key=interrupt
BY
:
Olin Lathrop email (remove spam text)
> > Questions:
> > 1) should I disable GIE in ISR or leave it on?
>
> Depends on what you need to happen.
>
> > 2) if I leave it on, if an interrupt occurs during ISR, it will call
> > ISR again from start ?
>
> Yes
There seems to be some general confusion here. First, GIE is automatically
disabled when the interrupt is taken, so you can't "leave it on". GIE will
be re-enabled by RETFIE at the end of the interrupt.
You do **NOT** want GIE on in the interrupt routine. This can cause an
interrupt within an interrupt. You would have to go thru a lot of trouble
to make sure your interrupt routine is re-entrant to handle this case.
Think of what your interrupt routine will do to the saved state of the first
interrupt if a second one comes along before the first completes. In theory
you could make your interrupt routine re-entrant, but I think this is
extremely unlikely to be a benefit in practise. Also note that extra call
stack locations are used up globally if you allow nested interrupts.
********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, STOPspamolin
embedinc.com, http://www.embedinc.com
--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestTakeThisOuT
mitvma.mit.edu
<006801c0ce47$c1eabc00$260bf6cd@pc> 7bit
See also: www.piclist.com/techref/microchip/ints.htm?key=interrupt
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.
month overview.
new search...