View Single Post
  #6   Spotlight this post!  
Unread 27-01-2006, 10:21
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,753
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: stupid Array error: Error [1300] stack frame too l

The linker will only allow you to define a total of 256 bytes of global (or static) variables within any single project file. Variables are located in Data space where the values can be changed whenever you like.

If you want to create "char table[255]", it'll need to be defined in a file off by itself that doesn't have any other global or static declarations and referenced as an extern. "int table[255]" is too large to be defined anywhere but within the much larger Program space.

Using the keyword "rom" forces the array to be defined in (Read Only Memory) Program space rather than the Data memory, then you can be as large as you have program space for, but the values are fixed like your code statements and cannot be assigned or changed while your program is running. You have to pre-define the array values, e.g.,
Code:
rom const int table[255]={1,2,3,4,...255};
See pdf page 22 (document page 14) of the MPLAB C18 C Compiler User's Guide for a description of rom vs ram.
Also discussed in this thread.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 27-01-2006 at 15:56.