GLCD Double Image

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
TonyR
Posts: 75
Joined: Fri Jan 14, 2011 11:49 pm
Location: Sydney
Contact:

GLCD Double Image

Post by TonyR » Tue Sep 23, 2014 9:49 am

Hi All,

Ive got the GLCD library going nicely except with one bug.

The screen of the display (KS0801 controller) seems to be divided in half, probably due to CS1 CS2 operation.

If I try to place text or a graphic such as a box on the screen it thinks that the X compoent of 0,0 is mid screen. Y works OK.

ie.

Code: Select all

GLCD.WriteAt(0,31,"Hello")
actually appears midscreen for X, not where x is 0. (its a 128 pixel screen). Y 31 is OK.

If I comment out the "Invert Chip Select" library directive I then get "hello" where x is 0 as well as where x is mid screen. Y is OK.

There seems to be something mixed up with the X position / chip select operation?

Advice welcome.

Code is below,

Thanks,

Tony R.

Code: Select all

Device = 18F87J93                    // select our device
Clock = 12
Config OSC = HS
                          
// User options
#Option GLCD_MODEL = KS0108         // GLCD driver    
#option GLCD_SCREEN_WIDTH = 128     // Screen Width in Pixels 
#option GLCD_SCREEN_HEIGHT = 64     // Screen Height in Pixels 
#Option GLCD_DATA = PORTD           // data port
#Option GLCD_RS  = PORTB.2          // RS pin
#Option GLCD_RW  = PORTB.1          // RW pin
#Option GLCD_EN  = PORTB.0          // EN pin
#Option GLCD_CS1 = PORTB.4          // chip select
#Option GLCD_CS2 = PORTC.4          // chip select
#Option GLCD_RST = PORTE.3          // reset pin
#Option GLCD_ASPECT_RATIO = 100     // aspect ratio, smaller number will squeeze y for GLCD circles and box 
#Option GLCD_INIT_DELAY = 50        // initialisation delay (ms) 
'#Option GLCD_INVERT_CS = true       // invert CS lines... 
 
Include "glcd.bas"           // main GLCD module
Include "graphics.bas"       // support for GLCD
Include "Bitmaps.bas"        // support for GLCD
Include "Arial.bas"          // ArialFont for GLCD


                             
TRISD = %00000000           // IO is on ports B D and E       
TRISB = %00000000                
TRISE = %00000000               

While true 
    GLCD.Cls                    
    DelayMS(1000)
    GLCD.SetFont(ArialBold)
    GLCD.WriteAt(0,31,"Hello")    ' hello is succesfully blinked but at x =0 and x = midscreen (64 I guess)
    DelayMS(1000)        
Wend


TonyR
Posts: 75
Joined: Fri Jan 14, 2011 11:49 pm
Location: Sydney
Contact:

Re: GLCD Double Image

Post by TonyR » Tue Sep 23, 2014 8:44 pm

Further to my bug causing the GLCD to show two "hellos"

I checked the CS1 and CS2 lines, they are fine

Is the Library calculating 2 x 64 pixel wide screens instead of 1 x 128 pixel widescreen? Suggestions welcome

Here is what it looks like
[img]
"c:\hello on lcd.jpg"
[/img]

TonyR
Posts: 75
Joined: Fri Jan 14, 2011 11:49 pm
Location: Sydney
Contact:

Re: GLCD Double Image

Post by TonyR » Tue Sep 23, 2014 8:49 pm

[img]
<img src="c:\lcd.jpg" alt="Hello on LCD" style="width:350px;height:250px">
[/img]

bitfogav
Registered User
Registered User
Posts: 169
Joined: Sat Oct 09, 2010 1:39 pm
Location: United Kingdom

Re: GLCD Double Image

Post by bitfogav » Thu Oct 09, 2014 11:39 pm

I know this is a late reply and you might have fixed this issue?, I can't see the images that you have uploaded but I have had this issue before and it turned out to be my CS lines.. I just swapped the GLCD CS lines around (CS1 to CS2 etc), and that fixed it..

Try this from

Code: Select all

#Option GLCD_CS1 = PORTB.4          // chip select
#Option GLCD_CS2 = PORTC.4          // chip select
To

Code: Select all

#Option GLCD_CS1 = PORTC.4          // chip select
#Option GLCD_CS2 = PORTB.4          // chip select

TonyR
Posts: 75
Joined: Fri Jan 14, 2011 11:49 pm
Location: Sydney
Contact:

Re: GLCD Double Image

Post by TonyR » Sat Nov 22, 2014 5:52 am

Thanks BitforGav, it was the CS lines. All good now.

Post Reply