Header Ads

Lcd display with PIC microcontroller and Mikro C compiler



In this tutorial you will learn how to interface LCD whit PIC16F877A Microcontroller. 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.
LM16x2 Lcd display






16 column & 2 row







dot segment
pin configuration
circuit schematic



Component needed for this project


  1. PIC16F877A
  2. 8MHz Crystal
  3. LM16x2 Lcd display
  4. 10K POT
  5. 10K
  6. Breadboad
  7. Connection wire
  8. PICkit 2
  9. PC
  10. 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


The mikroC PRO for PIC provides a library for communication with Lcds (with HD44780 compliant controllers) through the 4-bit interface.


Lcd Library Routines


  • Lcd_Init
  • Lcd_Out
  • Lcd_Out_Cp
  • Lcd_Chr
  • Lcd_Chr_Cp
  • Lcd_Cmd














Mikro C 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
}
}



Code describe:

First time here I write codes for Lcd module connections and intialize Lcd in main funciton. Than I clear the Lcd and off the cursor.


Download here for hex file. Click download button.

download



4 comments:

  1. Sometime few educational blogs become very helpful while getting relevant and new information related to your targeted area. As I found this blog and appreciate the information delivered to my database.
    전자부품판매

    ReplyDelete
  2. I think this is an informative post and it is very useful and knowledgeable. We provide LCD modules/LCD Displays, Graphic LCM, smart Display LCD, TFT LCM, Custom LCD Module Display, and LCD panels. china LCD Manufacturers.

    tft lcd

    ReplyDelete
  3. Thanks for sharing this blog. Very useful Post. Contact STONE Tech for tft module

    tft module

    ReplyDelete
  4. Thanks for sharing this great content. If you want to buy HMI display module(Intelligent TFT LCD). Hire STONE Tech to get the best prices.
    tft lcd module

    ReplyDelete

Theme images by 5ugarless. Powered by Blogger.