Difference between revisions of "Liquid crystal display"

From MidsouthMakers - Memphis Area Hackerpace
Jump to navigation Jump to search
Line 20: Line 20:
  
 
=== SerLCD ===
 
=== SerLCD ===
{{expand section}}
+
An example utilizing the SerLCD functions.  This requires the SerLCD functions to be in the same sketch.
 +
 
 +
<source lang="java">
 +
void setup() {
 +
  Serial.begin(9600);
 +
}
 +
 
 +
void loop() {
 +
  // Example usage:
 +
  clearLCD();
 +
  backlightOn();
 +
 
 +
  //Print text on each line
 +
  selectLine(0);
 +
  delay(100);
 +
  Serial.print("Line One");
 +
  delay(500);
 +
  selectLine(1);
 +
  delay(100);
 +
  Serial.print("Line Two");
 +
  delay(500);
 +
  selectLine(2);
 +
  delay(100);
 +
  Serial.print("Line Three");
 +
  delay(500);
 +
  selectLine(3);
 +
  delay(100);
 +
  Serial.print("Line Four");
 +
  delay(500);
 +
 
 +
  //print a character at the end of each line:
 +
  goTo(19);
 +
  delay(100);
 +
  Serial.print("*");
 +
  goTo(39);
 +
  delay(100);
 +
  Serial.print("*");
 +
  goTo(59);
 +
  delay(100);
 +
  Serial.print("*");
 +
  goTo(79);
 +
  delay(100);
 +
  Serial.print("*");
 +
 
 +
  delay(500);
 +
  backlight50();
 +
  delay(500);
 +
  backlightOff();
 +
  delay(500);
 +
}
 +
</source>
  
 
[[Category:Electronic components]]
 
[[Category:Electronic components]]

Revision as of 22:10, 19 January 2010

A parallel input, 16x2 LCD display.

A liquid crystal display (LCD) is a thin, flat panel used for electronically displaying information such as text, images, and moving pictures. Its uses include monitors for computers, televisions, instrument panels, and other devices ranging from aircraft cockpit displays, to every-day consumer devices such as video players, gaming devices, clocks, watches, calculators, and telephones. Among its major features are its lightweight construction, its portability, and its ability to be produced in much larger screen sizes than are practical for the construction of cathode ray tube (CRT) display technology. Its low electrical power consumption enables it to be used in battery-powered electronic equipment. It is an electronically-modulated optical device made up of any number of pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in color or monochrome. The earliest discovery leading to the development of LCD technology, the discovery of liquid crystals, dates from 1888.

See Wikipedia for more details on Liquid crystal display.

Overview

An LCD module is a very versatile and useful component to incorporate into projects. It can allow for an opportunity to view the data that is being handled or a dynamic means to interact with its user. It can be used with an Arduino or connected to a microcontroller needing as little as 4 pins to operate.

Communication

Parallel

  • HD44780 - a standard form of parallel communication used with LCD screens.

Serial

Arduino

The Arduino is capable of communicating with the LCD modules in either serial or parallel. In the event of trying to conserve ports on the Arduino, it is best to look into possible serial communication instead of the standard parallel.

HD44780

For the HD44780 standard, it can handle the 8bit and 4bit mode. Preferably to use fewer ports on your Arduino, the 4bit mode is the better choice. Even though 8bit is faster, the 4bit is quite well fast enough. The Arduino has built in libraries to support the use of the HD44780 or compatible standard at Arudino-LCD.

SerLCD

An example utilizing the SerLCD functions. This requires the SerLCD functions to be in the same sketch.

void setup() {
  Serial.begin(9600);
}

void loop() {
  // Example usage:
  clearLCD();
  backlightOn();
  
  //Print text on each line
  selectLine(0);
  delay(100);
  Serial.print("Line One");
  delay(500);
  selectLine(1);
  delay(100);
  Serial.print("Line Two");
  delay(500);
  selectLine(2);
  delay(100);
  Serial.print("Line Three");
  delay(500);
  selectLine(3);
  delay(100);
  Serial.print("Line Four");
  delay(500);
  
  //print a character at the end of each line:
  goTo(19);
  delay(100);
  Serial.print("*");
  goTo(39);
  delay(100);
  Serial.print("*");
  goTo(59);
  delay(100);
  Serial.print("*");
  goTo(79);
  delay(100);
  Serial.print("*");
  
  delay(500);
  backlight50();
  delay(500);
  backlightOff();
  delay(500);
}