Reply by October 24, 20072007-10-24
Hi Jonny,

I have used a www.ramtex.dk driver. It sets a number of registers
in the initialization sequence. Manu controllers require a number
of settings. I'm not sure that your LcdInit is complete:

> void LcdInit(void) > { > LCD_CS1(); > LcdWriteCmd(DISPLAYON); > LCD_CS2(); > LcdWriteCmd(DISPLAYON); > }
Try to read your display controller manual for hints.
Reply by October 23, 20072007-10-23
Hi Johnny,

Without having looked at your source code:  standard troubleshooting
for a blank LCD screen is to check the contrast voltage.  Always
worked for me.

Regards,
Marc

Reply by johnny October 23, 20072007-10-23
Hi everybody,

I am doing programming for 128x64 KS0107/08 Graphical LCD using Rabbit
2000 microprocessor. I am new to this LCD. I couldn't find how to make a
pixel on. I tried with the program as shown below.. But I am not getting
display.

On the other hand, I didn't know what will be character size, actually
what will be the procedure to know the size of a character..

Kindly suggest me any idea or a sample program to display a character...
 



#class auto

/* commands for port settings */
#define SET_RS() BitWrPortI(PDDR,&PDDRShadow,1,0)											//SET RS
#define CLR_RS() BitWrPortI(PDDR,&PDDRShadow,0,0)											//CLR RS
#define SET_EN() BitWrPortI(PDDR,&PDDRShadow,1,1)											//SET EN
#define CLR_EN() BitWrPortI(PDDR,&PDDRShadow,0,1)											//CLR EN
#define SET_CS1() BitWrPortI(PDDR,&PDDRShadow,1,2)											//SET CS1
#define CLR_CS1() BitWrPortI(PDDR,&PDDRShadow,0,2)                        
      //CLR CS1
#define SET_CS2() BitWrPortI(PDDR,&PDDRShadow,1,3)											//SET CS2
#define CLR_CS2() BitWrPortI(PDDR,&PDDRShadow,0,3)											//CLR CS2
#define LCD_CS1() CLR_CS2();SET_CS1();
#define LCD_CS2() SET_CS2();CLR_CS1();

/* commands for LCD */
#define DISPLAYON	0x3F																				/* display on */
#define SETPAGEADR 0xB8                                                   
      /* x coordinate from 0-128 */
#define SETBYTEADR 0x40																				/* y coordinate from 0-64 */
#define SETSTARTADR 0xC0																			/* start line (z - address) */

/* function prototypes */
void LcdInit(void);
void LcdWriteCmd(unsigned char );
void LcdWriteData(unsigned char  );
void LcdDelay(void);
void LcdClear(void);
void LcdSetXY(int , int );

unsigned int i,j,x,y,row,col;

void main(void)																						/* Main Function */
{
   WrPortI ( PDFR,NULL,0x00 );
	WrPortI ( PDDCR,NULL,0xFF );
 	WrPortI ( PDDDR,NULL,0xFF );

   LcdInit();

   LcdClear();

   printf("\n MAIN LOOP");

	for(row = 0; row < 8 ; row++ ) {
		for(col = 0; col < 128 ; col++){
         LcdSetXY(row,col);
         LcdWriteData(0xFF);
      }
   }
   LcdClear();

   while(1);
}

void LcdInit(void)																					/* initialization of LCD */
{
	printf("\n Init function ");

	LCD_CS1();
   LcdWriteCmd(DISPLAYON);

	LCD_CS2();
   LcdWriteCmd(DISPLAYON);
}

void LcdWriteCmd(unsigned char cmd)																/* send command to LCD
*/
{
	printf("\n IN CMD ");
 	CLR_RS();
 	WrPortI(PADR,&PADRShadow,(PADRShadow | cmd));
	SET_EN();
	LcdDelay();
	CLR_EN();
}

void LcdWriteData(unsigned char data)															/* send data to LCD
*/
{
	printf("\n In DATA ");
	SET_RS();
 	WrPortI(PADR,&PADRShadow,(PADRShadow | data));
	SET_EN();
	LcdDelay();
	CLR_EN();
}

void LcdDelay(void)																					/* delay function */
{
   for(i=0;i<10;i++){
   	for(j=0;j<50;j++);
   }
}

void LcdClear(void)																					/* clear screen LCD */
{
	for(x=0; x<8; x++){
		for(y = 0; y < 128; y++){
         LcdSetXY(x,y);
         LcdWriteData(0x00);
      }
   }
}

void LcdSetXY(int x, int y)																	/* set pixel at a given pos.
*/
{
   if( y < 64 ){
	   LCD_CS1();
      if(x < 8)
      LcdWriteCmd(SETPAGEADR | x);
      LcdWriteCmd(SETBYTEADR | y);
   }
   else {
      LCD_CS2();
      if(x < 8)
      LcdWriteCmd(SETPAGEADR | x);
      LcdWriteCmd(SETBYTEADR | y);
	}
}