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 support@ccsinfo.com

recursion???

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



Joined: 12 Jun 2006
Posts: 9

View user's profile Send private message

recursion???
PostPosted: Mon Jun 19, 2006 4:08 am     Reply with quote

CAN WE DO RECURSION IN PIC C COMPILER??? if not then why???

moreover i am having a problem in fgetc(arr[i],stream)....it only gets first ten characters of a character string coming in serially and does not get and print the remaining until the program has restarted...
:S
Ttelmah
Guest







PostPosted: Mon Jun 19, 2006 5:26 am     Reply with quote

No.
It is actually very difficult to perform recursion, on a chip without a software 'stack'. Recursion is easy to arrange (at a massive cost in memory storage), on a chip that has the ability to push/pop the variable data, for each copy of a function, but on an architecture without this ability, is difficult to arrange. You can actually write a function to support recursion, by dynamically allocating variable storage using malloc, but given the limited RAM space, and the overhead of doing this, it is not something that is supported.
Without seeing your code for the fgetc (what you print, how large the arrays are, the nature of the incoming data), it is hard o have any idea of what is going wrong, but assuming this is with the hardware UART, I'd suggest adding 'errors' to the #use RS232 directive. The suspicion is that the code is not servicing the data fast enough, resulting in a UART overflow, which will then disable the UART, till the chip is reset. Adding 'errors', makes the compiler add the code to reset this condition if it occurs.

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