Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

LCD interfacing with PIC16F877A coding

Status
Not open for further replies.

tamil_yes

Junior Member level 1
Joined
Sep 25, 2008
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,386
lcd interfacing with pic16f877a

Hi to everyone
I am trying to display the character in LCD
I have interfaced the LCD with PIC 16f877A
follwing connection
LCD PIC
pin4 (RS) RB1
pin5 (RW) RE1
pin6(EN ) RE2
pin7 to pin14 PORTD



and i have connected contrst also
I am using CCS compiler
following program is compiling in CCS compiler
but not displaying anything
can any one help me
coding
#include <16F877A.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#byte LCD_data=0x08
#bit LCD_D7=0x08.7
#bit LCD_RS=0x06.1
#bit LCD_RW=0x09.1
#bit LCD_EN=0x09.2


void LCD_busy()
{
LCD_D7=1;
LCD_EN=1;
LCD_RS=0;
LCD_RW=1;

while(LCD_D7)
{
LCD_EN=0;
LCD_EN=1;
}
}

void LCD_init()
{
LCD_data=0x38; // funtion set ; 2 line,8-bit,5x7 dot
LCD_RS=0;
LCD_RW=0;
LCD_EN=1;
LCD_EN=0;
LCD_busy();

LCD_data=0x0F; // display on,cursor blink
LCD_RS=0;
LCD_RW=0;
LCD_EN=1;
LCD_EN=0;
LCD_busy();

LCD_data=0x01; // clear lcd
LCD_RS=0;
LCD_RW=0;
LCD_EN=1;
LCD_EN=0;
LCD_busy();

LCD_data=0x06; // entry mode set,auto increment with no. shift
LCD_RS=0;
LCD_RW=0;
LCD_EN=1;
LCD_EN=0;
LCD_busy();

}

void LCD_command(unsigned char var)
{
LCD_data=var;
LCD_RS=0;
LCD_RW=0;
LCD_EN=1;
LCD_EN=0;
LCD_busy();
}

void LCD_senddata(unsigned char var)
{
LCD_data=var;
LCD_RS=1;
LCD_RW=0;
LCD_EN=1;
LCD_EN=0;
LCD_busy();
}

void main()
{

setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,WDT_18MS);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);

LCD_init();
//LCD_command();
LCD_senddata('P');

}
 

lcd interfacing in pic16f877a

I am using CCS PCW C compiler
can any one help me
 

PIC16F877A microcontroller connection with HD44780 LCD,C code for programming PIC16F877A to interface LCD
**broken link removed**
 

Hey that was a useful link but when i try to compile it it has a error in header file lcd.h .... ??? an example with working lcd would be appreciated .....
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top