Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:46 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Q: RP2040-LCD-0.96-M and PicoMite?

     Page 2 of 4    
Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 06:53am 06 Jun 2023
Copy link to clipboard 
Print this post

Looking at the schematic you need:

SYSTEM SPI GP10, GP11, GP12
LCDPANEL ST7735S, L, GP8, GP12, GP9, GP25

so it all fits nicely in 8-9-10-11-12-25.

All these are hard-wired. The final pin (backlight) on the display is normally optional but, in this case, it's hard-wired to the backlight. You could, of course, not define it and have the backlight flashing on and off using Heartbeat. :)

You could still use the system SPI pins for other SPI devices (not an audio DAC), such as a SD card. You'd need to allocate a CS pin for anything you use.

The two buttons are hard-wired and can't be used for anything else.

The 2-pin battery connector feeds VSYS via a Schottky diode.

It looks to me like a standard Pico, apart from the above pins.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 207
Posted: 07:04am 06 Jun 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  Looking at the schematic you need:

SYSTEM SPI GP10, GP11, GP12
LCDPANEL ST7735S, L, GP8, GP12, GP9, GP25

so it all fits nicely in 8-9-10-11-12-25.

All these are hard-wired. The final pin (backlight) on the display is normally optional but, in this case, it's hard-wired to the backlight. You could, of course, not define it and have the backlight flashing on and off using Heartbeat. :)

You could still use the system SPI pins for other SPI devices (not an audio DAC), such as a SD card. You'd need to allocate a CS pin for anything you use.

The two buttons are hard-wired and can't be used for anything else.

The 2-pin battery connector feeds VSYS via a Schottky diode.

It looks to me like a standard Pico, apart from the above pins.



It is not possible to use GP12 within LCDPANEL as RST - PicoMite complains that Pin GP12 is already used within System SPI. That was the reason I tried GP0  
This costs me hours and finally, before giving up, I tried GP0 in that place.



Without any settings on standard text output I count 20 chars by 8 lines on the display.

-andreas
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1114
Posted: 07:23am 06 Jun 2023
Copy link to clipboard 
Print this post

  andreas said  Who is the first, who writes a barricade game for the tiniest basic computer of the world?

-andreas

(is it possible to use the two buttons already on the board? ;)

no!

Nice to see it Working
I never played Malefiz ( barricade game) so I am out ;-)

Cheers
Mart!n
'no comment
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 07:24am 06 Jun 2023
Copy link to clipboard 
Print this post

Ah... you are quite right. There is a clash there. You could use something like

OPTION SPI GP10, GP11, GP28

or use any other SP2 RX (MISO) pin as the Pico is very flexible. You should really leave RST on GP12. That leaves it possible to hang other devices on system SPI.

--------------------

It would be interesting to cut the tracks to those buttons and re-wire them to make them more useful. :)  You might still want to do something with the BOOT input though. You'd need to cut a track to isolate RUN and, probably, remove R12 to isolate the BOOT button. Fiddly. :)
Edited 2023-06-06 17:32 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 207
Posted: 07:34am 06 Jun 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  Ah... you are quite right. There is a clash there. You could use something like

OPTION SPI GP10, GP11, GP28

or use any other SP2 RX (MISO) pin as the Pico is very flexible. You should really leave RST on GP12. That leaves it possible to hang other devices on system SPI.

--------------------

It would be interesting to cut the tracks to those buttons and re-wire them to make them more useful. :)  You might still want to do something with the BOOT input though. You'd need to cut a track to isolate RUN and, probably, remove R12 to isolate the BOOT button. Fiddly. :)


I did reset the options and tried it, but PicoMite refuses that:

> option list
PicoMite MMBasic Version 5.07.07
> option SPI GP10,GP11,GP28
Error : Invalid Option

bug or feature?

-andreas
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 07:41am 06 Jun 2023
Copy link to clipboard 
Print this post

I think this should do it:

OPTION SYSTEM SPI DISABLE 'get rid of the old settings
SETPIN GP28 OFF  'just in case this pin has been set as analogue input by default
OPTION SYSTEM SPI GP10, GP11, GP28
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 207
Posted: 07:59am 06 Jun 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  I think this should do it:

OPTION SYSTEM SPI DISABLE 'get rid of the old settings
SETPIN GP28 OFF  'just in case this pin has been set as analogue input by default
OPTION SYSTEM SPI GP10, GP11, GP28


Yepp! works!  (SETPIN GP28,OFF comma was missing)

