Pinout of 16 x 2 LCD :
Pin No: |
Pin Name: |
Description |
1 |
Vss |
Ground pin connected to system ground |
2 |
Vcc |
Powers the LCD with +5V (4.7V – 5.3V) |
3 |
VE |
Decides the contrast level of display i.e. dimming the brightness or increasing the
brightness of LCD. Grounded to get maximum contrast. |
4 |
RS |
There are two very important registers inside
the LCD. The RS pin is used for the selection of these registers. If RS
= 0, the instruction command code register is selected, which allows the user
to send commands for the LCD such as clear display, cursor at home, and so
on. If RS = 1, the data register is selected. It allows the user to send data
that is to be displayed on the LCD. |
5 |
R/W |
This pin toggles the display among the read
or writes operation, and it is connected to a microcontroller unit pin to get
either 0 or 1 (0 = Write Operation, and 1 = Read Operation). |
6 |
E |
Sends data to data pins when a high to low
pulse is given; Extra voltage push is required to execute the instruction and
EN(enable) signal is used for this purpose. This
pin should be held high to execute Read/Write process, and it is connected to
the microcontroller unit & constantly held high. |
7 |
D0 |
Data pins 0 to 7 forms a 8-bit data
line. They can be connected to Microcontroller to send 8-bit data. These LCD’s can also operate on 4-bit mode in such case Data
pin 4,5,6 and 7 will be left free. |
8 |
D1 |
|
9 |
D2 |
|
10 |
D3 |
|
11 |
D4 |
|
12 |
D5 |
|
13 |
D6 |
|
14 |
D7 |
|
15 |
A |
Backlight LED pin positive terminal |
16 |
K |
Backlight LED pin negative terminal |
Features of 16 x 2 LCD Module :
- Operating Voltage is 4.7V to 5.3V.
- Current consumption is 1mA without backlight.
- Alphanumeric LCD display module, meaning can display alphabets and numbers.
- Consists of two rows and each row can print 16 characters.
- Each character is build by a 5×8 pixel box.
- Can work on both 8-bit and 4-bit mode.
- It can also display any custom generated characters.
- Available in Green and Blue Backlight.
Components Required :
Circuit Diagram :
LCD PIN |
ARDUINO PIN |
Vss |
GND |
Vdd |
5V |
V0 |
D6 |
RS |
D12 |
RW |
GND |
E |
D11 |
D0 |
- |
D1 |
- |
D2 |
- |
D3 |
- |
D4 |
D5 |
D5 |
D4 |
D6 |
D3 |
D7 |
D2 |
A |
5V |
K |
GND |
Source Code :
/*
16 x 2 LCD Display with Arduino
HarshTronics
For More :
https://www.harshtronic.blogspot.com
https://www.instagram.com/harshtronics
*/
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // Creates an LC object Parameters: (RS, E, D4, D5, D6, D7)
int contrast = 100;
void setup()
{
analogWrite(6,contrast);
lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display }
}
void loop()
{
lcd.setCursor(3,0);
lcd.print("Welcome to"); // Prints "Welcome to" on the LCD
delay(3000); // 3 seconds delay
lcd.setCursor(2,1); // Sets the location at which subsequent text written to the LCD will be displayed
lcd.print("HarshTronics"); // Prints "HarshTronics" on the LCD
delay(3000); // 3 seconds delay
lcd.clear(); // Clears the display
lcd.setCursor(4,0);
lcd.print("Arduino"); // Prints "Arduino" on the LCD
delay(3000); // 3 seconds delay
lcd.setCursor(2,1); // Sets the location at which subsequent text written to the LCD will be displayed
lcd.print("LCD Tutorial");
delay(3000);
lcd.clear(); // Clears the display
lcd.setCursor(0,0);
lcd.print("Subscribe on");
lcd.setCursor(3,1);
lcd.print("Youtube");
for (int positionCounter = 0; positionCounter < 4; positionCounter++)
{
lcd.scrollDisplayRight(); // scroll one position right
delay(1000);
}
for (int positionCounter = 4; positionCounter > 0; positionCounter--)
{
lcd.scrollDisplayLeft(); // scroll one position left
delay(1000);
}
lcd.clear();
for(int i=0;i<=7;i++)
{
lcd.setCursor(i,0);
lcd.blink(); //Displays the blinking LCD cursor
delay(1000);
}
lcd.noBlink(); // Turns off the blinking LCD cursor
for(int i=7;i<=15;i++)
{
lcd.setCursor(i,0);
lcd.cursor(); // Displays an underscore (line) at the position to which the next character will be written
delay(1000);
}
lcd.noCursor(); // Hides the LCD cursor
lcd.clear(); // Clears the LCD screen
}
/*
HarshTronics
For More :
https://www.harshtronic.blogspot.com
https://www.instagram.com/harshtronics
*/
No comments:
Post a Comment