Hi,
> 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
CRITICAL(critical_function());
Hope that helps,
Raphael
</mail>
------------------------------------------------------------------------------
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.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user