Needing help with possible KS0108 controller

Discussion in 'Embedded Systems and Microcontrollers' started by coldpenguin, May 22, 2012.

  1. coldpenguin

    Thread Starter Active Member

    Apr 18, 2010
    165
    9
    So I obtained some LCD screens, but I don't think they are what they are meant to be, or are what the look like they might be.

    Using the screens as per the data sheet, nothing works. (non KS0108 controller)
    Plugging the screen into some code which I know works with a KS0108 controller, leaves me with strange results. If I connect one Chip select, that side of the screen works (almost) perfectly. It is dropped down by one Y row.
    Plugging in both CS lines, the whole display is corrupted. Unplugging the other CS line, and the other side of the screen is (almost) ok.
    So a quick test program:
    Code ( (Unknown Language)):
    1.  
    2.  
    3.  
    4. l=0;
    5. for(k=0;k<8;k++){
    6.    l=1-l;  //from here A
    7.    GLCD_CS1=l;
    8.    GLCD_CS2=1-l;   //from here B
    9.  
    10.    GLCD_EN=1;
    11.    GLCD_RS=0;
    12.    GLCD_RW=0;
    13.    for(j=0;j<100;j++){   //Delay is listed as 72us, this should be at least 100us
    14.       _asm NOP _endasm
    15.    }
    16.  
    17.    GLCD_DATA=0b10111000+k;   //Select X page
    18.  
    19.    GLCD_EN=0;
    20.    for(j=0;j<100;j++){
    21.       _asm NOP _endasm
    22.    }
    23.  
    24.  
    25.    for(i=0;i<64;i++){   //To here  
    26.       GLCD_EN=1;
    27.       GLCD_RS=1;
    28.       GLCD_RW=0;
    29.       for(j=0;j<100;j++){
    30.          _asm NOP _endasm
    31.       }
    32.  
    33.       GLCD_DATA=0b11111111;
    34. //GLCD_DATA=0b00000000; This was used for testing, if CS1, and CS2 are both active, this does what is expected
    35.  
    36.       GLCD_EN=0;
    37.       for(j=0;j<100;j++){
    38.          _asm NOP _endasm
    39.       }
    40.    }
    41. }
    42.  
    43.  
    44.  while(1)
    45. {
    46. _asm    NOP    _endasm
    47. }
    48.  
    This does exactly what is expected.
    However, if I take the code from here A-B and place it /to here/, I end up with the left hand screen mostly white, bar some missing pixels on the very left hand edge (random), and the top 1/8th of the right hand screen white.

    This occurrs even if I double all of the waits.
    I think that the device is somehow bust on the CS side of things. Any suggestions? (apart from don't buy from there any more if they don't know what they are selling). I did try it with an explicit Y select on the first X too, with no difference (and re-tried when I noticed that this code was missing it)
     
Loading...