CFAH1601 initialization

trickster

New member
Hey, I'm new to LCD programming. I have read the data sheet on how to initialize the lcd and I guess I'm not doing something right. I'm doing a project where I'm interfacing the lcd with an 8051. I was curious if anyone had code in c that I could possibly look at so I can see where I'm going wrong.

Here's what I wrote:

//Initializing the LCD
void lcd_init()
{
//Sets LCD to default settings
EN = 0;
RS = 1;
// RW = 0;

lcd_wait();
lcd_wait();
lcd_wait();
lcd_wait();
lcd_wait();
lcd_wait();
lcd_wait();
lcd_wait();
lcd_wait();

EN = 0;
RS = 1;
// RW = 0;

//Set LCD to single line mode
RS = 0;
EN = 1;
P1 = 0x34; //Function set of data legth:8-bit(1), # of line:1
//display font type - F:5x8dots (0)
EN = 0;
lcd_wait();
lcd_wait();
lcd_wait();

//Turns on display
RS = 0;
EN = 1;
P1 = 0x0C; //Sets the display to on, cursor off, blinking off
EN=0;
lcd_wait();

reset_curpos();
}


RS and EN are sbits... I grounded R/W since I'm only writing, never reading. I know the lcd works because I grounded V0, grounded Pin 1 and have Vcc at 5V.

I appreciate it!
trickster
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

trickster

New member
I tried to look at the source code and I didnt' see where the initialization of the lcd was. Any idea which one I should look at?
Thanks!
 
Top