1
'''A demonstration program for GCGB and GCB.
2
'''--------------------------------------------------------------------------------------------------------------------------------
3
'''This program is a simple GLCD demonstration of the KS0108 GLCD capabilities.
4
'''This program draws lines, boxes, circles and prints strings and numbers.
5
'''The GLCD is connected to the microprocessor as shown in the hardware section of this code.
6
'''@author EvanV with works of ChuckH
10
'''********************************************************************************
15
#define GLCD_TYPE GLCD_TYPE_KS0108 ' This is the Default value, not required.
18
#define GLCD_CS1 PORTC.0 'D12 to actually since CS1, CS2 can be reversed on some devices
19
#define GLCD_CS2 PORTC.1
20
#define GLCD_DB0 PORTD.0 'D0 to pin 7 on LCD
21
#define GLCD_DB1 PORTD.1 'D1 to pin 8 on LCD
22
#define GLCD_DB2 PORTD.2 'D2 to pin 9 on LCD
23
#define GLCD_DB3 PORTD.3 'D3 to pin 10 on LCD
24
#define GLCD_DB4 PORTD.4 'D4 to pin 11 on LCD
25
#define GLCD_DB5 PORTD.5 'D5 to pin 12 on LCD
26
#define GLCD_DB6 PORTD.6 'D6 to pin 13 on LCD
27
#define GLCD_DB7 PORTD.7 'D7 to pin 14 on LCD
29
#define GLCD_RS PORTe.0
30
#define GLCD_Enable PORTe.2
31
#define GLCD_RW PORTe.1
32
#define GLCD_RESET PORTC.2
34
' Changed timing for 32 mhz device
35
#define KS0108ReadDelay 2 ; = 2 normal usage, 6 or above is OK at 32 mhz!
36
#define KS0108WriteDelay 1 ; = 1 normal usage you may get away with 0, 2 or above is OK at 32 mhz!
37
#define KS0108ClockDelay 1 ; = 1 normal usage you may get away with 0, 2 or above is OK at 32 mhz!
38
'change to LED height, this, avoids set the 4 LED signals
39
#define LED_GLCD_HEIGHT GLCD_HEIGHT-1
42
Dim CHAR, XVAR as Byte
44
; ----- Main body of program commences here.
49
GLCDPrint 0,10,"Hello"
53
GLCDPrint 0,10, "ASCII #:"
55
'Draw Box Around ASCII Character
60
GLCDPrint 17, 20 , Str(char)
61
GLCDdrawCHAR 20,30, char
65
'Draw Line using line command
68
'draw line using Pset command