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 : Getting the best out of Pico ADC
Page 11 of 17 | |||||
Author | Message | ||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
@NPHighview, I must try your latest code but have to plug my kb from vga . using the 160x80 what's your option list show please? If only 3 buttons but I got a hantek and this is more educational like bigger display and gui touch area. Nice job you've done with this. My only gripe is there's a lot of code to follow.. my prob. stan |
||||
NPHighview Senior Member Joined: 02/09/2020 Location: United StatesPosts: 200 |
Here you go: OPTION SYSTEM SPI GP10,GP11,GP28 OPTION COLOURCODE ON OPTION POWER PWM ON OPTION HEARTBEAT OFF OPTION CPUSPEED 250000 OPTION DISPLAY 50, 132 OPTION LCDPANEL ST7735S, LANDSCAPE,GP8,GP12,GP9,GP25 Sorry about the length of the code. I've worked on projects with many tens of thousands of lines of code (medical ultrasound imaging device, for instance), but as long as you approach it systematically, as I've tried to do by defining self-contained, single-purpose subroutines, it works out fine. I had the task of determining whether a 100K-line-of-code program was working the way it was intended, and was told to do so in a mathematically-provable way. I took 6 months to teach myself Haskell (a contemporary functional programming language), and wrote 11 lines of code to demonstrate that the 100K-LOC program was working correctly, but that it had been set up wrong! This brings to mind the 1676 book, "The Art of Speaking": Live in the Future. It's Just Starting Now! |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
It looks like lovely code to me. :) I'm a great fan of using whitespace and comments to clarify what's happening. If I have one minor niggle it's in the use of pin numbers rather than GP numbers. The RP2040 has no concept of pin numbers and all pins are accessed as GPIO01-GPIO29. To reduce typing for the PicoMite MMBasic accepts GP0-GP29. The pin numbers are tied to the PCB, not the RP2040, so can only work on one particular RP2040 platform or exact pin compatibles without modification. There are problems though: CONST Butn1 = GP0 doesn't work. However, CONST Butn1 = MM.INFO(PINNO GP0) does. This is all just my opinion though, others will no doubt disagree or simply not be bothered. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Nice one NPH, I don't want to print long progs to follow them but try asm and follow own code :) I'm impressed already with your scope code and I am learning from it and mmbasic. when I can figure it out tidy then try bigger display and touch but using my new and old samples arrays, as layers no mem but blit maybe as it don't do black er it's weird. the waveshare rpi with the 160x80 display is neat and your scope is a good application. Edit what's really cool is you don't have to wire the display so no errors. Edited 2023-08-31 01:43 by stanleyella |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
Prompted by Stan's misunderstanding, see the latest beta for a new math command |
||||
NPHighview Senior Member Joined: 02/09/2020 Location: United StatesPosts: 200 |
Mick: The "CONST Butn1 = MM.INFO(PINNO GP0)" technique is what I had been missing. I did what I could by identifying the hardware dependencies in comments... Stan: I can solder, but as I get older, my soldering steadiness diminishes :-) Glad to have found the Waveshare boards! Peter: What a delight to be programming in such a rich environment! Thanks all! - Steve Live in the Future. It's Just Starting Now! |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
NPH -- I never mentioned your soldering skills.. I bread board stuff and like others make wiring errors. the ili9488 needs a Schottky diode and resistor but I can miss wire ili9341, easy when sd card and touch needs wiring. No wiring the wee waveshare, neat. Ta for your input to this helpful forum, I would be lost without the help I've got here. |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2137 |
Thanks Peter, it can not only scale the input to fit the screen but also put min. at the bottom and max. at the top all in one command! |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
like math scale samples!(),(199/3.3),samples!()'scale to 200 pixel math add samples!(),20,samples!()'offset 20 pixels does but better? |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2137 |
Yes, in your program you have 0 at the top but NPHighview and I put O at the bottom by using a negative scale factor then adding the screen height to invert the samples. This can do the inversion by swapping scalepoint1 and scalepoint2. MATH WINDOW inarray(), scalepoint1, scalepoint2, outarray() |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
I had a play with MATH WINDOW I started using the same in and out array. That didn't go well but using two separate arrays works well in NPHighview's program SUB Scale_Samples MEMORY COPY FLOAT addr.sample + trigger*8, addr.buffer, Hres MATH WINDOW buffer(), 10,230, buffer2() END SUB SUB Update_Display FRAMEBUFFER COPY L, F FRAMEBUFFER WRITE F : PIXEL Horizontal(), buffer2(), Signal FRAMEBUFFER COPY F,n END SUB This was on a 320 x 240 pixel display. Jim VK7JH MMedit MMBasic Help |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Jim, good day. I'm confused as to "This was on a 320 x 240 pixel display." as 320x240x3=230400 which is more than RAM: 0K ( 0%) 0 Variables 0K ( 0%) General 152K (100%) Free > Is it me being thick again? sorry. stan |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 512 |
Hi Steve, I've done a quick and very dirty conversion to a 480x320 LCD display, just to see how it looks and how fast the update was. I've done away with the LAYERS and simply save the last times points in a lasttime array, which I use to remove the last trace, before drawing the new trace. I also had to move some of your GP pin allocations, because my setup was already using some, so for the moment I've removed the hard buttons and moved the PWM output to GP22. The number in the top left is the screen update rate in mS, so not at all bad. Video of operation is here:- Scope video Copy of your code modified here:- Scope480x320.zip Keep up the good work Steve. :-) Regards, Kevin. |
||||
NPHighview Senior Member Joined: 02/09/2020 Location: United StatesPosts: 200 |
Kevin - very nice indeed! I hope you found the code to be relatively easy to navigate and change. Live in the Future. It's Just Starting Now! |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Hi @Bleep . You disturbed a bee's nest when you started this thread. It's been a learning curve. I personally thought the layer was very neat but not that it only worked on the waveshare 160x80. youtube is an easier way to display video imho 10KHz 70%pwm triggering...poor :( https://www.youtube.com/watch?v=mheHDtksYJ0 |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 512 |
Hi Steve, Yes code was fine to look through, lots of comments, which I like. :-) Regards, Kevin. |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
The first scope I did was SSD1306 i2c on gcbasic. I asked the main dev for xor for display and he provided it so you just xored the display over the cursor and it didn't erase it. There's a mmb read pixel function but that would be slow. Why need a graticule? it's not a "real" scope, just short code to test on board signals if no real scope. Making a silk purse from is an interesting journey though. |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Thanks to phil99 I got pixel version working but prefer line as it trigger better |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
What about displaying sine, sawtooth and triangle waves? Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
|
||||
Page 11 of 17 |
Print this page |