Hello PIC.ers, A subtle gotcha, this one. BTDT, got the T-shirt. After disabling interrupts i.e. bcf intcon,gie complete safety is not assured unless you check the global enable bit to see that it *really* is as expected (clear, that is). My trouble with this magically vanished when I started to use macros for int. enable/disable: int_off MACRO ;disables all interrupts bcf intcon,gie btfsc intcon,gie ;make sure bit cleared (int could ;have occurred 1/2way thru instruction) goto $-2 ENDM int_on MACRO ;re-enable interrupts bsf intcon,gie ENDM best regards, John >Date: Fri, 22 Sep 2000 15:02:00 +0100 >From: "Alan B. Pearce" >Subject: Re: [PIC]: custom mpasm mnemonics > >>I was the one who posted the original macro. Is this true!? Can an >>interrupt really happen immediately after the instruction that disables >>interrupts? This seems hard to believe. I've never seen any mention = >of > >Apparently yes. I have not experienced it, but have seen code with this = >sort of construct in it. The scenario seems to be that the interrupt = > e-mail from the desk of John Sanderson, JS Controls. Snailmail: PO Box 1887, Boksburg 1460, Rep. of South Africa. Tel/fax: Johannesburg 893 4154 Cellphone no: 082 469 0446 email: jsand@pixie.co.za Manufacturer & purveyor of laboratory force testing apparatus, and related products and services. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: "[PIC]:" PIC only "[EE]:" engineering "[OT]:" off topic "[AD]:" ad's