Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

How to interface 16×2 lcd in 4-bit mode with Arduino uno

By EG Projects

Before proceeding first just take a look on Whats The difference between 4-bit and 8-bit lcd.
Starting from the first line. First import the <liquidCrystal.h> library This library is designed to provide necessary functions to be used with lcd. Then the line LiquidCrystal lcd(12,11,5,4,3,2); is initializing the lcd in 4-bit mode. Arduino has less pins than other simple micro controllers so we use lcd with Arduino in 4-bit mode.
 * 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

Now You people are thinking how does it do that. The liquidcrystal library do that since it is coded in such a way that it automatically assign pins in the above format. Note that always assign the pins in descending order like i did 12,11,5,4,3,2. If you not assign it in descending order than your lcd wont work. In the statement the starting keyword LiquidCrystal is the library keyword than in lcd(12,11,5,4,3,2) lcd is the name which we are going to use for our lcd operations you can also change it according to your wish. In setup loop my first statement is lcd.begin(16 ,2). The statement tells the Arduino Atmag micro controller that we are using 16×2 lcd. Rest of the code is very easy I hope you can understand them. The LiquidCrystal library can perform many functions here is detail of each function.     

  • lcd.clear() ->This clears the screen (and sets the cursor to theupper left hand corner).
  • lcd.print() ->Prints the text.
  • lcd.setCursor(coloumb , row) ->It takes two arguments first is coloumb and second is row to which we want to set our cursor.
  • lcd.noCursor() ->Shows no cursor on the screen.
  • lcd.cursor() ->Brings back the cursor. 
  • lcd.noDispla() ->Nothing will display on the lcd.
  • lcd.display() ->Trun on the dispaly. 
  • lcd.blink() ->Cursor will blink on the screen.
  • lcd.noBlink() ->Cursor will not blink on the screen.

Note: Use the correct syntax of the statements the ardunio functions uses first word starting with small letter and second with capital. For example noBlink() n is small B is capital digitalWrite() d is small W is capital.

                                                                                CODE
//countng using lcd and button

#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);//always initiliaze
//lcd pins in sequence like 12 11 5 4 3 2 
int button =8;//button 8 used as input
void setup()
{
lcd.begin(16, 2);
lcd.clear();
pinMode(button, INPUT);//initiliziong button as input
}
void loop()
{
  int count;
  lcd.print(“PRESS BUTTON”);
  delay(4000);
  lcd.clear();
  lcd.setCursor(0, 0);
while(1){
  if(digitalRead(button)==HIGH)
  {
   delay(1000);//necessary delay other wise pressing one time
  // will made wile loop run many times and value is incremented
  //to thousands so a delay is used so one high signal increments 
   //one time
  count++;
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(count);//Arduino can display integer types also
  }}}

Download program sketch from here
If you don’t understand any thing just leave a comment below.

lcd_in_4_bit_mode_with_ardunio.rar
File Size: 0 kb
File Type: rar

Download File



Filed Under: Arduino, Microcontroller Projects

 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • PS2 Keyboard To Store Text In SD Card Using Arduino Circuit Setup On Breadboard
    How To Use PS2 Keyboard To Store Text In SD Card Using Arduino- (Part 42/49)
  • Wireless Path Tracking System Using Mouse, XBee And Arduino Circuit Setup On Breadboard
    How To Make A Wireless Path Tracking System Using Mouse, XBee And Arduino- (Part 43/49)
  • How to Make a Wireless Keyboard Using Xbee with Arduino- (Part 44/49)
  • Making Phone Call From GSM Module Using Arduino Circuit Setup On Breadboard
    How to Make Phonecall From GSM Module Using Arduino- (Part 45/49)
  • How to Make a Call using Keyboard, GSM Module and Arduino
    How To Make A Call Using Keyboard, GSM Module And Arduino- (Part 46/49)
  • Receiving SMS Using GSM Module With Arduino Prototype
    How to Receive SMS Using GSM Module with Arduino- (Part 47/49)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Renesas delivers intelligent sensor solutions for IoT applications
  • Microchip Technology releases AVR-IoT Cellular Mini Development Board
  • Qualcomm acquires Cellwize to accelerate 5G adoption and spur infrastructure innovation
  • MediaTek’s chipset offers high-performance option for 5G smartphones
  • Nexperia’s new level translators support legacy and future mobile SIM cards

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • FPGA LVDS with separate clock
  • How do you find the angle made by two isosceles triangles in a kite?
  • Limits of duty cycle for ICM7555 IC?
  • Increasing the Termination Resistor value for Ethernet
  • Thermal pad construction on pcb

RSS Electro-Tech-Online.com Discussions

  • we are facing an issue with one-wire communication by using DS2485
  • RF modules which can handle high number of bytes per second
  • Are Cross-wind compensation and Road crown compensation functions inputs to LKA function?
  • Component identification.
  • Flickering (candle) LED to trigger 555
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering