Hi, > But when I look at the compiled (assembler source code) I see no > difference with or without the __critical keyword nor any evidence > of any interrupt disabling code. > > So what am I doing wrong?
Errr, nothing: __critical is not implemented for the PIC ports. You can partially emulate its effect by disabling interrupts manually and see if that helps. /* All code untested. */ iflags = (INTCON & 0xC0); INTCON &= ~0xC0; // critical code here INTCON |= iflags; or wrapped in a macro: #define CRITICAL(CODE) do { \ static unsigned char __sdcc_iflags = (INTCON & 0xC0); \ INTCON &= ~0xC0; \ do { CODE; } while (0); \ INTCON |= __sdcc_iflags; \ } while(0) CRITICAL(low = 1; high = 42); // or CRITICAL(critical_function()); Hope that helps, Raphael ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user