CFAH2004K initialization String?

BlogSpider

New member
I'm having issues. What's the initialization string for this LCD? I want to enable ALL FOUR LINES.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

CF Tech

Administrator
It should be the standard sequence for any 20x4 LCD. Here is one example:

Code:
/////////////////////////////////////////////////////////////////////////////
void Write_LCD_Data_8(ubyte data)
  {
  //Make register select 1, Make R/W 0=write
  OnRsH();
  OnRwL();
  //Write the data to the port.
  data_register=data;	
  Update_Buttons_From_Data_Register();
  //Strobe enable
  Sleep(1);
  OnEH();
  Sleep(1);
  OnEL();
  }
/////////////////////////////////////////////////////////////////////////////
void Write_LCD_Control_8(ubyte data)
  {
  //Make register select 0, Make R/W 0=write
  OnRsL();
  OnRwL();
  //Write the data to the port.
  data_register=data;	
  //Strobe enable
  Sleep(1);
  OnEH();
  Sleep(1);
  OnEL();
  }
/////////////////////////////////////////////////////////////////////////////
void Init_LCD_8(void)
  {
  //This sequence is from the initialization on page 45 of the HD44780U
  //data sheet.
  Sleep(40);
  Write_LCD_Control_8(0x38);
  //Yes, the data sheet says write it twice.
  Sleep(5);
  Write_LCD_Control_8(0x38);
  //Yes, the data sheet says write it three times.
  Sleep(125);
  Write_LCD_Control_8(0x38);
  //Yes, the data sheet says write it four times, but at least this one counts.
  //038h is Function set:
  //8 bit,
  //2 line
  //F = (5x8)
  Sleep(1);
  Write_LCD_Control_8(0x38);
  //"Display off"
  Sleep(2);
  Write_LCD_Control_8(0x08);
  //"Display clear"
  Sleep(2);
  Write_LCD_Control_8(0x01);
  //006h is Entry mode set, increment, no shift
	Sleep(2);
  Write_LCD_Control_8(0x06);
  //Display on, cursor on, blinking
	Sleep(2);
  Write_LCD_Control_8(0x0F);
  //Clear the display again. This seems to fix a power-up problem
  //where the display shows "{{{{{" in a couple of places.
	Sleep(2);
  Write_LCD_Control_8(0x01);
  }
/////////////////////////////////////////////////////////////////////////////
The addresses to access the lines are:
Code:
line  value written to control register
  0   0x80
  2   0xC0
  3   0x94
  4   0xD4
Then you write the data to be shown to the data register.

Please let me know if that is what you needed, or if you have other questions.

(ref: http://www.crystalfontz.com/software/CFAH_WinTest/index.html )
 
Top