LCD interface with PIC16F877A Microcontroller
In this tutorial I will show you how to interface LCD with PIC microcontroller. You can watch the video and read the written tutorial below.
In this tutorial I am use PIC16F877A microcontroller & LM16X2 LCD display. PIC16F877A microcontroller. PIC16F877A microcontroller 8KB flash program memory & 256 Byte EEPROM memory.
LM 16X2 LCD Display it has16 pin connection.
In this tutorial I am use Mikro C Pro For PIC compiler for coding. Mikro C Pro For Pic provide a comfortable LCD library for LCD interfacing.
Circuit diagram of lcd module connection
In this tutorial I am use PIC16F877A microcontroller & LM16X2 LCD display. PIC16F877A microcontroller. PIC16F877A microcontroller 8KB flash program memory & 256 Byte EEPROM memory.
LM 16X2 LCD Display
LCD means Liquid Crystal Display. In this project I am use LM 16X2 LCD Display. 16X2 means 16 column & 2 row in this display. There are 16*2 = 32 segment in this display. Each segment hold 8x2 dot patterns.
LM16X2 LCD Display |
LM 16X2 LCD Display it has16 pin connection.
PIN CONFIGURATION |
In this tutorial I am use Mikro C Pro For PIC compiler for coding. Mikro C Pro For Pic provide a comfortable LCD library for LCD interfacing.
MIKRO C PRO FOR PIC LCD Library
The mikroC PRO for PIC provides a library for communication with Lcds (with
HD44780 compliant controllers) through the 4-bit interface.
External dependencies of LCD Library
The following variables must be defined in all projects using Lcd library. Lcd module connections example below.
// Lcd moude connection start
- sbit LCD_RS at RB0_bit ;
- sbit LCD_EN at RB1_bit ;
- sbit LCD_D4 at RB2_bit ;
- sbit LCD_D5 at RB3_bit ;
- sbit LCD_D6 at RB4_bit ;
- sbit LCD_D7 at RB5_bit ;
- sbit LCD_RS_Direction at TRISB0_bit ;
- sbit LCD_EN_Direction at TRISB1_bit ;
- sbit LCD_D4_Direction at TRISB2_bit ;
- sbit LCD_D5_Direction at TRISB3_bit ;
- sbit LCD_D6_Direction at TRISB4_bit ;
- sbit LCD_D7_Direction at TRISB5_bit ;
// Lcd module connection end
Lcd Library Routine
- Lcd_Init
- Lcd_Out
- Lcd_Out_Cp
- Lcd_Chr
- Lcd_Chr_Cp
- Lcd_Cmd
Circuit Diagram
Circuit diagram of lcd module connection
Mikro C code:
Download
You can download Mickro C file here. click the download button.
download |
No comments