Custom characters on HD44780

Here's a snippet I use to load custom characters on a 16x2 hd4470 lcd.

/*

@param cgramloc cgram location from 0-7

@param *data char array

@param cgrpos cgrampostion 0x00-0x07

@param x,y location coordinates

*/

void TextLCD::putCustomChar(int cgramloc, char *data,int cgrpos,int x,int y){

  writeCommand(0x40+((cgramloc&0x07)<<3)); //Set CG-RAM address
  
  for (int i=0; i<8; i++) {
    writeData(*data++);	
  }

  locate(x,y);
  writeData(cgrpos);

}

In order to  printf deg celcius one has to load the symbol on the cgram address.

char degree[8] = {0x02,0x05,0x05,0x02,0x00,0x00,0x00,0x00};

lcd.putcustomChar(1,degree,0x01,12,0);

lcd.printf("C");


18 Nov 2010

Thank you very much.

I was implementing my own but having so much trouble, even if it looks doing the same things as yours...

so this has really helped me.

Regards. Jaime.

Please log in to post comments.