Animation In LCD

Discussion in 'Embedded Systems and Microcontrollers' started by mukesh.sehwag, Sep 6, 2012.

  1. mukesh.sehwag

    Thread Starter New Member

    Oct 16, 2010
    7
    0
    I want to display custom characters on LCD like smileys,etc. Can anybody tell me how can I do the same.
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,452
    3,371
    Yeah, write a program to send custom characters to the LCD.
     
  3. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234

    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)


    Code ( (Unknown Language)):
    1.  
    2. /*These are the patterns loaded into the LCD's CGRAM at startup*/
    3. unsigned char pattern3[8]={0x00,0x0E,0x15,0x1B,0x15,0x0E,0x00,0x00};    //Blower On Symbol
    4. unsigned char pattern2[8]={0x04,0x0E,0x1F,0x00,0x04,0x0E,0x1F,0x00};    //Baffle Open Symbol
    5. unsigned char pattern0[8]={0x08,0x14,0x1C,0x14,0x06,0x05,0x05,0x06};    //Access Door Open Symbol
    6. unsigned char pattern1[8]={0x10,0x10,0x10,0x1C,0x06,0x05,0x05,0x06};    //Loading Door Open Symbol
    7. unsigned char pattern4[8]={0x10,0x10,0x10,0x1C,0x07,0x04,0x06,0x04};    //Low Fuel
    8. unsigned char pattern5[8]={0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F};    //|||||
    9. unsigned char patternF[8]={0x18,0x1F,0x04,0x06,0x04,0x04,0x00,0x00};    //Farenheight
    10. unsigned char patternC[8]={0x18,0x1B,0x04,0x04,0x04,0x03,0x00,0x00};    //Celcius
    11.  
    12. //This is how the function is used in the main routine when starting up//
    13.  
    14. LCD_Build_Pattern(0,pattern0);
    15. LCD_Build_Pattern(1,pattern1);
    16. LCD_Build_Pattern(2,pattern2);
    17. LCD_Build_Pattern(3,pattern3);
    18. LCD_Build_Pattern(4,pattern4);
    19. LCD_Build_Pattern(5,pattern5);
    20. LCD_Build_Pattern(6,patternF);
    21. LCD_Build_Pattern(7,patternC);
    22.  
    23.  
    24. /*********************************************************
    25. *******************/
    26. //this is the function used to load the custom fonts/graphics into the CGRAM//
    27.  
    28. void LCD_Build_Pattern(unsigned char location, unsigned char *ptr)
    29. {   unsigned char i;
    30.     if(location<8){
    31.         LCD_RS=0;
    32.         lcd_write(0x40 + (location*8));
    33.         DelayMs(5);
    34.         LCD_RS=1;
    35.         for(i=0;i<8;i++)
    36.             lcd_putch(ptr[i]);
    37.             DelayMs(5);
    38.        
    39.     };//end if
    40.     LCD_RS=1;
    41.     lcd_goto(0x00);
    42. }//End build pattern
    43. /**************************************************************************** [/i]
     
    Last edited: Sep 6, 2012
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
  5. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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).
     
    absf likes this.
Loading...