0% found this document useful (0 votes)
13 views16 pages

Liquid Crystal Display Vs Virtual Terminals

Uploaded by

Seyo Kasaye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views16 pages

Liquid Crystal Display Vs Virtual Terminals

Uploaded by

Seyo Kasaye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Liquid Crystal

Display
Using Liquid Crystal Display

• The LiquidCrystal library allows you to control LCD displays that are
compatible with the Hitachi HD44780 driver.
• There are many of them out there, and you can usually tell them by
the 16-pin interface.
• The LCDs have a parallel interface, meaning that the microcontroller
has to manipulate several interface pins at once to control the display.
Using Liquid Crystal Display

• The interface consists of the following pins:


• A register select (RS) pin that controls where in the LCD's memory you're
writing data to. You can select either the data register, which holds what goes
on the screen, or an instruction register, which is where the LCD's controller
looks for instructions on what to do next.
• A Read/Write (R/W) pin that selects reading mode or writing mode
• An Enable pin that enables writing to the registers
• 8 data pins (D0 -D7). The states of these pins (high or low) are the bits that
you're writing to a register when you write, or the values you're reading when
you read.
Using Liquid Crystal Display

• There's also a display contrast pin (Vo), power supply pins (+5V and
GND) and LED Backlight (Bklt+ and BKlt-) pins that you can use to
power the LCD, control the display contrast, and turn on and off the
LED backlight, respectively.
• The process of controlling the display involves putting the data that
form the image of what you want to display into the data registers,
then putting instructions in the instruction register.
Using Liquid Crystal Display

• LCD RS pin to digital pin 12


• LCD Enable pin to digital pin 11
• LCD D4 pin to digital pin 5
• LCD D5 pin to digital pin 4
• LCD D6 pin to digital pin 3
• LCD D7 pin to digital pin 2
• LCD R/W pin to GND
• LCD VSS pin to GND
• LCD VCC pin to 5
Using Liquid Crystal Display

• The Hitachi-compatible LCDs can be controlled in two modes:


• 4-bit or 8-bit. The 4-bit mode requires seven I/O pins from the Arduino, while
the 8-bit mode requires 11 pins.
• For displaying text on the screen, you can do most everything in 4-bit
mode,
• so example shows how to control a 16x2 LCD in 4-bit mode.
• To use we need this library: #include <LiquidCrystal.h>
Using Liquid Crystal Display
Functions
display(): methods to turn on the display.
LiquidCrystal() noDisplay(): methods to off the display.
begin() :Initialize LCD scrollDisplayLeft():methods to reverse the direction the
clear() : Clear the LCD screen text is flowing.
home() :Positions the cursor in the top-left corner of scrollDisplayRight(): methods to reverse the direction the
the LCD. Use clear() if you also want to clear the text is flowing.
display.
setCursor(): method to reposition the cursor. To move autoscroll() :moves all the text one space to the left each
the cursor, just call with a row and column position. time a letter is added
write(): used to write a character to the LCD. noAutoscroll():turns scrolling off
print() :Print a message to the lcd
leftToRight() : causes text to flow to the right from the cursor, as
cursor() :methods to control an underscore-style if the display is left-justified.
cursor.
noCursor() : no underscore style cursor
rightToLeft():causes text to flow to the left from the
cursor, as if the display is right-justified.
blink() :methods to blink a block-style cursor.
noBlink(): method for noblink createChar(): it is possible to create and display custom characters on the
LCD.
Proteus Design for Examples
LiquidCrystal() & begin() &
display() & noDisplay()
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");

}
void loop() {
// Turn off the display:
lcd.noDisplay();
delay(500);
// Turn on the display:
lcd.display();
delay(500);
}
LiquidCrystal() & begin() & leftToRight() &
rightToLeft() & cursor() & write() & home()
#include<LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 =
2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int thisChar = 'a';
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// turn on the cursor:
lcd.cursor();
}
LiquidCrystal() & begin() & leftToRight() &
rightToLeft() & cursor() & write() & home()
void loop() { // reset at 'z':
// reverse directions at 'm': if (thisChar > 'z') {
if (thisChar == 'm') { // go to (0,0):
lcd.home();
// go right for the next letter
// start again at 0
lcd.rightToLeft(); thisChar = 'a';
//lcd.clear(); }
} // print the character
// reverse again at 's': lcd.write(thisChar);
if (thisChar == 's') { // wait a second:
delay(1000);
// go left for the next letter
// increment the letter:
lcd.leftToRight(); thisChar++;
} }
#include <LiquidCrystal.h>
blink() & noBlink()
const int rs = 12, en = 11, d4 = 5, d5 = 4,
d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
// set up the LCD's number of columns and
rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// Turn off the blinking cursor:
lcd.noBlink();
delay(3000);
// Turn on the blinking cursor:
lcd.blink();
delay(3000);
}
Autoscroll() & noAutoscroll()
• #include <LiquidCrystal.h>
• const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
• LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // set the cursor to (16,1):
• void setup() { lcd.setCursor(16, 1);
• // set up the LCD's number of columns and rows: // set the display to automatically
• lcd.begin(16, 2);
scroll:
lcd.autoscroll();
• }
// print from 0 to 9:
• void loop() {
for (int thisChar = 'A'; thisChar<='L';
• // set the cursor to (0,0): thisChar++) {
• lcd.setCursor(0, 0); lcd.write(thisChar);
• // print from 1 to 26: delay(500);
• for (int thisChar = 1; thisChar <=12; thisChar++)
} {
• lcd.print(thisChar); // turn off automatic scrolling
• delay(500); lcd.noAutoscroll();
• }
// clear screen for the next loop:
lcd.clear();
setCursor()
• const int numRows = 2;
• const int numCols = 16;
// scroll 30 positions (string length +
scrollDisplay display length) to the right
// to move it offscreen right:
Right and left lcd.print("From Mesay!");
delay(1000);
for (int positionCounter = 0;
#include <LiquidCrystal.h>
positionCounter < 30; positionCounter++) {
const int rs = 12, en = 11, d4 = 5, d5
lcd.scrollDisplayRight();
= 4, d6 = 3, d7 = 2;
// wait a bit:
LiquidCrystal lcd(rs, en, d4, d5, d6,
delay(150);
d7);
}
void setup() {
// scroll 16 positions (display length +
lcd.begin(16, 2);
string length) to the left
}
// to move it back to center:
void loop() {
lcd.print("Your Lecturer!");
lcd.print("hello, Student!");
delay(1000);
delay(1000);
for (int positionCounter = 0;
for (int positionCounter = 0;
positionCounter < 16; positionCounter++) {
positionCounter < 15; positionCounter+
lcd.scrollDisplayLeft();
+) {
// wait a bit:
lcd.scrollDisplayLeft();
delay(150);
// wait a bit:
}
delay(150);
lcd.clear();
}
delay(1000);}
Class Work for Afternoon(3 mark)
(Team Work and Individual mark)
Check LCD Notice board around new WCU President office and SMART
Rooms
Then Develop Protues Design to Simulate Ardunio Program.

You might also like