Here is my code for interfacing 16*2 LCD with PIc16f877a in 4 bit mode
code was bulit successfully in MPLAB but there was no indication in the display of my development board
Moderator edit: added [code] ... [/code]
Code:
#include<htc.h>
#include<pic.h>
#define RS RB5
#define EN RB4
#define D4 RB0
#define D5 RB1
#define D6 RB2
#define D7 RB3
//#define _XTAL_FREQ 11059200
#include "lcd.h"
__CONFIG (0xFF02);
void main()
{
int i;
TRISB = 0x00;
Lcd4_Init();
while(1)
{
//Lcd4_Clear();
// Lcd4_Set_Cursor(1,1);
//Lcd4_Write_String("Hello World");
/* for(i=0;i<15;i++)
{
// __delay_ms(1000);
Lcd4_Shift_Left();
}
for(i=0;i<15;i++)
{
__delay_ms(1000);
Lcd4_Shift_Right();
} */
//for(i=0;i<100;i++)
Lcd4_Clear();
Lcd4_Set_Cursor(2,1);
Lcd4_Write_Char('a');
Lcd4_Write_Char('S');
//__delay_ms(2000);
for(i=0;i<1;i++);
}
}
Moderator edit: added [code] ... [/code]