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 the 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 Toggling 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, or else you may burn your LCD display. If the pins are 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 the circuit below for all 4 projects.
In this file, we add the configuration of fuses, and the definition of the oscillator, and include statements. This file is important because of LCD library needs this file and included libraries. Create
config.h file in Header Files and copy-paste the code below. If your microcontroller is different edit configuration fuses.
In this project, we are going to write “Trion Projects” for the 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 the string and toggle the 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 integer numbers on the LCD display. For this, we need to include
stdio.h library. We included it in the
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.