Problem mikro c with callig too much subroutines

Status
Not open for further replies.

vicvicvar

Newbie level 1
Joined
Aug 5, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
15
Hey guys Im working on this code

void subroutine1()
{
//something goes here ( a lot of code )
}
void subroutine2()
{
//something goes here ( also a lot of code)
}
void subroutine()
{
//something goes here too with a lot of code
}

void main()
{
//Configuration bits here etc etc

while(1)
{
if(condition1)
{

if(condition2)
....................{
......................subroutine1();
......................subroutine2();

................................if(condition4)
................................{
................................subroutine3();
................................subroutine1();
................................}

...................}

...................if(condition1)
..................{
...................subroutine1()
...................subroutine3()
..................}

.......}


}

}


Im using the easy pic 7 to download the code to the 18f45k22 . The easy pic do download the code but is not working but if I remove some subroutines it will work with just a few. I dont know if the program counter gets overflowed when calling many subroutines with a lot of code in them and having all this inside IF conditional statement.

Do you know whats happening ? thanks !
 

Check th stack memory available on your uC. I guss the stack over flow occurs because of too many function calls... And make sure you are not calling any other function calls inside the subroutines...
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…