Lcd display with PIC microcontroller and MikroC compiler
In this tutorial you will learn how to interface LCD whit PIC16F877A Microcontroller. Here we are used LM16x2 LCD display.
You can watch the video or read the written tutorial below.
LM16x2 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. There are 16 pin for connections.
Circuit Diagram
Component needed for this project
- PIC16F877A
- 8MHz Crystal
- LM16x2 Lcd display
- 10K POT
- 10K
- Breadboad
- Connection wire
- PICkit 2
- PC
- PIC Universal Programmer Adaptor
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
MikroC Code
// Lcd module connections
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;
// End Lcd module connections
void main() {
Lcd_Init(); // Initialize Lcd module
Lcd_Cmd(_LCD_CLEAR); // Clear Lcd display
Lcd_Cmd(_LCD_CURSOR_OFF); // Lcd cursor off
while(1){ // Endless loop
Lcd_Out(1,3,"WELCOME TO"); // 1st row,3rd column to start writting
delay_ms(1000); // 1second delay
Lcd_Out(2,1,"MINA TECHNOLOGY"); // 2nd row, 1st column to start writting
delay_ms(1000); // 1second delay
Lcd_Cmd(_LCD_CLEAR); // Clear Lcd display
Lcd_Out(1,3,"DEVELOPED BY"); // 1st row,1st column to start writting
delay_ms(1000); // 1second delay
Lcd_Out(2,1,"MINA TECHNOLOGY"); // 2nd row, 1st column to start writting
delay_ms(1000); // 1second delay
Lcd_Cmd(_LCD_CLEAR); // Clear Lcd display
}
}
Download free source code
Post Comments