lcd breakout manual
DESCRIPTION
LCD breakout manual by Tenet TechnetronicsTRANSCRIPT
2011
Author: Manoj.j
Reviewer: Ram
Revision: 1.3
Tenet Technetronics
1/8/2011
LCD breakout user manual
i
Contents
Introduction
Introduction to LCD breakout
Hardware Overview
LCD breakout features
Components overview
Schematic
Software Overview
Flow Chart
Pseudo code
Code
Demo Application
References and further reading
2
Introduction
This breakout board is designed to simplify the physical connection in interfacing an LCD with an Arduino. The breakout board is compatible for both 16x2 character LCD and graphical LCD. All power and control pins necessary to connect it to the Arduino/Comet board are broken out using long wire-wrap headers which extend through the shield. The breakout can be reset through reset button on top of the breakout. Separate variable potentiometer is provided for both 16x2 character LCD and graphical LCD to control the backlight contrast.
Hardware Overview
Figure1: The LCD breakout
3
LCD breakout features
The breakout supports both Graphical LCD and 16x2 Text LCD.
The LCD breakout shield can be mounted on Arduino/Comet board.
The backlight contrast can be adjusted through potentiometer.
Components overview
Table1: components overview
Components
Brief
specificatio
n
Product link
References
Potentiometer Resistance:
10 kilo ohm
http://tenettech.com/
product.php?id_pro
duct=1498
http://en.wikipedia.org/wiki/Potentiometer
Reset button Normal push
button
http://tenettech.com/
product.php?id_pro
duct=1499
http://en.wikipedia.org/wiki/Push-button
Extended LCD
berg
connectors
16x2 LCD http://tenettech.com/
product.php?id_pro
duct=517
http://en.wikipedia.org/wiki/Liquid_crystal_dis
play
Graphical LCD 128x64 LCD http://www.tenettech.com/product.php?id_product=1523
http://www.dfrobot.com/wiki/index.php?title=128x64_Graphic_LCD_%28SKU:FIT0021%29
4
Schematic
Figure 2: 16x2 text LCD and graphical LCD breakout schematic
5
Software overview
Flowchart
16x2LCD Graphical LCD
Initialization of LCD
functional pins
Set the (cursor, clear
screen) status
Print statements to
display
Start
End
Initialization of LCD
functional pins
Initialization of
bitmap
position/system font
Add shapes
to images
Initialization of LCD
functional pins
Set the (cursor, clear
screen) status
Print statements to
display
Start
End
Start
End
6
Pseudo code
16x2LCD
Include header files for LCD
Global declaration: LCD pins initialization.
Function name : Setup
Return type : Void
Description : Initialization
Body : Print statement that is to be displayed on LCD.
Function name : Loop
Return type : Void
Description : Infinite
Body : Set the cursor and rate at which it is to be displayed.
Graphical LCD
Include header files for LCD
Function name : Setup
Return type : Void
Description : Initialization
Body : LCD pins initialization.
Set up the Bitmap position
Set the system font
Function name : Loop
Return type : Void
Description : Infinite
Body : Include the shapes which you need to add to images
Include number of iterations in one second.
7
code
(i) 16x2 LCD
// 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 columns and rows:
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);
}
(ii) Graphical LCD
#include <ks0108.h> // library header
#include <Arial14.h> // font definition for 14 point Arial font.
#include "SystemFont5x7.h" // system font
#include "ArduinoIcon.h" // bitmap
unsigned long startMillis;
unsigned int iter = 0;
8
void setup()
{
GLCD.Init(NON_INVERTED); // initialise the library
GLCD.ClearScreen();
GLCD.DrawBitmap(ArduinoIcon, 32,0, BLACK); //draw the bitmap at the given x,y position
delay(3000);
GLCD.ClearScreen();
GLCD.SelectFont(System5x7); // select fixed width system font
}
void loop()
{ // run over and over again
startMillis = millis();
while( millis() - startMillis < 1000)
{ // loop for one second
GLCD.DrawRect(0, 0, 64, 61, BLACK); // rectangle in left side of screen
GLCD.DrawRoundRect(68, 0, 58, 61, 5, BLACK); // rounded rectangle around text area
for(int i=0; i < 62; i += 4)
GLCD.DrawLine(1,1,63,i, BLACK); // draw lines from upper left down right side of
rectangle
GLCD.DrawCircle(32,31,30,BLACK); // draw circle centered in the left side of screen
GLCD.FillRect(92,40,16,16, WHITE); // clear previous spinner position
GLCD.CursorTo(5,5); // locate curser for printing text
GLCD.PrintNumber(++iter); // print current iteration at the current cursor position
}
// display number of iterations in one second
GLCD.ClearScreen(); // clear the screen
GLCD.CursorTo(13,2); // positon cursor
GLCD.Puts("FPS= "); // print a text string
GLCD.PrintNumber(iter); // print a number
}
9
Demo Application
LCD breakout shield
Figure3: The breakout
LCD shield is mounted on Comet through extended headers from the breakout
Figure4: The breakout with Comet
16x2 text LCD is connected to breakout
Figure5: The breakout with LCD
10
The result image shows characters are printed on LCD
Figure6: character displayed on LCD
Graphical LCD is interfaced to Comet using the breakout shield
Figure7: The breakout with graphical LCD
The result showing coded images in graphical LCD
Figure8: images displayed on graphical LCD
11
References and Further Reading
www.arduino.cc
www.tenettech.com/comet
http://www.youtube.com/user/tenetworld?blend=2&ob=5#p/u/3/NJHPJblpkRU
http://tenettech.com/category.php?id_category=283