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 12 of 17 | |||||
Author | Message | ||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
How well is triggering working on the other waveforms? Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
NPH's code pisses over mine my triggering is rubbish..but I tried. It's all a hobby,I got a scope but got to respect the work NPH has done...the box looks crap imho. that's why everything is acrylic. Edited 2023-09-01 06:40 by stanleyella |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Program: 12K ( 9%) Program (323 lines) 112K (91%) Free Saved Variables: 16K (100%) Free RAM: 25K (16%) 81 Variables 75K (49%) General 52K (35%) Free > OPTION LIST PicoMite MMBasic Version 5.07.08b14 OPTION SYSTEM SPI GP10,GP11,GP12 OPTION CPUSPEED (KHz) 250000 OPTION LCDPANEL ILI9341, LANDSCAPE,GP7,GP8,GP9 OPTION TOUCH GP14,GP15 GUI CALIBRATE 0, 262, 327, 929, 702 OPTION SDCARD GP13 cro.zip The only changes I made were to the pins used as they conflicted with my setup. I also added 'i' to invert the trace. The signal being traced is the random AC pickup from a short lead on the input pin. Edit: Add this line after Math Window Text 150,50,Str$(Math(Max buffer())-Math(Min buffer()),2,3)+" p-p" to display peak to peak value Jim Edited 2023-09-01 07:41 by TassyJim VK7JH MMedit MMBasic Help |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
|
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2137 |
And another to show the centre-line Voltage. Text 150,Vres/2,Str$(( (Math(Max buffer()) + Math(Min buffer()) )/2),2,3)+" V" Perhaps another could then show Volts / Division. MATH WINDOW calculates Math(Max and Math(Min but doesn't make them available. A future version perhaps? MATH WINDOW inarray(), scalepoint1, scalepoint2, outarray()[, Max][, Min] Edited 2023-09-01 17:13 by phil99 |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
To answer Stan's query re memory use with framebuffers. RGB121 uses 4 bits, not 24 Memory used for a 320x240 display would be 38400 bytes The ere are two framebuffers used so memory requirements are 76800 bytes. If you want to use the 480x320 display, you probably can get away with using one framebuffer instead of two. It would mean redrawing the grid etc each time. Jim VK7JH MMedit MMBasic Help |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Hi Jim. Ta for the colour mem info. As you said "It would mean redrawing the grid etc each time." The layer and frame buffer means draw grid once on layer L not every frame which takes longer than drawing the samples. stan |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
Good idea, will do |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Jim sir, hi I tried your modified NPH's scope but RUN [264] SetPin V_sw, INTL, V_ISR, PULLUP ' Switch to cycle through Voltage scales Error : Pin 21/GP16 is reserved on startup > option list PicoMite MMBasic Version 5.07.08b14 OPTION SYSTEM SPI GP18,GP19,GP16 OPTION AUTORUN ON OPTION LCDPANEL ILI9488, LANDSCAPE,GP15,GP14,GP13 OPTION TOUCH GP12,GP11 GUI CALIBRATE 0, 3936, 3893, -1287, -855 OPTION SDCARD GP22 > ER where is Pin 21/GP16 in the scope code please? I scanned it a few times... like reading a book..jokin. it's my poundland glasses not age honest RGB121 uses 4 bits, not 24 what's that and how to with ililcd please? I searched the manual but didn't find RGB121. is it just use 8 colours? Edited 2023-09-02 07:18 by stanleyella |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Look for the CONST instructions at the beginning Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Const Hres = MM.HRes ' Horizontal screen resolution Const Vres = MM.VRes ' Vertical screen resolution Const Major = Vres/4 ' Major tic mark pixel spacing Const Minor = Major/4 ' Minor tic mark pixel spacing Const PWM_Pin = 24 ' GP18 - PWM Test Signal output pin Const ADC_Pin = 31 ' GP26 - Analog to Digital Converter input pin Const V_sw = 21 ' GP7 - Vertical Scale pushbutton switch Const T_sw = 22 ' GP13 - trigger Select pushbutton switch Const A_sw = 25 ' GP14 - Time Scale pushbutton switch Const PWM_Freq = 5000 ' Frequency for Test Signal on Pin 24 Const PWM_Duty = 49 ' Base duty cycle for test Signal PWM in % Const PWM_Jitter = 2 ' Jitter in % for test Signal PWM Const Debounce = 200 ' Debounce delay in mSec for front panel switches ' Generic to all displays Const HMajor = Hres/Major ' How many Horiz Major Tic marks Const VMajor = Vres/Major ' How many Vert Major Tic marks Const HMinor = Hres/Minor ' How many Horiz Minor Tic marks Const VMinor = Vres/Minor ' How many Vert Minor Tic marks Const Background = RGB(32,64,32) ' Color for Display Background, A la Tektronix scopes Const GMajor = RGB(black) ' Color for Major tic marks Const GMinor = RGB(black) ' Color for Minor tic marks Const Signal = RGB(yellow) ' Color for displayed Signal Const TxtColor = RGB(cyan) ' Color for displayed text Const Trig_None = 0 Const Trig_Down = 1 ' Enumerate possible trigger conditions Const Trig_Up = 2 Const ADC_Max = 8 ' Maximum index into ADC Time Scale array (0-7) Const V_Max = 3 ' Maximum index into Voltage Scale array (0-3) Const Trig_Max = 2 |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
ignore the comments, I didn't change them Your system uses pin 21 (which is GP16) for SPI. You have to change the pins to ones that are free on your system. RGB121 means one bit for Red, two bits for Green, one bit for Blue. This is what the picomiteVGA uses and give more that adequate colours for charts. one + two + one = 4 bits for each pixel. Why waste 3x8 = 24 bits when 4 is all you use? Jim VK7JH MMedit MMBasic Help |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Corrected comments: Const V_sw = 21 ' GP16 - Vertical Scale pushbutton switch Const T_sw = 22 ' GP17 - trigger Select pushbutton switch Const A_sw = 25 ' GP19 - Time Scale pushbutton switch So there's a pin clash. :) A much better way to handle this sort of thing is: Const V_sw = MM.INFO(PINNO GP16) ' Vertical Scale pushbutton switch Const T_sw = MM.INFO(PINNO GP17) ' trigger Select pushbutton switch Const A_sw = MM.INFO(PINNO GP19) ' time Scale pushbutton switch This will automatically use the correct PicoMite board pin number for the Const values. It will return the *wrong* values if the board isn't pin-compatible. I'm afraid that in that case you are on your own. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2137 |
In TassyJim's photo of the output of cro.zip the trace does not fill the screen as it should with Math Window. Even with a clean sine wave same result. It turns out the last element of buffer() is always 0 (revealing the display is upside down). This kludge side-steps that without actually fixing the cause by setting the last element to Max. Sub Scale_Samples Memory copy FLOAT addr.sample + trigger*8, addr.buffer, Hres ' Math Scale buffer(), 0.2, buffer() ' Scale samples to fit vertically ' Math Add buffer(), V.Offset(Vselect), buffer2() ' Offset to bottom of screen (positive is up) buffer(HRes) = Math(Max buffer()) Math Window buffer(), MM.VRes,0, buffer2() Text 150,50,Str$(Math(Max buffer())-Math(Min buffer()),2,3)+" Vp-p" Text 150,Vres/2,Str$(( (Math(Max buffer()) + Math(Min buffer()) )/2),2,3)+" V" End Sub Edit The above fills the screen properly over a limited range of input voltages but not as the signal goes low. Math Window fills the screen from almost 0 signal to 3.3V in my simpler scope so it isn't the problem. As Stan said that program is too complicated for a simple scope. Edited 2023-09-02 12:07 by phil99 |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
@phil99 My "scope" was just show a-d as a graph for me to learn mmbasic new commands. It was short code but I added frame and layer L to allow for a graticule -just draw once,not each frame. trigger next and others methods better. I never meant it to be a scope. As it was meant to work from rpipico 0-3.3V it could be a simple signal analyser to see if pins are doing what you wanted but not my intension. The idea has stirred up activity though. I got to get mem error on ililcd layer L sorted, I don't understand the rgb usage/implementation to make it happen. I can't send graphics to blit1 and copy blit1 to blit2 and write to blit2 then display blit2. I tried an extra pin to test the signal freq and change sample rate but road to nowhere SETPIN GP7, FIN,10 'measure freq pause 10 'time to allow capture freq% = pin(GP7) cyc% = 4 'number of cycles to display. freq%=freq% * MM.HRES / cyc% ' freq of ADC for cyc% cycles on screen if freq%>500000 then freq%=freq%/2 'print freq% SETPIN GP26, AIn adc open freq%,1 |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
I don't get if enough mem for layer L. How do I use rgb121 please? If I knew I wouldn't ask, so will layer L work with ili lcd using rgb121 or is it vga only not lcd? |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
A spanner. What's better, using pin21 or gp16... as standard? I'd go for gp16. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
I'd go for gp16. It is entirely YOUR choice. Only you know what modules you are using. As long as you know which pin number is connected to which GPxx and which pins are allocated to existing peripherals, you can configure any code to suit. If I knew I wouldn't ask, so will layer L work with ili lcd using rgb121 or is it vga only not lcd? The photo I supplied shows a LCD, no VGA monitor in sight. The version of the code I supplied uses both layers in FRAMEBUFFER and works. You don't have to worry about RGB121, the firmware does that for you. If you display is too big for both layers, you will have to change the code to use one layer only. Jim VK7JH MMedit MMBasic Help |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Aren't you already using GP16 for SPI? Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Phil, This is due to some sections of the code expect OPTION BASE 0 while other sections assume BASE 1 A crude 'fix' is to copy an extra value to fill the last slot Sub Scale_Samples Memory Copy Float addr.sample + trigger*8, addr.buffer, Hres+1 A better fix would be to enforce OPTION BASE 1 (or 0) I was going to explore using an extra two array elements as false max and min to 'tweak' the scaling to rounded values. That would give a better auto-scale. Jim VK7JH MMedit MMBasic Help |
||||
Page 12 of 17 |
Print this page |