LCD - can you program characters? (Or looking for a certain character)

Ok, I've asked about "inverting" the display.

It must be possible in some ways, because the "multi-day-alarm-clock" has this "PHI BIG FONT" where you can change how the time is displayed.

And to do that, you need the big font library.

Anyway, no hard feelings. The question is a bit academic at this point.

What I want to know now is I want to make "symbols" to indicate if alarms are enabled.

As I have the 20 x 4 display, there is a bit of spare space to put such symbols.

However, in typing this, I realise that there MAY be a "BELL" symbol in the character set for the display anyway.
You know, the one which looks like a bell.

Though what character would I need to enter on the PC?

I am getting close to getting the project completed.

The standard LCD character display screens with the HD44780 or compatible drivers have room for up to eight custom characters. I've used these to create degrees-symbols and that sort of thing. There's a web-page that gives some good information about these displays and how to create characters for them:

In the LiquidCrystal library, the command to create the character is lcd.createChar() - there is an example here:

Cheers!

Here is some sample code that shows how to use the liquidCrystal library functions.
Just create the character with createChar() then print it using the same index number
used in creatChar().
It can help to use the binary definitions vs hex because with the binary defintions
you can kind of see the character and for me it is easier to directly move the design from graph paper
to code.

--- bill

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
//            lcd(RS,  E, d4, d5, d6, d7)
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

// Creat a set of new characters

uint8_t bell[8]  = {0x4,0xe,0xe,0xe,0x1f,0x0,0x4};
uint8_t note[8]  = {0x2,0x3,0x2,0xe,0x1e,0xc,0x0};
uint8_t clock[8] = {0x0,0xe,0x15,0x17,0x11,0xe,0x0};
uint8_t heart[8] = {0x0,0xa,0x1f,0x1f,0xe,0x4,0x0};
uint8_t duck[8]  = {0x0,0xc,0x1d,0xf,0xf,0x6,0x0};
uint8_t check[8] = {0x0,0x1,0x3,0x16,0x1c,0x8,0x0};
uint8_t cross[8] = {0x0,0x1b,0xe,0x4,0xe,0x1b,0x0};
uint8_t retarrow[8] = {	0x1,0x1,0x5,0x9,0x1f,0x8,0x4};


byte smiley[8] = {
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b10001,
  0b01110,
  0b00000
};

byte armsUp[8] = {
  0b00100,
  0b01010,
  0b00100,
  0b10101,
  0b01110,
  0b00100,
  0b00100,
  0b01010
};

byte frownie[8] = {
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b00000,
  0b01110,
  0b10001
};

void setup()
{

  lcd.begin(16,2);               // initialize the lcd 

  lcd.createChar (0, smiley);    // load character to the LCD
  lcd.createChar (1, armsUp);    // load character to the LCD
  lcd.createChar (2, frownie);   // load character to the LCD

  lcd.home ();                   // go home
  lcd.print("Hello, ARDUINO ");  
}

void loop()
{
  // Do a little animation by writing to the same location
  lcd.setCursor ( 14, 1 );
  lcd.print (char(2));
  delay (200);
  lcd.setCursor ( 14, 1 );
  lcd.print ( char(0));
  delay (200);
}

Thanks for both replies.

Shall look at.

Sorry for the "silly question", but I am really wanting to get this to a usable stage soon.

Not having an alarm clock is annoying to say the least.

Hi again.

Ok, I got that part working.

Alas there is a problem - and when isn't there?

This "alarm clock V5" code:

The display has two options - standard font and a BIG font.

I was only going to use the small font, but I now see that the BIG one may be better.

So, ok, I look at the main part of the code and find this:

PROGMEM prog_char lcd_chr0[]={64,64,64,64,64,64,64,64,0};// 0
PROGMEM prog_char lcd_chr1[]={64,64,64,64,64,31,31,31,0};//1
PROGMEM prog_char lcd_chr2[]={64,64,64,31,31,64,64,64,0};//2
PROGMEM prog_char lcd_chr3[]={64,64,64,31,31,31,31,31,0};//3 {64,64,64,31,31,64,31,31,0};
PROGMEM prog_char lcd_chr4[]={31,31,31,64,64,64,64,64,0};//4
PROGMEM prog_char lcd_chr5[]={31,31,64,64,64,31,31,31,0};//5
PROGMEM prog_char lcd_chr6[]={31,31,31,31,31,64,64,64,0};//6 {31,31,64,31,31,64,64,64,0}
PROGMEM prog_char lcd_chr7[]={31,31,31,31,31,31,31,31,0};//7 {31,31,64,31,31,64,31,31,0}
// PROGMEM prog_char lcd_chr8[]={0x4,0xe,0xe,0xe,0x1f,0x0,0x4};   // added for bell character.
//PROGMEM const char *chr_item[] = {lcd_chr0, lcd_chr1, lcd_chr2, lcd_chr3, lcd_chr4, lcd_chr5, lcd_chr6, lcd_chr7, lcd_chr8};
PROGMEM const char *chr_item[] = {lcd_chr0, lcd_chr1, lcd_chr2, lcd_chr3, lcd_chr4, lcd_chr5, lcd_chr6, lcd_chr7};

Now, I have the two // lines following the pattern giving me a BELL symbol.
But that doesn't work when the BIG FONT is chosen.

Later on in the code I have these lines:

uint8_t bell[9]  = {0x4,0xe,0xe,0xe,0x1f,0x0,0x4};  //  unknown number to use to keep it from not altering the BIG FONT.

void render_RTC(int temp)
{

  lcd.createChar (9, bell);

But that doesn't work either.

No matter what I do, somehow the BIG FONT is corrupted with my BELL symbol.

I shall look at the BIG FONT files, but if they have things to do with programming the characters, what are the initial lines in the first block doing?

Sorry for asking all these "silly" questions. I am trying myself as well.

From the LiquidCrystal documentation:

Syntax
 lcd.createChar(num, data)

Parameters: 
lcd: a variable of type LiquidCrystal
num: which character to create (0 to 7)
data: the character's pixel data

From your code:

lcd.createChar (9, bell);

You are using a 'num' value of 9 which is outside the range of 0 through 7

When it comes to the addresses of the custom characters, the LCD controller exhibits a characteristic called foldback memory. The net result of this is that custom character memory addresses 0, 1, 2 ... 7 and addresses 8, 9, 10, ...15 take you to exactly the same memory locations.

My guess is that your 'bell' character at address 9 is overwriting the 'BIG FONT' character at address 1.

Don

To put it another way, there are only 8 custom characters that can be defined and
the big font code uses all 8 custom character slots to create the components used to create
its larger characters.

If you want a custom "character" when using the large font, you will have to
create it from combinations of the other characters you have available. (normal and custom characters used by the large font).
You could probably go into the large font character data and define something
so that the large character code (is it a library ?) could draw it as well.

--- bill