> option list
PicoMite MMBasic Version 5.07.07
OPTION SYSTEM SPI GP10,GP11,GP28
OPTION HEARTBEAT OFF
OPTION LCDPANEL ST7735S, LANDSCAPE,GP8,GP12,GP9,GP25
> cls
> backlight 10
> cls rgb(red)
> works!


Thank you Mick!

-andreas
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 08:04am 06 Jun 2023
Copy link to clipboard 
Print this post

Excellent, no prob. :)
Pity about the comma. I keep missing them out. lol
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 207
Posted: 08:06am 06 Jun 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  Excellent, no prob. :)
Pity about the comma. I keep missing them out. lol


at school time I started with 40 errors within one dictate  

-andreas
 
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 123
Posted: 08:26am 06 Jun 2023
Copy link to clipboard 
Print this post

  andreas said  Hello,

the RP2040-LCD-0.96-M  is Picomite compatible


very cool. i will order one too.
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1114
Posted: 08:54am 06 Jun 2023
Copy link to clipboard 
Print this post

I ordered one @ Amazon..
Should arrive tomorrow or Friday
As first try, maybe I find the Time to convert the 3D Maze to 160x80 Pixels
Edited 2023-06-06 19:37 by Martin H.
'no comment
 
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 207
Posted: 03:20pm 06 Jun 2023
Copy link to clipboard 
Print this post

  Martin H. said  I ordered one @ Amazon..
Should arrive tomorrow or Friday
As first try, maybe I find the Time to convert the 3D Maze to 160x80 Pixels


I should work as business development manager and get some % from waveshare  

-andreas
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1114
Posted: 02:07pm 07 Jun 2023
Copy link to clipboard 
Print this post

  andreas said  
  Martin H. said  I ordered one @ Amazon..
Should arrive tomorrow or Friday
As first try, maybe I find the Time to convert the 3D Maze to 160x80 Pixels



I should work as business development manager and get some % from waveshare  

-andreas



Andreas,
Mine has just been delivered. With the settings you posted it worked immediately.






Thank you

(my old eyes just have trouble reading the small display)
Edited 2023-06-08 00:36 by Martin H.
'no comment
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 02:33pm 07 Jun 2023
Copy link to clipboard 
Print this post

Will these overclock?
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1114
Posted: 02:41pm 07 Jun 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  Will these overclock?

lets try ...

first impression...
option cpuspeed 252000 seems to work as well as option cpuspeed 378000
Cheers
 Mart!n
'no comment
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 02:45pm 07 Jun 2023
Copy link to clipboard 
Print this post

Thanks Martin. :)

Like the mini-maze! :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 04:51pm 07 Jun 2023
Copy link to clipboard 
Print this post

Mine arrived today. From Andreas I used his
OPTION SYSTEM SPI GP10,GP11,GP12
OPTION LCDPANEL ST7735S, LANDSCAPE,GP8,GP0,GP9,GP25
It does graphics fine. Thanks all. Do I use above or
SYSTEM SPI GP10, GP11, GP12
LCDPANEL ST7735S, L, GP8, GP12, GP9, GP25
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 05:14pm 07 Jun 2023
Copy link to clipboard 
Print this post

If you use GP12 for both SYSTEM SPI and LCDPANEL it will work, but you can't put anything else on SYSTEM SPI. Not even an SD card as all incoming data will reset the display. That's why I advised Andreas to use a different pin for MISO. I picked GP28 because not many people use all three analogue ports on the Pico.

Look back at my posts on here.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1114
Posted: 05:25pm 07 Jun 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  
Like the mini-maze! :)

for the 160x80 Display

'Maze Game by Mart!n Herhaus 2022
'Version for 160x80 Screen
cw%=RGB(white):WallC1%=0:WallC2%=RGB(RED):cP%=RGB(green)
'Read the XY-Coordinates of the Wall Elements Corners
Dim Wall%(6,4,2)
For N%=0 To 5 'Walls
For C%=0 To 3 '4 Corners
  For F%=0 To 1 '2 Coordinates (X,Y)
    Read Wall%(N%,C%,F%)
  Next
Next
Next
MazeW%=24:MazeH%=24
' create array and fill
Dim Maze$(MazeW%,MazeH%) length 1
restart:
For x% = 0 To MazeW%
For y% = 0 To MazeH%
  Maze$(x%, y%) = "#"
