SlideShare una empresa de Scribd logo
1 de 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();
}

Más contenido relacionado

La actualidad más candente

Interfacing keypad
Interfacing keypadInterfacing keypad
Interfacing keypad
PRADEEP
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
Ahmed Sakr
 

La actualidad más candente (20)

I/O Ports
I/O Ports I/O Ports
I/O Ports
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Arduino
ArduinoArduino
Arduino
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
Arduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoArduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic Arduino
 
PPT ON Arduino
PPT ON Arduino PPT ON Arduino
PPT ON Arduino
 
Fpga architectures and applications
Fpga architectures and applicationsFpga architectures and applications
Fpga architectures and applications
 
Heart rate monitoring system using arduino
Heart rate monitoring system using  arduinoHeart rate monitoring system using  arduino
Heart rate monitoring system using arduino
 
Introduction to MPLAB IDE
Introduction to MPLAB IDEIntroduction to MPLAB IDE
Introduction to MPLAB IDE
 
Arduino course
Arduino courseArduino course
Arduino course
 
Keypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 MicrocontrollerKeypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 Microcontroller
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
 
8051 MICROCONTROLLER
8051 MICROCONTROLLER 8051 MICROCONTROLLER
8051 MICROCONTROLLER
 
Introduction to pic microcontroller
Introduction to pic microcontrollerIntroduction to pic microcontroller
Introduction to pic microcontroller
 
ARM Processor
ARM ProcessorARM Processor
ARM Processor
 
Interfacing keypad
Interfacing keypadInterfacing keypad
Interfacing keypad
 
Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the Arduino
 
ARM Processor architecture
ARM Processor  architectureARM Processor  architecture
ARM Processor architecture
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
Aurdino presentation
Aurdino presentationAurdino presentation
Aurdino presentation
 

Destacado

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
 

Destacado (16)

Lcd with arduino uno
Lcd with arduino unoLcd with arduino uno
Lcd with arduino uno
 
Arduino uno lcd display 16x2
Arduino uno lcd display 16x2Arduino uno lcd display 16x2
Arduino uno lcd display 16x2
 
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
 
Android ppt
Android ppt Android ppt
Android ppt
 

Similar a 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 a 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
 
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
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 

Más de 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(); }