Custom Character LCD 4 Bit

Home Forums Microcontrollers PIC Microcontroller Custom Character LCD 4 Bit

This topic contains 4 replies, has 2 voices, and was last updated by  Ivan 2 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10070

    Ivan
    Participant

    Hi everyone.

    I saw the Interfacing LCD with PIC Microcontroller – MPLAB XC8 on electroSome and I did the circuit. It works fine! But I’m wondering. Is there a way to create custom character?

    #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
         ...
      }
    }
    
    #10084

    Ivan
    Participant

    I’m sorry, before I make this post I tried to search but it seems like I failed.

    Thank you 🙂

    #10086

    Ligo George
    Keymaster

    I tested the above code in PROTEUS, it seems to be working..

    #10090

    Ivan
    Participant

    I felt sorry because I did another post about the same subject, I should search more. The code works fine.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

string(7) "9898001"