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

I am also having problems with function transitions.

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



Joined: 08 Sep 2020
Posts: 221

View user's profile Send private message

I am also having problems with function transitions.
PostPosted: Mon Jan 18, 2021 4:06 am     Reply with quote

CCS C 5.99
MCU 33EP512GM710
crystal 16MHZ clock 120MHZ

I created functions as I have described. But when it is in function 2, I want to pass to function 1. It is giving error. Why is it doing this? How can I fix.

ERROR : Line 1165(1,2): Recursion not permitted [Table_Configuration]

for example;
Code:

void func1();
void func2();
void func3();

void func3()
{

}
void func2()
{
    if(press == TRUE)
       func1();
}
void func1()
{

}

void main(void)
{
   while(TRUE)
  {

   }

}

_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Mon Jan 18, 2021 5:15 am     Reply with quote

What you post, compiles happily.

Recursion, is a function calling itself. You would get that error, if (for
example) func1, then called func2().
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 18, 2021 5:38 am     Reply with quote

re: Recursion not permitted

The best, the very, very BEST real World example of 'recursion' I know , was when Bell Canada first offered 'call forwarding', something everyone takes for granted now. It was only in use about 2 weeks when the ENTIRE Toronto-Hamilton long distance system was shut down. NOBODY could make a call ! The problem was that EVERY pair of wires was in use !
Turns out some guy call forwarded his Hamilton home number to his Toronto office number. Before he left Toronto, he call forwarded his office number to his home number. Sounds OK, right ? What happened was ONE call got the Bell computers to keep taking phone lines to get the call from Hamilton to Toronto to Hamilton to Toronto to .......... until the entire system crashed.
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Mon Jan 18, 2021 7:43 am     Reply with quote

Also, possibly worth saying that for the 16bit PIC's (where the stack is used
for variables as well as return addresses), it is technically possible to have
recursion used. There is a preprocessor directive #RECURSIVE, that
allows this for a single function. However this while working a few compiler
versions ago, does not work on the current compilers, and it involves
significant care, since otherwise a problem similar to the one Jay describes,
can apply to the stack....
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