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

Help for graphics on a normal 2 X 20 display

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



Joined: 07 Jan 2006
Posts: 64
Location: Braga

View user's profile Send private message Send e-mail MSN Messenger

Help for graphics on a normal 2 X 20 display
PostPosted: Sat Jan 21, 2006 11:35 am     Reply with quote

How can I have an array of some graphics made by me, and print then during the program on LCD ?

Ex.:
Code:

printf(lcd_putc, "Some text\n");
lcd_gotoxy(1,2);
printf(lcd_putc, mygraphic[x] );

Thank you ALL !!
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

Re: Help for graphics on a normal 2 X 20 display
PostPosted: Sat Jan 21, 2006 11:47 am     Reply with quote

jruibarroso wrote:
how can i have a array of some graphics made by me, and print then during the program on LCD

Ex.:

printf(lcd_putc, "Some text\n");
lcd_gotoxy(1,2);
printf(lcd_putc, mygraphic[x] );


Thank you ALL !!


You build up your characters in the ram of the display (consult your display's data sheet). Then when you need them they occupy low addresses not normally used by the ASCII table so just access them like regular characters.

I can't release the entire project file to you as it was done for a paying client but I can show you a couple of key lines that should move things along. However the BIGGEST issue is that you read and understand the data sheet for your display. If your data sheet doesn't have a good explanation of how the character ram works, download some other data sheets for similar parts from different vendors. I have found the Noritake data sheets pretty good but I think you have to register on their web site to get them.

Partial example using the lcd functions found in the CCS example code:

Code:

// create icons
const int8 lcd_characters[] =
{
   0x04,0x0E,0x0A,0x0A,0x0A,0x0E,0x0E,0x00,//25%
   0x04,0x0E,0x0A,0x0A,0x0E,0x0E,0x0E,0x00,//50%
   0x04,0x0E,0x0A,0x0E,0x0E,0x0E,0x0E,0x00,//75%
   0x04,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x00,//100%
   0x04,0x0E,0x0A,0x0A,0x0A,0x0A,0x0E,0x00,//LOW
   0x04,0x0A,0x15,0x04,0x04,0x04,0x04,0x04,//UP
   0x1C,0x14,0x1C,0x07,0x04,0x06,0x04,0x00,//degF
   0x1C,0x14,0x1C,0x07,0x04,0x04,0x07,0x00
}; //degC

   // load table into LCD RAM as part of display initialization routine
   // this is done only once after Power-On-Reset
   lcd_send_byte(0,0x40);
   for(i=0;  i<64;  i++)
   {
      delay_us(100);
      lcd_send_byte(1,lcd_characters[i]);
   }

// ... other code happens here

lcd_putc(0x00); // display the 25% battery symbol at current character position

_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
fredddd
Guest







PostPosted: Sat Jan 21, 2006 6:27 pm     Reply with quote

Try this online LCD simulator to play with custom characters.
http://www.geocities.com/dinceraydin/djlcdsim/djlcdsim.html
VanHauser



Joined: 03 Oct 2005
Posts: 88
Location: Ploiesti, Romania

View user's profile Send private message

PostPosted: Sat Jan 28, 2006 8:10 pm     Reply with quote

Put this somewhere at the beginning of your code:

Code:

// Custom characters
// First one cannot be displayed in strings (0x00 is string terminator...)

#define LCD_CUST_CHARS 4    // Maximum 8

const int8 lcd_chars[8][LCD_CUST_CHARS] = {
  {0b00000000,0b00001100,0b00000000,0b00011100},
  {0b00000000,0b00010010,0b00000000,0b00000010},
  {0b00000000,0b00010010,0b00000000,0b00001100},
  {0b00000000,0b00001100,0b00001100,0b00000010},
  {0b00000000,0b00000000,0b00010010,0b00011100},
  {0b00000000,0b00000000,0b00000100,0b00000000},
  {0b00000000,0b00000000,0b00001000,0b00000000},
  {0b00000000,0b00000000,0b00011110,0b00000000}
};

#define LCD_CH_BLANK  0
#define LCD_CH_DEGREE 1
#define LCD_CH_2UNDER 2
#define LCD_CH_3RDPOW 3


#separate
void lcd_init_chars() {
  int8 ch, line;
  lcd_send_byte(0, 0x40);
  for (ch=0; ch<LCD_CUST_CHARS; ch++)
    for (line=0; line<8; line++) {
      lcd_send_byte(1, lcd_chars[line][ch]);
    }
  lcd_send_byte(0, 0x80);
}


This example creates 4 custom characters, which can be easily seen by looking at the code. To load them, call lcd_init_chars() right after calling lcd_init(). For printing write something like:
Code:
lcd_putc("\fFlow: 50 m\x03/h H\x02O\nTemp: 70\x01 C");

Notice the custom character codes matching the position in the graphics array. Have fun!
jruibarroso



Joined: 07 Jan 2006
Posts: 64
Location: Braga

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Sun Jan 29, 2006 8:00 am     Reply with quote

thank you for help Very Happy
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