Problem with CLS in KS0108 driver
Moderators: David Barker, Jerry Messina
-
- Posts: 113
- Joined: Mon Jan 11, 2010 10:39 pm
- Location: Chesterfield
Problem with CLS in KS0108 driver
I'm trying to use a 128x64 LCD which uses the KS0108 driver. I can get graphics and text to display correctly. However, the GLCD.cls command does not work. The screen is 'garbled' - it looks like the command is in effect doing nothing and the data is just what happened at power-on.
Does anyone have any suggestions what may be wrong?
This LCD has a reset line which is connected. I think the driver toggles this automatically? I'm not sure however whether the hardware reset should clear the data RAM though.
I've tried this both with the 'standard' KS0108 driver and the version on here for the 3 CS devices (even though this only has 2 CS lines)
Also, I am using this with a touchscreen and I've been trying the code for this, adapted to suit. This code uses the GLCD.fill command but this does not seem to be supported on the KS0108 - any ideas why not?
Does anyone have any suggestions what may be wrong?
This LCD has a reset line which is connected. I think the driver toggles this automatically? I'm not sure however whether the hardware reset should clear the data RAM though.
I've tried this both with the 'standard' KS0108 driver and the version on here for the 3 CS devices (even though this only has 2 CS lines)
Also, I am using this with a touchscreen and I've been trying the code for this, adapted to suit. This code uses the GLCD.fill command but this does not seem to be supported on the KS0108 - any ideas why not?
-
- Posts: 113
- Joined: Mon Jan 11, 2010 10:39 pm
- Location: Chesterfield
-
- Posts: 113
- Joined: Mon Jan 11, 2010 10:39 pm
- Location: Chesterfield
More info: I can confirm that GLCD.cls is being called and the compiler is using the version in my UserLibrary folder. I've modified KS0108 as below and this clears the screen, albeit slowly!
Pen.Color = 0
y = 0
Repeat
x = 0
Repeat
SetPixel(x,y)
Inc(x)
Until x > (GLCDWidth-1)
Inc(y)
Until y > (GLCDHeight-1)
Pen.Color = 0
y = 0
Repeat
x = 0
Repeat
SetPixel(x,y)
Inc(x)
Until x > (GLCDWidth-1)
Inc(y)
Until y > (GLCDHeight-1)
I use GLCD.Cls all the time with the KS0108 driver without problems. Your GLCD definition should look something like this:
Code: Select all
#option GLCD_DATA = PORTB ' data port
#option GLCD_RS = PORTA.1 ' RS pin
#option GLCD_EN = PORTA.0 ' EN pin
#option GLCD_RW = PORTA.2 ' RW pin
#option GLCD_CS1 = PORTA.5 ' chip select
#option GLCD_CS2 = PORTA.4 ' chip select
#option GLCD_RST = PORTA.3
#option GLCD_ASPECT_RATIO = 100
#option GLCD_INIT_DELAY = 0
-
- Posts: 113
- Joined: Mon Jan 11, 2010 10:39 pm
- Location: Chesterfield
-
- Posts: 113
- Joined: Mon Jan 11, 2010 10:39 pm
- Location: Chesterfield
Sorted the copy and paste - I had an online survey open in another tab and they block the copy function, presumably for security. GLCD options are below:
Code: Select all
#option GLCD_MODEL = KS0108 // GLCD driver
#option GLCD_DATA = PORTB // data port
#option GLCD_RS = PORTC.1 // RS pin
#option GLCD_EN = PORTA.6 // EN pin
#option GLCD_RW = PORTC.0 // RW pin
#option GLCD_CS1 = PORTA.5 // chip select
#option GLCD_CS2 = PORTA.4 // chip select
#option GLCD_ASPECT_RATIO = 75 // aspect ratio
#option GLCD_INIT_DELAY = 100 // initialisation delay (ms)
#option GLCD_INVERT_CS = false // invert CS lines...
#option GLCD_RST = PORTA.7 // RST select