SlideShare a Scribd company logo
1 of 13
Interfacing to LCD 16x2

By hendri@eepis-its.edu
You are free:
to Share — to copy, distribute and transmit the work
Under the following conditions:
Attribution — You must attribute the work in the manner specified by the author
or licensor (but not in any way that suggests that they endorse you or your use
of the work).
Noncommercial — You may not use this work for commercial purposes.
No Derivative Works — You may not alter, transform, or build upon this work.
Block Diagram
Pin Connection
Timing Diagram
Timing Diagram
LCD Command
LCD Command
Initialize Procedure
Arduino way

#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, EN, D4, D5, D6, D7);
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("H");
}

void loop() {
}
Arduino From Scratch
int RS   = 8;                                          delay(5); //delay 4.1ms
int En   = 9;
int D4   = 4;                                          //function set 1
int D5   = 5;                                          digitalWrite(RS,LOW);
int D6   =6;                                           digitalWrite(D7,LOW);
int D7   =7 ;                                          digitalWrite(D6,LOW);
                                                       digitalWrite(D5,HIGH);
void enable()                                          digitalWrite(D4,HIGH);
{                                                      enable();
  digitalWrite(En,LOW);
  delay(1);                                            delayMicroseconds(100);
  digitalWrite(En,HIGH);
  delay(1);                                            //function set 1
  digitalWrite(En,LOW);                                digitalWrite(RS,LOW);
}                                                      digitalWrite(D7,LOW);
// the setup routine runs once when you press reset:   digitalWrite(D6,LOW);
void setup() {                                         digitalWrite(D5,HIGH);
  // initialize the digital pin as an output.          digitalWrite(D4,HIGH);
  pinMode(RS, OUTPUT);                                 enable();
  pinMode(En, OUTPUT);
  pinMode(D4, OUTPUT);                                 //bf can be check after following instruction
  pinMode(D5, OUTPUT);                                 digitalWrite(RS,LOW);
  pinMode(D6, OUTPUT);                                 digitalWrite(D7,LOW);
  pinMode(D7, OUTPUT);                                 digitalWrite(D6,LOW);
                                                       digitalWrite(D5,HIGH);
 delay(15);                                            digitalWrite(D4,LOW);
                                                       enable();
 //function set 1
 digitalWrite(RS,LOW);
 digitalWrite(D7,LOW);
 digitalWrite(D6,LOW);
 digitalWrite(D5,HIGH);
 digitalWrite(D4,HIGH);
 enable();
Arduino From Cont


//function set 4 bit               //display clear
 digitalWrite(RS,LOW);               digitalWrite(RS,LOW);
 digitalWrite(D7,LOW);               digitalWrite(D7,LOW);
 digitalWrite(D6,LOW);               digitalWrite(D6,LOW);
 digitalWrite(D5,HIGH);              digitalWrite(D5,LOW);
 digitalWrite(D4,LOW);               digitalWrite(D4,LOW);
 enable();                           enable();
 digitalWrite(RS,LOW);               digitalWrite(RS,LOW);
 digitalWrite(D7,HIGH);              digitalWrite(D7,LOW);
 enable();                           digitalWrite(D6,LOW);
                                     digitalWrite(D5,LOW);
//display off                        digitalWrite(D4,HIGH);
digitalWrite(RS,LOW);                enable();
digitalWrite(D7,LOW);
digitalWrite(D6,LOW);               //entry mode set
digitalWrite(D5,LOW);               digitalWrite(RS,LOW);
digitalWrite(D4,LOW);               digitalWrite(D7,LOW);
enable();                           digitalWrite(D6,LOW);
digitalWrite(RS,LOW);               digitalWrite(D5,LOW);
digitalWrite(D7,HIGH);              digitalWrite(D4,LOW);
digitalWrite(D6,LOW);               enable();
digitalWrite(D5,LOW);               digitalWrite(RS,LOW);
digitalWrite(D4,LOW);               digitalWrite(D7,LOW);
enable();                           digitalWrite(D6,LOW);
                                    digitalWrite(D5,HIGH);
                                    digitalWrite(D4,HIGH);
                                    enable();
                                    // init done
Arduino From Cont

// display on                         // the loop routine runs over and over again forever:
 digitalWrite(RS,LOW);                void loop() {
 digitalWrite(D7,LOW);                 }
 digitalWrite(D6,LOW);
 digitalWrite(D5,LOW);
 digitalWrite(D4,LOW);
 enable();
 digitalWrite(RS,LOW);
 digitalWrite(D7,HIGH);
 digitalWrite(D6,HIGH);
 digitalWrite(D5,HIGH);
 digitalWrite(D4,LOW);
 enable();

     // display 'H'
    digitalWrite(RS,HIGH);
    digitalWrite(D7,LOW);
    digitalWrite(D6,HIGH);
    digitalWrite(D5,LOW);
    digitalWrite(D4,LOW);
    enable();
    digitalWrite(RS,HIGH);
    digitalWrite(D7,HIGH);
    digitalWrite(D6,LOW);
    digitalWrite(D5,LOW);
    digitalWrite(D4,LOW);
    enable();
}

