Wire LCD Driver

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

EMBEDDED SYSTEMS LAB

-Final Project

3-Wire LCD Driver


(Software & Hardware)

Submitted By:

Waiz Yousaf - 200401057


Hasnat - 200401049
Mehak - 200401042
Objectives:
The main objective of this Project is:
• To drive a 3-Wire LCD
• To print a sentence on it and to get data from EPROM

Equipment’s:
• PIC16F877A (microcontroller)
• Crystal Oscillator
• Capacitors
• Resistors
• Potentiometer
• 74HC595 register

Introduction:

• 3-Wire LCD:
In most cases, the LCD display requires at least 4 data lines to function.
However, some microcontroller families, such as the PIC12F family, do not have this
many available pins, thus we must find a way to reduce the number of pins the LCD
display uses.
The shift register, which is serial-in parallel-out accepts serial data from the
microcontroller through two pins (data pin and clock pin), which is then used to deliver
data in serial format to the LCD display.

75HC595:

Serial to Parallel Device:


When given a series of timed pulses, a serial-to-parallel device
latches them onto a parallel array of output pins.

Serial Communication:
A computer bus or communication channel is used in serial
communication, a telecommunications approach that transfers data by sending bits at a time in a
sequential manner. It is the most basic method of getting a message across to a recipient.
✓ Data is transmitted in serial transmission as binary pulses. In other words, Binary One
denotes a logic HIGH or 5 Volts, and Binary Zero denotes a logic LOW or 0 Volts.
Depending on the type of transmission channel and data transfer, serial communication
can take many different forms.
Working of 75HC595:
An 8-bit shift register having serial-in, parallel-out, a storage
register, and 3-state outputs is the 74HC595. There are separate clocks for the shift and storage
registers. The device has an asynchronous reset MR input as well as a serial input (DS) and
output (Q7S) that permit cascading. The shift register is reset by a low signal on MR. When the
SHCP input switches from LOW to HIGH, data is displaced. When the STCP input transitions
from LOW to HIGH, the data in the shift register is transferred to the storage register. The shift
register and storage register will always be one clock pulse apart if the two clocks are coupled. If
the output enable input (OE) is LOW, data from the storage register is displayed at the output.

PIN Layout:
Pin Number Pin Name Description
1,2,3,4,5,6,7 Output Pins (Q1 to Q7) The 74hc595 has 8 output pins out of
which 7 are these pins. They can be
controlled serially.
8 Ground Connected to the Ground of the circuit.
9 (Q7) Serial Output This pin is used to connect more than
one 74hc595 as cascading.
10 (MR) Master Reset Resets all outputs as low. Must be held
high for normal operation.
11 (SH_CP) Clock This is the clock pin to which the clock
signal must be provided from
MCU/MPU.
12 (ST_CP) Latch The Latch pin is used to update the
data to the output pins. It is active high.
13 The Output Enable is used to turn off
(OE) Output Enable the outputs. Must be held low for
normal operation.
14 (DS) Serial Data This is the pin to which data is sent,
based on which the 8 outputs are
controlled.
15 (Q0) Output The first output pin.
16 Vcc This pin powers the IC, typically +5V
is used.
EEPROM:
The term "electrically erasable programmable read-only memory," or EEPROM,
is abbreviated. It's a flash drive memory gadget made to keep the data it contains even when the
power is off. The chip enables developers to repeatedly write to and programmed the IC. It will
be able to function as an EPROM—a UV erasable programming ROM—as a result. It is mainly
utilized in laptops and PCs. The board can be utilized as non-volatile storage by microcontrollers
for smart cards and remote keyless systems.

Code:

#define LCD_DATA_PIN PIN_B0; //initializing PINS OF MC


#define LCD_CLOCK_PIN PIN_B1; //initializing PINS OF MC
#define LCD_EN_PIN PIN_B2; //initializing PINS OF MC
#include<16F877A.h> //libraries
#fuses HS,NOWDT,NOPROTECT,NOLVP //build in
#use delay(clock=4000000) //4MHz frequency
#include <3Wirelcd.c> //main library for driving
. 3 Wire LCD
void main() //main function
{
int i; //initializing variable i
LCD_INITIALIZE(); //Initializing LCD
lcd_cmd(LCD_CLEAR); //clearing LCD so that it won't
. pick any garbage value
PIN_B2==1; //Enablbe pin,firstly 1
delay_ms(100); //for generation of delay
PIN_B2==0; //then zero
lcd_goto(1,1); //16x2 LCD, will go to first row
, and first column point and print
. data
printf(lcd_out,"Embedded FP"); //to display data
. using lcd_out command at
. 1,1 location
delay_ms(100);
while(1) //forever true loop
{
i++; //continously increment
lcd_goto (2,4); // 16x2 LCD, will go to second row
. and 4th column point and print data
printf(lcd_out,"%3u",i); //To print '%3u' and
increment the value of i one by one at 2,4 location
delay_ms(100);
}
}

CCS Compiler Code:


Circuit Diagram:

PCB Layout :
3D View:

Advantages of Serial Transmission:

• It uses less number of conducting wires, hence reduces cost of the interface.
• It supports long distance data communication.
• It uses less number of wires often only one, this leads to simple interface between
transmitting and receiving devices or ICs. It is easy to implement.

Conclusion:
Thus, in this project we have tried to implement a 3 Wire LCD driver using a
shift register which is the main part of this project. It takes data serially and then convert it to
parallel data and then display on the LCD.

You might also like