Black boxes are seen whenever the initialization is not proper. Check out timings in the initialization routine.
Post your code, we can find out the problem
Thank you for your reply..
The current situation is that the LCD has started working, but the characters are not being the displayed in the proper way.
example:- T in displayed as U on the lcd
Various other characters are also being displayed in the same way..
Where is the problem??
#include<delay.h>
#include<p89v51rd2.h>
#define LCD_rs P3_0
#define LCD_rw P3_1
#define LCD_en P3_2
void LCD_busy()
{
unsigned char i,j;
for(i=0;i<50;i++) //A simple for loop for delay
for(j=0;j<255;j++);
}
void LCD_init()
{
P1 = 0x38; //Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
P1 = 0x0F; //Display on, Curson blinking command
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
P1 = 0x01; //Clear LCD
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
P1 = 0x06; //Entry mode, auto increment with no shift
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->L
LCD_busy();
}
void lcd_cmd(unsigned char var)
{
P1 = var; //Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in instruction register
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
}
void LCD_senddata(unsigned char var)
{
P1 = var; //Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs = 1; //Selected data register
LCD_rw = 0; //We are writing
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
}
void LCD_sendstring(unsigned char *var)
{
while(*var)
{
LCD_senddata(*var++);
}
}
void main(void)
{
LCD_init();
lcd_cmd(0x38);
DELAY(10);
LCD_senddata('F');
LCD_senddata(':');
LCD_senddata('1');
}