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 14 of 17 | |||||
Author | Message | ||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
It's neat and only needs one ADC input, but it's nowhere near as fast as using interrupts on individual digital pins. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
True but using spi and touch and sdcard not lots of pins left, i2c but not 5 button pins as well. It's cool for me and games. allow time for debounce and code ermm? I can use it though on pin 27 and pin 26 for scope,yes? I dunno why I can't move on from this scope thing. is it learning interrupts now? always something new. Ripping others code to get bits not simple, got to understand the prog to get the bits:( I keep my progs short or I can't read them myself. |
||||
NPHighview Senior Member Joined: 02/09/2020 Location: United StatesPosts: 200 |
Mick: Mission accomplished! Here's a two trace scope. At the moment, triggering is only done on Channel 1, and the fastest time has dropped from 50 uSec to 100 uSec. (Pin 31 wired to test signal; pin 32 is floating) I had been thinking about how to do it this morning, and figured that my first whack at it would fail due to too much memory usage (second buffers for both the raw signal and the displayed trace), but wouldn't you know it, it worked first time out. What a wonderful environment to code in! ' TwoTrace - a 2-channel oscilloscope on the RP2040-LCD-0.96 ' Steve Johnson September, 2023 ' ' Analog Signal input 1 on GP26 / Pin 31 - trace 1 / trigger ' Analog Signal input 2 on GP27 / Pin 32 - trace 2 ' Test Signal output on GP18 / Pin 24 ' ' Scope controls via momentary contact switches to ground ' Vertical Scale switch on GP13 / Pin 17 ' Trigger Select switch on GP14 / Pin 19 ' Time Scale switch on GP15 / Pin 20 ' ' Scope Controls (via serial input from terminal emulator): ' Voltage: {0}, {1}, {2} to change vertical scale ' Time: {F}aster, {S}lower to change horizontal scale ' Trigger: {U}p, {D}own, {N}one to change trigger criteria ' ' Sampling, Test Signal, Triggering, Framebuffers from stanleyella ' Math & Memory Copy from matherp ' Ganssle's switch debounce routine from CaptainBoing and Steve Johnson ' Graticules, Array Drawing, variable scales & triggering from Steve Johnson ' Interrupt Service Routines from Steve Johnson Option EXPLICIT ' Specifically For Waveshare RP2040-LCD-0.96 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 = MM.Info(PINNO GP18) ' Pin 24 - PWM Test signal output pin Const ADC1_Pin = MM.Info(PINNO GP26) ' Pin 31 - Analog to Digital Converter 1 Const ADC2_Pin = MM.Info(PINNO GP27) ' Pin 32 - Analog to Digital Converter 2 Const V_sw = MM.Info(PINNO GP13) ' Pin 17 - Vertical Scale pushbutton switch Const T_sw = MM.Info(PINNO GP14) ' Pin 19 - Trigger Select pushbutton switch Const A_sw = MM.Info(PINNO GP15) ' Pin 20 - 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 - calculations done off screen dimensions 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 T1_color = RGB(yellow) ' Color for displayed Trace1 Const T2_color = RGB(cyan) ' Color for displayed Trace2 Const TxtColor = RGB(white) ' Color for displayed text Const ShadColor = RGB(black) ' Color for text shadows Const Trig_None = 0 Const Trig_Down = 1 ' Enumerate possible trigger conditions Const Trig_Up = 2 Const ADC_Max = 7 ' Maximum index into ADC Time Scale array (0-6) Const V_Max = 3 ' Maximum index into Voltage Scale array (0-3) Const Trig_Max = 2 ' Declare storage Dim INTEGER c, n, x, y, trigger, trigger_timeout, Vselect, Trig_Type, ADC_select Dim INTEGER v_time, v_diff, v_state, v_old, v_press ' Volts scale button debouncing and status Dim INTEGER t_time, t_diff, t_state, t_old, t_press ' Trigger type button debouncing and status Dim INTEGER a_time, a_diff, a_state, a_old, a_press ' ADC frequency button debouncing and status Dim INTEGER Horizontal(Hres) ' Horizontal coordinate buffer for fast graticule and buffer draw Dim FLOAT trace1(2*Hres) ' Extra size to hopefully pick up a trigger event Dim FLOAT trace2(2*Hres) ' Extra size to hopefully pick up a trigger event Dim FLOAT buffer1(Hres) ' Display buffer for screen output Dim FLOAT buffer2(Hres) ' Display buffer for screen output Dim INTEGER addr.trace1, addr.trace2, addr.buffer1, addr.buffer2 Dim INTEGER HMajorX1(HMajor+1), HMajory1(HMajor+1), HMajory2(HMajor+1) ' For Horizontal Major Axes Dim INTEGER VMajorX1(VMajor+1), VMajorx2(VMajor+1), VMajory1(VMajor+1) ' For Vertical Major Axes Dim INTEGER HMinorX1(HMinor+1), HMinory1(HMinor+1), HMinory2(HMinor+1) ' For Horizontal Minor Axes Dim INTEGER VMinorX1(VMinor+1), VMinorx2(VMinor+1), VMinory1(VMinor+1) ' For Vertical Minor Axes Dim Float V.Scale(10), V.Offset(10), V.MajVolts(10) Dim Float H.Freq(10), H.Seconds(10) Dim String H.Units$(10), keypress$ ' ========================== Initialization ================================= Timer = 0 Initialize_Arrays Initialize_Hardware Display_Instructions Draw_Graticules ' ========================== Processing Loop ================================ Do Randomize_Test_Signal trigger_timeout = Timer Do Handle_Keypresses Handle_Switches trigger = -1 Get_Samples trigger = find_trigger(Trig_Type) If Timer-trigger_timeout > 2500 Then Display_No_Trigger ' Waiting too long for a trigger. Loop Until trigger >= 0 If Timer-trigger_timeout > 2500 Then Draw_Graticules ' OK, we've got a trigger. Clear message. Scale_Samples Update_Display Loop ' ========================== Interrupt Service Routines ==================== Sub V_ISR ' Interrupt Service Routine for Voltage SPST Button If v_press = 0 Then ' Ignore further button presses until handled in main loop If (Timer - v_time) > debounce Then v_press = 1 : v_time = Timer EndIf End Sub Sub T_ISR ' Interrupt Service Routine for Trigger SPST Button If t_press = 0 Then ' Ignore further button presses until handled in main loop If (Timer - t_time) > debounce Then t_press = 1 : t_time = Timer EndIf End Sub Sub A_ISR ' Interrupt Service Routine for ADC Frequency SPST Button If a_press = 0 Then ' Ignore further button presses until handled in main loop If (Timer - a_time) > debounce Then a_press = 1 : a_time = Timer EndIf End Sub ' ========================== Subs and Functions ============================ Sub Handle_Keypresses keypress$ = Inkey$ Select Case keypress$ Case "0" : Vselect = 0 Case "1" : Vselect = 1 Case "2" : Vselect = 2 Case "3" : Vselect = 3 Case "u", "U" : Trig_Type = Trig_Up Case "d", "D" : Trig_Type = Trig_Down Case "n", "N" : Trig_Type = Trig_None Case "f", "F" : ADC_select = Min(ADC_select+1, ADC_Max) : Set_ADC_Timing Case "s", "S" : ADC_select = Max(ADC_select-1, 0) : Set_ADC_Timing Case "" : Exit Sub ' No key pressed. No change. Case Else : Display_Instructions ' Unknown key pressed. End Select Draw_Graticules End Sub Sub Handle_Switches ' using Ganssel's debounce routine in Fruit of the Shed Local INTEGER V, T, A If v_press = 1 Then v_press = 0 Vselect = (Vselect+1) Mod (V_Max+1) EndIf If t_press = 1 Then t_press = 0 Select Case Trig_Type Case Trig_Up: Trig_Type = Trig_Down Case Trig_Down: Trig_Type = Trig_None Case Trig_None: Trig_Type = Trig_Up Case Else : Trig_Type = Trig_Up End Select EndIf If a_press = 1 Then a_press = 0 ADC_select = (ADC_select+1) Mod (ADC_Max+1) : Set_ADC_Timing EndIf Draw_Graticules End Sub Function find_trigger(a) Local median = Math(MEAN trace1()) Select Case a Case Trig_Down For c = 0 To Hres-1 If trace1(c) > median+0.1 And trace1(c+1) < median+0.2 Then find_trigger = c : Exit Function Next find_trigger = -1 : Exit Function Case Trig_Up For c = 0 To Hres-1 If trace1(c+1) > median+0.1 And trace1(c) < median+0.2 Then find_trigger = c : Exit Function Next find_trigger = -1 : Exit Function Case Else find_trigger = 0 : Exit Function End Select End Function Sub Display_Instructions Local i, j FRAMEBUFFER WRITE L CLS Background Text 6, Vres/2, "Pico", CMV, 1, 1, T1_Color, Background Text Hres-6, Vres/2, "Scope", CMV, 1, 1, T2_Color, Background Text 18, 3, "Keyboard:", LT, 7, 1, TxtColor, Background Text 25, 15, "Volt: 0, 1, 2, 3", LT, 7, 1, TxtColor, Background Text 25, 27, "Time: Faster, Slower", LT, 7, 1, TxtColor, Background Text 25, 39, "Trig: Up, Dn, None", LT, 7, 1, TxtColor, Background Text 25, 51, "Pin 24: Test Signal", LT, 7, 1, TxtColor, Background FRAMEBUFFER COPY L, F FRAMEBUFFER COPY F,N Pause 4000 Text 20, 79, "Waiting for Trigger.....", LB, 7, 1, T1_Color, Background FRAMEBUFFER COPY L, F FRAMEBUFFER COPY F,N End Sub Sub Display_No_Trigger FRAMEBUFFER WRITE L Text Hres/2, Vres/2, "Waiting for Trigger.....", CM, 7, 1, T1_Color, Background FRAMEBUFFER COPY L, F FRAMEBUFFER COPY F,N End Sub Sub Initialize_Arrays addr.trace1 = Peek(varaddr trace1()) addr.trace2 = Peek(varaddr trace2()) addr.buffer1 = Peek(varaddr buffer1()) addr.buffer2 = Peek(varaddr buffer2()) Math Set 0, HMajory1() : Math Set Vres, HMajory2() ' Set Arrays for Time Major Axis Math Set 0, VMajorX1() : Math Set Hres, VMajorx2() ' Set Arrays for Volts Major Axis Math Set 3*Vres/4+Minor/2, HMinory1() Math Set 3*Vres/4-Minor/2, HMinory2() ' Set Arrays for Time Minor Axis Math Set Hres/2+Minor/2, VMinorx1() Math Set Hres/2-Minor/2, VMinorx2() ' Set Arrays for Volts Minor Axis For x = 0 To Hres-1 : Horizontal(x) = x : Next ' used in array graphics For x = 0 To HMajor : HMajorx1(x) = x*Major : Next ' for Time Major Axis graticule For y = 0 To VMajor : VMajory1(y) = y*Major : Next ' for Volts Major Axis graticule For x = 0 To HMinor : HMinorx1(x) = x*Minor : Next ' for Time Minor Axis graticule For y = 0 To VMinor : VMinory1(y) = y*Minor : Next ' for Volts Minor Axis graticule ' RP2040-LCD-0.96 - specific values here. ' ' For Voltage, Zero is at pixel 60, 3/4 down the display V.Scale(0)= -4.0 : V.Offset(0)=60 : V.MajVolts(0) = 5.000 ' 5.000 Volts per Major Division V.Scale(1)= -8.0 : V.Offset(1)=60 : V.MajVolts(1) = 2.500 ' 2.500 Volts per Major Division V.Scale(2)=-16.0 : V.Offset(2)=60 : V.MajVolts(2) = 1.250 ' 1.250 Volts per Major Division V.Scale(3)=-32.0 : V.Offset(3)=60 : V.MajVolts(3) = 0.675 ' 0.675 Volts per Major Division ' For Time, H.Freq(0) = 1000 : H.Units(0)="mSec" : H.Seconds(0) = 20.0 H.Freq(1) = 2000 : H.Units(1)="mSec" : H.Seconds(1) = 10.0 H.Freq(2) = 4000 : H.Units(2)="mSec" : H.Seconds(2) = 5.0 H.Freq(3) = 10000 : H.Units(3)="mSec" : H.Seconds(3) = 2.0 H.Freq(4) = 20000 : H.Units(4)="mSec" : H.Seconds(4) = 1.0 H.Freq(5) = 40000 : H.Units(5)="uSec" : H.Seconds(5) = 500.0 H.Freq(6) = 100000 : H.Units(6)="uSec" : H.Seconds(6) = 200.0 H.Freq(7) = 200000 : H.Units(7)="uSec" : H.Seconds(7) = 100.0 ' H.Freq(8) = 400000 : H.Units(8)="uSec" : H.Seconds(8) = 50.0 - too fast for 2 channels ADC_select = 3 ' Select from a number of time scales Vselect = 1 ' Select from a number of Scale factors and offsets for volts Trig_Type = Trig_Down ' Select from a number of trigger types End Sub Sub Initialize_Hardware SetPin V_SW, INTL, V_ISR, PULLUP ' Switch to cycle through Voltage scales SetPin T_SW, INTL, T_ISR, PULLUP ' Switch to cycle through Trigger types SetPin A_SW, INTL, A_ISR, PULLUP ' Switch to cycle through ADC Frequency (Time) scales SetPin GP18, PWM1A ' Set up pin 24 for PWM test signal output PWM 1, PWM_Freq, PWM_Duty ' Square wave on Pin 24 SetPin (31), AIn ' ADC input on Pin 31 ADC open H.Freq(ADC_Select), 2 ' Sample at specified frequency FRAMEBUFFER CREATE F FRAMEBUFFER LAYER L End Sub Sub Set_ADC_Timing ADC FREQUENCY H.Freq(ADC_Select) End Sub Sub Draw_Graticules Local STRING T$, V$, A$ FRAMEBUFFER WRITE L CLS Background Line HMinorx1(), HMinory1(), HMinorx1(), HMinory2(), 1, GMinor ' Draw minor horiz graticules Line VMinorx1(), VMinory1(), VMinorx2(), VMinory1(), 1, GMinor ' Draw minor vert graticules Line HMajorx1(), HMajory1(), HMajorx1(), HMajory2(), 1, GMajor ' Draw major horiz graticules Line VMajorx1(), VMajory1(), VMajorx2(), VMajory1(), 1, GMajor ' Draw major vert graticules A$ = Str$(H.Seconds(ADC_Select),3,0) + " " + H.Units(ADC_Select) Text 0, Vres, A$, LB, 7, 1, TxtColor, Background ' Draw Time Scale at Lower Left V$ = Str$(V.MajVolts(Vselect), 2, 2)+" V" Text Hres, Vres, V$, RB, 7, 1, TxtColor, Background ' Draw Volts Scale at Lower Right Select Case Trig_Type Case Trig_Up: T$ = "/" Case Trig_Down: T$ = "\" Case Trig_None: T$ = "-" Case Else : T$ = " " End Select Text Hres/2, Vres, T$, CB, 7, 1, TxtColor, Background ' Draw Trigger at Lower Middle End Sub Sub Randomize_Test_Signal PWM 1, PWM_Freq, PWM_Duty+PWM_Jitter*Rnd ' Randomize duty cycle to ensure displayed signal is refreshing End Sub Sub Get_Samples ' Load ADC inputs into sample() array trace1(2*Hres-1) = -1 ' Samples will never be < 0 ADC start trace1(), trace2() Do While trace1(2*Hres-1) < 0 : Loop End Sub Sub Scale_Samples Memory copy FLOAT addr.trace1 + trigger*8, addr.buffer1, Hres Memory copy FLOAT addr.trace2 + trigger*8, addr.buffer2, Hres Math Scale buffer1!(), V.Scale(Vselect), buffer1!() ' Scale samples to fit vertically Math Scale buffer2!(), V.Scale(Vselect), buffer2!() ' Scale samples to fit vertically Math Add buffer1!(), V.Offset(Vselect), buffer1!() ' Offset to bottom of screen (positive is up) Math Add buffer2!(), V.Offset(Vselect), buffer2!() ' Offset to bottom of screen (positive is up) End Sub Sub Update_Display FRAMEBUFFER COPY L, F FRAMEBUFFER WRITE F : Pixel Horizontal(), buffer1!(), T1_color FRAMEBUFFER WRITE F : Pixel Horizontal(), buffer2!(), T2_color FRAMEBUFFER COPY F,N End Sub Live in the Future. It's Just Starting Now! |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
LOL! Excellent. I wondered if someone would take me up on that one. :) I anticipated that the ADC would now run at 1/2 speed compared to a single channel, so the maximum displayed frequency will be lower. Very pretty though. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
2 sines out off phase and a component tester. don't try stereo pico sound, it in phase. |
||||
NPHighview Senior Member Joined: 02/09/2020 Location: United StatesPosts: 200 |
Here's a photo using both the on-board test signal (from which trigger is derived) and an off-board XR2206-based (but exceedingly crappy) "signal generator" (well, my test leads are nothing to brag about either). I don't have access to better signal generators. Sorry! Live in the Future. It's Just Starting Now! |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Unfortunately you almost certainly can't display a sine wave from that without level shifting the input. You are seeing just the top half of the sine, the bottom half is being clipped. This will bias the trace to mid voltage (about 1.65V) and let you see both halves. 3V3 | 10K 100nF | input---| |-----+---------- ADC input | 10K | GND It's always a good idea to put a capacitor on the output from those. IIRC the XR2206 uses a virtual ground so the output signal is +/- around half the supply voltage. I can't remember the circuit of those little devices, but I know they are very basic. A series resistor (4k7-10k) is a good idea too, to protect the ADC input. Edited 2023-09-05 07:25 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
I got XR2206-based (but exceedingly crappy) "signal generator" as well. they messed the circuit for cheapness but it can sweep freq which tests a scope. I posted this over a tear ago using lcd and 2 adc in but no 90 deg sines. Mean time I changed my simple scope from line to pixel. Dunno if I like pixel,I'll sort a sine. Trigs ok. guess it's faster than line. for x%=0 to 238 'screen width 'line x%,samples!(x%+c%),x%+1,samples!(x%+1+c%),,rgb(green) 'draw new sample from sample(c%) pixel x%,samples!(x%+c%),rgb(green) 'plot new sample from sample(c%) next x% |
||||
NPHighview Senior Member Joined: 02/09/2020 Location: United StatesPosts: 200 |
Well, that's better. Reviewing the XR2206 IC schematic, it's biased up to half the (9V) supply voltage, so it's a wonder that I got anything at all. With a 47 uF capacitor (your previous recommendation) and the 10K resistors, a 1KHz tone played from my old iPod looks decent. The square wave is internally generated on the Pico. Live in the Future. It's Just Starting Now! |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2136 |
The photo with my scope prog. used the same cheap signal generator. Its output has a DC bias so all that is needed is a pot to reduce the level to suit the Pico. Its own level control does not change the DC bias. @Stan, speed isn't very important on my scope as does not erase and redraw the whole screen all in on go. It only erases one vertical line at a time and drawing the new pixels on it before moving on to the next. Most of the time it is seamless. Edited 2023-09-05 08:18 by phil99 |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Pixels look ok with sines,you can tell it's a sine. Dunno about squares as my usb hantek dso draws waves not plot so what a real scope look like? rhetorical. |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Lots of interesting projects happening! I shall retry 2 channel a-d. x axis adc1, y axis adc2. sine on each but 90 deg out of phase and pretty Lissajous or simple circuit and component tester, before they sold pic lcd ones for £7 on ebay. |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2136 |
With Beta 15 Math Window now makes Min. and Max. values of the input array available. In my scope program it can be used to replace this:- Math WINDOW samples(), VRes - 1, 0, samples2() 'Make samples fit screen, min at bottom, max at top Max = Math(max samples()) : Min = Math(min samples()) p2p = Max - Min 'peak-to-peak sample values With this:- Math WINDOW samples(), VRes - 1, 0, samples2(), Min, Max 'Make samples fit screen, min at bottom, max at top p2p = Max - Min 'peak-to-peak sample values Thanks Peter Edited 2023-09-05 09:02 by phil99 |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
All of you, please be careful with the inputs to the ADC when experimenting with signals that don't come from the Pico. If you see a sine or triangle clip at the top or bottom then you are pushing the input out of spec and you could damage it unless you at least have a resistor in series with the input to limit the current. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
True https://www.google.com/search?client=opera&q=remember+guys+take+care+out+there&sourceid=opera&ie=UTF-8&oe=UTF-8#fpstate=ive&vld=cid:b6837800,vid:Jmg86CRBBtw |
||||
NPHighview Senior Member Joined: 02/09/2020 Location: United StatesPosts: 200 |
Phil99: Aha! With the WINDOW capability, a Pico-based VU meter would be very practical. Stan: Here's a Lissajous demo on the Colour Maximite 2 from a few years ago. Time to try the PicoScope code there. Live in the Future. It's Just Starting Now! |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
NPH, Hi. Getting a 2 channel generator with variable phase is the prob. A transistor a few resistors and cap and pot for phase shift but 2 channels at different freq needed for x-y experiments. |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Serious. my scope was meant for on board 3.3V not external input. I was careful to set the sig gen amp and offset to show a sine.Had to be 0V to trig. A multimeter on ac volts is not reliable to test for safe input voltage imho. 3.3V then bye-bye then buy. |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
Mik I think posted a sine to fill an array code Make it twice (why say 2 times) larger and use it to use the sine sample but from different part of sine to be phase shifted. |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2136 |
Red Face Time...again. The version of my scope program posted earlier displays the wrong signal frequency. Replace the 'Show signal data line near the bottom with this:- Text 1, 1, Str$(max,1,3)+"V "+Str$(p2p,1,3)+"Vp-p "+Str$(ADC_Hz\(TC2-TC-H.offset),1,0)+"Hz "+Str$(HRes*1000/8/ADC_Hz,1,4)+"mS/Div." If it is too long for your editor window do it as two lines then delete the <CR> from the end of the first half. Edit Or this instead:- Freq = ADC_Hz/(TC2-TC-H.offset) : mSpD = HRes*1000/8/ADC_Hz Text 1, 1, Str$(max,1,3)+"V "+Str$(p2p,1,3)+"Vp-p "+Str$(Freq,1,1)+"Hz "+Str$(mSpD,1,3)+"mS/Div." Also the sample buffer size (buff) can be reduced to HRes * 3 with little effect. It was made large to allow rapid adjustment to a sudden large decrease in input frequency, say 10kHz to 5Hz. However it doesn't take much longer. Edited 2023-09-06 22:20 by phil99 |
||||
Page 14 of 17 |
Print this page |