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 : PicoMite/VGA/WEB V5.07.08 release candidates
Page 12 of 18 | |||||
Author | Message | ||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1109 |
Could it be possible to change the transparent colour of the layer framebuffer without closing it? If I do FRAMEBUFFER Layer 13 ' do some stuff FRAMEBUFFER Layer 0 I get "Error : Layer already exists" If I add the required FRAMEBUFFER Close L, I lose my image on the layer buffer. Grr. ;-) Visit Vegipete's *Mite Library for cool programs. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9123 |
Don't see why not - untested PicoMiteVGA (2).zip |
||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1109 |
Seems to work properly. Although there might be an odd background colour left over after the FRAMEBUFFER is closed. (CLS by itself at the end of the program clears the screen to white.) Do we not have the ability to set the FRAMEBUFFER LAYER transparent colour to -1, meaning no colours are transparent? autosave Option DEFAULT INTEGER MODE 2 CLS Dim ctab(15):For i = 0 To 15: Read ctab(i) : Next colr: ' order is messed up Data RGB(BLACK),RGB(BLUE),RGB(GREEN),RGB(CYAN),RGB(RED) Data RGB(MAGENTA),RGB(YELLOW),RGB(WHITE),RGB(MYRTLE) Data RGB(COBALT) ,RGB(MIDGREEN),RGB(CERULEAN) Data RGB(RUST), RGB(FUCHSIA),RGB(BROWN),RGB(LILAC) ' draw a back ground image For j = 1 To 20 For i = 33 To 127 Print Chr$(i); Next i Next j FRAMEBUFFER layer 0 ' -1 for no transparent colour? FRAMEBUFFER write L CLS For j = 0 To 3 For i = 0 To 3 x = i * MM.HRes / 4 y = j * MM.VRes / 4 c = ctab(j * 4 + i) Box x,y,MM.HRes/4,MM.VRes/4,1,0,c Next i Next j For i = 1 To 15 ' make each colour transparent FRAMEBUFFER layer i Pause 1500 Next i FRAMEBUFFER close CLS 0 ' must specify 0 for black? Visit Vegipete's *Mite Library for cool programs. |
||||
amigawizard Regular Member Joined: 15/08/2023 Location: AustraliaPosts: 43 |
Peter, can we have LINE x, y, - , - [, LW [, C]] same as LINE x1, y1, MM.INFO(HPOS), MM.INFO(VPOS) [, LW [, C]] I have used this for year`s in Oscilloscope`s is much faster than LINE x1, y1, x2, y2 [, LW [, C]] thank you ! Wayne ! ` |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9123 |
Please explain the use-case with a simple example. Does the line command update mm.info(hpos) etc.? Edited 2023-11-14 18:59 by matherp |
||||
amigawizard Regular Member Joined: 15/08/2023 Location: AustraliaPosts: 43 |
Peter, HScan = 250000 Option base 1 Dim array1!(5000) , array2!(5000) start: keyin$ = Inkey$ If Not ( keyin$ = "" ) Then DoIt GoTo start Sub DoIt Cro Display grid End Sub Sub Cro 'ADC open 125000 , 2 'ADC open 250000 , 2 ADC open HScan , 2 ADC start array1!() , array2!() ADC close End Sub Sub Display CLS Box 0,0,480,320,,(RGB(red)) For x = 2 To 478 Step 1 Line x , 250 - array1!(x) * 35 , - , - ,, RGB(green) Line x , 400 - array2!(x) * 35 , - , - ,, RGB(yellow) Next x End Sub Sub grid For x = 12 To 478 Step 35 For y = 20 To 316 Step 35 ' Pixel x , y , RGB(cyan) ''(yellow) Pixel x , y , RGB(pink) ''(yellow) Next y Next x End Sub End '' Wayne !! ` |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9123 |
That can't work as written. Assuming the first line resets HPOS to x1 then the second line will end at the endpoint of the first line and not the point last written by the second line - think about it |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9123 |
Try this PicoMite.zip Note the two lines have to be drawn separately and the use of PIXEL with -1 as the colour to position cursor. HScan = 250000 Option base 1 Dim array1!(5000) , array2!(5000) start: keyin$ = Inkey$ If Not ( keyin$ = "" ) Then DoIt GoTo start Sub DoIt Cro Display grid End Sub Sub Cro 'ADC open 125000 , 2 'ADC open 250000 , 2 ADC open HScan , 2 ADC start array1!() , array2!() ADC close End Sub Sub Display CLS Box 0,0,480,320,,(RGB(red)) Pixel 1,250-array1!(1),-1 For x = 2 To 478 Step 1 Line x , 250 - array1!(x) * 35 ,,,, RGB(green) Next x Pixel 1,400-array2!(1),-1 For x = 2 To 478 Step 1 Line x , 400 - array2!(x) * 35 ,,,, RGB(yellow) Next x End Sub Sub grid For x = 12 To 478 Step 35 For y = 20 To 316 Step 35 ' Pixel x , y , RGB(cyan) ''(yellow) Pixel x , y , RGB(pink) ''(yellow) Next y Next x End Sub End Edited 2023-11-14 20:48 by matherp |
||||
amigawizard Regular Member Joined: 15/08/2023 Location: AustraliaPosts: 43 |
Yes it was only an example needed pixel set for the first location pixel can do two lines at a time but as you suggest i will try your code thank you for this ! Wayne !!! ` |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9123 |
It will be faster if you put up with while lines |
||||
amigawizard Regular Member Joined: 15/08/2023 Location: AustraliaPosts: 43 |
Peter, Yes that is "Fast" thank you again for the help ! looking forward to the final Release Wayne !!!! ` |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9123 |
This is even faster. I like making things go fast PicoMite.zip HScan = 250000 Option base 1 Dim array1!(5000) , array2!(5000) start: keyin$ = Inkey$ If Not ( keyin$ = "" ) Then DoIt GoTo start Sub DoIt Cro Display grid End Sub Sub Cro 'ADC open 125000 , 2 'ADC open 250000 , 2 ADC open HScan , 2 'ADC start now has the capability of defining the range to map the output 'for each channel specify where 0V should be converted and where VCC should be converted ADC start array1!() , array2!(),,,250,250-35*3.3,400,400-35*3.3 ADC close End Sub Sub Display CLS Box 0,0,480,320,,(RGB(red)) Timer =0 colour rgb(green) Pixel 1,array1!(1),-1 For x = 2 To 478 Step 1 Line x , array1!(x) Next x ' Pixel command now has the ability to set the cursor position by specifying a colour of -1 colour rgb(magenta) Pixel 1,array2!(1),-1 For x = 2 To 478 Step 1 'line now has the ability of drawing from the x,y specified to the current cursor position and if used in this way then updates the cursor position Line x , array2!(x) Next x Print Timer End Sub Sub grid For x = 12 To 478 Step 35 For y = 20 To 316 Step 35 ' Pixel x , y , RGB(cyan) ''(yellow) Pixel x , y , RGB(pink) ''(yellow) Next y Next x End Sub End Edited 2023-11-14 22:41 by matherp |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
What is this example code supposed to do besides draw a red-outlined box? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9123 |
Its doing a plot of adc readings on the y axis against time (x) |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Could we have xor for b/w primitive lcd graphics. a scope grid that doesn't get erased when you erase the previous trace. but that would need read pixel?? |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9123 |
V5.07.08RC18 https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip Prompted by amigawizard I've added some ultra-fast plotting capability New command LINE PLOT ydata() [,nbr] [,xstart] [,xinc] [,ystart] [,yinc] [,colour] ydata is an array of floats or integers to be plotted nbr is the nbr of line segments to be plotted - defaults to the lesser of the array size and MM.HRES-2 if omitted xstart is the x-coordinate to start plotting - defaults to 0 xinc is the increment along the x-axis to plot each coordinate - defaults to 1 ystart is the location in ydata to start the plot - defaults to the array start yinc is the increment in ydata to add for each point to be plotted colour is the colour to draw the line This give a huge performance increase over plotting discrete line segments. For example plotting 319 line segments on the VGA version takes around 1mSec @ 252MHz Example If MM.Device$="PicoMiteVGA" Then MODE 2 Dim array!(2000) For i=0 To 2000:array!(i)=Sin(Rad(i*2))*MM.VRes\8+MM.VRes\3:Next CLS Timer =0 Line plot array!() 'plot from start of array 1 line segment per x coordinate Print @(0,0)Timer Pause 4000 Timer =0 Line plot array!(),,,2,,,RGB(red) 'plot every second x = zoom in Print @(0,0)Timer Pause 4000 Timer =0 Line plot array!(),,,,,2,RGB(cyan) 'plot every second y = zoom out Print @(0,0)Timer Pause 4000 For i=0 To 2000:Inc array!(i),MM.VRes\3 :Next Timer =0 Colour RGB(green) Line plot array!(),200,50 'plot 50 samples starting at x=50 Print @(0,0)Timer Pause 4000 Timer =0 Colour RGB(magenta) Line plot array!(),250,50,,50 'plot 150 samples starting at x=50 from position 50 Print @(0,0)Timer Pause 4000 In addition I've added extra capability to the ADC START command to optionally scale the reading as required ADC START CHAN1arr!() [,Chan2arr!()] [,Chan3arr!()] [,Chan4arr!()] [,C1min] [,C1max] [,C2min] [,C2max] [,C3min] [,C3max] [,C4min] [,C4max] By default the min and max values are set to 0 and VCC to give voltage readings. But if the data is for display then you can use other values so: C1min=200 and C1max=100 will create values ranging from 200 to 100 for equivalent voltages of 0 - 3.3. This allows you to scale the reading for display without further manipulation or to recover the original ADC readings (C1min=0.0, C1max=4095.0) Edited 2023-11-15 02:14 by matherp |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Vectrex emulation for the PicoMite anyone? :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Very cool. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Amazing work but not sure what is lcd applicable or just vga. LINE PLOT ydata() [,nbr] [,xstart] [,xinc] [,ystart] [,yinc] [,colour] could this be polygram? Edited 2023-11-15 04:11 by stanleyella |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9123 |
All the above work on any type of display I'm on a roll today. If you re-download RC18 then it now has a new MATH function MATH(CROSSING array() [,level] [,direction] level defaults to 0 direction defaults to 1 (valid -1 or 1) This returns the array index at which the values in the array pass the "level" in the direction specified. This makes plotting ADC data for an oscilloscope application even easier than before Example code If MM.Device$="PicoMiteVGA" Then MODE 2 Dim array%(2000) Do ' create a sine wave with a random start point j=(Rnd * 360) For i=0 To 2000:array%(i)=-Sin(Rad(i*2+j))*MM.VRes/8+MM.VRes/3:Next CLS Colour RGB(green) Line plot array%() Colour RGB(magenta) Line 0,MM.VRes/3,MM.HRes-1,MM.VRes/3,,RGB(blue) x%=Math(crossing array%(),MM.VRes/3,-1) Text 0,0,Str$(x%) Line plot array%(),250,50,,x% 'plot 250samples starting at the crossing point Pause 100 Loop Edited 2023-11-15 04:13 by matherp |
||||
Page 12 of 18 |
Print this page |