Next :Next
'generate random Maze
generator
MovDir$=Chr$(146)+Chr$(148)+Chr$(147)+Chr$(149)
Map%=0:CLS cw%
'place Player
PlrX%=MazeW%-1:PlrY%=MazeH%-1:PD%=3
'place Exit
Ex_X%=2:Ex_Y%=0:If Maze$(Ex_X%,1)="#" Then Inc Ex_X%
Maze$(Ex_X%,Ex_Y%)="E"
If map% Then Box 243+Ex_X%*3,3+Ex_Y%*3,3,3,,WallC2%,WallC2%
Colour 0,cw%
Text 122,33,"D  X "
'Text 244,130,"KEYS:"
'Text 244,140,"W:FORWARD"
'Text 244,150,"A:TURN L."
'Text 244,160,"D:TURN R."
'Text 244,190,"M:SHOW/ "
'Text 244,204," HIDE MAP"
' --- Game Loop ---
Do
Text 120,40,Mid$(MovDir$,PD%+1,1)+" "+Str$(PlrX%)
Text 120,50,"Y="+Str$(PlrY%)+" "
Draw_3D
Select Case PD%
  Case 0:XS%=0 :YS%=-1
  Case 1:XS%=1 :YS%=0
  Case 2:XS%=0 :YS%=1
  Case 3:XS%=-1:YS%=0
End Select
If map% Then Box 122+PlrX%*1.5,3+PlrY%,1,1,,cp%,cp%
Key$=""
Do :Key$=Inkey$:Loop While Key$=""
  Key$=UCase$(Key$)
  Select Case Key$
  Case "A",Chr$(130)
    Inc PD%,-1:Inc PD%,4*(PD%=-1)
  Case "D",Chr$(131)
    Inc PD%:PD%=PD% And 3
  Case "W",Chr$(128)
    OX%=PlrX%:OY%=PlrY%
    Inc PlrX%,XS%:Inc PlrY%,YS%
    If Maze$(PlrX%,PlrY%)="#" Then PlrX%=OX%:PlrY%=OY%
    If Map% Then Box 122+ox%*1.5,3+oy%,1,1,,cw%,cw%
    Case "M"
    Map%=1*(Map%=0)
    If Map% Then
      Box 122,3,38,25,,cw%,cw%
      Show_Maze
      Box 122+Ex_X%*1.5,3,Ex_Y%*1.5,2,1,,255.255
    Else
      Box 122,3,38,25,,cw%,cw%
    EndIf
End Select
If PlrX%=Ex_X% And PlrY%=Ex_Y% Then Exit
Loop
Text 16,16,Chr$(151)+" WELL DONE! "+Chr$(151)
Text 30,30,"PRESS Q TO QUIT"
Text 30,40,"OR ANY OTHER KEY"
Text 30,50," TO TRY ANOTHER"
Text 04,60,"     MAZE"
Do :Key$=Inkey$:Loop While Key$=""


If Key$="q" Then CLS 0:End
GoTo restart
'----------------------------
Sub draw_3d
Box 0,0,120,80,,cw%,cw%
Select Case PD%
 Case 0
   For f%=0 To 5
     If PlrY%-f%<0 Then Exit For
     If Maze$(PlrX%-1,PlrY%-f%)="#" Then Draw_Element f%,0,0 Else Draw_Element f%,0,1
     If Maze$(PlrX%+1,PlrY%-f%)="#" Then Draw_Element f%,1,0 Else Draw_Element f%,1,1
     If Maze$(PlrX%,PlrY%-f%)="#" Then Draw_Element f%,1,2:Exit For
   Next f%
  Case 1
    For f%=0 To 5
      If PlrX%+f%>MazeW% Then Exit For
      If Maze$(PlrX%+f%,PlrY%-1)="#" Then Draw_Element f%,0,0 Else Draw_Element f%,0,1
      If Maze$(PlrX%+f%,PlrY%+1)="#" Then Draw_Element f%,1,0 Else Draw_Element f%,1,1
      If Maze$(PlrX%+f%,PlrY%)="#" Then Draw_Element f%,1,2:Exit For
      Next f%
  Case 2
    For f%=0 To 5
     If PlrY%+f%>MazeH% Then Exit For
     If Maze$(PlrX%+1,PlrY%+f%)="#" Then Draw_Element f%,0,0 Else Draw_Element f%,0,1
     If Maze$(PlrX%-1,PlrY%+f%)="#" Then Draw_Element f%,1,0 Else Draw_Element f%,1,1
     If Maze$(PlrX%,PlrY%+f%)="#" Then Draw_Element f%,1,2:Exit For
   Next f%
 Case 3
   For f%=0 To 5
     If PlrX%-f%<0 Then Exit For
     If Maze$(PlrX%-f%,PlrY%+1)="#" Then Draw_Element f%,0,0 Else Draw_Element f%,0,1
     If Maze$(PlrX%-f%,PlrY%-1)="#" Then Draw_Element f%,1,0 Else Draw_Element f%,1,1
     If Maze$(PlrX%-f%,PlrY%)="#" Then Draw_Element f%,1,2:Exit For
   Next f%
