View previous topic :: View next topic |
Author |
Message |
young
Joined: 24 Jun 2004 Posts: 285
|
what is the biggest array size that I could define |
Posted: Tue Feb 08, 2005 12:34 pm |
|
|
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 |
Posted: Tue Feb 08, 2005 3:33 pm |
|
|
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
|
|
Posted: Tue Feb 08, 2005 8:55 pm |
|
|
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]);
}
|
|
|
|
|