16x2 LCD Interface with Arduino
Its quite inconvenience to use serial monitor of Arduino IDE to display data or any message when a wireless display is needed. Thus a on-board display will be helpful for solving this issue. 16x2 LCD is one of the simplest & cheapest display one can use for this purpose.
Things needed:
- Arduino
-16x2 lcd
- Connecting wires
About 16x2 LCD :
The LCDs have a parallel interface, meaning that the
microcontroller has to manipulate several interface pins at once to control the
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.
·
There's also a display constrast 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. The LiquidCrystal Library simplifies
this for you so you don't need to know the low-level instructions.
Circuit Diagram
There are generally 16 pin slots on 16x2 LCD module. Here I have used 12 as shown in the figure. After wiring the module connect it and see if the back light is glowing.
Coding Part:
Write or past this code in arduino IDE
// include
the library code:
#include
<LiquidCrystal.h>
char str1[]="GaneshGadgets";
char
str2[]=".blogspot.com";
LiquidCrystal
lcd(7, 6, 5, 4, 3, 2);
void setup()
{
// set up the LCD's number of columns and
rows:
lcd.begin(16, 2);
}
void loop()
{
lcd.setCursor(0,
0);//cursor position
lcd.print("Ganeshgadgets
");
lcd.setCursor(3,
1);
lcd.print(".blogspot.com
");
}
The result will be like this: