CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Recurison on a PIC16F877A

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
steppermotor



Joined: 24 Oct 2010
Posts: 10

View user's profile Send private message

Recurison on a PIC16F877A
PostPosted: Sun Nov 14, 2010 1:31 am     Reply with quote

I tried to re-call a function. It told me recursion is not permitted any ideas?

With prototype headers
Code:

void start();
void end();
void main();

void start()

{

end();
//It will tell me that recursion is not permitted?
}

void end()
{

}

void main{

}
Ttelmah



Joined: 11 Mar 2010
Posts: 19559

View user's profile Send private message

PostPosted: Sun Nov 14, 2010 3:49 am     Reply with quote

Don't use recursion.....
Problem is that the PIC, does not have a data 'stack'. So subroutines can't have temporary variables that go to different locations each time the function is called, without a lot of extra coding. So a routine cannot be called inside another copy of itself - 'no recursion'.
What you post, won't give the error you are talking about. However if you change it so that end contains a call to 'start', it will.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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