Menu Skip to content
Home
PROJECT SHOP
Internet of Things
IoT Projects
IoT Tutorials
Arduino
Arduino Projects
Arduino Tutorials
Electronics
Projects
Tutorials
Microcontroller
AVR Projects
AVR Tutorials
About Us
Contact Us
Terms and Conditions
Privacy Policy
Search for: Search … Search
Three Wire LCD Interface with Arduino
December 14, 2016Arduino Projects, Arduino Tutorialsarduino, code, display, interfacing, LCDManoj R. Thakur
We have seen parallel interface technique using Arduino library and we know that it requires 6 IO Lines, Now let’s see how we can
reduce required IO’s using 74HC595. We know that we can reduce number IO required by using I2C based LCD interface circuit; It
costs ten times more than 74HC595 Circuit.
Arduino 3 wire LCD interface circuit
In this circuit similar to the bargraph display we are using 74HC595 Shift register to interface 16×2 LCD.
3 Wire LCD Interface with Arduino Circuit
For LCD contrast setting 1K Ohm fixed resistor is used it gives optimum contrast value. Connect R/W to ground as we are not going
to read the LCD. LCD is connected in 4-bit mode.
Arduino Code for 3 wire LCD
Here we are not using any library to interface the LCD.
1 /* Three Wire LCD Interface using 74HC595
2 [Link] */
3
4 //Define 74HC595 Connections with arduio
5 const int Clock=7;
6 const int Data=6;
7 const int Latch=5;
8
9 void LCDinit(void);
10 void LCDSendByte(char d,char RS);
11 void LCDPrint(char Line,char string[16]);
12 //=============================================================
13 // Setup
14 //=============================================================
15 void setup() {
16 // initialize the digital pin as an output.
17 pinMode(Data, OUTPUT);
18 pinMode(Clock, OUTPUT);
19 pinMode(Latch, OUTPUT);
20 LCDinit(); //initalize LCD in 4-bit mode
21 }
22 //=============================================================
23 // Loop
24 //=============================================================
25 void loop() {
26 LCDPrint(0,"Circuits4You");
27 LCDPrint(1,"Hello There");
28 delay(500);
29 }
30
31 //=============================================================
32 // Send Data or Command to LCD
33 //=============================================================
34 void LCDSendByte(char d,char RS)
35 {
36 char dH,dL,temp;
37 //Keep Data on upper nybble
38 dH = d & 0xF0; //Get MSB
39 dL = d & 0x0F;
40 dL = d << 4; //Get LSB
41 //Send MSB with E=clock
42 temp=0;
43 temp=dH | RS | 0x02; //MSB With RS+E bit
44 ShiftData(temp);
45 //Send MSB with E=0
46 temp=0;
47 temp=dH | RS; //MSB With RS bit
48 ShiftData(temp);
49 //Send LSB with E=clock
50 temp=0;
51 temp=dL | RS | 0x02; //MSB With RS+E bit
52 ShiftData(temp);
53 //Send LSB with E=0
54 temp=0;
55 temp=dL | RS; //MSB With RS bit
56 ShiftData(temp);
57 }
58 //=============================================
59 void ShiftData(char temp)
60 {
61 int i;
62 for(i=0;i<8;i++)
63 {
64 if((temp & 0x80)==0x80) //Send 1-bit to shift register
65 {digitalWrite(Data,HIGH);}
66 else
67 {digitalWrite(Data,LOW);}
68
69 digitalWrite(Clock,LOW);
70 digitalWrite(Clock,HIGH);
71 temp=temp<<1;
72 }
73 //Latch the data
74 digitalWrite(Latch,LOW);
75 delay(1);
76 digitalWrite(Latch,HIGH);
77 }
78 //=================================================================
79 // LCD Display Initialization Function
80 //=================================================================
81 void LCDinit()
82 {
83 int count;
84 char t[]={0x43,0x03,0x03,0x02,0x28,0x01,0x0C,0x06,0x02,0x02};
85 for (count = 0; count <= 9; count++)
86 {
87 LCDSendByte(t[count],0); //Command RS=0
88 }
89 }
90 //=================================================================
91 // Display Line on LCD at desired location Function
92 //=================================================================
93 void LCDPrint(char Line,char string[16])
94 {
95 int len,count;
96 if(Line==0) {
97 LCDSendByte(0x80,0); //Command RS=0 Move Cursor to Home
98 }
99 else {
100 LCDSendByte(0xC0,0); //Command RS=0 Move Cursor to Second Line
101 }
102 len = strlen(string);
103 for (count=0;count<len;count++)
104 {
105 LCDSendByte(string[count],1); //Data RS=1
106 }
107 }
108 //=================================================================
Result
This technique saves IO lines as well as circuit cost.
Facebook
Twitter
Google Plus
LinkedIn
Pin It
Related
ESP8266 NodeMCU 16x2 LCD Interface
ESP8266 NodeMCU 16x2 LCD Interface
In this tutorial we interface 16x2 LCD display with ESP8266 NodeMCU without using I2C and with minimum pins i.e. using only 3
pins. To interface LCD with ESP8266 we need at least 6 IO lines but ESP already have very few IO lines, to expand IO lines we use
serial…
January 2, 2018
In "ESP8266"
LCD interface using I2C Module with Arduino
LCD interface using I2C Module with Arduino
I2C module with LCD display using Arduino How to interface PCF85574 module with arduino? To connect LCD display 16×2 or
20×4 to Arduino you know you’ll need at least 6 wires to connect, it means sacrificing some IO’s that could be used for connecting
other components such as sensors or…
September 17, 2016
In "Arduino Tutorials"
Digital Code Lock using Arduino
Digital Code Lock using Arduino
Digital code lock systems are most common on security systems. An electronic lock or digital lock is a device which has an
electronic control assembly attached to it. They are provided with an access control system. This system allows the user to unlock the
device with a password. The password…
June 5, 2016
In "Arduino Projects"
Post navigation
← Four Digit 7-Segment Display Interfacing with Arduino Touch Screen interfacing with Arduino →
One thought on “Three Wire LCD Interface with Arduino”
1. Pingback: LCD interface using I2C Module with Arduino | [Link]
Leave a Reply
You must be logged in to post a comment.
Login with:
Our e-Books
Zero to Hero: ESP8266: Become Super hero of Internet of Things
Measurement Made Simple with Arduino: Ultimate e-Book for all your measurement needs at one place.
Arduino Beginners Guide: Get started with arduino in simple steps
Subscribe to Blog via Email
Enter your email address to subscribe to this blog and receive notifications of new posts by email.
Join 177 other subscribers
Email Address
Subscribe
Join Circuits4You community
Recent Posts
ESP8266 jQuery and AJAX Web Server
ESP8266 HTTP GET Request Example
ESP8266 (NodeMCU) post request data to website
ESP8266 Static IP Address arduino Example
How to convert integer to string and string to int on Arduino ?
Advertisement
Search for: Search … Search
Recent Posts About Us
ESP8266 jQuery and AJAX WebTerms Server& Conditions
ESP8266 HTTP GET Request Example Privacy Policy
ESP8266 (NodeMCU) post request Contact
data to
Uswebsite
ESP8266 Static IP Address arduino Example
How to convert integer to string and string to int on Arduino ?