Graphic
LCD
' Graphic_64x128-multitest.bas
' At 20MHz PIC clock the GLcdpset command gives false patterns
' OK at 12MHz and below
AllDigital
PORTA = 0
PORTB = 0
PORTC = 0
PORTD = 0
PORTE = 0
TRISA = 0
TRISB = 0
TRISC = 0
TRISD = 0
TRISE = 0
Define GLCD_DREG = PORTB
Define GLCD_RSREG = PORTA '- defines the port where rs line is connected
To
Define GLCD_RSBIT = 1 '- defines the pin where rs line is connected
To
Define GLCD_EREG = PORTC '- defines the port where e line is connected
To
Define GLCD_EBIT = 5 '- defines the pin where e line is connected To
Define GLCD_RWREG = PORTA '- defines the port where R / W line is connected
To
Define GLCD_RWBIT = 5 '- defines the pin where R / W line is connected
To
Define GLCD_CS1REG = PORTD '- defines the port where cs1 line is connected
To
Define GLCD_CS1BIT = 0 '- defines the pin where cs1 line is connected
To
Define GLCD_CS2REG = PORTC '- defines the port where cs2 line is connected
To
Define GLCD_CS2BIT = 0 '- defines the pin where cs2 line is connected
To
Symbol ltc_cs1 = PORTD.0
Symbol ltc_cs2 = PORTC.0
ltc_cs1 = 1
ltc_cs2 = 1GLcdinitloop:
'--------------------------
'flash all pixels 3 times
GLcdclear 0x00
WaitMs 1000
GLcdclear 0xff
WaitMs 1000
GLcdclear 0x00
WaitMs 1000
GLcdclear 0xff
WaitMs 1000
GLcdclear 0x00
WaitMs 1000
GLcdclear 0xff
WaitMs 1000
GLcdclear 0x00
WaitMs 1000
'--------------------------
' swipe all on
Dim i As Byte
Dim j As Byte
For i = 0 To 127
For j = 0 To 63
'WaitMs 50
GLcdpset i, j
Next j
WaitMs 10
Next i
WaitMs 2000
'--------------------------
'fill with writing
'Dim i As Byte
GLcdclear 0x00
For i = 0 To 15
GLcdposition i, 0
GLcdwrite "Page: ", #i
WaitMs 100
Next i
'--------------------------
' delete in blocks
For i = 0 To 15
GLcdclean i
WaitMs 500
Next i
WaitMs 1000
'--------------------------
' draw two diagonal lines
Dim k As Byte
For j = 0 To 63
GLcdpset j, j
Next j
For j = 0 To 63
k = j + 63
GLcdpset k, j
Next j
WaitMs 1000
Goto loop
|