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

show picture in glcd (k0108)

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Dec 21, 2007 12:25 pm     Reply with quote

Use the 'const' keyword to put the array in ROM, instead of RAM.
Then you can make an array larger than 90 bytes. When it's
in ROM, it can be up to 255 bytes. (This is the limit for 16F-series PICs).
If you need a const array larger than this, then split it into two or more
arrays. See the example in the GLCD.c file. It's in this directory:
Quote:
c:\Program Files\picc\Drivers\glcd.c


Two arrays are used to store the character data in ROM:
Code:
const int8 Text[51][5] =
{0x00, 0x00, 0x00, 0x00, 0x00, // SPACE
 0x00, 0x00, 0x5F, 0x00, 0x00, // !
// Etc.


Code:
const int8 Text2[44][5]=
{0x26, 0x49, 0x49, 0x49, 0x32, // S
 0x01, 0x01, 0x7F, 0x01, 0x01, // T
ROBOTICAR



Joined: 28 Aug 2007
Posts: 45

View user's profile Send private message

PostPosted: Tue Dec 25, 2007 6:32 am     Reply with quote

thanks for help.
can you introduce some programs to create bitmap picture for glcd?
Bcox



Joined: 09 Oct 2007
Posts: 17
Location: Windsor, CT

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

PostPosted: Fri Jan 04, 2008 7:10 am     Reply with quote

Here is a function I have created to put into the glcd.c file when using it with a 128x64 KS0108 glcd. The program reads from program memory where I had to store my image (i.e. #ROM 0x1000 = image in hex format).

For those somewhat new to GLCDs, make sure you take a look at your chip select lines on your glcd. On the display I am using, they are low active instead of high active so in my glcd.c file, I had to reverse this so my image would show up on the correct side of the screen. Just a small note but I have seen this come up in other threads.

Code:
void glcd_image(long mempointer  //This is the image location in program memory)
{  int j, i;
   int page = 0xB8;
   char chipsel;
   char buffer[1];
   output_low(GLCD_DI);                // Set for instruction
   glcd_writeByte(GLCD_CS1, 0x40);     // Set the column address to 0
   glcd_writeByte(GLCD_CS2, 0x40);
   glcd_writeByte(GLCD_CS1, page);     // Set the page address to 0
   glcd_writeByte(GLCD_CS2, page);
   for (j = 0; j < 8; j++, page+=1)
   {  output_low(GLCD_DI);
      glcd_writeByte(GLCD_CS1, page);
      glcd_writeByte(GLCD_CS2, page);
      for (i = 0; i < 128; i++)
      {
         if ( i < 64)
         {
            chipsel = GLCD_CS1;
         }
         else
         {
            chipsel = GLCD_CS2;
         }
         read_program_memory(mempointer, buffer, 1);
         mempointer++;
         output_high(GLCD_DI);
         glcd_writeByte(chipsel, *buffer);
      }
   }
}
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