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

lookup table

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



Joined: 18 May 2010
Posts: 78

View user's profile Send private message

lookup table
PostPosted: Sun Oct 16, 2011 3:12 am     Reply with quote

Hi
I want to make a look up table with 201 numbers. By CONST definition I made it but only 128 numbers is returned in main program. Please help me about maximum of look up table's elements.
My chip is PIC16f877 with 256 x 8 bytes of EEPROM Data Memory
Code:

int16 const num[]={               
0,0,0,0,1,1,2,2,3,4,5,6,7,8,10,11,13,14,16,18,20,22,24,26,28
,30,33,35,38,41,44,46,49,53,56,59,62,66,69,73,76,80,84,88,92
,96,100,104,108,113,117,122,126,131,135,140,145,150,155,160
,165,170,175,180,186,191,196,202,207,213,218,224,230,235,241
,247,253,
259,265,270,276,282,288,294,301,307,313,319,325,331,337,344,350,
356,362,369,375,381,387,394,400,406,413,419,425,431,438,444,450,
456,463,469,475,481,487,493,499,506,512,518,524,535,541,547,553,
559,565,570,576,582,587,593,598,604,609,614,620,625,630,635,640,
645,650,655,660,665,669,674,678,683,687,692,696,700,704,708,712,
716,720,724,727,731,734,738,741,744,747,751,754,756,759,762,765,
767,770,772,774,776,778,780,782,784,786,787,789,790,792,793,794,
795,796,797,798,798,799,799,800,800,800,800};

thanks
temtronic



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

View user's profile Send private message

PostPosted: Sun Oct 16, 2011 6:39 am     Reply with quote

Have you the following line...

#device PIC16F877 *=16


The '*=16' allows 16 bit pointers....which may allow the table to be accessed ( page boundary issues).
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Oct 16, 2011 2:13 pm     Reply with quote

Quote:
int16 const num[]={

Please help me about maximum of look up table's elements.
My chip is PIC16f877 with 256 x 8 bytes of EEPROM Data Memory

Your table is stored in Flash program memory. This is what the 'const'
declaration does. It is not stored in data eeprom.

Next, there is a limit in the 16F compiler of 256 bytes per const array.
You are trying to make a large array of int16 values and that is causing
the error message.

These threads discuss the problem and explain a solution:
http://www.ccsinfo.com/forum/viewtopic.php?t=36068
http://www.ccsinfo.com/forum/viewtopic.php?t=36847
http://www.ccsinfo.com/forum/viewtopic.php?t=29898


Quote:
#device PIC16F877 *=16

This applies to RAM, not to Flash program memory. It doesn't affect
const arrays.
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