Custom Characters on LCD using PIC – MikroC

LCD Custom Characters

Custom Characters on LCD using PIC – MikroC

I hope that you already go through our tutorial, Interfacing Character LCD with PIC Microcontroller – MicroC Pro. These character based LCDs are commonly made using HD44780 compatible controllers. It allows us to define 8 custom characters in addition to the standard pre-programmed characters. In this tutorial we will learn to define our own custom characters using MikroC compiler.


CGROM – Character Generator ROM

This is the memory which holds 5×8 or 5×10 dot patterns of predefined characters in the LCD. It can generate 208 5×8 dot character patterns and 32 5×10 dot character patterns.

DDRAM – Display Data RAM

This is the memory which holds the character data which is currently displayed on the LCD screen. Its capacity is 80×8 bits, ie 80 characters.

CGRAM – Character Generator RAM

This memory works similar to CGROM but as this is a RAM we can modify its data any time. So we can store our custom character patterns in this memory through program. We can store up to eight 5×8 character dot patterns or four 5×10 character dot patterns in this memory.

Character Generation using MikroC

You can easily create your own custom characters using MikroElectronika LCD Custom Character Generator Tool.

  • Go to Tools >> LCD Custom Character

MikroElektronika LCD Custom Char Generator Tool

MikroElektronika LCD Custom Char Generator

MikroElektronika LCD Custom Char Generator

  • Set the font size of your LCD
  • Set CGRAM Address
  • Design your custom character
  • Then click on the Generate Code button

This will give you a function to store and display the custom character in the LCD. By changing the CGRAM address you can store up to eight 5×8 custom characters in the LCD memory. You can see a modified MikroC code below, which will store and display 8 custom characters in the LCD.

MikroC Modified Code

// LCD module connections
sbit LCD_RS at RD2_bit;
sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;

sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
// End LCD module connections

const char character0[] = {0,0,10,31,31,14,4,0};
const char character1[] = {14,27,17,17,17,17,31,0};
const char character2[] = {14,27,17,17,17,31,31,0};
const char character3[] = {14,27,17,17,31,31,31,0};
const char character4[] = {14,27,17,31,31,31,31,0};
const char character5[] = {14,31,31,31,31,31,31,0};
const char character6[] = {0,4,2,31,2,4,0,0};
const char character7[] = {0,0,14,17,17,10,27,0};

void CustomChar0() {
  char i;
  for (i = 0; i<=7; i++) Lcd_Chr_CP(character0[i]);

void CustomChar1() {
  char i;
  for (i = 0; i<=7; i++) Lcd_Chr_CP(character1[i]);

void CustomChar2() {
  char i;
  for (i = 0; i<=7; i++) Lcd_Chr_CP(character2[i]);

void CustomChar3() {
  char i;
  for (i = 0; i<=7; i++) Lcd_Chr_CP(character3[i]);

void CustomChar4() {
  char i;
  for (i = 0; i<=7; i++) Lcd_Chr_CP(character4[i]);

void CustomChar5() {
  char i;
  for (i = 0; i<=7; i++) Lcd_Chr_CP(character5[i]);

void CustomChar6() {
  char i;
  for (i = 0; i<=7; i++) Lcd_Chr_CP(character6[i]);

void CustomChar7() {
  char i;
  for (i = 0; i<=7; i++) Lcd_Chr_CP(character7[i]);

void main()  {
  Lcd_Init(); // Initialize LCD

  Lcd_Cmd(_LCD_CLEAR); // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

  //Send Custom Charactors to CGRAM

  //Display Custom Characters

Circuit Diagram

Interfacing LCD with PIC Microcontroller - Circuit Diagram

Interfacing LCD with PIC Microcontroller – Circuit Diagram


LCD Custom Characters

LCD Custom Characters

Download Here

You can download MikroC and Proteus files here.

Buy Here

  • Sale
    Out of stock
    16x2 Green Character LCD Module16x2 Blue Character LCD Module

    16×2 Character LCD Module

    0 out of 5

    16×2 Character LCD is a very basic and low cost LCD module which is commonly used in electronic devices and projects. 16×2 means it contains 2 rows that can display 16 characters. In these displays, each character is displayed using 5×8 or 5×10 dot matrix.  This module can display ASCII characters, special characters and even custom characters. It uses HD44780 compatible controller for its operation. Two variants of this LCD modules are available, one having BLACK characters on GREEN and other having WHITE characters on BLUE.

    150.00165.00 149.00159.00
  • -31%
    PIC 16F877APIC 16F877A

    PIC 16F877A Microcontroller

    0 out of 5

    This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful PIC architecture into an 40- or 44-pin package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. The PIC16F877A features 256 bytes of EEPROM data memory, self programming, an ICD, 2 Comparators, 8 channels of 10-bit Analog-to-Digital (A/D) converter, 2 capture/compare/PWM functions, the synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus and a Universal Asynchronous Receiver Transmitter (USART). All of these features make it ideal for more advanced level A/D applications in automotive, industrial, appliances and consumer applications.

    200.00 139.00
  • -21%
    Out of stock
    USB PIC ProgrammerPICKit2 Clone

    USB PIC Programmer PICkit 2

    0 out of 5

    The PICkit 2 programmer is a development tool with a easy to use interface for programming and debugging Microchip’s flash families of micro-controllers. The windows programming interface supports all commonly available PIC microcontrollers. With Microchip’s powerful MPLAB Integrated Development Environment (IDE) the PICkit 2 enables in circuit debugging on most PIC microcontrollers.

    1,170.00 929.00

Share this post

  • line

    thanks. How Can I use more than 8 characters?

  • You can store only 8 custome characters in LCD memory. If you want more than 8, then you should store it in microcontroller memory.

  • Aldrin

    Hey, in what version of MikroC is the custom char generator available? I have MickroC version 6 and GLCD is the only available tool. Looking forward for an answer. Thanks.

  • It is available in v6, MikroC Pro v6

  • TonyMK