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 .
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.
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