SlideShare a Scribd company logo
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

ODP
D Flip Flop
PDF
8051 interfacing
PPT
Interrupts for PIC18
PPT
Architecture of 8086 Microprocessor
PPTX
Data flow model -Lecture-4
PPT
8085 microproceesor ppt
PDF
8051 assembly programming
PPTX
I/O port programming in 8051
D Flip Flop
8051 interfacing
Interrupts for PIC18
Architecture of 8086 Microprocessor
Data flow model -Lecture-4
8085 microproceesor ppt
8051 assembly programming
I/O port programming in 8051

What's hot (20)

PPTX
melay and moore machine.pptx
PDF
Msp430 assembly language instructions &amp;addressing modes
PDF
Chapter 7 8051 programming in c
PPTX
Analog to Digital Converters
PPS
Arduino Uno Pin Description
PDF
Minimum and Maximum Modes of microprocessor 8086
PPTX
8051 Microcontroller
PDF
verilog code for logic gates
PPTX
Bcd to 7 segment display
PDF
Introduction to pic microcontroller
PPTX
Instruction set of 8086
PPT
Multiplexers & Demultiplexers
PPTX
Buck boost converter
PPT
Demultiplexing of buses of 8085 microprocessor
PPT
PIC Microcontrollers.ppt
PPTX
PPT on 8085 Microprocessor
PPT
8086 pin details
PPT
Chapter 16 timers and counters
PDF
Architecture of 8085
PPTX
gate level modeling
melay and moore machine.pptx
Msp430 assembly language instructions &amp;addressing modes
Chapter 7 8051 programming in c
Analog to Digital Converters
Arduino Uno Pin Description
Minimum and Maximum Modes of microprocessor 8086
8051 Microcontroller
verilog code for logic gates
Bcd to 7 segment display
Introduction to pic microcontroller
Instruction set of 8086
Multiplexers & Demultiplexers
Buck boost converter
Demultiplexing of buses of 8085 microprocessor
PIC Microcontrollers.ppt
PPT on 8085 Microprocessor
8086 pin details
Chapter 16 timers and counters
Architecture of 8085
gate level modeling
Ad

Viewers also liked (17)

PPTX
Lcd with arduino uno
PPTX
Arduino uno lcd display 16x2
PPTX
Interfacing with Arduino
PPTX
LCD Theory and Working Principles
ODP
FPGA Tutorial - LCD Interface
PPTX
Getting Started with Raspberry Pi and Arduino
PPT
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNO
PPTX
Digital Notice Board
DOCX
Arduino lcd display
PPTX
Smart LED Notice Board
DOCX
Design Development of Water Monitoring Systems by Using Arduino and Sensors
PDF
Project report on gsm based digital notice board
PPTX
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
PPTX
Soil Moisture Sensor and Arduino
PDF
Arduino uno
PPTX
Introduction to arduino
PPT
Lcd with arduino uno
Arduino uno lcd display 16x2
Interfacing with Arduino
LCD Theory and Working Principles
FPGA Tutorial - LCD Interface
Getting Started with Raspberry Pi and Arduino
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNO
Digital Notice Board
Arduino lcd display
Smart LED Notice Board
Design Development of Water Monitoring Systems by Using Arduino and Sensors
Project report on gsm based digital notice board
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
Soil Moisture Sensor and Arduino
Arduino uno
Introduction to arduino
Ad

Similar to Interfacing to lcd with arduino (20)

DOCX
Direct analog
PDF
Arduino: Intro and Digital I/O
TXT
PIC and LCD
PPTX
R tist
DOCX
7segment scetch
PPT
Intro2 Robotic With Pic18
PPTX
Temperature sensor with a led matrix display (arduino controlled)
PPTX
Magnetic door lock using arduino
DOCX
PDF
Introduction to Arduino and Circuits
PDF
Combine the keypad and LCD codes in compliance to the following requ.pdf
PDF
硕士答辩Keynote
PPTX
Basic of Firmware & Embedded Software Programming in C
PPTX
LED Cube Presentation Slides
PDF
Programming arduino makeymakey
PDF
Arduino Workshop 2011.05.31
PPTX
texto.pptx
PPTX
Vechicle accident prevention using eye bilnk sensor ppt
PDF
From Arduino to LinnStrument
DOCX
Lampiran 1.programdocx
Direct analog
Arduino: Intro and Digital I/O
PIC and LCD
R tist
7segment scetch
Intro2 Robotic With Pic18
Temperature sensor with a led matrix display (arduino controlled)
Magnetic door lock using arduino
Introduction to Arduino and Circuits
Combine the keypad and LCD codes in compliance to the following requ.pdf
硕士答辩Keynote
Basic of Firmware & Embedded Software Programming in C
LED Cube Presentation Slides
Programming arduino makeymakey
Arduino Workshop 2011.05.31
texto.pptx
Vechicle accident prevention using eye bilnk sensor ppt
From Arduino to LinnStrument
Lampiran 1.programdocx

More from Politeknik Elektronika Negeri Surabaya (7)

ODP
Fpga creating counter with internal clock
ODP
Fpga creating counter with external clock

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(); }