More Related Content

What's hot

Introduction to arduino ppt main
Introduction to  arduino ppt mainIntroduction to  arduino ppt main
Introduction to arduino ppt main
eddy royappa
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
Wingston
 
8096 microcontrollers notes
8096 microcontrollers notes8096 microcontrollers notes
8096 microcontrollers notes
Dr.YNM
 
Anti drowsy alarm for drivers
Anti drowsy alarm for driversAnti drowsy alarm for drivers
Anti drowsy alarm for drivers
Duc Nguyen Van
 

What's hot (20)

8051 MICROCONTROLLER
8051 MICROCONTROLLER 8051 MICROCONTROLLER
8051 MICROCONTROLLER
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
 
Introduction to arduino ppt main
Introduction to  arduino ppt mainIntroduction to  arduino ppt main
Introduction to arduino ppt main
 
Arduino uno lcd display 16x2
Arduino uno lcd display 16x2Arduino uno lcd display 16x2
Arduino uno lcd display 16x2
 
8251 USART
8251 USART8251 USART
8251 USART
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
 
Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu
 
Fire detection system using arduino
Fire detection system using arduino Fire detection system using arduino
Fire detection system using arduino
 
Programmable peripheral interface 8255
Programmable peripheral interface 8255Programmable peripheral interface 8255
Programmable peripheral interface 8255
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
 8051 MICROCONTROLLER ARCHITECTURE.pptx 8051 MICROCONTROLLER ARCHITECTURE.pptx
8051 MICROCONTROLLER ARCHITECTURE.pptx
 
Ardui no
Ardui no Ardui no
Ardui no
 
8051 interfacing
8051 interfacing8051 interfacing
8051 interfacing
 
PIC Microcontrollers
PIC MicrocontrollersPIC Microcontrollers
PIC Microcontrollers
 
INTRODUCTION TO MICROCONTROLLER
INTRODUCTION TO MICROCONTROLLERINTRODUCTION TO MICROCONTROLLER
INTRODUCTION TO MICROCONTROLLER
 
Seven Segment Display
Seven Segment DisplaySeven Segment Display
Seven Segment Display
 
8096 microcontrollers notes
8096 microcontrollers notes8096 microcontrollers notes
8096 microcontrollers notes
 
Anti drowsy alarm for drivers
Anti drowsy alarm for driversAnti drowsy alarm for drivers
Anti drowsy alarm for drivers
 
Msp430 assembly language instructions &amp;addressing modes
Msp430 assembly language instructions &amp;addressing modesMsp430 assembly language instructions &amp;addressing modes
Msp430 assembly language instructions &amp;addressing modes
 
RTC Interfacing and Programming
RTC Interfacing and ProgrammingRTC Interfacing and Programming
RTC Interfacing and Programming
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
 

Viewers also liked

Digital Notice Board
Digital Notice BoardDigital Notice Board
Digital Notice Board
Raaki Gadde
 
Smart LED Notice Board
Smart LED Notice BoardSmart LED Notice Board
Smart LED Notice Board
swarnimmaurya
 
Project report on gsm based digital notice board
Project report on gsm based digital notice boardProject report on gsm based digital notice board
Project report on gsm based digital notice board
manish katara
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
Ahmed Sakr
 

Viewers also liked (16)

Lcd with arduino uno
Lcd with arduino unoLcd with arduino uno
Lcd with arduino uno
 
Interfacing with Arduino
Interfacing with ArduinoInterfacing with Arduino
Interfacing with Arduino
 
LCD Theory and Working Principles
LCD Theory and Working PrinciplesLCD Theory and Working Principles
LCD Theory and Working Principles
 
