Hi Eduardo,
Here under is my code for initializing the 128x64 display using KS0108
I don't know why there is double spacing in the code using the html
. If needed I can mail you this part of the code
Regards
Stephane
/*-------------------------------------------------------------------------------
LCD Initialization
GLCD_LcdINIT()
-------------------------------------------------------------------------------*/
void GLCD_LcdInit(void)
{
LCD_DATA = 0;
LCD_DI = 0;
LCD_RW = 0;
LCD_E = 0;
LCD_CS1 = 0;
LCD_CS2 = 0;
LCD_RST = 1;
pause();
LCD_RST=0;
pause();
LCD_RST=1;
pause();
LcdSelectSide(LEFT);
LcdInstructionWrite(DISPLAY_OFF); // Display OFF
LcdInstructionWrite(START_LINE);
LcdInstructionWrite(X_ADRESS);
LcdInstructionWrite(Y_ADRESS);
LcdInstructionWrite(DISPLAY_ON); // Display ON
LcdSelectSide(RIGHT);
LcdInstructionWrite(DISPLAY_OFF); // Display OFF
LcdInstructionWrite(START_LINE);
LcdInstructionWrite(X_ADRESS);
LcdInstructionWrite(Y_ADRESS);
LcdInstructionWrite(DISPLAY_ON); // Display ON
GLCD_ClearScreen();
}
/*-------------------------------------------------------------------------------
Select the side of the LCD
LcdSelectSide(U8 u8LcdSide)
u8LcdSide = LEFT or RIGHT
-------------------------------------------------------------------------------*/
void LcdSelectSide(U8 u8LcdSide)
{
if(u8LcdSide == RIGHT)
{
LCD_E=0;
LCD_DI=0;
LCD_RW=1;
LCD_CS1=0; // switch to right
LCD_CS2=1;
LcdInstructionWrite(Y_ADRESS);
}
else
{
LCD_E=0;
LCD_DI=0;
LCD_RW=1;
LCD_CS1=1; // switch to left
LCD_CS2=0;
LcdInstructionWrite(Y_ADRESS);
}
}