View Single Post
  #6   Spotlight this post!  
Unread 08-05-2006, 21:46
jerry w's Avatar
jerry w jerry w is offline
Free Agent Mentor
no team (Team Krunch)
Team Role: Engineer
 
Join Date: Nov 2003
Rookie Year: 2002
Location: dunedin fl
Posts: 113
jerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud of
Re: Strange ERROR.MCP file coming up Robot not programming!

Quote:
Originally Posted by Salik Syed
Okay figured it out,
I don't know the reasoning behind this... but for anyone with similar problems:
DO NOT switch to large code model
switch to the Multi-Bank Stack model...
this worked for me... I had a lot of ROM data tables etc.. i'm not aware of low level stuff like memory but this worked
we had the same problem. thanks for the solution. here is the reason.

the stack in a pic is designed to use a single block of data memory.
using dynamic variables inside a function tells the compiler to use stack space for data storage. but, with many variables, you quickly run out of stack space. with the robot controller, there is usually more than enough data space to allow for static variables. the limit, as we discovered, is on the size of the stack. we fixed the error by making the local variables static.

in addition, the compiler must add code to setup and then cleanup the stack inside of a function. the extra code slows down processing. thus I recommend that all local variables be declared static, as a way to reduce program size and prevent stack problems.

for example...
Code:
void Camera_State_Machine(unsigned char byte)
{
	static unsigned char state = UNSYNCHRONIZED;
	static unsigned char packet_buffer[34];
	static unsigned char packet_buffer_index;
	static unsigned char packet_char_count;
jerry w
__________________
Happiest when people tell the truth... However, I am blessed with many friends.