Shop OBEX P1 Docs P2 Docs Learn Events
Nokia Knockoff LCD (New) — Parallax Forums

Nokia Knockoff LCD (New)

Buck RogersBuck Rogers Posts: 2,178
edited 2010-08-28 19:42 in BASIC Stamp
Hello!
In this code example for Sparkfun's Nokia display:
' {$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
Mr Hitt, (Bean), there you describe the thing talking to the device, it does not explain if it is the breakout board for the display. Or just the display. I have the breakout board naturally.

I also have a BS2 on order as it were. The program code I obtained directly from the page for the display w/o the breakout board, here
http://www.sparkfun.com/commerce/product_info.php?products_id=569

All it says there is naturally BS2. I might also mention that the people at the firm confirm that it is rather difficult to make the display work.

However there were some successful ones using different platforms who're leaning towards Linux according to the above mentioned site.

Anyway any hints would be most appreciated, as I have an application almost ready for the device.
Sign In or Register to comment.