' {$STAMP BS2p} Change for your Stamp Type, recommend one of the faster stamps. ' {$PBASIC 2.5} Black CON 0 White CON 255 Blue CON 3 Green CON 28 Red CON 224 Cyan CON Blue + Green Yellow CON Green + Red Magenta CON Blue + Red Reset PIN 3 ' Connect ALL pins with 10K resistors SData PIN 2 SClock PIN 1 CS PIN 0 dat VAR Byte ctr VAR Word ' Used in InitLCD & Clear subroutines x VAR Byte ' X-Coordinate (0 to 129) y VAR Byte ' Y-Coordinate (0 to 129) color VAR Byte ' Color to plot Start: GOSUB InitLCD color = Black : GOSUB Clear FOR x = 0 TO 129 y = ((SIN (x * 2)) + 128) / 2 color = Blue GOSUB Plot y = ((SIN (x * 2 + 128)) + 128) / 2 color = Green GOSUB Plot y = ((COS (x * 2)) + 128) / 2 color = Red GOSUB Plot y = ((COS (x * 2 + 128)) + 128) / 2 color = Yellow GOSUB Plot NEXT END SendCommand: SHIFTOUT SData, SClock, MSBFIRST, [0\1, dat\8] RETURN SendData: SHIFTOUT SData, SClock, MSBFIRST, [255\1, dat\8] RETURN InitLCD: HIGH CS PAUSE 10 HIGH SClock LOW SData LOW Reset PAUSE 1 Reset = 1 PAUSE 20 CS = 0 dat = $CA : GOSUB SendCommand dat = $03 : GOSUB SendData dat = 32 : GOSUB SendData dat = 12 : GOSUB SendData dat = $00 : GOSUB SendData dat = $BB : GOSUB SendCommand dat = $01 : GOSUB SendData dat = $D1: GOSUB SendCommand dat = $94 : GOSUB SendCommand dat = $81 : GOSUB SendCommand dat = 5 : GOSUB SendData dat = $01 : GOSUB SendData dat = $20 : GOSUB SendCommand dat = $0F : GOSUB SendData PAUSE 100 dat = $A7: GOSUB SendCommand dat = $BC : GOSUB SendCommand dat = $00 : GOSUB SendData dat = 0 : GOSUB SendData dat = $01 : GOSUB SendData dat = $00 : GOSUB SendData dat = $CE : GOSUB SendCommand dat = 0 : GOSUB SendData dat = 2 : GOSUB SendData dat = 4 : GOSUB SendData dat = 6 : GOSUB SendData dat = 8 : GOSUB SendData dat = 10 : GOSUB SendData dat = 12: GOSUB SendData dat = 15 : GOSUB SendData dat = 0 : GOSUB SendData dat = 2 : GOSUB SendData dat = 4 : GOSUB SendData dat = 6 : GOSUB SendData dat = 8 : GOSUB SendData dat = 10 : GOSUB SendData dat = 12 : GOSUB SendData dat = 15 : GOSUB SendData dat = 0 : GOSUB SendData dat = 5 : GOSUB SendData dat = 10 : GOSUB SendData dat = 15 : GOSUB SendData dat = $25 : GOSUB SendCommand dat = $AF : GOSUB SendCommand PAUSE 200 FOR ctr = 0 TO 130 dat = $D6 : GOSUB SendCommand NEXT RETURN Plot: dat = $75 : GOSUB SendCommand dat = y + 2: GOSUB SendData dat = 131 : GOSUB SendData dat = $15 : GOSUB SendCommand dat = x : GOSUB SendData dat = 129 : GOSUB SendData dat = $5C : GOSUB SendCommand dat = color : GOSUB SendData RETURN Clear: x = 0 : y = 0: GOSUB Plot FOR ctr = 1 TO 16899 SHIFTOUT SData, SClock, MSBFIRST, [255\1, dat\8] NEXT RETURN