cover photo

BLOG · 10/3/2023

title

Mahammad Riyaz
Mahammad Riyaz
OP
title
This Article is flagged by a Coordinator and it probably requires some changes to be approved.

INTERFACING 16*2 LCD TO ARDUINO NANO By connecting a 1602a LCD display to Arduino we can display any characters on it Maximum character displayed in one shot : 32(including 2 rows); Brief description : Here I performed 3 types of operations 1) Displayed “ welcome to MARVEL” inside the the void setup and void loop as well 2) Moving the digits(0 to 9) in ( 0 ) from left to right and in ( 1) right to left using auto scroll and setCursor keywords 3)Displayed all alphabets of English in a sequential manner by the help of if statement and lcd.rightToLeft() , lcd.leftToright() keywords Circuit connections I followed : * LCD RS pin to digital pin 12 * LCD Enable pin to digital pin 11 * LCD D4 pin to digital pin 5 * LCD D5 pin to digital pin 4 * LCD D6 pin to digital pin 3 * LCD D7 pin to digital pin 2 * LCD R/W pin to ground * 10K resistor (potentiometer) * A and K pins are actually anode and cathode pins of backlight( A → +5V , K → GND) * Middle pin of potentiometer to Vo of LCD To display long sentence(size > 32) Logic : set cursor to first row and first column and write maximum of 16 characters ( blank space also counts as a character) Then set the cursor to 2nd row , and display the remaining characters , then give some delay and clear the screen and display the remaining words in first and second rows by the help of setCursor keyword Ex: Void loop (){ lcd.setCursor( 0) ; // begins the line from first column and first row lcd.print(“ WELCOME “); // prints hello world in first row , first column lcd.setCursor( 1) ; // setting the cursor to 2nd row 1st column (if you want to display somewhere in The middle you can set the cursor as ( 1) lcd.print(“ MARVEL “); delay(1000); lcd.clear(); // clears the screen lcd.setCursor( 0) ; lcd.print(“this is 1602a “); lcd.setCursor( 1) ; lcd.print(“ LCD “); Delay (1000); lcd.clear(); } The LCD controller uses RS and RW lines along with E to operate the LCD. Resistor Select (RS): Determines whether a command(RS = 0) is sent (to set up the display) or actual data(RS=1) is sent. Read/Write RW=0; writes to the LCD. RW=1;Reads from the LCD.

UVCE,
K. R Circle,
Bengaluru 01