SlideShare ist ein Scribd-Unternehmen logo
1 von 4
EMBEDDED SYSTEMS TUTORIAL8 - INTERFACING 16X2
ALPHANUMERIC LCD WITH AVR PART 1
Hi..!! friends this time I am here with a very very useful tutorial for embedded system beginners, this time
we are going to learn how to interface a LCD module, after learning LCD interfacing you will be able to
make so many important project related to LCD display….so lets start….!!

THING WE NEED TO START

For learning LCD interfacing we must have a 16X2 alphanumeric LCD display, of course our USBasp
programmer and ATmega 16.
For interfacing LCD we must have LCD library, u can found so many libraries on net but Mr. Peter
Fluery’s library is most trusted and most widely used one , THNX to him you can directly download his
library from this linklcd library

LCD PIN DISCRIPTION

A 16x2 alphanumeric LCD contains 16 pins and description of these pins is given below
1 VSS (GND )
2 VCC (+5V)
3 VEE ( adjust contrast)
4 RS
5 R/W
6 E
7 DB0
8 DB1
9 DB2
10 DB3
11 DB4
12 DB5
13 DB6
14 DB7
15 LED+ (+5V)
16 LED- (GND)
In this tutorial we are using our LCD in 4bit mode so we will use DB4-DB7(PIN 11-14 of LCD) as DATA
pins.
USING LIBRARIES

The LCD library which u will download will contain mainly two files lcd.c and lcd.h, by changing the
PORT in lcd.h you can change the port of LCD connection, by default it is set to PORTA. You can also
change pins of LCD connection from same file for this purpose you have to open lcd.h with notepad , then
change PORT/PINS according to your choice and then save it. For adding library support in your
program you have to paste lcd.c and lcd.h in the same folder where your .c file of program is contained.
And these libraries can be added to the program by including these header file in starting of program#include”lcd.c”
#include”lc.h”
COMMANDS USED
In lcd.h file you can get information about the commands which we have to use in our program , I am
discussing some of them here but you can check the library to get knowledge about all the useful
command
Initializing the LCD
To initialize the LCD in program we have to this command is used
lcd_init(LCD_DISP_ON);
To move cursor at a specific position
lcd_gotoxy(x,y);

here x and y are the co-ordinates of desired location.

To clear the display
lcd_clrscr();
To set cursor to home position
lcd_home();
To display any text string
lcd_puts("desired text string");
in addition to these commands there are many more command but for starting interfacing these
commands are sufficient and we will discuss other commands later.

SAMPLE CODE
Here is a simple sample code to start with this time we are going to display a simple text on string on the
LCD .
#include <stdlib.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include<util/delay.h>
#include "lcd.h"
#include "lcd.c"
int main(void)
{
while(1)
{
lcd_init(LCD_DISP_ON);
lcd_gotoxy(2,0);
lcd_puts("TECH_STRONG");
_delay_ms(500);
lcd_clrscr();
lcd_gotoxy(1,0);
lcd_puts("LCD INTERFACING");
lcd_gotoxy(2,1);
lcd_puts("BY ABHILASH");
_delay_ms(500);
lcd_clrscr();
}
}
CIRCUIT DIAGRAM FOR CONNECTIONS
So that’s it now just make a simple circuit as shown below.

// Initialize LCD
// setting cursor to (2,0)
// to display text
// wait for some time
// clear display
//setting cursor to (1,0)
// to display text
//setting cursor to (1,0)
// to display text
// wait for some time
// clear display
The contrast of LCD can be adjusted by using the variable resistance used here.
Now compile the program and burn your MCU with corresponding hex file and our first LCD interfacing
project is ready……now you can display any thing on the LCD …..yes I know you are going to display
your name first…..:p

I hope this article was useful for guys in case of any query, doubt or critical view just leave a comment. In
next LCD interfacing tutorial we will discuss about rotating a text , displaying integers and some basic
LCD projects……..till then bye….enjoy your LCD……!!

Weitere ähnliche Inhalte

Ähnlich wie Est 8 1 st

Moving message display
Moving message displayMoving message display
Moving message displayviraj1989
 
Lcd module interface with xilinx software using verilog
Lcd module interface with xilinx software using verilogLcd module interface with xilinx software using verilog
Lcd module interface with xilinx software using verilogsumedh23
 
4 bit lcd_interfacing_with_arm7_primer
4 bit lcd_interfacing_with_arm7_primer4 bit lcd_interfacing_with_arm7_primer
4 bit lcd_interfacing_with_arm7_primerpvmistary
 
4 bit lcd_interfacing_with_arm7_primer
4 bit lcd_interfacing_with_arm7_primer4 bit lcd_interfacing_with_arm7_primer
4 bit lcd_interfacing_with_arm7_primerpvmistary
 
Arduino Teaching Program
Arduino Teaching ProgramArduino Teaching Program
Arduino Teaching ProgramMax Kleiner
 
Developing an avr microcontroller system
Developing an avr microcontroller systemDeveloping an avr microcontroller system
Developing an avr microcontroller systemnugnugmacmac
 
SIMPLE Frequency METER using AT89c51
SIMPLE Frequency METER using AT89c51 SIMPLE Frequency METER using AT89c51
SIMPLE Frequency METER using AT89c51 aroosa khan
 
Rodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementationRodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementationFelipe Prado
 
please use only these Part 1 Organize the code 85 Fo.pdf
please use only these   Part 1 Organize the code 85  Fo.pdfplease use only these   Part 1 Organize the code 85  Fo.pdf
please use only these Part 1 Organize the code 85 Fo.pdfableelectronics
 

Ähnlich wie Est 8 1 st (20)

Alp lcd
Alp lcdAlp lcd
Alp lcd
 
Moving message display
Moving message displayMoving message display
Moving message display
 
Lcd module interface with xilinx software using verilog
Lcd module interface with xilinx software using verilogLcd module interface with xilinx software using verilog
Lcd module interface with xilinx software using verilog
 
Est 8 2 nd
Est 8 2 ndEst 8 2 nd
Est 8 2 nd
 
Lab Activity 3
Lab Activity 3Lab Activity 3
Lab Activity 3
 
LCD_Example.pptx
LCD_Example.pptxLCD_Example.pptx
LCD_Example.pptx
 
131080111003 mci
131080111003 mci131080111003 mci
131080111003 mci
 
4 bit lcd_interfacing_with_arm7_primer
4 bit lcd_interfacing_with_arm7_primer4 bit lcd_interfacing_with_arm7_primer
4 bit lcd_interfacing_with_arm7_primer
 
4 bit lcd_interfacing_with_arm7_primer
4 bit lcd_interfacing_with_arm7_primer4 bit lcd_interfacing_with_arm7_primer
4 bit lcd_interfacing_with_arm7_primer
 
Arduino Teaching Program
Arduino Teaching ProgramArduino Teaching Program
Arduino Teaching Program
 
Developing an avr microcontroller system
Developing an avr microcontroller systemDeveloping an avr microcontroller system
Developing an avr microcontroller system
 
SIMPLE Frequency METER using AT89c51
SIMPLE Frequency METER using AT89c51 SIMPLE Frequency METER using AT89c51
SIMPLE Frequency METER using AT89c51
 
Led flash
Led flashLed flash
Led flash
 
Howto curses
Howto cursesHowto curses
Howto curses
 
Arduino: Arduino lcd
Arduino: Arduino lcdArduino: Arduino lcd
Arduino: Arduino lcd
 
Rodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementationRodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementation
 
please use only these Part 1 Organize the code 85 Fo.pdf
please use only these   Part 1 Organize the code 85  Fo.pdfplease use only these   Part 1 Organize the code 85  Fo.pdf
please use only these Part 1 Organize the code 85 Fo.pdf
 
_LCD display-mbed.pdf
_LCD display-mbed.pdf_LCD display-mbed.pdf
_LCD display-mbed.pdf
 
7 seg
7 seg7 seg
7 seg
 
Lcd & keypad
Lcd & keypadLcd & keypad
Lcd & keypad
 

Mehr von Akshay Sharma

Eye monitored wheel chair control for people suffering from quadriplegia
Eye monitored wheel chair control for people suffering from quadriplegiaEye monitored wheel chair control for people suffering from quadriplegia
Eye monitored wheel chair control for people suffering from quadriplegiaAkshay Sharma
 
The next generation classroom smart, interactive and connected learning envir...
The next generation classroom smart, interactive and connected learning envir...The next generation classroom smart, interactive and connected learning envir...
The next generation classroom smart, interactive and connected learning envir...Akshay Sharma
 
Over voltage protector circuit
Over voltage protector circuitOver voltage protector circuit
Over voltage protector circuitAkshay 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 (13)

Eye monitored wheel chair control for people suffering from quadriplegia
Eye monitored wheel chair control for people suffering from quadriplegiaEye monitored wheel chair control for people suffering from quadriplegia
Eye monitored wheel chair control for people suffering from quadriplegia
 
The buzzer glove
The buzzer gloveThe buzzer glove
The buzzer glove
 
The next generation classroom smart, interactive and connected learning envir...
The next generation classroom smart, interactive and connected learning envir...The next generation classroom smart, interactive and connected learning envir...
The next generation classroom smart, interactive and connected learning envir...
 
Over voltage protector circuit
Over voltage protector circuitOver voltage protector circuit
Over voltage protector circuit
 
Haptic technology
Haptic technologyHaptic technology
Haptic technology
 
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 6
Est 6Est 6
Est 6
 
Est 1
Est 1Est 1
Est 1
 

Kürzlich hochgeladen

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
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
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 

Kürzlich hochgeladen (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
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
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 

Est 8 1 st

  • 1. EMBEDDED SYSTEMS TUTORIAL8 - INTERFACING 16X2 ALPHANUMERIC LCD WITH AVR PART 1 Hi..!! friends this time I am here with a very very useful tutorial for embedded system beginners, this time we are going to learn how to interface a LCD module, after learning LCD interfacing you will be able to make so many important project related to LCD display….so lets start….!! THING WE NEED TO START For learning LCD interfacing we must have a 16X2 alphanumeric LCD display, of course our USBasp programmer and ATmega 16. For interfacing LCD we must have LCD library, u can found so many libraries on net but Mr. Peter Fluery’s library is most trusted and most widely used one , THNX to him you can directly download his library from this linklcd library LCD PIN DISCRIPTION A 16x2 alphanumeric LCD contains 16 pins and description of these pins is given below 1 VSS (GND ) 2 VCC (+5V) 3 VEE ( adjust contrast) 4 RS 5 R/W 6 E 7 DB0 8 DB1 9 DB2 10 DB3 11 DB4 12 DB5
  • 2. 13 DB6 14 DB7 15 LED+ (+5V) 16 LED- (GND) In this tutorial we are using our LCD in 4bit mode so we will use DB4-DB7(PIN 11-14 of LCD) as DATA pins. USING LIBRARIES The LCD library which u will download will contain mainly two files lcd.c and lcd.h, by changing the PORT in lcd.h you can change the port of LCD connection, by default it is set to PORTA. You can also change pins of LCD connection from same file for this purpose you have to open lcd.h with notepad , then change PORT/PINS according to your choice and then save it. For adding library support in your program you have to paste lcd.c and lcd.h in the same folder where your .c file of program is contained. And these libraries can be added to the program by including these header file in starting of program#include”lcd.c” #include”lc.h” COMMANDS USED In lcd.h file you can get information about the commands which we have to use in our program , I am discussing some of them here but you can check the library to get knowledge about all the useful command Initializing the LCD To initialize the LCD in program we have to this command is used lcd_init(LCD_DISP_ON); To move cursor at a specific position lcd_gotoxy(x,y); here x and y are the co-ordinates of desired location. To clear the display lcd_clrscr(); To set cursor to home position lcd_home(); To display any text string lcd_puts("desired text string"); in addition to these commands there are many more command but for starting interfacing these commands are sufficient and we will discuss other commands later. SAMPLE CODE
  • 3. Here is a simple sample code to start with this time we are going to display a simple text on string on the LCD . #include <stdlib.h> #include <avr/io.h> #include <avr/pgmspace.h> #include<util/delay.h> #include "lcd.h" #include "lcd.c" int main(void) { while(1) { lcd_init(LCD_DISP_ON); lcd_gotoxy(2,0); lcd_puts("TECH_STRONG"); _delay_ms(500); lcd_clrscr(); lcd_gotoxy(1,0); lcd_puts("LCD INTERFACING"); lcd_gotoxy(2,1); lcd_puts("BY ABHILASH"); _delay_ms(500); lcd_clrscr(); } } CIRCUIT DIAGRAM FOR CONNECTIONS So that’s it now just make a simple circuit as shown below. // Initialize LCD // setting cursor to (2,0) // to display text // wait for some time // clear display //setting cursor to (1,0) // to display text //setting cursor to (1,0) // to display text // wait for some time // clear display
  • 4. The contrast of LCD can be adjusted by using the variable resistance used here. Now compile the program and burn your MCU with corresponding hex file and our first LCD interfacing project is ready……now you can display any thing on the LCD …..yes I know you are going to display your name first…..:p I hope this article was useful for guys in case of any query, doubt or critical view just leave a comment. In next LCD interfacing tutorial we will discuss about rotating a text , displaying integers and some basic LCD projects……..till then bye….enjoy your LCD……!!