Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Sensor Series
      • 3D Printing
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Display custom characters on LCD using AVR Microcontroller (ATmega16)- (Part 9/46)

By Ashutosh Bhatt July 2, 2010

This is the most interesting article to play with LCD. After going through the article, you can create any character/symbol which cannot be created using the ASCII values for example smiley. You can even create small games. Conventionally 16X2 LCD is use to display text or numerical values. It is possible to display special characters, your own designed characters too on LCD by using its 5 x 8 matrix block. These special characters are stored in the CGRAM of LCD. This article shows how to create and display special character on LCD using ATmega16. For more details refer to the article how to create custom characters.
 

 

This article assumes that the readers are aware of the concepts of interfacing LCD with AVR microcontroller (ATMEGA 16). For more information about interfacing LCD with AVR, refer How to display string on LCD using AVR. In order to create a custom character its configuration is first defined in the CGRAM of the LCD. A maximum of eight characters can be stored at a time in the 16 x 2 LCD. Every character is assigned eight bytes in the CGRAM and by configuring these bytes any character can be generated. The size of the CGRAM is 64 bytes.
 
For detailed description about configuring the CGRAM, refer to creating custom characters on LCD using 8051. The concepts of generating a custom character remain the same. The connection of  LCD with the AVR is shown in the circuit diagram.

 

Project Source Code

###


 
//Program to display special Characters on LCD using AVR Microcontroller (ATmega16)
/*
To display special character on LCD data
LCD DATA port----PORT B
ctrl port------PORT D
rs-------PD0
rw-------PD1
en-------PD2
 
using internal clock frequency 1MHz
 
*/
#include<avr/io.h>
#include<util/delay.h>
 
#define LCD_DATA PORTB //LCD data port
 
#define signal PORTD
#define en PD2 // enable signal
#define rw PD1 // read/write signal
#define rs PD0 // register select signal
 
void LCD_cmd(unsigned char cmd);
void init_LCD(void);
void LCD_write(unsigned char data);
void LCD_character();
 
int main()
{
DDRB=0xff;
DDRD=0x07;
init_LCD();
_delay_ms(50); // delay of 50 mili seconds
LCD_character();
return 0;
}
 
void init_LCD(void)
{
LCD_cmd(0x38); // initialization of 16X2 LCD in 8bit mode
_delay_ms(1);
 
LCD_cmd(0x01); // clear LCD
_delay_ms(1);
 
LCD_cmd(0x0E); // cursor ON
_delay_ms(1);
 
LCD_cmd(0x80); // ---8 go to first line and --0 is for 0th position
_delay_ms(1);
return;
}
 
void LCD_cmd(unsigned char cmd)
{
LCD_DATA=cmd;
ctrl =(0<<rs)|(0<<rw)|(1<<en);
_delay_ms(1);
ctrl =(0<<rs)|(0<<rw)|(0<<en);
_delay_ms(50);
return;
}
 
void LCD_write(unsigned char data)
{
LCD_DATA= data;
ctrl = (1<<rs)|(0<<rw)|(1<<en);
_delay_ms(1);
ctrl = (1<<rs)|(0<<rw)|(0<<en);
_delay_ms(50);  
return ;
}
 
