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

Is CCS able to manage long tables

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







Is CCS able to manage long tables
PostPosted: Fri Mar 14, 2003 3:25 am     Reply with quote

Hi All,
Is this delaration allowed on a 16F877 ?

BYTE myvar[3][40];

this makes 3 tables of 40 Bytes, resulting in a 120 bytes table. on a 16F877, each RAM banks are 96 bytes length, is CCS able to split this table to the different RAM banks ?
thanks
joe
___________________________
This message was ported from CCS's old forum
Original Post ID: 12662
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Is CCS able to manage long tables
PostPosted: Fri Mar 14, 2003 12:51 pm     Reply with quote

:=Hi All,
:=Is this delaration allowed on a 16F877 ?
:=
:=BYTE myvar[3][40];
:=
:=this makes 3 tables of 40 Bytes, resulting in a 120 bytes table. on a 16F877, each RAM banks are 96 bytes length, is CCS able to split this table to the different RAM banks ?
---------------------------------------------------------

CCS can not span ram banks with a large array.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12675
mark r. hahn
Guest







Re: Is CCS able to manage long tables
PostPosted: Fri Mar 14, 2003 6:01 pm     Reply with quote

:=Hi All,
:=Is this delaration allowed on a 16F877 ?
:=
:=BYTE myvar[3][40];
:=
:=this makes 3 tables of 40 Bytes, resulting in a 120 bytes table. on a 16F877, each RAM banks are 96 bytes length, is CCS able to split this table to the different RAM banks ?
:=thanks
:=joe

CCS can't handle this, but you can at the expense of some additional code. For example I had to have a 120 byte array for one project. I just split it into 2 60 byte arrays.

// in bank 0
byte array1[60];

// in bank 1
byte array2[60];

// use a function to access array
byte get_array_value(int index)
{
if (idx < 60)
return(array1[idx]);
else
return(array2[idx-60]);
}

Hey, I know it's sleazy. If you want better code, use one of the 18Fxxx parts, they have tons of RAM.

Mark
___________________________
This message was ported from CCS's old forum
Original Post ID: 12693
joe06
Guest







Re: Is CCS able to manage long tables
PostPosted: Sat Mar 15, 2003 4:40 am     Reply with quote

ok thanks, I finally found a trick for that, creating 2 functions read_array and write_array, with both dimensions passed as parameters, and using #locate to place my splitted arrays in different banks.
joe

:=:=Hi All,
:=:=Is this delaration allowed on a 16F877 ?
:=:=
:=:=BYTE myvar[3][40];
:=:=
:=:=this makes 3 tables of 40 Bytes, resulting in a 120 bytes table. on a 16F877, each RAM banks are 96 bytes length, is CCS able to split this table to the different RAM banks ?
:=---------------------------------------------------------
:=
:=CCS can not span ram banks with a large array.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12705
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