![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Lestard
Joined: 13 Mar 2004 Posts: 2
|
Interrupt Warning Message |
Posted: Sat Mar 13, 2004 12:30 pm |
|
|
I wrote a subroutine (subprogram), which handles a LCD and so on.
The Code looks like the following:
void init(void);
void main()
{
init(); //This subprogramm initializes an LCD and so on
while(1)
{
//There is some code
}
}
After compiling the whole program, the compiler gives me
the warning "Interrupts disabled during call to prevent re-entrancy".
Why does the compiler does this?
And there is a second problem:
e.g.
enable_interrupts(int_rda);
enable_interrupts(global);
The PIC does not execute the line "enable_interrupts(global);".
I also tried to change these two lines, but the PIC does nothing.
What could be the problem?
Thanks for every useful reply |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
Re: Interrupt Warning Message |
Posted: Sat Mar 13, 2004 12:46 pm |
|
|
Lestard wrote: | I wrote a subroutine (subprogram), which handles a LCD and so on.
The Code looks like the following:
void init(void);
void main()
{
init(); //This subprogramm initializes an LCD and so on
while(1)
{
//There is some code
}
}
After compiling the whole program, the compiler gives me
the warning "Interrupts disabled during call to prevent re-entrancy".
Why does the compiler does this?
And there is a second problem:
e.g.
enable_interrupts(int_rda);
enable_interrupts(global);
The PIC does not execute the line "enable_interrupts(global);".
I also tried to change these two lines, but the PIC does nothing.
What could be the problem?
Thanks for every useful reply |
The compiler will disable interrupts 'round' a routine, if the same routine is called inside an interrupt handler, and elsewhere in the code. This is to prevent the routine being called from inside itself (re-entrancy). This is not basically supported by the processors architecture.
If the compiler is preventing enable_interrupts(global) from working inside an interrupt, this is a _very good thing_, and is preventing an allmost certain crash. Basically, till you have exited the interrupt handler, and the registers have been restored, you must not enable interrupts. This has caused many crashes in the past, and if the compiler is blocking this, it represents an attempt to stop you 'shooting yourself in your foot'...
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|