void LCD_character()
{
LCD_cmd(64);  // Address where customized character is to be stored
LCD_write(0);
LCD_write(14);
LCD_write(17);
LCD_write(2);
LCD_write(4);
LCD_write(4);
LCD_write(0);
LCD_write(4);
LCD_cmd(0x80);  // Location of LCD where the character is to be displayed
LCD_write(0);  // Displaying the character created at address 0x64 
_delay_ms(10);
 
LCD_cmd(72);  // Address where customized character is to be stored
LCD_write(0);
LCD_write(10);
LCD_write(21);
LCD_write(17);
LCD_write(18);
LCD_write(4);
LCD_write(0);
LCD_write(0);
LCD_cmd(0x82);  // Location of LCD where the character is to be displayed
LCD_write(1);  // Displaying the character created at address 0x72
_delay_ms(10);
 
LCD_cmd(80);  //Address where customized character is to be stored
LCD_write(0);
LCD_write(0);
LCD_write(10);
LCD_write(0);
LCD_write(4);
LCD_write(0);
LCD_write(14);
LCD_write(17);
LCD_cmd(0x84);  // Location of LCD where the character is to be displayed
LCD_write(2);  // Displaying the character created at address 0x80 
_delay_ms(10);
 
LCD_cmd(88);  //Address where customized character is to be stored
LCD_write(1);
LCD_write(3);
LCD_write(5);
LCD_write(9);
LCD_write(9);
LCD_write(11);
LCD_write(27);
LCD_write(24);
LCD_cmd(0x86);  // Location of LCD where the character is to be displayed
LCD_write(3);  // Displaying the character created at address 0x88 
_delay_ms(10);
 
LCD_cmd(96);  // Address where customized character is to be stored
CD_write(0);
LCD_write(0);
LCD_write(0);
LCD_write(4);
LCD_write(0);
LCD_write(31);
LCD_write(0);
LCD_cmd(0xC0);  // location where the character is to be displayed
LCD_write(4);  // Display the character created at address 0x96 
_delay_ms(10);
 
LCD_cmd(104);  //Address where customized character is stored
LCD_write(0);
LCD_write(17);
LCD_write(10);
LCD_write(17);
LCD_write(4);
LCD_write(0);
LCD_write(14);
LCD_write(17);
LCD_cmd(0xC2);  // Location of LCD where the character is to be displayed
LCD_write(5);  // Display the character created at address 0x104 
_delay_ms(10);
 
LCD_cmd(112);  // Address where customized character is to be stored
LCD_write(0);
LCD_write(14);
LCD_write(17);
LCD_write(2);
LCD_write(4);
LCD_write(4);
LCD_write(0);
LCD_write(4);
LCD_cmd(0xC4);  // Location of LCD where the character is to be displayed
LCD_write(6);   // Display the character created at address 0x112 
_delay_ms(10);
 
LCD_cmd(120);  // Address where customized character is to be stored
LCD_write(10);
LCD_write(0);
LCD_write(4);
LCD_write(0);
LCD_write(14);
LCD_write(17);
LCD_write(17);
LCD_write(14);
LCD_cmd(0xC6);  // Location of LCD where the character is to be displayed
LCD_write(7);   // Display the character created at address 0x120
_delay_ms(10);
}
 

###

 


Circuit Diagrams

Circuit-Diagram-of-Display-custom-characters-on-LCD-using-AVR-Microcontroller-ATmega16

Project Components

  • ATmega16
  • LCD

Project Video


Filed Under: AVR
Tagged With: atmega16, avr, display, led, microcontroller
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Power Efficiency
Discover proven strategies for power conversion, wide bandgap devices, and motor control — balancing performance, cost, and sustainability across industrial, automotive, and IoT systems.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions.

  • Synchronous rectifier chips nil stocked everywhere?
  • PCB layout impact on RF path impedance
  • rechargeable battery and simple alkaline battery in one single product
  • Persistent Shoot-Through vin=vout in Synchronous Buck Converter – Physical Phenomenon Issue
  • Methods for Calculating SNR and SFDR in a CUI for Use in Machine Learning

RSS Electro-Tech-Online.com Discussions

  • Looking for obsolete item from Parallax
  • Panasonic RQ-A170 Walkman recorder
  • strange laptop problem
  • WTB: "The Theory Of Servicing AM, FM, And FM Receivers" by Clarence R. Green and Robert M. Bourque
  • Converting 1vac to 24vac

Featured – Real Time Hardware Filter Design

  • Practical implementation of bandpass and band reject filters
  • Practical application of hardware filters with real-life examples
  • A filter design example
  • Types of filter responses
  • What are the two types of hardware filters?
  • What are hardware filters and their types?

Recent Articles

  • GigaDevices introduces 32-bit MCUs with integrated DSP and FPU support
  • Grinn introduces 8-core SBC supporting AI-ready embedded development
  • EPC’s 100 kHz BLDC inverter supports high-efficiency motion control
  • Melexis announces 5 W smart driver to supports sensorless FOC operation
  • STMicroelectronics’ motion sensor simplifies industrial IoT system design

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Sensor Series
      • 3D Printing
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
  • Guest Post Guidelines
  • Advertise
  • Subscribe