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 : Silliness: PicoSpin
Page 1 of 2 | |||||
Author | Message | ||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1109 |
Just messing around with polygons and the latest (VGA) firmware: (Might work with an LCD display, I haven't tried.) '=============================================================================| ' PicoSpin ' ' written by Vegipete, Jan 2024 ' ' needs: ' Firmware version 5.08.00 or newer ' OPTION CPUSPEED 252000 (KHz) Option DEFAULT FLOAT 'INTEGER Option LCDPANEL NOCONSOLE Option angle degrees CLS 0 Dim pln(9)=(8,5,4,16,8,8,12,4,8,12) ' length of each poly ' "PICOMITE" polygon definitions ' The "P" and the "O" require 2 parts each Dim p0x(pln(0))=(-38,-38,-30,-28,-28,-30,-36,-36,-38) Dim p0y(pln(0))=(5,-5,-5,-3,-1,1,1,5,5) Dim p1x(pln(1))=(-36,-36,-31,-30,-31,-36) Dim p1y(pln(1))=(-1,-3,-3,-2,-1,-1) Dim p2x(pln(2))=(-27,-27,-25,-25,-27) Dim p2y(pln(2))=(5,-5,-5,5,5) Dim p3x(pln(3))=(2,0,0,2,8,10,8,7,3,2,2,3,7,8,10,8,2) Math add p3x(),-23,p3x() ' shift left into place Dim p3y(pln(3))=(5,3,-3,-5,-5,-3,-2,-3,-3,-2,2,3,3,2,3,5,5) Dim p4x(pln(4))=(-9,-11,-11,-9,-3,-1,-1,-3,-9) Dim p4y(pln(4))=(5,3,-3,-5,-5,-3,3,5,5) Dim p5x(pln(5))=(-8,-9,-9,-8,-4,-3,-3,-4,-8) Dim p5y(pln(5))=(3,2,-2,-3,-3,-2,2,3,3) Dim p6x(pln(6))=(1,1,3,7,11,13,13,11,11,7,3,3,1) Dim p6y(pln(6))=(5,-5,-5,-1,-5,-5,5,5,-2,2,-2,5,5) Dim p7x(pln(7))=(15,15,17,17,15) Dim p7y(pln(7))=(5,-5,-5,5,5) Dim p8x(pln(8))=(22,22,18,18,28,28,24,24,22) Dim p8y(pln(8))=(5,-3,-3,-5,-5,-3,-3,5,5) Dim p9x(pln(9))=(29,29,39,39,31,31,35,35,31,31,39,39,29) Dim p9y(pln(9))=(5,-5,-5,-3,-3,-1,-1,1,1,3,3,5,5) FRAMEBUFFER Create ' hidden layer to draw scene FRAMEBUFFER Write F : CLS 0 x = MM.HRes/2 y = MM.VRes/2 angl = 0 scal = 3 Do k = Asc(Inkey$) ' press any key to quit If k Then FRAMEBUFFER Close End EndIf CLS For i = 0 To 9 ' draw all letter pieces DrawLetter(i,x,y,angl,pi*(Sin(scal)+1.1)) Next FRAMEBUFFER copy F,N,B ' animate stuff ' could change position too, if you desire. Inc angl,.5 Inc scal,.9 Loop ' polygon number,x,y,angle,scale Sub DrawLetter(n,xc,yc,a,s) Local x(pln(n)),y(pln(n)) Select Case n ' scale copy polygon to working arrays Case 0 Math scale p0x(),s,x() : Math scale p0y(),s,y() Case 1 Math scale p1x(),s,x() : Math scale p1y(),s,y() Case 2 Math scale p2x(),s,x() : Math scale p2y(),s,y() Case 3 Math scale p3x(),s,x() : Math scale p3y(),s,y() Case 4 Math scale p4x(),s,x() : Math scale p4y(),s,y() Case 5 Math scale p5x(),s,x() : Math scale p5y(),s,y() Case 6 Math scale p6x(),s,x() : Math scale p6y(),s,y() Case 7 Math scale p7x(),s,x() : Math scale p7y(),s,y() Case 8 Math scale p8x(),s,x() : Math scale p8y(),s,y() Case 9 Math scale p9x(),s,x() : Math scale p9y(),s,y() End Select Math v_rotate 0,0,a,x(),y(),x(),y() ' spin 'em Math add x(),xc,x() ' position 'em Math add y(),yc,y() Polygon pln(n),x(),y(),RGB(green) ' draw em (b/w in Mode 1) ' Note: fill mode bogs down above a certain size End Sub Visit Vegipete's *Mite Library for cool programs. |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
er... far out? how about in a galaxy far far away? the math functions are clever.. typical basic, as is most mmb.. not! not complaining, lots of interesting graphics to learn and no trig.. well not much. great examples vegipete Edited 2024-01-21 09:08 by stanleyella |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
Very impressive, I've tested it, at length, at 378Mhz on my VGA and I'm getting 16.4mS per screen update, I also tested it without the background copy and it still looked very smooth to me, no artefacts and now 9mS per screen update! so 61Hz or 110Hz, amazing! especially when you can use the inbuilt math and draw functions on whole arrays. :-) Regards, Kevin. |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Hi Kevin sir. I downloaded PicoMiteVGA_5.08.00RC3_378MHz.opt and .opt.txt but too dim to figure what to do without messin up things. I use 378 with ili glcd no prob. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
Remember Stan, the 378 VGA *might * be ok for you and it might just lock up y6our Pico or give strange errors. There's no guarantee that it will be ok. You can't assume that a normal PicoMite that runs fine at 378 will also be fine as a PicoMite VGA at 378. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
:( not moaning, vga is nice as is. will try vegipete's code on glcd non vga at 378 and spi is supposed to be slow but I'm happy with it. stan |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
You need to put that file on your A: then run the command Option disk load "A:/PicoMiteVGA_5.08.00RC3_378MHz.opt" This will give you the 378Mhz option, along with the other options Phill mentioned in his post:- phills post you then need to set up your options as Phil says. As Mick says there are absolutely no guarantees it will work reliably for you, it seems fine for me, I have made sure my power supply is way more than enough, with thick wires, so no power drop, & that the Pico has free air movement in case it should get warm. Regards Kevin. |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Does indeed work on an LCD--ILI9341. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Like picorocks it's not right with ili9341 non vga latest https://www.youtube.com/watch?v=D2EzyXflhks |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Thanks Kevin for the vga cpu speed advice. I'll see. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
Looks like it could be a timing issue if the program is converted from VGA to LCD. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
OPTION CPUSPEED 252000 and the same |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
No, timing within the program. The CPUSPEED is the clock, but there are other things going on such as interrupts. These can change the program flow speed. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
doh. dunno what to look for. the display is ok and the math functions ok. is it a spi speed thing? if there's a spi speed option. I'll try my own polygon and math to sort it in my head and test. stan, tries but dim. |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Also works for me with ILI9488, though the speed of rotation is, uh, stately. In some orientations, there are artifacts on the right and bottom margins. I don't exactly see what might be done in the program to fix that. Maybe pixels beyond hres-1 and vres-1 are clipped to those values. (Note: with this firmware, this picomite locks up at CPUSPEED 378000, though it previously worked (for at least some programs) at that speed. picospin.bas was run at 252000.) PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Yes @lizby, ili9488 spin works like not enough volts, well slow but works. is it slower than ili9341 or me? |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
With twice as many pixels to set with SPI, you'd expect it to be slower. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
Added to that more colours (RGB666 vs. RGB565) requires sending 3 bytes per pixel instead of 2, slowing it further. Image quality has a cost. |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
Have just run this on my GameMite with a ILI9341 display, clocked at 378Mhz I get an update rate of 30.6mS; at 252Mhz I get 34.5mS, so basically similar results, roughly between 32.7Hz and 30Hz, not at all bad, about half the rate compared to the VGA. This would appear to be the upper refresh limit for an LCD, it appears that the Framebuffer copy takes about 30mS to send the frame update, so even using the 'B' option does not really speed it up, because the CLS and plotting is only taking a few mS, the rest is the screen data transfer. If I use the 'B' option, I can then place a 'Pause 22' immediately after the Framebuffer copy and it makes no difference to the update rate, so 22mS to do lots of extra screen plotting. ;-) Edited 2024-01-22 21:35 by Bleep |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9115 |
23mSec on an 8-bit parallel ili9341 of which 15.7mSec is the copy Filled polygons BOX 0,0,mm.hres,mm.vres,1,0 Before the copy Edited 2024-01-22 22:26 by matherp |
||||
Page 1 of 2 |
Print this page |