LCDInfo.com
http://forum.lcdinfo.com/

reading display data from a KS0108B driver chip
http://forum.lcdinfo.com/viewtopic.php?f=9&t=166
Page 1 of 1

Author:  Phileo [ Thu Mar 06, 2003 1:40 ]
Post subject:  reading display data from a KS0108B driver chip

Hello,

I am trying to read display data from the CrystalFontz CFAG12864B graphical LCD (which uses the KS0108B chip).

I think the procedure is as follows:
SetPage;
SetColumn;

write sequence:
LCD_CTRL_REG: RESET = 1, D/I = 1, E = 1, R/W = 1, select( CSx )
LCD_CTRL_REG: RESET = 1, D/I = 1, E = 0, R/W = 1, select( CSx )
read LCD_DATA_REG;
LCD_CTRL_REG: RESET = 1, D/I = 1, E = 1, R/W = 1, select( CSx )

However, I am not reading back the 8bit data that I expect at that location.
What am I doing wrong ?


Thx.
Cheers,
Albert

Author:  Henri [ Fri Mar 07, 2003 22:49 ]
Post subject: 

Finally got to write something here as I've been quite busy the last few days.

Any progress on this ?

I quickly looked at the datasheet and it said that the data can be read when E = HIGH. I haven't personally ever read from KS0108 so I can only tell what the datasheet says.

edit:
Also noticed this in the datasheet:
Quote:
To read the contents of display data RAM, twice access of read instruction is needed. In first access, data in display data RAM
is latched into output register. In second access, MPU can read data which is latched. That is, to read the data in display data
RAM, it needs dummy read. But status read is not needed dummy read.


edit2:
I also found some code for Ks0108
Code:
void glcd_WaitIfBusy(void)
{
  outp(0x00, glcd_DataDir);
  sbi(glcd_Control, glcd_RW);
  cbi(glcd_Control, glcd_RS);
  do {
    glcd_Delay(1);
    sbi(glcd_Control, glcd_Enable);
    glcd_Delay(1);
    cbi(glcd_Control, glcd_Enable);
  } while (bit_is_set(glcd_DataIn, glcd_sBUSY));
}

unsigned char glcd_ReadData(void)
{
   glcd_WaitIfBusy();
  outp(0x00, glcd_DataDir);
  sbi(glcd_Control, glcd_RW);
  sbi(glcd_Control, glcd_RS);
  sbi(glcd_Control, glcd_Enable);
  glcd_Delay(1);
  cbi(glcd_Control, glcd_Enable);
  return inp(glcd_DataIn);
}

Author:  stef [ Fri Jul 11, 2003 17:14 ]
Post subject: 

you want write to address 1 ( for example ) :

you select the address 1 ( by send command )
you write the data in the address
and now the next address is automaticly set by the KS0108B ( address 2 )

so if you read now , you read the data in address 2 .


I think you have to send the address (the same ) beford read it .

Author:  DarkElf [ Wed Jul 23, 2003 21:53 ]
Post subject: 

attention to the lpt port: some of the pins are 0V activ, i mean that if you set the bit, it will produce 0 volt and if you clear it, it will produce 5v, it on some of the control pins.

Author:  stef [ Tue Jul 29, 2003 14:33 ]
Post subject: 

E should be low at all the time .

step by step:

- you set CSx , r/w ,d/i

- you put E =1

( maybe need delay here )

- read the bus D7-D0

- E=0

Page 1 of 1 All times are UTC + 2 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/