I am using pic16f877a development with in built LCD display. I just want to display the word.
Here i am attaching the code that was built successfully in MPLAB but still nothing is displaying.
Hope many experts are here some can help on this issue
Here i am attaching the code that was built successfully in MPLAB but still nothing is displaying.
C:
#include<pic.h>
#define EN RB4
#define RS RB5
__CONFIG (0xFF02);
void lcd_delay()
{
int i;
for(i=0;i<255;i++);
}
void lcd_data(unsigned char)
{
EN=1;
RS=0;
lcd_delay();
EN=0;
}
void lcd_command(unsigned char)
{
EN=1;
RS=1;
lcd_delay();
EN=0;
}
void display_string(const char *s)
{
while(*s)
lcd_data(*s++);
}
void lcd_Init()
{
TRISB=0x00;
PORTB=0x00;
ADCON1=0x06;
lcd_command(0X01); //Clear Dispaly
lcd_delay();
lcd_command(0x0C); //Display ON, Cursor OFF
lcd_delay();
lcd_command(0x80); // Force begin to first character
lcd_delay();
lcd_command(0X06); // Inc cursor, Shift cursor to right
lcd_delay();
lcd_command(0X28); // 4bit mode,2 lines, 5x7 matrix
lcd_delay();
}
void main()
{
lcd_Init();
while(1)
{
display_string("Hai");
//lcd_data("HEI");
lcd_delay();
}
}
Last edited by a moderator: