Reply To: Custom Character LCD 4 Bit

Home Forums Microcontrollers PIC Microcontroller Custom Character LCD 4 Bit Reply To: Custom Character LCD 4 Bit

#10077
Ligo George
Keymaster

Try the following code :

const unsigned short MyChar5x8[] = {
        0x04, 0x0E, 0x1F, 0x0E, 0x04, 0x00, 0x00, 0x00,  // Code for char num #0
        0x1F, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1F,  // Code for char num #1
        0x0E, 0x11, 0x1B, 0x11, 0x15, 0x11, 0x11, 0x0E,  // Code for char num #2
        0x00, 0x11, 0x1F, 0x11, 0x1B, 0x0E, 0x04, 0x00,  // Code for char num #3
        0x04, 0x0E, 0x1F, 0x0E, 0x04, 0x04, 0x04, 0x04,  // Code for char num #4
        0x04, 0x04, 0x04, 0x04, 0x04, 0x1F, 0x0E, 0x04,  // Code for char num #5
        0x1F, 0x00, 0x04, 0x04, 0x0E, 0x00, 0x00, 0x1F,  // Code for char num #6
        0x1F, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x1F   // Code for char num #7
        };
void InitCustomChars()
{
  char i;
  Lcd_Cmd(0x04);
  Lcd_Cmd(0x00);
  for (i = 0; i <= 63 ; i++)
    Lcd_Write_Char(MyChar5x8[i]);
  Lcd_Cmd(0);
  Lcd_Cmd(2);
}

void main()
{
  ....
  ....
  Lcd_Init();
  ....
  ...
  InitCustomChars();
  ....
  ...
  do
  {
     ''''
     ....
     Lcd_Set_Cursor(1,1);
     Lcd_Write_Char(0); //Displays First Custom Character
     ...
  }
}
>