Hi,
I have two threads interrupt and main thread. currently, i'm using NOOVERLAY. In order to save space in the RAM, i want to overlay data between functions, BUT I want that the interrupt will not overlay with the main thread.
How can i do it? i'm using a KEIL of 8051 Uvision.
example: void interrup (void); ..... void main (void); .....
How can i do it?
You don't have to - it's automatic.
Since you never call the interrupt functions from your main code, they're not part of the calling tree that starts with main(), and therefore the compiler does not overlay their local variables with any of the main code.
BUT I want that the interrupt will not overlay with the main thread.
... the Keil software would be useless.
THINK about the call tree ... there are no calls to your ISR (well, if there is you are screwed anyhow)
Erik
Thanks,
Off course you are right that what I thought, however I tried it and some data was corrupted by the interrupt since it used the same space for different variables.
In addition I used different register bank for the interrupt and the main thread so this was not the cause
May be I didn't declare the interrupt appropriately so the linker didn't "treat" as an interrupt
Below the code for interrupt declaration:
char xdata *ptr2isr;
ptr2isr = (char *) isr;
void isr(void)interrupt 1 using 1 {
…… }
Are you, by any chance, calling any functions from the interrupt function that you are also calling from your main code ?
No, i never use the same function from interrupt and main thread
Another question: What is the purpose of taking the address of the ISR and casting it to a char pointer ?
How can i do it otherwise?
Ariel
What are you trying to achieve by it?
It seems an entirely pointless exercise!
do what?
Ariel, please explain what you meant with this code:
what are you trying to do here?
that is easy to verify using a breakpoint, not?
did you get any warnings during linking?
you need to link it in directly