On Thu, Oct 20, 2011 at 9:53 PM, M.L. wrote: > On Thu, Oct 20, 2011 at 3:58 PM, Sergey Dryga wrote: >> M.L. lkeng.net> writes: >> >>> >> For example : >>> >> __asm__ volatile(=93disi #0x3FFF=94); // disable temporarily all int= errupts >>> > >>> > or, in C: >>> > INTCONbits.GIE =3D 0; //disable interrupts >>> > >>> >>> Those are not equivalent. >>> >> Why? =A0They both disable global interrupts, right? =A0Maybe this is a p= roof that >> one needs to know assembly? >> > > Yes, it would seem to be evidence of that. > DISI is an instruction that disables interrupts for a literal number > of CPU cycles on a 16 bit PIC24 or dsPIC. > INTCON is a register on PIC18 and PIC16 that controls general > interrupt behavior. It does not exist on 16 bit PICs. GIE is the bit > that, as you correctly state, disables all interrupts indefinitely. So what we're saying here is that in the context the OP was talking about 8 bit uCs, the C version provides the correct result, and the assembly version doesn't? Chris --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .