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 define a pointer to a large const array

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



Joined: 24 Feb 2009
Posts: 15
Location: Addis

View user's profile Send private message

how to define a pointer to a large const array
PostPosted: Tue Mar 23, 2010 10:29 am     Reply with quote

I was interfacing an LCD with 18F458. I've a large array of char which has 1538 byte elements to store large fonts.

Does the compiler support pointer to an array of size more than 256 bytes??
if so, how can I define this pointer?
_________________
chips are forever
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 23, 2010 12:58 pm     Reply with quote

Look at the TEXT[][] arrays and the glcd_text57() function in this file:
Quote:

c:\program files\picc\drivers\glcd.c

Notice how the TEXT data is broken up into two arrays. That's done
because of the 'const' array limit of 256 bytes for the PCM compiler.
The PCH compiler (18F) doesn't have this size restriction. But the
glcd.c file is done this way so it will work with both compilers.

For example, with the PCH compiler, you can edit the TEXT and TEXT2
arrays, and combine them into one array. Then you don't have to do
a test on the input char value, to see which array to use. You could just
have one line to copy the 'const' font data to a RAM array. Example:
Code:

memcpy(pixelData, TEXT[textptr[i]-' '], 5);
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