scorrpeio
Full Member level 5
PIC+LCD problem
Hello,
I wrote a codeto display some data on LCD display.
But, I am not getting anything on the display
The PORT D is for DATA and PORT A is for E(RA1), RS(RA3), R/W(RA2) LCD control bits.
The command logic works fine. But, Data is nowhere displayed on to the screen.
Please suggest me where I am going wrong. What to do to display some data onto the screen.
thank you in advance
Hello,
I wrote a codeto display some data on LCD display.
But, I am not getting anything on the display
Code:
#include<p18f4520.h>
#pragma config WDT = OFF
void Delay( void );
void GetLCDCommand(void);
void GetLCDData(void);
void main(void)
{
int index;
char A[10];
TRISA = 0x0; //PORT A configured in O/P mode
TRISD = 0x00;
GetLCDCommand();
//Configure Display as 2-line, 8-bit, 5x7-dots
PORTD = 0x38;
GetLCDCommand();
//to get a blinking curser display
PORTD=0X0F;
GetLCDCommand();
//to clear display
PORTD=0X01;
GetLCDCommand();
while(1)
{
PORTD = 0xff;
GetLCDData();
}
}
void Delay( void )
{
float index;
for( index = 0; index < 10000; index++ )
{
//do nothing
}
}
void GetLCDCommand(void)
{
int index;
PORTA = 0b0010;
PORTA = 0b0000;
for (index = 0; index < 1000; index++)
{
}
}
void GetLCDData(void)
{
int index;
PORTA = 0b1010;
PORTA = 0b1000;
for (index = 0; index < 1000; index++)
{
}
}
The PORT D is for DATA and PORT A is for E(RA1), RS(RA3), R/W(RA2) LCD control bits.
The command logic works fine. But, Data is nowhere displayed on to the screen.
Please suggest me where I am going wrong. What to do to display some data onto the screen.
thank you in advance