Organize and Share your Electronics the way you want. Sign-Up for a free account now. It takes only 30 seconds!

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



Read more Here







 

More Articles to Read

G-code controlled drawing plotter
G-code controlled drawing plotter
An Arduino round word clock
An Arduino round word clock
The Sandwich-o-Matic will make your lunch automatically
The Sandwich-o-Matic will make your lunch automatically
Scalar Network Analyser Jr
Scalar Network Analyser Jr
An Arduino-controlled automated whiskey distillery
An Arduino-controlled automated whiskey distillery
The Rex800 looks like a dinosaur Terminator
The Rex800 looks like a dinosaur Terminator
Home Environment Monitor
Home Environment Monitor
Understanding the Operation of the Frequency Synthesizer in Maxim’s RF Transceivers
Understanding the Operation of the Frequency Synthesizer in Maxim’s RF Transceivers
App note: EPIC: Electro-Pyrotechnic Initiator Chip Resistor
App note: EPIC: Electro-Pyrotechnic Initiator Chip Resistor
Noisy ESP8266
Noisy ESP8266
Noisy ESP8266
Noisy ESP8266
App note: Noise analysis for high-speed op amps
App note: Noise analysis for high-speed op amps
Skill Sunday: Arrays
Skill Sunday: Arrays
App note: Infrared remote control implementation with MSP430FR4xx
App note: Infrared remote control implementation with MSP430FR4xx
Gesture Controlled Smart Home
Gesture Controlled Smart Home
Design for a Wideband, Differential Transimpedance DAC Output
Design for a Wideband, Differential Transimpedance DAC Output
Wrist thrusters let you fly through the water effortlessly
Wrist thrusters let you fly through the water effortlessly
Bertan/Spellman 225-20R HV power supply teardown
Bertan/Spellman 225-20R HV power supply teardown
Blinking Christmas Lights
Blinking Christmas Lights
Adjusting clock with alarm, hygrometer & thermometer on 1.8″ ST7735 display
Adjusting clock with alarm, hygrometer & thermometer on 1.8″ ST7735 display

Top


Shares