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 support@ccsinfo.com

how to place larger arrays linear in RAM

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



Joined: 25 Dec 2014
Posts: 33

View user's profile Send private message

how to place larger arrays linear in RAM
PostPosted: Sun Mar 13, 2016 3:55 pm     Reply with quote

Hi,
i have several arrays of structs in my prog (PIC18) like this f.e.
Code:

typedef struct
{
   int8  Field0;             
   int8  Field1;           
   int8  Field2;               
   int8  Field3;           
   int16 Field4;           

} my_struct;
my_struct Counters[4];

for some reason i need these vars/arrays being linear in RAM, i mean not interrupted by some processor registers. I remember that prev Versions did so to optimize RAM usage - maybe the latest (using 5.056) does not.
I can check in the symbol file after each compile, but maybe there is some #use statement to ensure this?
best regards
Roland
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Mar 13, 2016 4:46 pm     Reply with quote

Use #locate.
http://www.ccsinfo.com/forum/viewtopic.php?t=54930&highlight=locate+struct
Ttelmah



Joined: 11 Mar 2010
Posts: 19451

View user's profile Send private message

PostPosted: Mon Mar 14, 2016 4:21 am     Reply with quote

Though really, on a PIC18, you should not have to worry.

Splitting basically only takes place on PIC16's, where the memory is segmented. On these you have banks, each of which has processor registers, then user RAM. So an array may (sometimes may _have_) to be split. 'Have', because on most chips the blocks of user RAM in a bank are small like 96 bytes.

On a PIC 18, the configuration is fundamentally different, with all the processor registers up at the top of memory, and the RAM below being a single addressable 'lump'.

Generally (unless memory is running very low), CCS will put any normal array on a PIC18 or later as a continuous lump. Smile
rolox



Joined: 25 Dec 2014
Posts: 33

View user's profile Send private message

PostPosted: Mon Mar 14, 2016 11:54 am     Reply with quote

thx to both.
In fact i started the project with a 16F1788 and had this issue with "segmentation" before , meanwhile switched to a 18F26K20 ...
greetings
roland
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