SlideShare ist ein Scribd-Unternehmen logo
1 von 4
EMBEDDED SYSTEMS TUTORIAL 9- INTERFACING 128X64
GRAPHICAL LCD WITH AVR
Hi friends this time I am here with a very interesting embedded systems tutorial, as in last tutorials we
learnt about 16x2 LCD interfacing but some times it seems vey difficult to display a huge amount of data
on such a small space provided by 16x2 LCD , so there is the solution a powerful 128x64 GRAPHICAL
LCD, with a lot of space and facility to display graphics along with alphanumeric data, in this tutorial we
are going to learn how to interface a GRAPHICAL LCD with AVR. We are going to discuss about a
ks0108 based LCD interfacing.

What is required??
I am using a HQM1286404 LCD it’s a pretty old one and please don’t be mistaken with newer versions of
LCD, if you are using any other version you have to find its datasheet for wiring connections because
wiring connections may be different from version to version. I will provide connections for HQM1286404
LCD only and its pretty hard to get accurate wiring connection , so better consult your datasheet and
internet as well. Except this you will need a AVR MCU, I am using ATMEGA 8 here and of course an LCD
library you can find o many libraries on internet but I am giving a best link to download a very nice library
written by Mr. Fabian Maximilian Thiele , thanx to him the link for this library is GLCD_LIBRARY
LCD PIN-OUT CONNECTIONS
Here is the correct pin-out of LCD:
1 Vcc
2 GND
3 VCON
4-11 DB0-DB7
12 CS2
13 CS1
14 RESET
15 R/W
16 D/I
17 EN
18 Vee out
19 LED Anode
20 LED Kathode

NOTE:- in some cases you will found that your LCD screen is swapped into two halves in such cases just
swap the chip select pins and problem will be corrected...:)
LIBRARY USE
The library , which you have downloaded contains to files ks0108.c and ks0108.h you have to copy
these files and have to paste in the same folder wher .c file of your main program is contained and you
have to add corresponding header files in the beginning of the program too like
#include "ks0108.h"
#include "ks0108.c"
the .h files contains the information about pin connection and commands you can easily change the
connection pin and ports from there .
Getting familiar with commands is just a learning by doing thig more you do more you learn. Just go
through the library to know more about the command its self explaining.
Along with these library files some font files are also provided these fonts must be added by adding
corresponding header file in beginning of the program.except these font you can fetch your windows font
with the help of this java program GLCDFontCreator2
SOURCE CODE
here is an interesting source code to start with
#include <inttypes.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include "ks0108.h"
#include "ks0108.c"
#include "arial_bold_14.h"
int main(void) {
// Wait a little while the display starts up
for(volatile uint16_t i=0; i<15000; i++);
// Initialize the LCD
ks0108Init(0);
// Select a font
ks0108SelectFont(Arial_Bold_14, ks0108ReadFontData, BLACK);
// Set a position
ks0108GotoXY(15,10);
// Print some text
ks0108Puts_P(PSTR("Tech_strong"));
// two little circles
ks0108DrawCircle(30, 30, 5, BLACK);
ks0108DrawCircle(90, 30, 5, BLACK);
// again some text
ks0108GotoXY(29,38);
ks0108Puts_P(PSTR("Tutorials"));
// a loading bar
for(int x=0;x<128;x++)
{
ks0108GotoXY(x,50);
ks0108DrawRect(x, 50, 80, 10, BLACK);
}
while(1);
}

CIRCUIT DIAGRAM
now just implement this easy circuit burn your MCU with corresponding .hex file and enjoy your
GRAPHICAL lcd.
NOTE:- In my program I have changed data port of LCD from PORTA to PORTD so be careful if
you are using this circuit connection you will have to change PORTA to PORTD in ks0108.h file of
library be careful ….!!
I think it was a useful article for you all in case of any query, doubt or critical view just leave a comment in
next tutorial we will discuss about displaying an image on this LCD,… till then bye…!

Weitere ähnliche Inhalte

Mehr von Akshay Sharma

Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...
Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...
Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...Akshay Sharma
 
A_law_and_Microlaw_companding
A_law_and_Microlaw_compandingA_law_and_Microlaw_companding
A_law_and_Microlaw_compandingAkshay Sharma
 
Ldr based line follower robot
Ldr based line follower robotLdr based line follower robot
Ldr based line follower robotAkshay Sharma
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full TutorialAkshay Sharma
 

Mehr von Akshay Sharma (10)

Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...
Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...
Double Side Band – Suppressed Carrier (DSB-SC) Modulation Demodulation using ...
 
