Space In HIndi

 


Pages

Popular

PLAYING LCD AND ARDUINO


LCD stands for Liquid Crystal Display. It is a display unit built using Liquid Crystal technology. In any embedded or electronics project display plays an important role of displaying useful output parameters. Liquid Crystal Displays comes in different size specifications. Out of all available LCD modules in market, the most commonly used one is 16×2 LCD Module which can display 32 ASCII characters in 2 rows (16 characters in 1 row).

1.LCD Basics:

 16x2 LCD has 16 pins. 
There are two modes of LCD operation 4-bit mode and 8-bit mode. 
We will be using LCD module in 4-bit mode.
 In order to interface it with Arduino, we need to understand it’s pin configuration and function of each pin.


VSS: Ground Pin 
VDD: 5V Pin 
VEE: This pin is used to adjust contrast of LCD display. The voltage at the VEE pin defines the contrast 
RS: Register select pin is used to choose type of register to be used. There are two data registers in LCD command register and data register. When RS is high Data register is selected and data given to LCD data pins will be displayed on LCD screen. When RS is low, command register is selected and data given to LCD data pins is treated as command to LCD module. 
R/W: As the name suggest, it is used to select either read mode or write mode. When pin is high read mode is activated and when pin is low write mode is activated. 
E: Read/ Write enable. 
D0 to D7: These are data pins to which commands and data could be passed to the LCD module. 
Backlight Cathode and Anode: These pins are used to power backlight of LCD module 
If you look closely, you can actually see the little rectangles for each character on the display and the pixels that make up a character. Each of these rectangles is a grid of 5×8 pixels.


  Displaying “Hello World” on 16x2 LCD


Although they display only text, they do come in many sizes and colors: for example, 16×1, 16×4, 20×4, with white text on blue background, with black text on green and many more.

The good news is that all of these displays are ‘swappable’ – if you build your project with one you can just unplug it and use another size/color LCD of your choice. Your code may have to adjust to the larger size but at least the wiring is the same!
 Components Required: 
1. Arduino UNO
 2. 16x2 LCD display 
3. 10KΩ potentiometer
 4. 220Ω resistor
 5. Connecting wires


Programming
In order to easily get started with LCD interfacing program, we will first try to display a string “Hello World” on row 0 and “16X2 LCD” on row 1 of LCD screen.
 In above interfacing diagram we have following connections between Arduino and LCD


First of all we need to include Liquid Crystal library in sketch. After that we need to set the interfacing pins to the library function. 
In void setup() we will initialize LCD. In void loop(), first we need to set the curser position. 
We will set it to row 0 and column 0. Then print string “Hello World”. Now move to row1 and column 0 and print “16X2 LCD”.

#include <LiquidCystal.h>
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);// sets the interfacing pins 
Void setup ()
 {
 lcd.begin(16, 2); 

Void loop () 
{
 lcd.setCursor (0, 0); //sets the cursor at row 0 column 0 
lcd.print ("Hello World"); // prints 16x2 LCD MODULE 
lcd.setCursor (0,1); //sets the cursor at row 0 column 1 
lcd.print ("16X2 LCD");
}

No comments: