| ||
|
Shopping Cart
|
| Home | MP3 Player | 8051 Tools | All Projects | PJRC Store | Site Map |
|
You are here:
Teensy
| Search PJRC |
|
|
LiquidCrystal LibraryLiquidCrystal lets you use small character type displays. Characters and a limited set of custom symbols can be used.
LiquidCrystal & LiquidCrystalFast work with Teensy and Teensy++, and all Arduino boards. Hardware Requirements
Slow ConnectionOnly 6 signal are required, RS, Enable, D4, D5, D6 and D7. The R/W pin must be connected to ground. Pins D0, D1, D2 and D3 are left unconnected.Fast ConnectionLiquidCrystalFast can use the R/W pin for faster access. Either way can update the display faster than a human eye can detect, but if your project needs to do other work, less time updating the display may be worth using a seventh pin.Large 4x40 ConnectionLiquidCrystalFast can also access large 4x40 displays, which have two enable pins.
Basic UsageLiquidCrystal lcd(RS, Enable, D4, D5, D6, D7)Create the LiquidCrystal object and specify the 6 pins where the LCD is connected. You can connect more than one display (each to its own pins) and create a separate LiquidCrystal objects for each. lcd.begin(width, height);Initialize the display and set the size. lcd.print(anything);Print a number or text. This works the same as Serial.print(), but prints to the LCD. lcd.setCursor(x, y);Move the cursor to position (x, y). These are zero-based coordinates. LiquidCrystalFast lcd(RS, RW, Enable, D4, D5, D6, D7)Create the LiquidCrystalFast object, using 7 pins. LiquidCrystalFast lcd(RS, RW, Enable1, Enable2, D4, D5, D6, D7)Create the LiquidCrystalFast object for large 40x4 display, using 8 pins. Many other functions are available. See below for links to more details.Example ProgramThis example can be loaded with File > Examples > LiquidCrystal > HelloWorld.// include the library code: #include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD's number of rows and columns: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("hello, world!"); } void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(millis()/1000); } DetailsFor more details, please refer to the official LiquidCrystal page.LiquidCrystalFast was written by John Raines in 2010. The Arduino developers had planned to include it into Arduino 0019, but appear to have abandoned plans to use John's improvements. Custom Character Creator by Druno Maia LiquidCrystal can use 8 all data pins. However, careful benchmarking with found little speed advantage. With R/W used by LiquidCrystalFast (which does offer nearly a 4X speedup with most LCDs), 8 pins is actually slower due to the Arduino pin number conversion done to switch the extra 4 pins from input to output. LiquidCrystal offers an option to use the R/W pin, but internally the code never makes use of that pin. If merely drives that pin low. If you want the R/W speedup, only LiquidCrystalFast actually makes use of the R/W pin. | |||||||||||||||||||||||||||||||||||||||||