Animation In LCD

BMorse

Joined Sep 26, 2009
2,675
I want to display custom characters on LCD like smileys,etc. Can anybody tell me how can I do the same.

Most HD44780 compatible LCD's have at least 7 user defined font space allocated in the CGRAM starting from address 0x01 to 0x07, you have to create each one and load these "custom fonts" into the CGRAM, (You will have to load these characters every time power is removed from the LCD)...

This site will help in designing these "custom" fonts or characters >> http://www.quinapalus.com/hd44780udg.html


Here is an example, this is something I am using right now in a project I am working on (This was written in Hi-Tech C for pic16f887)


Rich (BB code):
/*These are the patterns loaded into the LCD's CGRAM at startup*/
unsigned char pattern3[8]={0x00,0x0E,0x15,0x1B,0x15,0x0E,0x00,0x00};	//Blower On Symbol
unsigned char pattern2[8]={0x04,0x0E,0x1F,0x00,0x04,0x0E,0x1F,0x00};	//Baffle Open Symbol
unsigned char pattern0[8]={0x08,0x14,0x1C,0x14,0x06,0x05,0x05,0x06};	//Access Door Open Symbol
unsigned char pattern1[8]={0x10,0x10,0x10,0x1C,0x06,0x05,0x05,0x06};	//Loading Door Open Symbol
unsigned char pattern4[8]={0x10,0x10,0x10,0x1C,0x07,0x04,0x06,0x04};	//Low Fuel
unsigned char pattern5[8]={0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F};	//|||||
unsigned char patternF[8]={0x18,0x1F,0x04,0x06,0x04,0x04,0x00,0x00};	//Farenheight
unsigned char patternC[8]={0x18,0x1B,0x04,0x04,0x04,0x03,0x00,0x00};	//Celcius

//This is how the function is used in the main routine when starting up//

LCD_Build_Pattern(0,pattern0);
LCD_Build_Pattern(1,pattern1);
LCD_Build_Pattern(2,pattern2);
LCD_Build_Pattern(3,pattern3);
LCD_Build_Pattern(4,pattern4);
LCD_Build_Pattern(5,pattern5);
LCD_Build_Pattern(6,patternF);
LCD_Build_Pattern(7,patternC);


/*********************************************************
*******************/
//this is the function used to load the custom fonts/graphics into the CGRAM//

void LCD_Build_Pattern(unsigned char location, unsigned char *ptr)
{	unsigned char i;
	if(location<8){	
		LCD_RS=0;
		lcd_write(0x40 + (location*8));
		DelayMs(5);
		LCD_RS=1;
		for(i=0;i<8;i++)
			lcd_putch(ptr);
			DelayMs(5);
		
	};//end if
	LCD_RS=1;
	lcd_goto(0x00);
}//End build pattern
/**************************************************************************** 
 
Last edited:

THE_RB

Joined Feb 11, 2008
5,438
I thought his page was a bit basic. As for the "vertical scroll" it's just re-writing the 8 custom characters, so if you are scrolling something that has the same 8 characters in it then it will work, just by making new characters that look like they are scrolling. But it's not an actual "scroll" as you could not scroll the whole display or even a whole line (unless the line uses less than 8 individual characters).
 
Top