Hello, All:
This project uses BasicStamp 2P (also you can use PIC MCU) to interface with a GLCD Display and JP SerGLCD Module. Code used is standard PBasic 2.5, it should work on most BasicStamp chips.
Components:
1) Basic Stamp 2P
Manufactory: Parallax Home
Datasheet: BASIC Stamp Documentation
2) Graphic LCD 128x64
Manufactory: Circuit-ED - Electronic Development ProductsDatasheet: http://circuit-ed.com/uplds/GDM12864B.pdf
3) JP SerGLCD Module
Manufactory: Jianping ElectronicsDatasheet: http://www.jianpingusa.com/datasheet/JPSerGLCDUserManual12864.pdf
Project video :
Project Pictures:
Project code:
Visit my website at: http://oldspring.110mb.com/
Have fun!!!
OldSpring
This project uses BasicStamp 2P (also you can use PIC MCU) to interface with a GLCD Display and JP SerGLCD Module. Code used is standard PBasic 2.5, it should work on most BasicStamp chips.
Components:
1) Basic Stamp 2P
Manufactory: Parallax Home
Datasheet: BASIC Stamp Documentation
2) Graphic LCD 128x64
Manufactory: Circuit-ED - Electronic Development ProductsDatasheet: http://circuit-ed.com/uplds/GDM12864B.pdf
3) JP SerGLCD Module
Manufactory: Jianping ElectronicsDatasheet: http://www.jianpingusa.com/datasheet/JPSerGLCDUserManual12864.pdf
Project video :
Project Pictures:
Project code:
'=========================================================
' File........OldSpring GLCD 128x64 Simple Project.BSP
' Purpose.....BS2P + Serial GLCD Module
' Auther......OldSpring
' [email protected]
' WebSite.....http://oldspring.110mb.com
' Code........Mar 8, 2010
'========================================================
' {$STAMP BS2p}
' {$PBASIC 2.5}
SOUT PIN 0 ' Serial output to Rx
S_IN PIN 1 ' Serial input to Tx
x VAR Byte
x1 VAR Byte
x2 VAR Byte
y1 VAR Byte
y2 VAR Byte
idx VAR Byte
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T4800 CON 188
T9600 CON 84
T19K2 CON 32
T38K4 CON 6
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T4800 CON 500
T9600 CON 240
T19K2 CON 110
T38K4 CON 45
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T480 CON 813
T9600 CON 396
T19K2 CON 188
T38K4 CON 84
#ENDSELECT
Inverted CON $4000
Baud CON T19K2 '+ Inverted
'==============================================================
' Main program
'==============================================================
Main:
PAUSE 1000
GOSUB CleanScreen
idx = 1 'Set font #1
GOSUB SetFont
GOSUB text0
GOSUB SetFont
GOSUB text1
idx = 3 'Set font #3
GOSUB SetFont
GOSUB oldspring
x1 = 0
y1 = 0
x2 = 127
y2 = 63
GOSUB Draw_Round_Rectang
x1 = 1
y1 = 1
x2 = 126
y2 = 62
GOSUB Draw_Round_Rectang
x1 = 14
y1 = 12
x2 = 112
y2 = 31
GOSUB Draw_Rectang
x1 = 15
y1 = 13
x2 = 97
y2 = 18
GOSUB Invert
x1 = 15
y1 = 13
x2 = 97
y2 = 18
GOSUB Shift_Hor
GOSUB CleanScreen
x1 = 14
y1 = 12
x2 = 112
y2 = 31
GOSUB Draw_Rectang
GOSUB oldspring
PAUSE 1000
GOSUB shift_Y
END
'=========================== Draw Round Rectang ========================
Draw_Round_Rectang:
PAUSE 100
SEROUT SOUT, Baud, [$57] 'Round Rectang function
SEROUT SOUT, Baud, [x1] 'x1
SEROUT SOUT, Baud, [y1] 'y1
SEROUT SOUT, Baud, [x2] 'x2
SEROUT SOUT, Baud, [y2] 'y2
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, [250]
PAUSE 100
RETURN
'============================= Draw Rectang ============================
Draw_Rectang:
PAUSE 100
SEROUT SOUT, Baud, [$56] 'Rectang function
SEROUT SOUT, Baud, [x1] 'x1
SEROUT SOUT, Baud, [y1] 'y1
SEROUT SOUT, Baud, [x2] 'x2
SEROUT SOUT, Baud, [y2] 'y2
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, [250]
PAUSE 100
RETURN
'================================ Invert ===============================
Invert:
PAUSE 100
FOR idx = 0 TO 8
SEROUT SOUT, Baud, [$27] 'Invert function
SEROUT SOUT, Baud, [x1] 'x1
SEROUT SOUT, Baud, [y1] 'y1
SEROUT SOUT, Baud, [x2] 'w
SEROUT SOUT, Baud, [y2] 'h
SEROUT SOUT, Baud, [250]
PAUSE 1000
NEXT
PAUSE 100
RETURN
'=========================== Clean Screen ==============================
CleanScreen:
SEROUT SOUT, Baud, [$23]
SEROUT SOUT, Baud, [0]
SEROUT SOUT, Baud, [250]
PAUSE 100
RETURN
'============================= Set Font ================================
SetFont:
SEROUT SOUT, Baud, [$24]
SEROUT SOUT, Baud, [idx]
SEROUT SOUT, Baud, [250]
PAUSE 100
RETURN
'=========================== Screen Text0 ===============================
Text0:
SEROUT SOUT, Baud, [$2B]
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, ["by OldSpring"]
SEROUT SOUT, Baud, [250]
PAUSE 100
SEROUT SOUT, Baud, [$5F]
SEROUT SOUT, Baud, [30]
SEROUT SOUT, Baud, [48]
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, [250]
PAUSE 100
RETURN
'=========================== Screen Text1 ===============================
Text1:
SEROUT SOUT, Baud, [$2B]
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, ["GLCD Simple Project"]
SEROUT SOUT, Baud, [250]
PAUSE 100
SEROUT SOUT, Baud, [$5F]
SEROUT SOUT, Baud, [8]
SEROUT SOUT, Baud, [38]
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, [250]
PAUSE 100
RETURN
'=========================== OldSpring Screen ===============================
OldSpring:
SEROUT SOUT, Baud, [$2B]
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, ["OldSpring"]
SEROUT SOUT, Baud, [250]
PAUSE 100
SEROUT SOUT, Baud, [$5F]
SEROUT SOUT, Baud, [25]
SEROUT SOUT, Baud, [15]
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, [1]
SEROUT SOUT, Baud, [250]
PAUSE 100
RETURN
'=========================== Shift Hor ===============================
Shift_Hor:
PAUSE 100
FOR idx = 0 TO 96
SEROUT SOUT, Baud, [$26]
SEROUT SOUT, Baud, [x1 + idx]
SEROUT SOUT, Baud, [y1]
SEROUT SOUT, Baud, [x2 - idx]
SEROUT SOUT, Baud, [y2]
SEROUT SOUT, Baud, [1] 'Move text to Right side
SEROUT SOUT, Baud, [250]
PAUSE 100
NEXT
PAUSE 1000
RETURN
'=========================== Shift Y ===============================
Shift_Y:
PAUSE 100
FOR idx = 63 TO 32
SEROUT SOUT, Baud, [$25]
SEROUT SOUT, Baud, [idx] 'Move picture down
SEROUT SOUT, Baud, [250]
PAUSE 100
NEXT
PAUSE 1000
FOR idx = 32 TO 76
SEROUT SOUT, Baud, [$25]
SEROUT SOUT, Baud, [idx] 'Move picture up
SEROUT SOUT, Baud, [250]
PAUSE 100
NEXT
PAUSE 1000
SEROUT SOUT, Baud, [$25]
SEROUT SOUT, Baud, [0] 'Back to original position
SEROUT SOUT, Baud, [250]
RETURN
Visit my website at: http://oldspring.110mb.com/
Have fun!!!
OldSpring