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

putting custom characters on a LCD(4x16) screen

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



Joined: 04 Feb 2004
Posts: 3

View user's profile Send private message

putting custom characters on a LCD(4x16) screen
PostPosted: Wed Feb 04, 2004 3:43 am     Reply with quote

how many custom made characters can i create on a LCD.
at this point I only can create 8.
i have a 4x16 LCD and i want at least 32 characters.

thanx in advance.
mpfj



Joined: 09 Sep 2003
Posts: 95
Location: UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Feb 04, 2004 7:12 am     Reply with quote

You might get more help if you could give us the Make / Model of the LCD you are using ...
SteveS



Joined: 27 Oct 2003
Posts: 126

View user's profile Send private message

PostPosted: Wed Feb 04, 2004 7:29 am     Reply with quote

As I recall, all LCDs I used in the past only had 8 programmable (RAM)characters - perhaps newer controllers offer more. You may need to look at a different LCD. ALternatively, if you do not need all 32 characters shown at one time you could reprogram the 8 RAM characters as needed, but you are still limited to 8 custom characters displayed at one time.

- SteveS
jan_boes



Joined: 04 Feb 2004
Posts: 3

View user's profile Send private message

PostPosted: Mon Feb 09, 2004 6:12 am     Reply with quote

thanx
rwyoung



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

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

PostPosted: Mon Feb 09, 2004 8:38 am     Reply with quote

The "average" LCD (or VFD) display has 64 CGRam locations and each custom character is made from 8 CGRam locations. One word per row for both the 5x7 and 5x8 pixel types.

This is what I did and it works on several different brands of LCD and a Noritake VFD (the Noritake VFD seems to be the most fickle of the bunch).

Code:

/*******************************************************************************
 * Battery 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


...
more code
...
void lcd_init ()
{
  int8 i;
#use fast_io(B)
  set_tris_lcd (LCD_WRITE);
  lcd.rs = 0;
  lcd.rw = 0;
  lcd.enable = 0;
  delay_ms (15);
  for (i = 1; i <= 3; ++i)
    {
      lcd_send_nibble (3);
      delay_ms (5);
    }
  lcd_send_nibble (2);

  for (i = 0; i <= 3; ++i)
    lcd_send_byte (0, LCD_INIT_STRING[i]);
  delay_us (100);

  lcd_clear ();

  // program battery indicator graphics into CG RAM
  lcd_send_byte (0, 0x40);
  for (i = 0; i < 64; i++)
  {
    delay_us(100);
    lcd_send_byte (1, lcd_characters[i]);
  }
  lcd_on ();
}


Most of the lcd_init() routine is taken from the lcd example code provided by CCS.

The last loop loads in the CGRam characters. The 100us delay is pretty long for this application but since I modified the lcd_send_byte() code so that it doesn't read back status, some LCDs need a little longer to complete their internal processes.

For your application, if you can group your custom characters into 8 groups of 8 you might be able to load and reload as needed without too much delay aparent to the end user.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
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