Extended GLCD library for PIC18 - new version

General discussion on mikroPascal PRO for PIC.
Author
Message
janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Extended GLCD library for PIC18 - new version

#1 Post by janni » 06 Oct 2009 14:22

New version, of uGLCD is available - see here
_______________________________________________

Those that used this lib under mP 7 already know it's properties. It's been updated and slightly extended for the incoming mP PRO 3.00 release.

For those that never heard of this library, a short description follows.

It's a rather extensive library, called xGLCD, for PIC18 processors and KS107 based GLCDs (128x64 pixels) containing both textual and graphical routines allowing to draw on both the physical screen and a virtual one, placed in RAM.

Basic properties:
- both text and graphics may be drawn anywhere on the screen,
- 'packed' bitmap format implemented saving ROM space,
- clipping rectangle for most graphical functions,
- routines for copying whole, or part of the screen from GLCD to RAM and back,
- routines for icon drawing (from RAM or ROM), inverting, and horizontal shifting,
- both ME's fonts and variable-width fonts of any size (created, for example with Octal's GLCD Font Creator, http://www.pocketmt.com/) may be used,
- increased speed performance over standard lib, especially visible for higher clock frequencies.


For those that don't want to read further, here's a link to the lib: http://www.cobir.com/xGLCD_PRO.rar

The library consists of two parts - the main, precompiled lib file, xGLCDlib.mcl, and a header file, xGLCDheader.mpas. The latter is more than just a header. It also contains all the low level functions for communication with the GLCD. It's possible, therefore, to modify it, for example to work with GLCD connected by a serial interface, like SPI.

The header file also contains definitions of text, draw and plot styles and properties (xGLCD_Transparency, xGLCD_Var_Width, xGLCD_Add_Column, xGLCD_Aspect_ratio, and xGLCD_Clipped). The latter may be set and read with appropriate routines.

The header file should be placed together with user application (the main lib may be placed in mP Uses\P18 directory and, optionally, included in used processor definition file) and compiled after any change to it - like after redefining the data and control ports and lines. These are defined easily in the following part of header file:

Code: Select all

// --> Adjust data and control ports here to fit the hardware:

   atDataP = atPORTD;	// data port assignment
   atCtrlP = atPORTB;	// control lines port assignment

   GD_CS1 = 2;		    // GLCD control lines (CtrlP)
   GD_CS2 = 3;
   GD_rs  = 4;
   GD_rw  = 5;
   GD_en  = 6;
   GD_rst = 7;
There are also switches (define directives) optimising the lib for particular application which should be commented/uncommented:

Code: Select all

{$Define no_reset}	// no reset (GD_rst) line

{$Define RAMdraw}	 // allows drawing on RAM screen

{$Define LTE4MHz}	 // oscillator freq <= 4MHz 
For those that don't want to bother with manually changing the header file, there is an easier solution provided - a MakroIt Windows program (original idea by JoseLB) that prepares a ready to use header file copied to clipboard or directly saved as xGLCDheader.mpas file.

The Bitmap2Array PC program, included in the package, may be used to convert bitmaps to screens and icons in compressed format (for details, see http://www.mikroe.com/forum/viewtopic.php?t=13979).

An example program, xGlcdDemo, is provided to demonstrate the use of library routines. It was tested with PIC18F4620 processor. There's also library description in pdf format.

Have fun :) .
Last edited by janni on 31 Oct 2019 22:03, edited 2 times in total.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#2 Post by janni » 18 Oct 2009 11:16

The MakroIt and Bitmap2Array programs have been updated for use with other compilers (plus minor changes). It's not really necessary to use new versions with mP, but they're available with the whole xGLCD package.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#3 Post by janni » 28 Oct 2009 18:22

The library has been recompiled to allow the use of ICD. Apparently precompiled libs have to be compiled with ICD Debug option - only then programs that use them may be compiled both in Release and ICD Debug mode.

FRM
Posts: 381
Joined: 20 May 2005 18:58
Location: UK

#4 Post by FRM » 05 Nov 2009 16:19

Hi Janni, I finally got around to porting a project to Pro v.3.20. I've got an issue when using your xGLCD lib, whereby the colour parameter
passed in function calls as text styles constants 'xGLCD_tsErase' 'xGLCD_tsWrite' & 'xGLCD_tsInverse' are not recognised. I assume I can pass the numerical equivalent. Any ideas?
Thanks in advance :wink:

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#5 Post by janni » 05 Nov 2009 17:01

Hi FRM,

There is no reason why this should happen. The example attached to the lib uses these constants without problems. Are you sure you've included xGLCDheader unit in the uses clause (or sources in Project Manager)?

Do you call the text routines from main unit, or another one?

FRM
Posts: 381
Joined: 20 May 2005 18:58
Location: UK

