Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:41 25 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 : a "BASIC" scope :)

Author Message
YT2095

Newbie

Joined: 07/02/2012
Location: United Kingdom
Posts: 22
Posted: 02:09pm 08 Feb 2012
Copy link to clipboard 
Print this post

This is just for a bit of fun,

here is a Very simple program that will turn your MM/DM into a very crude low frequency Oscilloscope, although for BASIC, it`s not too bad!

10 setpin 1,1
20 cls
30 for x=0 to 479
40 pixel(x,(pin(1)*128))=1
50 next
60 goto 20

this make analog pin 0 into the input, and it`s wise to put a 10Mohm (or more, I use 100Mohm) resistor between A0 and +5v to pull the X axis down towards the middle of the screen, if you have only a 10M resistor then use the +3.3v rail, but this isn`t writen in stone, so play about until you`re happy the Y axis is roughly center screen with no signal.

in line 40, the "128" value is the Gain for the Amplitude, experiment with that also, 128 works nicely here, and I can pick up a good sine wave with a 6 inch bit of wire on A0, that will increase as I bring my hand near to it.

I can`r really think of any real-World application for this beyond demonstrating the principal behind a scope trace as Input over Time, but my kids love it!

and if you find any way to make this Faster (less waves per screen) and in realtime, please post your work-around/solution, I`d love to see and try it.

have fun! :)
 
Raros

Regular Member

Joined: 06/02/2012
Location: Italy
Posts: 55
Posted: 06:50pm 09 Feb 2012
Copy link to clipboard 
Print this post

Great YT2095.
Very interesting.

Raros
 
ksdesigns

Senior Member

Joined: 25/06/2011
Location: United States
Posts: 143
Posted: 07:08pm 09 Feb 2012
Copy link to clipboard 
Print this post

this is my version ..
http://www.kenseglerdesigns.com/cms/forums/viewtopic.php?f=4 &t=170

10 CLS
20 DIM ynew(480):DIM yold(480)
30 SETPIN 1,1
40 x=0
50 PIXEL(x,140-yold(x))=0
60 ynew(x)=PIN(1)*50
70 PIXEL(x,140-ynew(x))=1
75 yold(x)=ynew(x)
80 x=x+1
90 IF x > 480 THEN x=0 ELSE GOTO 50
100 END
ken
 
YT2095

Newbie

Joined: 07/02/2012
Location: United Kingdom
Posts: 22
Posted: 12:48pm 10 Feb 2012
Copy link to clipboard 
Print this post

I just tried your program, and after only a few minor adjustments, I must say it`s a Lot neater than mine on screen.
seeing the Dimension array you used, also made me wonder how fast the board would be capable of writing the A0 pin data to the SD card, to make a sort of Storage Scope?
again, it would probably be of no practicable purpose, but would certainly serve to demonstrate the principal behind it.

being quite New to this dev system, but no stranger to BASIC, I wonder if ASM can be used in the code like on the BBC Micro for instance? hitting the metal directly would certainly speed things up a little were it possible.

Thanks for your input each! :)

 
Print this page


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

© JAQ Software 2024