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 : Arduino code to picomite
Page 2 of 3 | |||||
Author | Message | ||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
I have juast tried using the BLIT and all I get is white space on BLIT WRITE Do I need to have MISO Connected?? Edited 2023-04-23 01:48 by asknik2022 |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3152 |
You need MISO for BLIT READ, but BLIT LOAD and BLIT WRITE will work without MISO. Please post your code. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
I have now connected MISO and still white space only How can I use blit load if I dont have sdcard?? |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
what about peak and poke?? |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6812 |
BLIT works with memory buffers, not files. You have to load your image from a file first then BLIT READ it from the screen into a buffer. After that you can keep BLIT WRITEing it back to the screen. There is a way to read from a file directly into a memory buffer, but I don't know if your image is ok for that. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3152 |
Picomite has a flash file system built in. Still need to see your code. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
here is the code. The BLIT co-ords are just testing dim integer bitpat cls restore for y = 0 to 63 for x = 0 to 15 ' 8 pixels per byte read read bitpat if bitpat = 999 then end ' unexpected end of data for b = 7 to 0 step -1 if bitpat AND 2^b then pixel x*8 + 7 - b, y, rgb(blue) next b next x next y blit read 1,0,0,200,100 pause 1000 blit write 1,0,0,200,100 end data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h06,&h03,&h00,&h60,&hC0,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h78,&h09,&h04,&h80,&h21,&h20,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h01,&h98,&h08,&h06,&h03,&h80,&h21,&h20,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&hA4,&h10,&h09,&h00,&h80,&h21,&h20,&h07,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&hA4,&h10,&h06,&h03,&h00,&h20,&hC0,&h00,&h80,&h00,&h00,&h00 data &h00,&h00,&h71,&h80,&hA4,&h10,&h00,&h00,&h00,&h00,&h00,&h01,&h00,&h00,&h00,&h00 data &h00,&h00,&h0A,&h40,&h98,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h80,&h3C,&h00,&h00 data &h00,&h00,&h3A,&h40,&h00,&h00,&h02,&h01,&h00,&h40,&h80,&h07,&h00,&h20,&h00,&h00 data &h00,&h00,&h42,&h40,&h00,&h08,&h02,&h01,&h08,&h40,&h80,&h00,&h00,&h38,&h00,&h00 data &h00,&h00,&h79,&h80,&h04,&h08,&h02,&h01,&h08,&h81,&h10,&h00,&h00,&h04,&h00,&h00 data &h00,&h00,&h00,&h00,&h04,&h08,&h02,&h01,&h08,&h81,&h11,&h04,&h00,&h38,&h00,&h00 data &h00,&h00,&h00,&h00,&h02,&h04,&h02,&h01,&h08,&h81,&h21,&h04,&h00,&h00,&h08,&h00 data &h00,&h00,&h00,&h84,&h02,&h04,&h0F,&hFF,&hFF,&hC3,&hE2,&h04,&h00,&h00,&h08,&h00 data &h00,&h00,&h00,&hC2,&h01,&h07,&hF0,&h00,&h00,&h3B,&hFE,&h08,&h40,&h40,&h08,&h00 data &h00,&hFE,&h00,&h62,&h01,&hF8,&h00,&h00,&h00,&h03,&hFF,&hE8,&h40,&h80,&h7F,&h00 data &h00,&h00,&h00,&h21,&h1E,&h00,&h04,&h00,&h80,&h00,&h7F,&hFE,&h80,&h80,&h08,&h00 data &h00,&h00,&h03,&h31,&hE0,&h00,&h04,&h00,&h80,&h04,&h01,&hFF,&hC1,&h00,&h08,&h00 data &h00,&h00,&h07,&h1E,&h00,&h40,&h00,&h00,&h00,&h04,&h00,&h1F,&hFA,&h00,&h08,&h00 data &h00,&h00,&h07,&hF0,&h00,&h40,&h3B,&h07,&h60,&h00,&h00,&h01,&hFF,&h00,&h00,&h00 data &h00,&h00,&h03,&h80,&h00,&h00,&h34,&h81,&h90,&hCC,&hC0,&h00,&h3F,&hC0,&h00,&h00 data &h00,&h00,&h0C,&h00,&h03,&h30,&h0C,&h82,&h90,&h53,&h20,&h00,&h07,&hF8,&h00,&h00 data &h00,&h00,&h70,&h40,&h00,&hC8,&h3B,&h02,&h60,&h53,&h20,&h00,&h00,&hFE,&h00,&h00 data &h00,&h01,&h80,&h20,&h01,&hC8,&h00,&h00,&h00,&h4C,&hC0,&h00,&h00,&h3F,&h80,&h00 data &h00,&h06,&h00,&h00,&h03,&h30,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h07,&hE0,&h00 data &h00,&h08,&h00,&h0C,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h01,&hFC,&h00 data &h00,&h30,&h00,&h12,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h78,&h00 data &h00,&h00,&h40,&h12,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h10,&h00 data &h00,&h00,&hA0,&h0C,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h44,&h00,&h00,&h00,&h02,&h02,&h30,&hC0,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h08,&h00,&h00,&h00,&h03,&h06,&h30,&hC0,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h10,&h00,&h00,&h00,&h01,&h8C,&h30,&hC0,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h22,&h00,&h00,&h00,&h00,&hD8,&h30,&hC0,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h05,&h00,&h00,&h00,&h00,&h70,&h19,&h80,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h02,&h00,&h00,&h00,&h00,&h20,&h0F,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data 9999 |
||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1110 |
Here it is 'fontified'. cls text mm.hres/2,mm.vres/2,"!",CM,8,,rgb(white),0 end ' VUMeter2.bas ' Font type : Full (1 character) ' Font start : CHR$(33) "!" ' Font size : 112x54 pixels ' Memory usage : 760 bytes DefineFont #8 01213670 00000000 00030600 0000C060 00000000 09000000 20218004 00000000 00000000 8004093C 00002021 00000000 06049C01 20218004 00000000 A2000000 80030904 00002021 00000000 0908A200 20218000 0000000F A2000000 80000908 80002021 00000000 0608A200 C0200003 00008000 A2C07100 00000008 00010000 0A000000 0008A220 00000000 00000001 9C200A00 00000000 80000000 1200007C 02000020 80400001 00408000 00202200 00010200 000F8040 42000040 02080020 80400801 00780000 04204200 08010208 000090C1 79000004 020804C0 10810801 00040000 04000000 08010208 00041181 00000004 02080200 11810801 00780004 02000000 08010204 00042181 00001000 02040284 22810801 10000004 01C20000 FFFF0F04 400CE2C3 00001040 F0070142 FA3B0000 10404008 0162007F 000000F8 4008FF03 0000FE80 04000721 FF038000 108040E8 38310000 80000400 80FC7F00 02001080 0400C011 07048000 100081FF 001E0700 80000440 C1FF0104 07001000 00400018 00040000 0000F23F 00200700 60073B20 FE070000 07000000 242000C0 C0CC9081 0000FF01 00000300 90813400 7F002053 04000080 0C980300 20539082 00E01F00 00401800 90820C64 07002053 600000F8 3BE40120 20536002 00FC0100 00208000 00000064 00002053 000100FF 00640010 C04C0000 803F0000 03000002 00000098 00000000 0004C00F 0000000E 00000000 F0070000 00110018 00000000 00000000 0000F801 00000011 00000000 F0000000 00116000 00000000 00000000 90006000 00000011 00000000 20000000 00119000 00000000 00000000 96000000 0200000E 00C03002 00000000 00006400 30060300 000000C0 0C000000 03000000 00C0308E 00000000 00000800 308C0100 000000C0 18000000 00000000 00C030D8 00000000 00001300 30D80000 000000C0 34000000 00000080 00C03070 00000000 00800400 39700000 000000C0 04000000 00000080 00801F20 00000000 00000300 0F200000 00000000 00000000 00000000 00000000 00000000 End DefineFont Visit Vegipete's *Mite Library for cool programs. |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2140 |
@asknik2022 your code works perfectly on my LCD. The blue VU sprite can be quickly "blitted" to anywhere on the screen. So it seems you are still not able to read back pixels from the screen. @vegipete's "fontified" version also works perfectly. Here is a test program for the LCD ' LCD Panel Tester It first counts the number of colours that can be read back from the screen then blits a chunk from the bottom to other locations up the screen. It then saves a BMP from the left to the flash drive (A:) and loads it to other places across the screen.Print "Screen Colours Counter Pixel Test" Dim a$(2)=(" Blues"," Greens"," Reds") Dim integer b, c, n CLS 127<<8 Text 30, MM.VRes *.8, " Pixel Test ",,, 2, RGB(white), RGB(0,0,127) For b = 0 To 16 Step 8 n = 0 For c = 0 To 255 Pixel c+30, b+25, c << b If Pixel(c+30,b+25) = c << b Then Inc n Next Print n; a$(b/8); " ="; Log(n)/Log(2); " bits" Text MM.HRes/2,MM.VRes/2-b*4,Str$(n)+a$(b/8)+" = "+Str$(Log(n)/Log(2))+" bits",C,,2,255<<b Next Pause 3000 Print "Blit test" For v = 0.6 To 0.3 Step -.1 Pause 500 Blit 10, MM.VRes*.2, 10, MM.VRes*v, MM.HRes-20, MM.VRes*.3 Box 10, MM.VRes*v, MM.HRes-20, MM.VRes*.3 Next Text 30, MM.VRes *.8, " Blit Test ",,, 2, RGB(white), RGB(0,0,127) Pause 3000 Print "Drive A: test" Text 30, MM.VRes *.8, " Drive A: Test ",,, 2, RGB(white), RGB(0,0,127) Save Image "A:/Drive A Test.BMP", MM.HRes*.2, MM.VRes*.2, MM.HRes*.3, MM.VRes*.7 Pause 2000 For v=.1 To .4 Step .1 Load Image "A:/Drive A Test.BMP", MM.HRes*v, mm.2res*.2 Pause 500 Box MM.HRes*v, mm.2res*.2, MM.HRes*.3, MM.VRes*.7 Next End The ILI9341 is one of the easiest to get working so check all wiring from LCD_SDO to MISO on the Pico to ensure it matches the manual. Edited 2023-04-23 15:26 by phil99 |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
WOW.. Thanks Guys I will try thsi later today. |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2140 |
Just noticed a typo near the end of the tester program. Pause 500 Box MM.HRes*v, mm.2res*.2, MM.HRes*.3, MM.VRes*.7 Next End Change mm.2res*.2, to mm.VRes*.2, . |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
When I run this code i get the following error Screen Colours Counter Pixel Test 0 Blues = [14] Print n; a$(b/8); " ="; Log(n)/Log(2); " bits" Error : Divide by zero |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2140 |
Yes, as it is getting nothing back from the display "0 Blues =" so it can't calculate the number of bits. For a ILI9341 it should show: 32 Blues = 5 bits 64 Greens = 6 bits 32 Reds = 5 bits Until you fix the SDO to MISO issue copy my image of the VU meter from earlier (right click on the image and select 'save as'). It is in PNG format as TBS won't upload BMP files. Open it in paint then save it as BMP. **see edit Then use XModem to transfer it to the Pico flash drive A:\ In TeraTerm at the Pico prompt type:- XMODEM R "VU_Meter.BMP" Then click on File -> Transfer -> XModem -> Send then navigate to the BMP and select it. You need to be fairly quick or it will time out. Type 'files' to see the contents of A:/ Once all that is done your program can load it to a Blit buffer. Edit Here is a 1 bit per pixel version, it should load a little faster. VU_Meter_1bit.zip then after saving to A: CLS 255 load image "VU_Meter_1bit.BMP" blit read #2,1,1,128,64 blit write #2, mm.hres/2-64, mm.vres/2-32 or just just load directly to the location of your choice. CLS 255 load image "VU_Meter_1bit.BMP", mm.hres/2-64, mm.vres/2-32 . Edited 2023-04-23 22:15 by phil99 |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3152 |
How can I use blit load if I dont have sdcard?? Picomite has a flash file system built in. Thanks for the code. It works for me. Here it is on a ILI9488, BLITted 20 times. I replaced your BLIT READ and BLIT WRITE with this: Blit read 1,0,0,100,60 Pause 1000 For i=0 To 3 For j=0 To 4 Blit write 1,i*100,j*60 Next j Next i End PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
i have just manually wired up a 3.2"" ILI9341 TFT SPI 240x320 v2.0 board including MISO to GP 16 and still will not rrun the test prog form @phil99 OPTION SYSTEM SPI GP18,GP19,GP16 OPTION LCDPANEL ILI9341, RLANDSCAPE,GP15,GP14,GP13 |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3152 |
Can you provide a photo front and back of your ILI9341? They're pretty standard, but there could be some wonky ones. How are you powering the backlight pin? What kind of "still will not run the test prog"? Error? Nothing on screen? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
Has it got touch? Blit won't work unless touch is configured as the touch chip will corrupt MISO if fitted and not configured |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2140 |
The BMP format supports 24 bit background and foreground colours for 1 bit / pixel images. Most viewers, including MMBasic will display them correctly however most editors only allow black and white. You can use a hex editor to change the relevant bytes to get any colours. Hex Byte numbers (starting from &H00) Blue Green Red Background 36 37 38 Foreground 3A 3B 3C Values can be 00 to FF Edited 2023-04-24 11:25 by phil99 |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3152 |
Not specifically related to this thread, other than that it has to do with SPI LCDs, but 3.5-inch 480x360 SPI ILI9488 with touch and BLITtable (at least the one I just got) is $7.24USD at Aliexpress. (Make sure you select the one with touch.) This requires a hardware mod to make MISO work--as simple as a 680R resistor between touch MISO (DO) and LCD MISO, with DO wired to the PicoMite MISO. Some have needed a diode version of this, but just the 680R has always worked for me for the 3 ILI9488s that I have. This is a really good price for an LCD which has twice as many pixels as the ILI9341. They were about twice that a year ago. (Note: there are some ILI9488s which use different chips from the one shown, and they won't work for BLIT READ. With Aliexpress, there's no guarantee that you will get what is pictured, but I've just ordered another one.) PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
paceman Guru Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
Just having a look at it. The specs say they're using an ADS7843 for the touch controller instead of our 'normal' XPT2046. Not sure if they're equivalent but something to check out. Greg |
||||
Page 2 of 3 |
Print this page |