Browse over 10,000 Electronics Projects using the Page Numbering provided at the bottom of each Page.

16×2 Serial LCD (Two Wire) with PIC12F675

16×2 Serial LCD (Two Wire) with PIC12F675

           The General purpose 16×2 or 16×1 char LCD are very easy to interface with any microcontroller , and these lcd are really very cheap and thoroughly available in the whole world, but the only problem with these lcd is they require 4 or 8 data lines + 2 or 3 control line to at minimum 6 line and maximum 11 lines are required. that not good because many small package microcontroller like PIC10 ,PIC12,PIC16 from microchip ,MSP430 Texas Instrument and Attiney from Atmel there all microcontroller have either 6 to 15 I/O lines. in this condition this technique will save you many I/O line because in this we use only 2 wires to connect the lcd with any microcontroller.

Most of these 16×2 ,16×1,8×1,8×2 ,8×4 ,20×4 and so on use stranded 8 line data and three control signal EN :- enable ,,RS- Register Select(data/command) ,, RW – read write

for futher details how these lcd works , pin configuration and command other things please visit my previouse post CLICK HERE :- 16×2 LCD with MCU


Theory Of Operation

This heart of the circuit is CD4094 shift register, this serial in Parallel out shift register allow us to clock the data and command on to the data and command line of the lcd basically we have first send the rs and data then send the enable in general

To achieve this, the data input to the shift register is logically ANDed with output Q7 using a resistor and a diode. Only when Q7 is high will allow a pulse on the data input be transmitted to the LCD as a pulse on its E input. because if the Q7 is low the the diode will start working in forward region and all the current will sink in to the Q7 nothing will to lcd .

To make sure that no spurious E pulses are generated,the following sequence of instruction must be followed care fully1. Clock eight zero bits into the shift register by setting the data signal low and generating eight clock pulses. The bits are clocked in on each rising clock edge. Now all the Q outputs of the shift register are low, and in particular no E signal can be generated.

clk = 0; // represent any port pin
data= 0; // represent any port pin

for(i=0;i<8;i++)
{
clk = 1;
clk = 0;
}

2. Now send seven data bits. The first bit must be high and will ultimately appear on Q7, where it will allow an E pulse to be generated. The second bit is destined for the RS signal on Q6; the next four bits are data. The final bit is zero, ensuring that the data signal is left low. After a total of seven clock pulses the data bits will appear as required on the Q outputs, and in particular Q7 will be high.

data = 1; //set Q7= 1 for E
clk =1;
clk=0;data = rs; //set Q6 for RS
clk =1;
clk =0;

for ( i=8;i>0;i=i>>1)
{
if(d & i) //i= 8 ,4, 2, 1
{
data =1;
}
else
{
data =0;
}
clk = 1;
clk = 0;
}

3. Now we emit a pulse on the data signal, which in turn generates a pulse on the E line because Q7 is high. The above procedure must be carried out twice, once for the high data nibble (bits D4 to D7) and once for the low data nibble (bits D0 to D3).

data=0; //shift Q0
clk = 1;
clk = 0;

data = 1; //now send enable
data = 0;

Implementing the Software with PIC12F675



Download the Software firmware ,Source code and Schematic


Simulation

Download the Simulation file


THE HARDWARE 


PCB  

THIS CIRCUIT CAN BE USED WITH



 

More Articles to Read

Single-Sided USB Charger
Single-Sided USB Charger
A FPGA controlled RGB LED MATRIX for Incredible Effects – the Hardware
A FPGA controlled RGB LED MATRIX for Incredible Effects – the Hardware
Using Nanotimers to Reduce IoT System Power Consumption by an Order of Magnitude
Using Nanotimers to Reduce IoT System Power Consumption by an Order of Magnitude
Replace a microwave’s beeping with the Windows XP startup sound
Replace a microwave’s beeping with the Windows XP startup sound
A DIY Laser Scanning Microscope
A DIY Laser Scanning Microscope
Reverse-engineering the surprisingly advanced ALU of the 8008 microprocessor
Reverse-engineering the surprisingly advanced ALU of the 8008 microprocessor
ESP8266 LED lighting: QuinLED v2.6 PCB
ESP8266 LED lighting: QuinLED v2.6 PCB
Switching LVDS Graphics in a Laptop Computer
Switching LVDS Graphics in a Laptop Computer
Teleknitting: TV-based string art
Teleknitting: TV-based string art
DIY Bubble Machine
DIY Bubble Machine
Start your day with Nerf target practice!
Start your day with Nerf target practice!
Teardown of a Peaktech 6225A
Teardown of a Peaktech 6225A

Top




Shares