Line 1: Line 1:
 
[[Category:Starter PIC16F877]]
 
[[Category:Starter PIC16F877]]
 +
In this tutorial we will see how to interface alpha-numeric LCD with PIC16F877A starter board.<br>
  
 +
 +
 +
=LCD pin Connection=
 +
Starter board comes with on board header to connect 1x16,2x16 or 4x20 LCD in <b>4-bit Mode</b>.<br>
 +
Below table shows the LCD pins connection.
 +
{| class="table table-striped table-hover table-condensed table-bordered"
 +
|-class="info"
 +
!RS || RW || EN || D0  || D1  || D2  || D3  || D4 || D5 || D6 || D7
 +
|-
 +
|PB_0  || PB_1  || PB_2  || P_NC || P_NC || P_NC || P_NC || PB_4 || PB_5 || PB_6 || PB_7
 +
|}
 +
*P_NC: Pin Not Connected
 +
<br>
 +
 
=Code=
 
=Code=
  

Revision as of 19:10, 2 May 2016

In this tutorial we will see how to interface alpha-numeric LCD with PIC16F877A starter board.


LCD pin Connection

Starter board comes with on board header to connect 1x16,2x16 or 4x20 LCD in 4-bit Mode.
Below table shows the LCD pins connection.

RS RW EN D0 D1 D2 D3 D4 D5 D6 D7
PB_0 PB_1 PB_2 P_NC P_NC P_NC P_NC PB_4 PB_5 PB_6 PB_7
  • P_NC: Pin Not Connected


Code

LCD 1x16

#include "lcd.h"
int main()
{
/*Connect RS->PB0, RW->PB1, EN->PB2 and data bus to PORTB.4 to PORTB.7*/
LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PB_4,PB_5,PB_6,PB_7);
LCD_Init(1,16);
LCD_DisplayString("Explore Lcd 1x16");
while(1);
return (0);
}

LCD 2x16

#include "lcd.h"
int main()
{
/*Connect RS->PB0, RW->PB1, EN->PB2 and data bus to PORTB.4 to PORTB.7*/
LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PB_4,PB_5,PB_6,PB_7);
LCD_Init(2,16);
LCD_DisplayString("Explore Embedded");
LCD_DisplayString("Lcd 4-bit Mode");
while(1);
return (0);
}

LCD 4x20

#include "lcd.h"
int main()
{
/*Connect RS->PB0, RW->PB1, EN->PB2 and data bus to PORTB.4 to PORTB.7*/
LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PB_4,PB_5,PB_6,PB_7);
LCD_Init(4,20);
LCD_DisplayString("Explore Embedded\n");
LCD_DisplayString("LCD 4-bit Mode\n");
LCD_DisplayString("20 x 4 \n");
LCD_DisplayString(":) :O");
while(1);
return (0);
}

Demo

The images below shows 16x2, 16x1 and 20x4 LCD's interfaced with starter AVR.
Pic16f877a 1x16 LCD.JPG


Downloads

Download the complete project folder from the below link: https://github.com/ExploreEmbedded/Pic16f877a_ExploreStarterPIC/archive/master.zip


Have a opinion, suggestion , question or feedback about the article let it out here!

Pic16f877a MPLABx Setup

In this tutorial we will see how to setup a Mplabx project to generate .hex file for Pic16f877a MPLABx Setup Steps Step1: Open the MPLABx software and select the...

Uploading Hex File Using Pickit2

In this tutorial we will see how to upload hex file using the below PICKit 2 programmer. Installing Pickit 2 Software Download and Install the Pickit2 software from...

Uploading Hex File Using Ds30 Bootloader

We will see in this tutorial how to upload hex file to PIC controller using DS30 loader GUI. Installing DS30 Software Download the DS30 Loader Software from the below...

LED Blinking with PIC16F877A Starter Board

In this tutorial we will learn how to blink the LED's with PIC16F877 Starter Board. Starter PIC board has two on board LED's connected to PORTD.0 and PORTD.1. Steps ...