Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:55 28 Nov 2024 Privacy Policy
Jump to

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 : simple ADC Oscilloscope

Author Message
amigawizard

Regular Member

Joined: 15/08/2023
Location: Australia
Posts: 43
Posted: 11:07am 17 Aug 2023
Copy link to clipboard 
Print this post

Hi All
    adc_test_1.bas


' adc test 1
Dim anaray1!(3000) , anaray2!(3000) , anaray3!(3000)

SetPin 1 , pwm
PWM 0 , 5000 , 55

ADC open 122000 , 2

ADC start anaray1() , anaray2()

Memory

End

  Wayne !
 
amigawizard

Regular Member

Joined: 15/08/2023
Location: Australia
Posts: 43
Posted: 12:02pm 17 Aug 2023
Copy link to clipboard 
Print this post

use  putty  !

     adc_tirg_6.bas



' adc test 6

Dim anaray1!(4500) , anaray2!(4500) , anaray3!(4500)

SetPin 1 , pwm
SetPin 2 , pwm
'PWM 0 , 500 , 25 , 2
PWM 0 , 50 , 25 , 5


' ADC open 122000 , 2
ADC open 22200 , 2

ADC start anaray1() , anaray2()


'Memory
'disp

trig3
dist

Print @(4,430) "                                                                                                        .             .         .  "
Print @(4,430) t1 , t , , anaray2(t) , anaray2(t+99)  , anaray2(t+100) , anaray2(t+101) , , x , anaray1(t)  , anaray1(t+200)
Print t + x ; "   "

End

Sub disp

  For x = 1 To 1255  Step 12
     Print @(x,-(anaray1(x)*30)+150) "*" : Print @(x,-(anaray2(x)*50)+350) "-"
  Next x

End Sub

Sub dist

  For x = 1 To 1350
''      Print @(x,-(anaray1(x+t)*30)+150) "*" : Print @(x,-(anaray2(x+t)*30)+400) "-"
     
pixel x , -(anaray1(x+t)*30)+150)
pixel x , -(anaray2(x+t)*30)+400)

  Next x

End Sub

Sub trig

  For t = 1 To 2000
'      If anaray1(t) > 2 Then If anaray1(t+1) < 1 Then Exit For
'      If anaray1(t) > 1 Then If anaray1(t+1) < 2 Then Exit For
'      If anaray1(t) < 2 Then If anaray1(t+1) > 1 Then Exit For
'      If anaray2(t) > 1 Then If anaray2(t+1) < 2 Then Exit For
'      If anaray2(t) > 1 Then If anaray2(t+100) < 2 Then Exit For
     If anaray2(t) < 1 Then If anaray2(t+100) > 2 Then Exit For
  Next t
  Print t , "here"
End Sub

Sub trig2

  For t1 = 1 To 2000
     If anaray2(t1) > 1 Then If anaray2(t1+100) < 2 Then Exit For
  Next t1

  For t = t1 To 2000
     If anaray2(t) < 1 Then If anaray2(t+100) > 2 Then Exit For
  Next t

End Sub

Sub trig3

  For t1 = 1 To 2000
     If anaray2(t1) > 1 Then If anaray2(t1+50) < 2 Then Exit For
  Next t1

  For t = t1 To 2000
     If anaray2(t) < 1 Then If anaray2(t+50) > 2 Then Exit For
  Next t

End Sub

End



      Wayne  !!
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 02:50pm 17 Aug 2023
Copy link to clipboard 
Print this post

This is what I seen running on a PicoMite with 480x320 ILI9488:



What would I do to see something more interesting?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
amigawizard

Regular Member

Joined: 15/08/2023
Location: Australia
Posts: 43
Posted: 03:15pm 17 Aug 2023
Copy link to clipboard 
Print this post

@ Lizby


  pixel x , -(anaray2(x+t)*90)+150)



     and connect  pin1  to pin32  

     *90  set the  gain

     F2  rerun   !

    Wayne  !!!
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 03:32pm 17 Aug 2023
Copy link to clipboard 
Print this post

Ok, thanks. With that, I get this:


PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
amigawizard

Regular Member

Joined: 15/08/2023
Location: Australia
Posts: 43
Posted: 04:15pm 17 Aug 2023
Copy link to clipboard 
Print this post

@ lizby

      pixel x , -(anaray2(x+t)*90)+150)
     
      pixel x , -(anaray2(x+t)*gain)+offset)

      pixel x , -(anaray2(x5 +t)*90)+150)

 try     For x = 1 To 480


     Wayne  !!!!
 
amigawizard

Regular Member

Joined: 15/08/2023
Location: Australia
Posts: 43
Posted: 12:54pm 22 Aug 2023
Copy link to clipboard 
Print this post

this is  to be  run   with  Putty  !

  ch = 32
 
 
Sub DoDC CH

''   ADC close
  ch = CH
  SetPin ch , ain
  Tstop = 0
  SetTick 18.1 , tick , 2
  Timer = 0

               
  mDC
  Print Timer
  Tstop = 2
  SetTick 0 , 0 , 2

'Print  " DC = " ; DC ; " Vdc  "
Print Format$( DC , "    DC = %2.4f  Vdc  " )

End Sub

Sub tick

  Tstop = 1

End Sub

Sub mDC

     nDC = 0

  For n = 1 To 400
     nDC = nDC + Pin(ch)
     If Tstop = 1 Then Exit For
  Next n
  Print DC , nDC , nDC / n , n , Pin(ch)
  DC = (nDC / (n ) )
''   Print

End Sub
 


    DC Voltage  Meter

     this one remove`s  50 Hz  and  averages  (200+)  samples
   
       Wayne !!!!!
 
amigawizard

Regular Member

Joined: 15/08/2023
Location: Australia
Posts: 43
Posted: 03:42pm 22 Aug 2023
Copy link to clipboard 
Print this post

update !!



Sub dcx

ch = 32
SetPin ch , ain
m = 0
Timer = 0
Do While Timer < 19.86  '20 ms
Dc = Dc + Pin(ch)
Inc m
Loop
Print ,, Timer, m
Dc = Dc / m

  Print Dc
End Sub



    Option  F9 "dcx" + chr$(13) + chr$(10)


        Wayne  !!!!!!
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024