In this tutorial, we are going to teach how to use an LCD display with an 8-bit PIC microcontroller. We will give you a powerful LCD library and explain how to use it in your microcontroller in this tutorial. We will do examples on PIC16F628A microcontroller but you can do small changes to use it in your projects. Let’s get started to make LCD Interfacing.
We will make 3 projects using our library. These are;
- Writing Strings to LCD Display
- Shifting Strings and Toggle LCD Display
- Writing Numbers to LCD Display
With these projects, you will make what you want with LCD.
16×2 LCD Display
This display is a very basic module that is shown below which uses in very basic electronics projects and products. Pin connections of LCD display which we use areas in the picture below. Be sure that pin orientations are is same, else you may burn your LCD display. If pins not the same, you need to correct the circuit for your LCD display.
We are going to use our LCD library. You can read a post about this library which we wrote in the link below.
We will use a circuit below for all 4 projects.
In this file, we add configuration of fuses, the definition of oscillator and include statements. This file important because of LCD library needs this file and included libraries. Create
config.h file in Header Files and copy-paste code below. If your microcontroller is different edit configuration fuses.
In this project, we are going to write “Trion Projects” for first-line and “LCD Interfacing” for the second line. You can print strings in 2 options. You can see options in the code.
Now let’s shift string and toggle LCD display. While printing strings we can center it. To center it we need to write 0 to
LCDPrintString‘s third parameter.
In our third project, we are going to print variables integer numbers to the LCD display. For this, we need to include
stdio.h library. We included it in
In this tutorial project, we teach how to use an LCD display with a PIC microcontroller. We hope this will be helpful. If you have some questions write in the comments below. Stay healthy and see you in the next tutorials.