FPGA Tutorial - LCD Interface
FPGA Tutorial - LCD InterfaceFPGA Tutorial - LCD Interface
FPGA Tutorial - LCD Interface
 
Getting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and ArduinoGetting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and Arduino
 
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNO
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNOWATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNO
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNO
 
Digital Notice Board
Digital Notice BoardDigital Notice Board
Digital Notice Board
 
Arduino lcd display
Arduino lcd displayArduino lcd display
Arduino lcd display
 
Smart LED Notice Board
Smart LED Notice BoardSmart LED Notice Board
Smart LED Notice Board
 
Design Development of Water Monitoring Systems by Using Arduino and Sensors
Design Development of Water Monitoring Systems by Using Arduino and SensorsDesign Development of Water Monitoring Systems by Using Arduino and Sensors
Design Development of Water Monitoring Systems by Using Arduino and Sensors
 
Project report on gsm based digital notice board
Project report on gsm based digital notice boardProject report on gsm based digital notice board
Project report on gsm based digital notice board
 
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
 
Soil Moisture Sensor and Arduino
Soil Moisture Sensor and Arduino Soil Moisture Sensor and Arduino
Soil Moisture Sensor and Arduino
 
Arduino uno
Arduino unoArduino uno
Arduino uno
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
Android ppt
Android ppt Android ppt
Android ppt
 

Similar to Interfacing to lcd with arduino

robotics presentation for a club you run
robotics presentation for a club you runrobotics presentation for a club you run
robotics presentation for a club you run
SunilAcharya37
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
tutorialsruby
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
tutorialsruby
 

Similar to Interfacing to lcd with arduino (20)

Praktek ARDUINO
Praktek ARDUINOPraktek ARDUINO
Praktek ARDUINO
 
Day1
Day1Day1
Day1
 
Arduino: Intro and Digital I/O
Arduino: Intro and Digital I/OArduino: Intro and Digital I/O
Arduino: Intro and Digital I/O
 
PIC and LCD
PIC and LCDPIC and LCD
PIC and LCD
 
P-Space Arduino/Genuino day 2016
P-Space Arduino/Genuino day 2016P-Space Arduino/Genuino day 2016
P-Space Arduino/Genuino day 2016
 
Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016
 
Arduino and Robotics
Arduino and RoboticsArduino and Robotics
Arduino and Robotics
 
Arduino: Arduino lcd
Arduino: Arduino lcdArduino: Arduino lcd
Arduino: Arduino lcd
 
Powerful Electronics with Arduino
Powerful Electronics with ArduinoPowerful Electronics with Arduino
Powerful Electronics with Arduino
 
05-Debug.pdf
05-Debug.pdf05-Debug.pdf
05-Debug.pdf
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
FINISHED_CODE
FINISHED_CODEFINISHED_CODE
FINISHED_CODE
 
robotics presentation for a club you run
robotics presentation for a club you runrobotics presentation for a club you run
robotics presentation for a club you run
 
Videogiochi in PHP 👾
Videogiochi in PHP 👾Videogiochi in PHP 👾
Videogiochi in PHP 👾
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
arduinoedit.pptx
arduinoedit.pptxarduinoedit.pptx
arduinoedit.pptx
 
coding and wiring dht11 and ultrasonic hcsr04 arduino
coding and wiring dht11 and ultrasonic hcsr04 arduino coding and wiring dht11 and ultrasonic hcsr04 arduino
coding and wiring dht11 and ultrasonic hcsr04 arduino
 
Intro to OpenGL ES 2.0
Intro to OpenGL ES 2.0Intro to OpenGL ES 2.0
Intro to OpenGL ES 2.0
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 

More from Politeknik Elektronika Negeri Surabaya (7)

Memulai AVR WINAVR
Memulai AVR WINAVRMemulai AVR WINAVR
Memulai AVR WINAVR
 
Fpga creating counter with internal clock
Fpga   creating counter with internal clockFpga   creating counter with internal clock
Fpga creating counter with internal clock
 
Fpga creating counter with external clock
Fpga   creating counter with external clockFpga   creating counter with external clock
Fpga creating counter with external clock
 
Modul2 setting xctu
Modul2 setting xctuModul2 setting xctu
Modul2 setting xctu
 
My Linux
My LinuxMy Linux
My Linux
 
Embedded lcd
Embedded lcdEmbedded lcd
Embedded lcd
 
winavr tutorial
winavr tutorial winavr tutorial
winavr tutorial
 

Interfacing to lcd with arduino

  • 1. Interfacing to LCD 16x2 By hendri@eepis-its.edu
  • 2. You are free: to Share — to copy, distribute and transmit the work Under the following conditions: Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial — You may not use this work for commercial purposes. No Derivative Works — You may not alter, transform, or build upon this work.
  • 10. Arduino way #include <LiquidCrystal.h> //LiquidCrystal lcd(RS, EN, D4, D5, D6, D7); LiquidCrystal lcd(8, 9, 4, 5, 6, 7); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("H"); } void loop() { }
  • 11. Arduino From Scratch int RS = 8; delay(5); //delay 4.1ms int En = 9; int D4 = 4; //function set 1 int D5 = 5; digitalWrite(RS,LOW); int D6 =6; digitalWrite(D7,LOW); int D7 =7 ; digitalWrite(D6,LOW); digitalWrite(D5,HIGH); void enable() digitalWrite(D4,HIGH); { enable(); digitalWrite(En,LOW); delay(1); delayMicroseconds(100); digitalWrite(En,HIGH); delay(1); //function set 1 digitalWrite(En,LOW); digitalWrite(RS,LOW); } digitalWrite(D7,LOW); // the setup routine runs once when you press reset: digitalWrite(D6,LOW); void setup() { digitalWrite(D5,HIGH); // initialize the digital pin as an output. digitalWrite(D4,HIGH); pinMode(RS, OUTPUT); enable(); pinMode(En, OUTPUT); pinMode(D4, OUTPUT); //bf can be check after following instruction pinMode(D5, OUTPUT); digitalWrite(RS,LOW); pinMode(D6, OUTPUT); digitalWrite(D7,LOW); pinMode(D7, OUTPUT); digitalWrite(D6,LOW); digitalWrite(D5,HIGH); delay(15); digitalWrite(D4,LOW); enable(); //function set 1 digitalWrite(RS,LOW); digitalWrite(D7,LOW); digitalWrite(D6,LOW); digitalWrite(D5,HIGH); digitalWrite(D4,HIGH); enable();
  • 12. Arduino From Cont //function set 4 bit //display clear digitalWrite(RS,LOW); digitalWrite(RS,LOW); digitalWrite(D7,LOW); digitalWrite(D7,LOW); digitalWrite(D6,LOW); digitalWrite(D6,LOW); digitalWrite(D5,HIGH); digitalWrite(D5,LOW); digitalWrite(D4,LOW); digitalWrite(D4,LOW); enable(); enable(); digitalWrite(RS,LOW); digitalWrite(RS,LOW); digitalWrite(D7,HIGH); digitalWrite(D7,LOW); enable(); digitalWrite(D6,LOW); digitalWrite(D5,LOW); //display off digitalWrite(D4,HIGH); digitalWrite(RS,LOW); enable(); digitalWrite(D7,LOW); digitalWrite(D6,LOW); //entry mode set digitalWrite(D5,LOW); digitalWrite(RS,LOW); digitalWrite(D4,LOW); digitalWrite(D7,LOW); enable(); digitalWrite(D6,LOW); digitalWrite(RS,LOW); digitalWrite(D5,LOW); digitalWrite(D7,HIGH); digitalWrite(D4,LOW); digitalWrite(D6,LOW); enable(); digitalWrite(D5,LOW); digitalWrite(RS,LOW); digitalWrite(D4,LOW); digitalWrite(D7,LOW); enable(); digitalWrite(D6,LOW); digitalWrite(D5,HIGH); digitalWrite(D4,HIGH); enable(); // init done
  • 13. Arduino From Cont // display on // the loop routine runs over and over again forever: digitalWrite(RS,LOW); void loop() { digitalWrite(D7,LOW); } digitalWrite(D6,LOW); digitalWrite(D5,LOW); digitalWrite(D4,LOW); enable(); digitalWrite(RS,LOW); digitalWrite(D7,HIGH); digitalWrite(D6,HIGH); digitalWrite(D5,HIGH); digitalWrite(D4,LOW); enable(); // display 'H' digitalWrite(RS,HIGH); digitalWrite(D7,LOW); digitalWrite(D6,HIGH); digitalWrite(D5,LOW); digitalWrite(D4,LOW); enable(); digitalWrite(RS,HIGH); digitalWrite(D7,HIGH); digitalWrite(D6,LOW); digitalWrite(D5,LOW); digitalWrite(D4,LOW); enable(); }