End Select
End Sub
'draw the elements
Sub Draw_Element nr%,mir%,Gap%
Local x1%,y1%,x2%,y2%,x3%,y3%,x4%,y4%
x1%=Wall%(nr%,0,0):y1%=Wall%(nr%,0,1)
x2%=Wall%(nr%,1,0):y2%=Wall%(nr%,1,1)
x3%=Wall%(nr%,2,0):y3%=Wall%(nr%,2,1)
x4%=Wall%(nr%,3,0):y4%=Wall%(nr%,3,1)
If mir% Then x1%=120-x1%:x2%=120-x2%:x3%=120-x3%:x4%=120-x4%
WallC1%=RGB(0,64,0):WallC2%=RGB(0,128,0)
If Not Gap% Then
  'Wall
  Triangle x1%,y1%,x2%,y2%,x4%,y4%,WallC1%,WallC1%
  Triangle x1%,y1%,x3%,y3%,x4%,y4%,WallC1%,WallC1%
ElseIf Gap%=1 Then
      'Gap
      Triangle x1%,y3%,x3%,y3%,x4%,y4%,WallC2%,WallC2%
      Triangle x1%,y4%,x1%,y3%,x4%,y4%,WallC2%,WallC2%
    Else
     'Blocker
      Triangle x1%,y1%,120-x1%,y1%,120-x1%,y2%,WallC2%,WallC2%
      Triangle x1%,y1%,120-x1%,y2%,x1%,y2%,WallC2%,WallC2%
    EndIf
EndIf
End Sub
Sub show_maze
For y% = 0 To MazeH%
  For x% = 0 To MazeW%
      If Maze$(x%,y%)="#" Then Box 122+x%*1.5,3+y%,1,1,,0,0
  Next x%
Next y%
End Sub

' --- 2D Maze generator ---
' algorithmen based on
' https://rosettacode.org/wiki/Maze_generation#BASIC256
' --------------------------
Sub generator
Local done%,i%,CurX%,CurY%,OldX%,OldY%,x%,y%
' initial start location
CurX%=Int(Rnd * (MazeW% - 1))
CurY%=Int(Rnd * (MazeH% - 1))
' value must be odd
If CurX% Mod 2=0 Then Inc CurX%
If CurY% Mod 2=0 Then Inc CurY%
Maze$(CurX%, CurY%) = " "
' generate maze
done%=0
Do While done%=0
    For i% = 0 To 99
      OldX%=CurX%
      OldY%=CurY%
      ' move in random direction
      Select Case Int(Rnd*4)
          Case 0
              If CurX%+2<MazeW% Then Inc CurX%,2
          Case 1
              If CurY%+2<MazeH% Then Inc CurY%,2
          Case 2
              If CurX%-2>0 Then Inc CurX%,-2
          Case 3
              If CurY%-2>0 Then Inc CurY%,-2
      End Select
      ' if cell is unvisited then connect it
      If Maze$(CurX%,CurY%)="#" Then
          Maze$(CurX%,CurY%)=" "
          Maze$(Int((CurX%+OldX%)/2),((CurY%+OldY%)/2))=" "
      EndIf
  Next i%
  ' check if all cells are visited
  done%=1
  For x%=1 To MazeW%-1 Step 2
      For y%=1 To MazeH%-1 Step 2
          If Maze$(x%,y%)="#" Then done%=0
      Next y%
  Next x%
Loop
End Sub
' --- WallData (160x80)---
Data  0, 0, 0, 80, 5, 3, 5, 76
Data  6, 4, 6, 76, 25, 17, 25, 63
Data  26, 17, 26, 63, 40, 27, 40, 53
Data  41, 27, 41, 53, 50, 33, 50, 46
Data  51, 34, 51, 46, 55, 37, 55, 43
Data  56, 37, 56, 43, 60, 40, 60, 40                                                                

"Cursor" to move
"M" Shows the Maze (not so usefull)
'no comment
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 06:26pm 07 Jun 2023
Copy link to clipboard 
Print this post

That's very good. I'll try it.Thanks for sharing. stan. I got a kb but I'll use an a-d  button pad.
 
     Page 2 of 4    
Print this page
© JAQ Software 2024