Jump to content

Recommended Posts

Hi,

 

What is the max ram buffer size i can create? My PIC is a 16F1826, it has 384 bytes or RAM

 

unsigned char OutBuffer[100];

 

Memory Usage Report

===================

Error: No remaining RAM block (on target) big enough for:

'OutBuffer' size:100 bytes

'OutBuffer' size:100 bytes

 

RAM available:384 bytes, used:228 bytes (59.4%), free:156 bytes (40.6%),

Heap size:0 bytes, Heap max single alloc:0 bytes

ROM available:4096 words, used:0 words (0.0%), free:4096 words (100.0%)

 

 

There is lots of RAM avaliable, im just not allowed to use it :P

Share this post


Link to post
Share on other sites

Hi Tom,

 

Your RAM is fragmented over several pages mixed in with SFRs.

 

Your max will be 96 bytes. Watch out for the last 16 bytes of common RAM which could reduce you to 80 bytes.

 

Large buffers require contiguous memory.

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites
Hi Tom,

 

Your RAM is fragmented over several pages mixed in with SFRs.

 

Your max will be 96 bytes. Watch out for the last 16 bytes of common RAM which could reduce you to 80 bytes.

 

Large buffers require contiguous memory.

 

Cheers

 

Reynard

 

OK, thanks. I thought that would be the case. I'll impliment an external RAM device and use that.

Share this post


Link to post
Share on other sites

Using an external RAM seems pretty drastic. Why not use two 50 byte arrays and create a simple wrapper function to write and read them? You would have to write functions to access your external RAM anyway.

 

unsigned char OutBuffer0[50],OutBuffer1[50];

void WriteArray(unsigned char Index, unsigned char Data)
{
if(Index>50){
	 OutBuffer1[Index-50] = Data;
}
else{
	 OutBuffer0[Index] = Data;
}
}

unsigned char ReadArray(unsigned char Index)
{
if(Index>50){
	 return(OutBuffer1[Index-50]);
}
else{
	 return(OutBuffer0[Index]);
}
}

Share this post


Link to post
Share on other sites

The largest single allocation cannot be larger than the contiguous space in a single bank. I don't know what the maximum you can get from a 16F1826 is, or if there is some overhead.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...