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

Need help with ROM and managing large files

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



Joined: 10 Feb 2011
Posts: 14

View user's profile Send private message

Need help with ROM and managing large files
PostPosted: Thu Feb 10, 2011 4:05 pm     Reply with quote

Hi,
I am trying to interface my pic16f877a with a knockoff nokia LCD. I have had success with everything except displaying characters, text, or bmp files, simply because it requires you to link to a larger file, and I am having difficulty doing that.

When I link a header file with the char bmp file, I get an error "out of ROM, a segment or the program is too large." Additionally, I see the following:
"Seg 00004-007FF, 07FC left, need 661F
Seg 00800-00FFF, 0800 left, need 661F
Seg 01000-017FF, 0800 left, need 661F
Seg 01800-01FFF, 0800 left, need 661F
Seg 00000-00003, 0000 left, need 661F"

According to many searches here, the answers range from using #separate, to splitting up code, or managing where in ROM the large files are stored. I believe its the latter, since the .sta file indicates i am using only 4% of my rom.

I am somewhat new to programming, and would greatly appreciate any thoughts which could guide me in the right direction.

My compiler version is 4.057.

Here is the routine which calls on the char in bmp.h:
Code:
void LCDWrite130x130bmp(void) {
   

 long  j;   // loop counter
// Data control (need to set "normal" page address for Olimex photograph)
Spi_Command(DATCTL);
Spi_Data(0x00); // P1: 0x00 = page address normal, column address normal, address scan in column direction
Spi_Data(0x00); // P2: 0x00 = RGB sequence (default value)
Spi_Data(0x02); // P3: 0x02 = Grayscale -> 16
// Display OFF
Spi_Command(DISOFF);
// Column address set  (command 0x2A)
Spi_Command(CASET);
Spi_Data(0);
Spi_Data(131);
// Page address set  (command 0x2B)
Spi_Command(PASET);
 Spi_Data(0);
Spi_Data(131);
 
// WRITE MEMORY
Spi_Command(RAMWR);
for(j = 0; j < 25740; j++) {
  Spi_Data(bmp[j]);
}
   
// Data control (return to "inverted" page address)
 Spi_Command(DATCTL);
Spi_Data(0x01); // P1: 0x01 = page address inverted, column address normal, address scan in column direction
Spi_Data(0x00); // P2: 0x00 = RGB sequence (default value)
Spi_Data(0x02); // P3: 0x02 = Grayscale -> 16
// Display On
Spi_Command(DISON);
 }


The bmp.h file is quite large.

I can post any additional code if necessary, or provide any further details.
Thanks for your time,
David
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Thu Feb 10, 2011 4:16 pm     Reply with quote

The problem is the file you are trying to load....
The '4%', is without this.
The chip has a 'grand total' of just 8192 words of storage. The file wants 26143.....
As it stands, it is not going to fit. No amount of juggling will make it fit. Your only hope would be to put this extra data into an _external_ memory (EEPROM?), and just read the stuff from this as needed. It sounds as if this data is things like character maps, which will only need speed when reading, so something like an EEPROM should do this OK.

Best Wishes
osu1177



Joined: 10 Feb 2011
Posts: 14

View user's profile Send private message

PostPosted: Thu Feb 10, 2011 4:24 pm     Reply with quote

Thank you Ttelmah, for your quick and courteous response. I will add an EEPROM to my circuit and continue from there.
Regards,
David
osu1177



Joined: 10 Feb 2011
Posts: 14

View user's profile Send private message

PostPosted: Mon Feb 21, 2011 2:46 pm     Reply with quote

Hi Ttelmah,
Are you aware of any resources which would help me find a suitable EEPROM? I need plenty of space, as I hope to evolve my simple character maps to animations. I am also quite new to this, is there sample code I could look at to help me establish communication with the EEPROM?
Regards,
David
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 21, 2011 3:27 pm     Reply with quote

code examples can be found in the examples folder wherever you installed the compiler on your machine
osu1177



Joined: 10 Feb 2011
Posts: 14

View user's profile Send private message

PostPosted: Mon Feb 21, 2011 5:27 pm     Reply with quote

Thanks temtronic. Are there any suggestions as to specific memory chips I should look into, preferably ones whose use is well documented?
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Feb 21, 2011 5:58 pm     Reply with quote

Try FRAM, it is 500x faster than EEPROM and it will make a huge difference
when writing large files. I use FRAM exclusively now...

http://www.ramtron.com/about-us/what-is-f-ram.aspx
_________________
Google and Forum Search are some of your best tools!!!!
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