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

Nokia 6610 LCD + '877 code issue

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



Joined: 09 Nov 2007
Posts: 282
Location: India

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

Nokia 6610 LCD + '877 code issue
PostPosted: Sun May 22, 2011 11:58 am     Reply with quote

I'm having a funny problem; I don't really know what the root cause is. I think its because my code spills over into the next ROM page (ie memory used is over 2048 words), but I'm not sure.

This is my code:
Code:
void main()
{
   float angle;
   int8 val;
   int8 x;
   char mystr[11];
   
   glcd_init(80);
   glcd_cls(black);
//   other LCD functions
   
   while(1)
   {
      glcd_line(65,73,65+51*(float)cos[x]/128,73+51*(float)sin[x]/128,yellow);
      x++;
//      other  functions      
   }
}
I haven't shown a bunch of other things like declarations, and the 'other LCD functions' since I've kinda worked out with a fair degree of certainty that they are not the offenders. The 'sin' and 'cos' functions are look-up table based.

The code posted above works fine. It compiles to less than 2048 words. If I use any other function (or combination of functions) that causes compilation to exceed 2048 words, then execution simply hangs. Nothing displays on the LCD. I've not yet located where in the code the execution actually stalls, but I know that even the initialization (glcd_init) is not completed successfully.

I haven't posted complete code; if you'd like me to post the driver or anything else, let me know.

PIC16F877 (NOT 877A!) @ 20MHz
Nokia 6610 LCD (PCF8833)
CCS v4.106

Rohit
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun May 22, 2011 3:04 pm     Reply with quote

Try to #org your const tables in other Rom pages. Maybe that will free up
some room in your current ROM page:
http://www.ccsinfo.com/forum/viewtopic.php?t=880&start=1
In that example, I've tried to pack them tightly together with no ROM
space between them. But you don't have to do that. You can start each
table at some convenient address within a ROM page.
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

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

PostPosted: Mon May 23, 2011 3:48 am     Reply with quote

I've shifted the tables to the last ROM page by using a #org directive. However, even now if my code (not including the tables) is longer than 2048 words the PIC stays in reset.

I've tried sprinkling a bunch of #separate directives over a few of the functions to see if I could shift some of the memory hogs to other ROM pages, but no go.

I'm starting to get irritated now - why should the PIC stay in reset? Does the '877 have hardware issues? Stack problems, and such like? I have to use an '877 right now, because its the only PIC I have on hand. I've ordered a couple of newer 16F882s which will be arriving in a few days. If its a silicon bug, it'll show up then.

Rohit
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

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

PostPosted: Mon May 23, 2011 4:03 am     Reply with quote

UPDATE:

Ok, the code seems to 'work' if I break the driver into functions and allocate each function a memory area (using #org). Now this approach is fine for some functions, but the method fails for other functions, which are themselves built up of multiple sub-functions. This is leading me to think that the 877 has ROM page switching issues. Is there a way I can validate that _this_ itself is the issue?

Rohit
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 23, 2011 12:04 pm     Reply with quote

A quick test would be to revert to a previous compiler version.
Maybe try vs. 4.093.
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