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 KingdomPosts: 6798 |
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: GermanyPosts: 207 |
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: GermanyPosts: 1114 |
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 KingdomPosts: 6798 |
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: GermanyPosts: 207 |
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 KingdomPosts: 6798 |
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: GermanyPosts: 207 |
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 KingdomPosts: 6798 |
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: GermanyPosts: 207 |
at school time I started with 40 errors within one dictate -andreas |
||||
hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 123 |
|
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1114 |
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: GermanyPosts: 207 |
I should work as business development manager and get some % from waveshare -andreas |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1114 |
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 KingdomPosts: 6798 |
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: GermanyPosts: 1114 |
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 KingdomPosts: 6798 |
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 KingdomPosts: 2129 |
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 KingdomPosts: 6798 |
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: GermanyPosts: 1114 |
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 KingdomPosts: 2129 |
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 |