I think I'll use the MACRO. What about #pragma nooverlay? Is it a nop too?

Maybe the manual should say something about it in the PIC16 port section. I'll think where to say it and write it, what do you think?

Thank you very much!

On Sun, Feb 12, 2012 at 1:36 PM, Raphael Neider <> wrote:

> I need to disable interrupts for some functions because they are called from
> main() and from interrupt. I was trying __critical keyword but it seems to
> be doing nothing. Does __critical work for PIC16 port?

__critical is (still) a nop for PIC16.

> If it doesn't, how do you do it?

<mail subject="Re: [Sdcc-user] __critical does nothing with PIC18F4550
?" date="2011-11-06">

You can partially emulate its effect by disabling interrupts
manually and see if that helps.

/* All code untested. */

uint8_t 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

Hope that helps,

Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
Sdcc-user mailing list