Liquid Crystal Display Vs Virtual Terminals
Liquid Crystal Display Vs Virtual Terminals
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
• 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
}
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.