A_law_and_Microlaw_companding
A_law_and_Microlaw_compandingA_law_and_Microlaw_companding
A_law_and_Microlaw_companding
 
8085 instructions
8085 instructions8085 instructions
8085 instructions
 
Ldr based line follower robot
Ldr based line follower robotLdr based line follower robot
Ldr based line follower robot
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full Tutorial
 
Est 11
Est 11Est 11
Est 11
 
Est 8 2 nd
Est 8 2 ndEst 8 2 nd
Est 8 2 nd
 
Est 8 1 st
Est 8 1 stEst 8 1 st
Est 8 1 st
 
Est 6
Est 6Est 6
Est 6
 
Est 1
Est 1Est 1
Est 1
 

Kürzlich hochgeladen

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 

Kürzlich hochgeladen (20)

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

Est 9

  • 1. EMBEDDED SYSTEMS TUTORIAL 9- INTERFACING 128X64 GRAPHICAL LCD WITH AVR Hi friends this time I am here with a very interesting embedded systems tutorial, as in last tutorials we learnt about 16x2 LCD interfacing but some times it seems vey difficult to display a huge amount of data on such a small space provided by 16x2 LCD , so there is the solution a powerful 128x64 GRAPHICAL LCD, with a lot of space and facility to display graphics along with alphanumeric data, in this tutorial we are going to learn how to interface a GRAPHICAL LCD with AVR. We are going to discuss about a ks0108 based LCD interfacing. What is required?? I am using a HQM1286404 LCD it’s a pretty old one and please don’t be mistaken with newer versions of LCD, if you are using any other version you have to find its datasheet for wiring connections because wiring connections may be different from version to version. I will provide connections for HQM1286404 LCD only and its pretty hard to get accurate wiring connection , so better consult your datasheet and internet as well. Except this you will need a AVR MCU, I am using ATMEGA 8 here and of course an LCD library you can find o many libraries on internet but I am giving a best link to download a very nice library written by Mr. Fabian Maximilian Thiele , thanx to him the link for this library is GLCD_LIBRARY LCD PIN-OUT CONNECTIONS Here is the correct pin-out of LCD: 1 Vcc 2 GND 3 VCON 4-11 DB0-DB7
  • 2. 12 CS2 13 CS1 14 RESET 15 R/W 16 D/I 17 EN 18 Vee out 19 LED Anode 20 LED Kathode NOTE:- in some cases you will found that your LCD screen is swapped into two halves in such cases just swap the chip select pins and problem will be corrected...:) LIBRARY USE The library , which you have downloaded contains to files ks0108.c and ks0108.h you have to copy these files and have to paste in the same folder wher .c file of your main program is contained and you have to add corresponding header files in the beginning of the program too like #include "ks0108.h" #include "ks0108.c" the .h files contains the information about pin connection and commands you can easily change the connection pin and ports from there . Getting familiar with commands is just a learning by doing thig more you do more you learn. Just go through the library to know more about the command its self explaining. Along with these library files some font files are also provided these fonts must be added by adding corresponding header file in beginning of the program.except these font you can fetch your windows font with the help of this java program GLCDFontCreator2 SOURCE CODE here is an interesting source code to start with #include <inttypes.h> #include <avr/io.h> #include <avr/pgmspace.h> #include "ks0108.h" #include "ks0108.c" #include "arial_bold_14.h" int main(void) { // Wait a little while the display starts up for(volatile uint16_t i=0; i<15000; i++); // Initialize the LCD
  • 3. ks0108Init(0); // Select a font ks0108SelectFont(Arial_Bold_14, ks0108ReadFontData, BLACK); // Set a position ks0108GotoXY(15,10); // Print some text ks0108Puts_P(PSTR("Tech_strong")); // two little circles ks0108DrawCircle(30, 30, 5, BLACK); ks0108DrawCircle(90, 30, 5, BLACK); // again some text ks0108GotoXY(29,38); ks0108Puts_P(PSTR("Tutorials")); // a loading bar for(int x=0;x<128;x++) { ks0108GotoXY(x,50); ks0108DrawRect(x, 50, 80, 10, BLACK); } while(1); } CIRCUIT DIAGRAM now just implement this easy circuit burn your MCU with corresponding .hex file and enjoy your GRAPHICAL lcd.
  • 4. NOTE:- In my program I have changed data port of LCD from PORTA to PORTD so be careful if you are using this circuit connection you will have to change PORTA to PORTD in ks0108.h file of library be careful ….!! I think it was a useful article for you all in case of any query, doubt or critical view just leave a comment in next tutorial we will discuss about displaying an image on this LCD,… till then bye…!