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

arrays - no memory space
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

arrays - no memory space
PostPosted: Thu Jan 20, 2005 9:49 am     Reply with quote

I am using PIC16F877A, compiler version 3.190.
I have got quite few arrays in my program, and that causes not enough memory space in RAM.
When I use #locate, the program counter becomes noughty and does not follow the program addresses sequence, and the code does not work then.
It seems like if I use const arrays instead, I can't use pointers
So, my code then doesn't work.
What is the solution for that?
Thank you
_________________
Alex
Ttelmah
Guest







Re: arrays - no memory space
PostPosted: Thu Jan 20, 2005 11:45 am     Reply with quote

alexz wrote:
I am using PIC16F877A, compiler version 3.190.
I have got quite few arrays in my program, and that causes not enough memory space in RAM.
When I use #locate, the program counter becomes noughty and does not follow the program addresses sequence, and the code does not work then.
It seems like if I use const arrays instead, I can't use pointers
So, my code then doesn't work.
What is the solution for that?
Thank you

A chip with more space, or use smaller arrays...
You have to be aware, that if you use #locate, you must understand the limitations (some areas are shared between banks, the compiler needs RAM for it's variables, putting things that are commonly accessed in high banks will result in an increase in bank switching code etc..). Obviously if these do not need to be variables, then use #const. No, you cannot have pointers to constant arrays (this is in the manual).

Best Wishes
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Thu Jan 20, 2005 12:26 pm     Reply with quote

You can use the #ROM directive to put stuff in program ROM, and as a bonus when you do that the data is a 14 bit word. I've found there's a limit to how much data the compiler lets you store that way, though. If you need more, you can make an addition to your program's HEX file before burning the program in--tedious to do, but works OK.

But if it's RAM you need, pure and simple, then you need a bigger processor, or an off-board RAM.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

Re: arrays - no memory space
PostPosted: Thu Jan 20, 2005 1:04 pm     Reply with quote

alexz wrote:
I am using PIC16F877A, compiler version 3.190.
I have got quite few arrays in my program, and that causes not enough memory space in RAM.
When I use #locate, the program counter becomes noughty and does not follow the program addresses sequence, and the code does not work then.
It seems like if I use const arrays instead, I can't use pointers
So, my code then doesn't work.
What is the solution for that?
Thank you


Don't use pointers. You can always copy the data to a RAM arrray and then use a pointer to it.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

FRAM
PostPosted: Thu Jan 20, 2005 3:22 pm     Reply with quote

If your board isn't finished you could add an fram.

It is nearly and fast as ram.
I2C,.. so its easy to hook up.
drivers are writen for it.

I use the ramtron fm24c04 FRAM.
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Fri Jan 21, 2005 3:14 am     Reply with quote

Thank you guys
_________________
Alex
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

Re: FRAM
PostPosted: Fri Jan 21, 2005 3:14 am     Reply with quote

treitmey wrote:
If your board isn't finished you could add an fram.

It is nearly and fast as ram.
I2C,.. so its easy to hook up.
drivers are writen for it.

I use the ramtron fm24c04 FRAM.



what is FRAM?
_________________
Alex
Kieran



Joined: 28 Nov 2003
Posts: 39
Location: Essex UK

View user's profile Send private message

What is FRAM
PostPosted: Fri Jan 21, 2005 4:14 am     Reply with quote

Have a look at the manufacturers site

http://www.ramtron.com
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

Re: What is FRAM
PostPosted: Fri Jan 21, 2005 4:31 am     Reply with quote

Kieran wrote:
Have a look at the manufacturers site

http://www.ramtron.com



Thanks, I just think that to use an additional external component is not such a good solution.

I am developing a USB device using PIC16F877A and USBN9603 USB controller of National.
I am thinking of changing all that to one of the new PIC18 series with USB controller on chip and also bigger memory, for example PIC18F4550.

But then I will obvously have to change all my code, written up to now, and probably write the new code using the PIC18 compiler won't I?
And that really slows down my desicion.
What do you think guys?
_________________
Alex
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Fri Jan 21, 2005 8:48 am     Reply with quote

Go for it. Yes, you'll spend some time porting to the 18-family, but all the code you've written is still valid.

Plus, buying the PCH compiler will allow you to target a lot of new chips.

I learned a long time ago that if I try to scrimp and save on tools, that I'll just end up paying for it later (either for the tool I should have bought in the first place, or in time lost). Spending a little money on a great development tool (PCH) is money well spent, in my opinion.
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Fri Jan 21, 2005 8:51 am     Reply with quote

newguy wrote:
Go for it. Yes, you'll spend some time porting to the 18-family, but all the code you've written is still valid.

Plus, buying the PCH compiler will allow you to target a lot of new chips.

I learned a long time ago that if I try to scrimp and save on tools, that I'll just end up paying for it later (either for the tool I should have bought in the first place, or in time lost). Spending a little money on a great development tool (PCH) is money well spent, in my opinion.


What is PCH ?
Will I be able to write in CCS and not in C18?
_________________
Alex
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Fri Jan 21, 2005 9:03 am     Reply with quote

Whoops. I'm confused.

I thought that you were using the CCS compiler to write your application. There are 3 different versions of the CCS compiler: one for the 12-series (PCB), one for the 16-series (PCM), and another for the 18-series (PCH).

Since you mentioned that you were writing code for a 16F-something PIC, I assumed that you owned the CCS PCM compiler. If this was true, then all you'd need to do in order to upgrade to the 18-series PICs would be to buy CCS's PCH upgrade.

Sorry. Porting code written for another compiler will be a little painful, but I still think that CCS is a great product.
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Fri Jan 21, 2005 9:08 am     Reply with quote

newguy wrote:
Whoops. I'm confused.

I thought that you were using the CCS compiler to write your application. There are 3 different versions of the CCS compiler: one for the 12-series (PCB), one for the 16-series (PCM), and another for the 18-series (PCH).

Since you mentioned that you were writing code for a 16F-something PIC, I assumed that you owned the CCS PCM compiler. If this was true, then all you'd need to do in order to upgrade to the 18-series PICs would be to buy CCS's PCH upgrade.

Sorry. Porting code written for another compiler will be a little painful, but I still think that CCS is a great product.


Thank you, that opened my eyes now.
Yes, I am using the PCM now.
So, is there much difference between the PCH and PCM?
_________________
Alex
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Fri Jan 21, 2005 9:15 am     Reply with quote

The only difference is that the PCH compiler allows you to target the 18-series PICs. Everything else is identical. I think that CCS charges $75 for the upgrade. It is WELL worth it. Plus, you get 30 days of free upgrades with the purchase. These upgrades are for all of their compilers (PCB, PCM, and PCH). So for $75, you gain the ability to write code for the 18 family, and you get your present compiler (PCM) upgraded to the latest version.

I know that I'll get jumped on for that, so I'll just save everyone the opportunity: I know that the latest version can be buggy. You can also download the "last known good" version with your 30 day download rights.
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Fri Jan 21, 2005 9:25 am     Reply with quote

Another question:
What is preferable PCH or C18?
And what are advantages and disadvantages?
_________________
Alex
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
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