Hello Don.
Well, the first step for me was to create a new file in Studio and just import your code into it. Then I just started a compile for a Nano18 and watched the compile window for errors. And, oh yeah, there were errors!

But nothing catastrophic.
I kept a running set of notes of what I did to eliminate these problems, and the notes look like:
Quote:
1 Renamed PIN commands to CON using P#s.
2 Changed Clear label to Clear_LCD
3 Changed pin settings of "=1" and "= 0" to "HIGH pin" and "LOW pin".
As for 1, Studio doesn't have PIN commands. You use CON and use the P# for the pin, so
Reset PIN 3
becomes
Reset CON P3.
If you don't use the "P" then Studio considers it a numeric value, not a pin.
For 2, Clear is a command in Studio, so I simply renamed it.
For 3, I changed pin assignments of "=1" and "=0" to HIGH pin# and LOW pin#. Thus
Reset = 1
becomes
HIGH Reset.
CS = 0
becomes
LOW CS.
After those three mods/corrections, Studio compiled the code without squawk. That's not say this is good working code for your LCD, just that there are no glaring syntax problems. There are still timing considerations and the like. I include the modified code here. At this time you'll want to check the notes on the SPI commands in Studio's manual and see if these work the same between the two parts. Make any changes for differences you find. BEWARE: These notes are for the Pro line of parts, NOT the nano per se. Having said that, BMicro endeavours to make the commands work the same among all its products.
Then try it with a Nano and come back with any errors you see.
Luck on your project.
Code:
; 091810 - Don's BStamp code modified for Nano use
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 CON P3 ; Reset PIN 3 ' Connect ALL pins with 10K resistors
SData CON P2 ; SData PIN 2
SClock CON P1 ; SClock PIN 1
CS CON P0 ; 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_LCD
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
HIGH RESET
PAUSE 20
LOW CS
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 = $24 : GOSUB SendData '5
dat = $03 : GOSUB SendData '$01
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 = 4 : GOSUB SendData '5
dat = 9 : GOSUB SendData '10
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_LCD:
x = 0 : y = 0: GOSUB Plot
FOR ctr = 1 TO 16899
SHIFTOUT SData, SClock, MSBFIRST, [255\1, dat\8]
NEXT
RETURN