![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
mugheesahmed
Joined: 12 Jun 2006 Posts: 9
|
recursion??? |
Posted: Mon Jun 19, 2006 4:08 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Mon Jun 19, 2006 5:26 am |
|
|
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 |
|
![](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
|