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

what is the biggest array size that I could define

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



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

what is the biggest array size that I could define
PostPosted: Tue Feb 08, 2005 12:34 pm     Reply with quote

I am defining a array as char data[128]; for device 16f76 , but I do not it is saying that not enough RAM for all variables. I already defined device=*16. Are there any way to do it?
Ttelmah
Guest







Re: what is the biggest array size that I could define
PostPosted: Tue Feb 08, 2005 3:33 pm     Reply with quote

young wrote:
I am defining a array as char data[128]; for device 16f76 , but I do not it is saying that not enough RAM for all variables. I already defined device=*16. Are there any way to do it?

Unfortunately not, on the 16F76.
The largest 'consecutive' run of RAM on this chip, is 112 bytes long, and even on this, 16 bytes is shared with other banks, and may cause problems. The array must fit into one bank (the compiler does not allow 'split' arrays across multiple banks).
If you want a larger array, you need a chip with larger areas of RAM.

Best Wishes
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Tue Feb 08, 2005 8:55 pm     Reply with quote

Can you do it as 2 arrays of 64, with a couple of functions to read and write from/to it?

Code:


// Global arrays
int upper_array[64];
int lower_array[64];

void write_big_array(int index, int data)
{
    if (index >= 64)
        upper_array[index - 64] = data;
    else
        lower_array[index] = data;
}

int read_big_array(int index)
{
    if (index >= 64)
        return(upper_array[index - 64]);
    else
        return(lower_array[index]);
}
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