The displays seem quite easy to use, you can easily draw lines, circles, rectangles, ellipse, images, and even text.
Below is a demo picture of my GLCD using all of the above.. also my demo code below which ive commented to show what is going on, any questions please ask!.
Code: Select all
Device = 18F2620 // select our device
Clock = 32 // internal 8Mhz * 4 PLL 32Mhz Clock
Config OSC = INTIO67 // configure OSC for internal
// 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 = PORTB // data port
#Option GLCD_RS = PORTC.0 // RS pin
#Option GLCD_RW = PORTC.1 // RW pin
#Option GLCD_EN = PORTC.2 // EN pin
#Option GLCD_CS1 = PORTC.3 // chip select
#Option GLCD_CS2 = PORTC.4 // chip select
#Option GLCD_RST = PORTC.5 // 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...
// Modules
Include "glcd.bas" // main GLCD module
Include "graphics.bas" // support for GLCD
Include "Bitmaps.bas" // support for GLCD
Include "utils.bas" // support to make all MCU pins Digital
Include "Arial.bas" // ArialFont for GLCD
// PORT setup and PLL Multiplier (set internal Osc to 32Mhz)
TRISA = %00000000 //
TRISB = %00000000 // Set all Ports output
TRISC = %00000000 //
OSCCON = %01111100 // Sets up the internal oscillator for 8Mhz
OSCTUNE.6 = 1 // Frequency Multiplier PLL for INTOSC Enable bit (Enabled)
SetAllDigital // set MCU pins as digital
// Demo pattern on GLCD
GLCD.Cls // clear GLCD display
GLCD.Rectangle(0,0,127,63) // draws a rectangle on all corners of display (X,Y,X,Y)
GLCD.Line(6,6,20,60) // draws line (left of screen)
GLCD.Line(125,2,105,2) // draws line (top right of screen)
GLCD.Ellipse(40,32,20,30) // draws Ellipse
GLCD.Circle(94,25,20) // draws Circle
GLCD.SetFont(ArialBold) // set font BOLD
GLCD.WriteAt(60,50,"Bitfogav") // write String to GLCD at x=60 y=50
GLCD.SetImage(65,4,BatteryImage, cmXOR) // draws image on GLCD (battery Image from Bitmap module)
// Main Programme
While true
// Flash LED
Output(PORTA.0)
High(PORTA.0)
DelayMS(1000)
Low(PORTA.0)
DelayMS(1000)
Wend