Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:57 01 Aug 2025 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 : Wave Share O Scope

Author Message
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 719
Posted: 01:09am 09 Apr 2022
Copy link to clipboard 
Print this post

Click here for a good time !


SetPin gp13, dout: Pin(gp13)=1: CLS ' set screen
Text 120,300,"V",cmn,3              ' draw controls
Text 120,180,"V",cmi,3
Text 060,240,"V",cmd,3
Text 180,240,"V",cmu,3

Dim a(240),y%(240): h%=240: v%=40   ' set controls
                                   ' h% = horizontal gain
Do : ADC open h%*1000,1             ' v% = verticle gain
t%=(Touch(x)*Touch(y))/10000        ' adjust controls
Select Case t%
Case 2: v%=v%*1.1: Case 4: v%=v%/1.1
Case 5: h%=h%*1.1: Case 1: h%=h%/1.1
End Select
If h%>500 Then h%=500: If h%<005 Then h%=005
If v%>200 Then v%=200: If v%<1 Then v%=1

ADC start a(): For x%=0 To 240       ' aquire
y%(x%)= 80+((1.65-a(x%))*v%)
Pixel x%,y%(x%): Next x%: Pause 100  ' trace
For x%=0 To 240: Pixel x%,y%(x%),0   ' blank trace
Next x%: ADC close: Loop

my site
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 02:50pm 09 Apr 2022
Copy link to clipboard 
Print this post

Nice find multiplying the X and Y touch coordinates and use the result in a select case statement.
You are starting and stopping the ADC every time ? Even if no changes ?
PicomiteVGA PETSCII ROBOTS
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 03:56pm 09 Apr 2022
Copy link to clipboard 
Print this post

That is a neat way of converting touch coordinates to select case statements! I'm going to have to ponder that for my Green Hills maze program port to the '170 with touchscreen.

I don't think
If h%>500 Then h%=500: If h%<005 Then h%=005
works as expected. The second IF never executes usefully.
Visit Vegipete's *Mite Library for cool programs.
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 719
Posted: 07:13pm 09 Apr 2022
Copy link to clipboard 
Print this post

  Volhout said   You are starting and stopping the ADC every time ?

Not now ......I think I see what You mean .... Could only adjust on ' touches '

SetPin gp13, dout: Pin(gp13)=1:CLS
Text 120,300,"V",cmn,3
Text 120,180,"V",cmi,3
Text 060,240,"V",cmd,3
Text 180,240,"V",cmu,3
Dim a(240),y%(240): h%=240: v%=40
ADC open 240000,1
Do : ADC frequency h%*1000
t%=(Touch(x)*Touch(y))/10000
Select Case t%
Case 2: v%=v%*1.1: Case 4: v%=v%/1.1
Case 5: h%=h%*1.1: Case 1: h%=h%/1.1
End Select
If h%>500 Then h%=500
If h%<005 Then h%=005
If v%>200 Then v%=200
If v%<001 Then v%=001
ADC start a(): For x%=0 To 240
y%(x%)= 80+((1.65-a(x%))*v%)
Pixel x%,y%(x%): Next x%: Pause 100
For x%=0 To 240: Pixel x%,y%(x%),0
Next x%: Loop

my site
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 719
Posted: 07:15pm 09 Apr 2022
Copy link to clipboard 
Print this post

  vegipete said  
I don't think

If h%>500 Then h%=500: If h%<005 Then h%=005

works as expected. The second IF never executes usefully.

You are oh so right .....

SetPin gp13, dout: Pin(gp13)=1:CLS
Text 120,300,"V",cmn,3
Text 120,180,"V",cmi,3
Text 060,240,"V",cmd,3
Text 180,240,"V",cmu,3
Dim a(240),y%(240): h%=240: v%=40
ADC open 240000,1
Do : ADC frequency h%*1000
t%=(Touch(x)*Touch(y))/10000
Select Case t%
Case 2: v%=v%*1.1: Case 4: v%=v%/1.1
Case 5: h%=h%*1.1: Case 1: h%=h%/1.1
End Select
If h%>500 Then h%=500
If h%<005 Then h%=005
If v%>200 Then v%=200
If v%<001 Then v%=001
ADC start a(): For x%=0 To 240
y%(x%)= 80+((1.65-a(x%))*v%)
Pixel x%,y%(x%): Next x%: Pause 100
For x%=0 To 240: Pixel x%,y%(x%),0
Next x%: Loop

my site
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 719
Posted: 12:10am 25 Apr 2022
Copy link to clipboard 
Print this post

Sometimes Knobs are Nicer




Dim a!(127)

Do

SetPin gp28, ain: v% = Pin(gp28) * 30
SetPin gp27, ain: h% = Pin(gp27) * 150000
ADC open h%+1,1
Pause 200
CLS
ADC start a!()
For x%=0 To 127
Pixel x%,32+((1.65-a!(x%))*v%)
Next x%
ADC close

Loop

ESC:Exit  F1:Save  F2:Run  F3:Find  F4:Mark  F5:Paste  Ln: 1  Col: 1      INS


Edited 2022-04-25 10:14 by hitsware2
my site
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025