#6 Post by FRM » 05 Nov 2009 17:39

Okay, in my infinite wisdom and avoidance of using the uses clause I forgot to add the header unit to the project manager - doh! :oops:
Thanks for giving my brain a shake up. :wink:

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#7 Post by janni » 14 Dec 2009 01:07

New version of xGLCD lib is available. The only change concerns ISR context saving of FSR registers used in the lib. Compiler doesn't notice if FSR registers are used in Pascal so I've changed all instances of FSR loading to assembly. Now the compiler should notice they're in use in main code and add them to context saving in ISR if other procedures called from there also use them.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Extended GLCD library for PIC18

#8 Post by janni » 04 Jul 2011 17:18

xGLCD lib compiled with mP PRO v5.00 is available (see first post for the download link).

FRM
Posts: 381
Joined: 20 May 2005 18:58
Location: UK

Re: Extended GLCD library for PIC18

#9 Post by FRM » 05 Jul 2011 00:48

Many thanks for the quick response & update janni :)
Best wishes,
Frankie

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Extended GLCD library for PIC18

#10 Post by janni » 14 Mar 2012 14:53

Forgotten to write about it :( - new GLCD library, this time called uGLCD is available for some time already. It's a successor of xGLCD, somewhat expanded, with different unit organisation and using sbits (thus shifting the adjustable part to main unit). It's also easily integrated with IDE via Package Manager.

Library part responsible for contact with hardware (GLCD controller) is still separate and as kind of hardware driver may be modified to fit different controllers. There are examples of such 'drivers' for controllers with write-only SPI interface, like uC1701 (small DOG displays) or ST7565R (some COG displays). Displays with sizes different from regular 128x64 pixels (like those with three KS107/8 controllers) may also be used with uGLCD.

uGLCD library optimized for PIC18 processors may be downloaded from this site.

There exists version of the library in pure Pascal that may, in principle, be compiled for any PIC family with enough RAM and ROM, but I haven't had time (or need, so far) to test it with processors more advanced than PIC18s.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Extended GLCD library for PIC18 - new version

#11 Post by janni » 31 Jul 2012 20:59

New version of uGLCD is available (0.07). An Area procedure has been added and bitmap2array program modified. Now it's possible to have compressed (packed) images of a partial screen area stored in Flash. Thanks to Malcolm_M, there's also new driver for GLCDs with ST7528 controllers (160x100 pixels).

uncleworf
Posts: 9
Joined: 05 May 2008 17:48

Re: Extended GLCD library for PIC18 - new version

#12 Post by uncleworf » 28 Mar 2013 21:21

I've installed mP PRO for PIC 6.0.0. Then I try to Install uGLCD .
I download from www,cobir.com and install with Package manager.
Now installed is version _0_006. uGLCDlib.
I need uGLCD_ST7565R for COG display.
Another problem. I need this lib. for mBasic PRO for PIC.
How can I translate??

best Regards
TOM

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

Re: Extended GLCD library for PIC18 - new version

#13 Post by LGR » 28 Mar 2013 21:29

There's a very basic ST7565R driver at Libstock, that contains the Pascal source and should be easily recompiled for PIC18, however, it doesn't have any of the higher level functions. It's just raw graphics.

It would be nice if somehow the vertical byte 128x64 library could be broken into higher level functions and lower lever drivers so that this could be used with hardware other than KS107, but AFAIK, we don't have that.

What I've found is that it's not hard to use the GLCD font generator with the ST7565R driver; you just have to understand how the font generator format works. It's the exact same format between the ST7565R and the KS107.
If you know what you're doing, you're not learning anything.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Extended GLCD library for PIC18 - new version

#14 Post by janni » 29 Mar 2013 03:11

uncleworf wrote:I've installed mP PRO for PIC 6.0.0. Then I try to Install uGLCD .
I download from www,cobir.com and install with Package manager.
Now installed is version _0_006. uGLCDlib.
Yes, I've forgotten to update the number in all places :( . Anyway, v 0.06 already had driver for ST7565R with SPI.
Another problem. I need this lib. for mBasic PRO for PIC.
How can I translate??
I could probably prepare a package for mB but you'd have to translate the driver. I don't have time to do it but I may help as time allows.

@LGR
It would be nice if somehow the vertical byte 128x64 library could be broken into higher level functions and lower lever drivers so that this could be used with hardware other than KS107, but AFAIK, we don't have that.
And all this time I believed that I did that :wink: .

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

Re: Extended GLCD library for PIC18 - new version

#15 Post by LGR » 29 Mar 2013 04:42

:oops:

Oops. I never bothered installing this, because it was only for PIC18, and I'm using the GLCD on PIC32. This does look good. Maybe some day I'll recompile it for PIC32.
If you know what you're doing, you're not learning anything.

Post Reply

Return to “mikroPascal PRO for PIC General”