Lesson 18 LCD Display
Lesson 18 LCD Display
Introduction
In this lesson, you will learn how to connect an LCD Display to Arduino UNO
R3 and display what we type.
In addition, with the Potentiometer we can control the brightness of the screen.
Hardware Required
1 * RexQualis UNO R3
1 * LCD1602 module
1 * Potentiometer (10k)
1 * Breadboard
Principle
LCD1602
The lcd display has 16 pins and the first one from left to right is the Ground pin.
The second pin is the VCC which we connect the 5 volts pin on the Arduino
Board. Next is the Vo pin on which we can attach a potentiometer for
controlling the contrast of the display.
Next, The RS pin or register select pin is used for selecting whether we will
send commands or data to the LCD. For example if the RS pin is set on low
state or zero volts, then we are sending commands to the LCD like: set the
cursor to a specific location, clear the display, turn off the display and so on.
And when RS pin is set on High state or 5 volts we are sending data or
characters to the LCD.
Code interpretation
//LCD A pin to 5V
int DI = 12;
int RW = 11;
int Enable = 2;
int i = 0;
value >>= 1;
digitalWrite(Enable,LOW);
delayMicroseconds(1);
digitalWrite(Enable,HIGH);
delayMicroseconds(1);
digitalWrite(Enable,LOW);
delayMicroseconds(1);
int i = 0;
digitalWrite(DI, HIGH);
digitalWrite(RW, LOW);
value >>= 1;
digitalWrite(Enable,LOW);
delayMicroseconds(1);
digitalWrite(Enable,HIGH);
delayMicroseconds(1);
digitalWrite(Enable,LOW);
delayMicroseconds(1);
int i = 0;
for (i=Enable; i <= DI; i++) {
pinMode(i,OUTPUT);
delay(100);
delay(64);
delay(50);
delay(20);
delay(20);
delay(20);
delay(100);
LcdCommandWrite(0x80); // display setting
delay(20);
delay(10);
LcdCommandWrite(0x80+3);
delay(10);
// Write information
LcdDataWrite('W');
LcdDataWrite('e');
LcdDataWrite('l');
LcdDataWrite('c');
LcdDataWrite('o');
LcdDataWrite('m');
LcdDataWrite('e');
LcdDataWrite(' ');
LcdDataWrite('t');
LcdDataWrite('o');
delay(10);
delay(10);
LcdDataWrite('R');
LcdDataWrite('e');
LcdDataWrite('x');
LcdDataWrite('q');
LcdDataWrite('u');
LcdDataWrite('a');
LcdDataWrite('l');
LcdDataWrite('i');
LcdDataWrite('s');
delay(5000);
delay(10);
delay(10);
LcdDataWrite('M');
LcdDataWrite('a');
LcdDataWrite('k');
LcdDataWrite('e');
LcdDataWrite(' ');
LcdDataWrite('S');
LcdDataWrite('c');
LcdDataWrite('i');
LcdDataWrite('e');
LcdDataWrite('n');
LcdDataWrite('c');
LcdDataWrite('e');
delay(10);
delay(10);
LcdDataWrite('F');
LcdDataWrite('u');
LcdDataWrite('n');
delay(5000);
delay(10);
delay(10);
LcdDataWrite('M');
LcdDataWrite('a');
LcdDataWrite('k');
LcdDataWrite('e');
LcdDataWrite(' ');
LcdDataWrite('S');
LcdDataWrite('c');
LcdDataWrite('i');
LcdDataWrite('e');
LcdDataWrite('n');
LcdDataWrite('c');
LcdDataWrite('e');
delay(10);
delay(10);
LcdDataWrite('P');
LcdDataWrite('o');
LcdDataWrite('p');
LcdDataWrite('u');
LcdDataWrite('l');
LcdDataWrite('a');
LcdDataWrite('r');
delay(5000);
}
Experimental Procedures
Then, you can see on the LCD Display that we have just
entered the text "Welcome to, Rexqualis……",and you can
adjust the brightness of the screen with the Potentiometer.