Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/04/09 08:25
Modified:
  01/04/09 09:38

Read: times


 
#161297 - Ks0108 Graphics LCD read problem
I wanted to know that, to read a byte fron the Ks0108 controller, how to set the address of the byte which i want to read? I am using 128*64 LCD - PL-G12864A, and currently i hv made the func:
unsigned char lcdread(unsigned char page, unsigned char column, unsigned char chipselect)
which inturn calls setpage(page, chipselect); and setcolumn(column, chipselect); to select the (read) pointer on the LCD, can anybody confirm if its correct..? I mean do the changing if rs, rw, en in setcolumn() and setpage() functions interfere with reading of LCD. I am using the same functions for setting DDRAM address pointer also for putting data on LCD. I am unable to read from the LCD.

while(1)	 
	{	P1 = 0;					// prog has ended turn on led
		MSDelay(1000);

		for(y=0;y<8;y++)		   	//just wanted to read the LCD
		//	setpage(y,1);   //they dont seem to work :(
		//	setcolumn(x,1);
		  	for(x=0;x<64;x++)
			{
				P0 = lcdread(y,x,1);   //P0 just shows random data, dont kno even if it's random!
				MSDelay(1000);		//delay between successive reads
			}						//to see leds blinking acc to data on disp
		//	setpage(y,2);
		//	setcolumn(x,2);
			for(x=0;x<64;x++)
			{
				P0 = lcdread(y,x,2);
				MSDelay(1000);
			}

		}
	//P0 = lcdread(3,8,1);
	}
unsigned char lcdread(unsigned char page, unsigned char column, unsigned char chipselect)
{
	setpage(page, chipselect);
	setcolumn(column, chipselect);
	
	ldata=0xFF;		//make I/P port	to read data
//	en=0;	
	rw=1;				// now reading from the LCD			
	en=0;
	rs=1;				//data
	if(chipselect==1)  	// if in Left half of LCD
	{
		cs1=1;
		cs2=0;
	}
	else			 //nahi to right half
	{
		cs1=0;
		cs2=1;
	}
	en=1;	   //now data wud have come to port
	return(ldata);
}
void setpage(unsigned char y, unsigned char chipselect)
{
	lcdcmd(0xB8+y,chipselect);	
}
void setcolumn(unsigned char x, unsigned char chipselect)
{
	lcdcmd(0x40+x,chipselect);
}
void lcdcmd(unsigned char cmd, unsigned char chipselect)
{	
	rw=0;			
	if(chipselect==1)  	//if in Left half of LCD
	{
		cs1=1;
		cs2=0;
	}
	else	 //nahi to right half
	{
		cs1=0;
		cs2=1;
	}

	rs=0;				//command
	ldata = cmd;
	en=1;
	//for(a=0;a<10;a++);	//lill delay
	en=0;	

}



 



List of 7 messages in thread
TopicAuthorDate
Ks0108 Graphics LCD read problem            01/01/70 00:00      
   You need to obey the data sheet.            01/01/70 00:00      
      I tried all things but...            01/01/70 00:00      
         Using bit masks.            01/01/70 00:00      
            SORTED ! :)            01/01/70 00:00      
               Your strobe still leaves EN true            01/01/70 00:00      
                  Prhps other functions take care of it...            01/01/70 00:00      

Back to Subject List