How to make own serial LCD display for PIC12F683 Microcontroller

Alphanumeric LCD generally HD44780 model is very popular display . This LCD use 8 pins for data display and three pin for control and AL together 16 pin . There will be problem on project if we have to connect numbers of components in single micro-controller to make a compact type of device . To reduce number of pin used in this tutorial we are going to make a serial LCD using data shifting technique.

In This project i am going to show you how to convert your parallel LCD display to serial LCD . Serial LCD is a little bit expensive but if we know this technique we can easily make cheap serial LCD by adding a 74HC595 chip .
code for this project is shown below

How to make own serial LCD display for PIC12F683 Microcontroller (Code)


#define _LCD_FIRST_ROW 0x80 //Move cursor to the 1st row
#define _LCD_SECOND_ROW 0xC0 //Move cursor to the 2nd row
#define _LCD_THIRD_ROW 0x94 //Move cursor to the 3rd row
#define _LCD_FOURTH_ROW 0xD4 //Move cursor to the 4th row
#define _LCD_CLEAR 0x01 //Clear display
#define _LCD_RETURN_HOME 0x02 //Return cursor to home position, returns a shifted display to
//its original position. Display data RAM is unaffected.
#define _LCD_CURSOR_OFF 0x0C //Turn off cursor
#define _LCD_UNDERLINE_ON 0x0E //Underline cursor on
#define _LCD_BLINK_CURSOR_ON 0x0F //Blink cursor on
#define _LCD_MOVE_CURSOR_LEFT 0x10 //Move cursor left without changing display data RAM
#define _LCD_MOVE_CURSOR_RIGHT 0x14 //Move cursor right without changing display data RAM
#define _LCD_TURN_ON 0x0C //Turn Lcd display on
#define _LCD_TURN_OFF 0x08 //Turn Lcd display off
#define _LCD_SHIFT_LEFT 0x18 //Shift display left without changing display data RAM
#define _LCD_SHIFT_RIGHT 0x1E //Shift display right without changing display data RAM
sbit One_Wire at GP0_bit;
sbit One_Wire_Direction at TRISIO0_bit;
char msg1[] = "www.electronify.org";
char msg2[] = "4 bit One-Wire LCD";
char msg3[] = "20x4 LCD display";
char msg4[] = "HD44780 model";
void Delay_6ms() {
Delay_ms(6);
}
void Delay_15us() {
Delay_us(10);
}
void Send_Byte(char rs, char out_char) {
char i = 0, mask = 0x80;
out_char.F1 = rs;
for(i = 0; i >= 1; // get the next bit
}
// The Shift1 protocol requires that the 8th bit is very
// long, this causes the 74HC595 shift register to latch
// all the 8 bits to its output port.
// NOTE! the 8th bit (bit0) will always be received as zero.
One_Wire = 0; // send 8th bit, lo pulse = 14x15 = 210uS
//for(i = 10; i; i--)Delay_15uS();
Delay_us(210);
One_Wire = 1; // and hi recovery 20x15 = 300 uS
//for(i = 14; i; i--)Delay_15uS();
Delay_us(300);
}
void Write_Nibbles(char rs, char out_char) {
char data2Send;
data2Send = out_char & 0xF0;
data2Send.F3 = 1;
Send_Byte(rs,data2Send);
data2Send.F3 = 0;
Send_Byte(rs,data2Send);
data2Send = out_char & 0x0F;
data2Send

How to make own serial LCD display for PIC12F683 Microcontroller (Schematic Diagram)

How to make own serial LCD display for PIC12F683 microcontroller schematic diagram

How this works ?

74hc595 is a kind of shift register . This chip converts serial data to parallel data (in this project we are connecting LCD on 4 bit mode this mode also shift remaining 4 bit data to higher register bit inside the LCD ) , so we are not doing anything new , we are just converting serial data into parallel so that we can reduce number of pin used on micro-controller .The shift register holds what can be thought of as eight memory locations, each of which can be a 1 or a 0.
To set each of these values on or off, we feed in the data using the ‘Data’ and ‘Clock’ pins of the chip. The clock pin needs to receive eight pulses, at the time of each pulse, if the data pin is high, then a 1 gets pushed into the shift register, otherwise a 0. When all eight pulses have been received, then enabling the ‘Latch’ pin copies those eight values to the latch register. This is necessary, otherwise the wrong LEDs would flicker as the data was being loaded into the shift register.

How to make own serial LCD display for PIC12F683 microcontroller 2

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation, and engineering. I have a clear and simple writing style and am skilled in using infographics and diagrams. I am a great researcher and is able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter