Touch module wont compile for KS0108 GLCD but should ?

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:

Touch module wont compile for KS0108 GLCD but should ?

Post by TonyR » Sun Sep 07, 2014 12:20 am

Hi All,

Another question, hopefully to save me reverse engineering through tons of lines of code to work out what should happen ....

I am trying to use Steven Wrights nice sample touch screen programs and David's GLCD from the SF website.

If I compile drawing.bas, exactly as it is on the SF website it compiles OK.
Code is here http://www.sfcompiler.co.uk/wiki/pmwiki ... ouchScreen

If I change the #option GLCD_MODEL = S1D13700 to #option GLCD_MODEL = KS0108 I immediately get errors calling GLCD functions.

But KS0108 is display listed as one that should work in the library.

For example the line GLCD.Cls(1) is OK with S1D13700, but I get "Error Drawing.bas(86): Too many parameters" with KS0108.

This works

Code: Select all

#option GLCD_MODEL = S1D13700
This causes calls to GLCD to fail

Code: Select all

#option GLCD_MODEL = KS0108
I'm sure its something simple that I could eventually find, but I'm so short of time if someone could tell me how to fix I would be very grateful,

Thanks,
Tony R.

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

Re: Touch module wont compile for KS0108 GLCD but should ?

Post by TonyR » Sun Sep 07, 2014 2:23 am

I think I figured this out, if someone with wisdom and experience would confirm.

Stevens draw.bas and keyboard.bas are calling GLCD functions which wont work if LCD specified is KS0108 because KS0108 cant do them. ie. Colour.

So the GLCD functions available change depending on display specified with #option?

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: Touch module wont compile for KS0108 GLCD but should ?

Post by Jerry Messina » Sun Sep 07, 2014 11:22 am

So the GLCD functions available change depending on display specified with #option?
Yes, that's right.

If you take a look at the GLCD.bas file, at the beginning you'll see a list of the supported display drivers. Each one has a section like this:

Code: Select all

// import KS0108 driver...
#if GLCD_MODEL = KS0108
include "KS0108.bas"                
public dim
   Pos as KS0108.Pos, 
   Cls as KS0108.Cls,
   SetPixel as KS0108.SetPixel,
   WriteByte as KS0108.WriteByte,
   ReadByte as KS0108.ReadByte,
   GetPixel as KS0108.GetPixel
#endif
Each of those declarations is an alias to one found in the driver file, so for example if you call 'GLCD.Cls()' you're actually calling 'KS0108.Cls()'

If you look at the different driver sections you'll see that they don't all support the same functions.

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

Re: Touch module wont compile for KS0108 GLCD but should ?

Post by TonyR » Mon Sep 08, 2014 9:46 pm

Thanks very much Jerry

Post Reply