> In the PICUART.ASM document/source by T. McGahee, there > is discussion about clearing GIE by doing like this : > > goe01 bcf intcon, gie > btfsc intcon, gie > goto gie01 > > Se the document for the reason to do this. It has something > to do with an interupt occuring *during* the execution of > the BCF intruction. Some 16 family PICs had a bug where an interrupt could be taken right after the GIE bit was cleared by BCF INTCON,GIE. The RETFIE at the end of the interrupt routine would re-enable interrupts. The net effect is that BCF INTCON,GIE disabled interrupts most of the time but not always. The workaround was to test the bit and try to clear it again if it was still set. See my INTR_OFF macro in STD.INS.ASPIC at http://www.embedinc.com/pic. It emits the workaround code on those chips with the bug, and a simple BCF INTCON,GIE on others. It also handles the different details of disabling interrupts on the 17 and 18 family. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu