We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a macro:
#define EnterCritical() do { SP++; *(unsigned char idata *)(SP-1) = IE; EA = 0; } while (0);
Why not use the @pragma disable before a function definition. For example:
#pragma disable void function (void) { // Do non-interruptable stuff in here. }
; FUNCTION function (BEGIN) 0000 D3 SETB C 0001 10AF01 JBC EA,?C0002 0004 C3 CLR C 0005 ?C0002: 0005 C0D0 PUSH PSW ; // Do non-interruptable stuff in here. 0007 D0D0 POP PSW 0009 92AF MOV EA,C 000B 22 RET ; FUNCTION function (END)
Hi Jon. That's an interesting idea. I have to see how that fits into the code, and how elegantly I can incorporate it into the preprocessor. Off the top of my head, I know of one place where my code requires attention when using this method. Look at this (inside a pragma-disabled function):
... for (many iterations) { do_something_looooooooong; enable interrupts; disable interrupts; } ...
Maybe you'll want to change that to...
#pragma disable void do_something (void) { . . . } void do_something_loop (void) { . . . //enable interrupts . . . for (i = 0; i < ???; i++) do_something (); . . . }
Yes, that would work. Andrew