Interfacing PIC12F1822 microcontroller with LCD display – CCS C

PIC12F1822 LCD Example using CCS PIC C compiler with one line scrolling

This topic shows how to interface the microcontroller PIC12F1822 with LCD display (1602, 2004 …..) using CCS C compiler.
The microcontroller PIC12F1822 has only 8 pins and only 5 of them can be configured as outputs. The LCD display needs at least 6 data lines to operate and we can not connect it directly to PIC12F1822 microcontroller.
Using a serial in parallel out shift register (74HC595, 74HC164, CD4094 ……) we can minimize the number of pins used by the LCD to 3.
Using the 3-wire LCD driver of the CCS C compiler we can easily interface the PIC12F1822 with LCD display. The 3-wire LCD driver can be found at:
3-Wire LCD driver for CCS PIC C compiler

It is easy to add this driver to your project just download the C file and copy it to your project folder or to the CCS PIC C driver folder.

Components list:

  • PIC12F1822 Microcontroller
  • LCD Display with HD44780 or compatible controller
  • 74HC595 Shift Register (74HC164 or CD4094 can be used)
  • 10K Variable Resistor
  • +5V Power Supply
  • Breadboard
  • Jumper Wires

Interfacing PIC12F1822 microcontroller with LCD display circuit:
PIC12F1822 LCD example circuit
The shift register data line is connected to RA0 pin and the clock line is connected to RA1 pin. LCDs enable pin is connected to pin RA3.
The internal oscillator of the PIC12F1822 microcontroller is used.
To see how to use 74HC164 or CD4094 instead of 74HC595 see the 3-wire LCD driver topic at the link above.

Interfacing PIC12F1822 microcontroller with LCD display CCS C code:
This is the full code of this example where the microcontroller runs with its internal oscillator at 32MHz. The code shows how to make only one line scrolling as shown in the video below.

PIC12F1822 LCD Example Video:

Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top