Share My Creation Oscilloscope

After a question here 'How to create a scope', I played a bit with the subject. Reminded me some 'old' days :).
The program can:
- display 4 curves, selectable
- select time interval (sampling rate)
- select the scale for each curve
- set an offset for each curve
- three diplay modes (SCOPE, MEM, ROLL)
- when the scope is stopped, display the curve values (touching the screen and moving)

The program is based on a timer, therefore there could be timing problems on slow devices.
The scope is on a panel so it could be used in other programs.
The curves are calculated, but it's possible to change the GetValues routine to get other signals.

The program is more a 'demonstrator' rather than a stand alone scope.
Bug reports and suggestions are welcome.

Best regards.

EDIT: 2012.01.07 Version 1.1
Amended bug reported in post #9

EDIT: 2012.01.10 Version 1.2
ROLL mode does work, but somewhat slow

EDIT: 2012.01.11 Version 1.3
Amended the bugs reported in post #14

EDiT: 2018.05.04 Version 1.4
Set the target version to 26 in the ManifestEditor
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
 

Attachments

  • Oscilloscope.jpg
    Oscilloscope.jpg
    90.7 KB · Views: 15,976
  • Oscilloscope1.jpg
    Oscilloscope1.jpg
    90.5 KB · Views: 2,211
  • Oscilloscope2.jpg
    Oscilloscope2.jpg
    90.1 KB · Views: 2,222
  • Oscilloscope_V_1_4.zip
    8.4 KB · Views: 1,063
Last edited:

pinoy_ako

Member
Licensed User
Longtime User
nice share Mr. Klaus. thanks. now i'm thinking of hooking my ioio to this. i just can't think i can. :D
 

Scantech

Well-Known Member
Licensed User
Longtime User
Is the "U/Div" something like a Zoom function? Smaller "U/DIv" values appears to make the drawing bigger.

Setting the "U Offset" below 0 and decreasing the value of the "u/div" will cause graphing lines to go upward direction with higher GetValues. But setting the offset above 0 will cause the graphing lines to go downward direction from the main offset starting point when decreasing the value of u/div. Is this the intention of the program or a bug?

Setting 0 offset is at the center of the grid which is normal, but setting Negative U/Offset will start above the 0 grid area and positive U/Offset value will start below the 0 offset area. Bug?

I am really starting to like this app. Rolling function will be great. I wish I can help but I need more time studying the codes.

I was testing it with this code.

B4X:
Sub GetValues
   Dim i As Int
   
   For i = 0 To CurvesNb
      'CurveVal(i, ii) = a(i) * Sin(w(i) * t)
      CurveVal(i,ii) =  Rnd(0,2)
   Next
End Sub
 

klaus

Expert
Licensed User
Longtime User
Is the "U/Div" something like a Zoom function? Smaller "U/DIv" values appears to make the drawing bigger.
This is a normal function of an oscilloscope.
If you have an amplitude of 1 unit (volt or anything else) and a scale of 1 unit/division (1 U/Div) the amplitute on the screen is 1 division.
If you still have an amplitude of 1 unit and a scale of 0.5 unit/division (0.5 U/Div) the amplitute on the screen is 2 divisions ( 1 / 0.5 = 2).
If you still have an amplitude of 1 unit and a scale of 2 units/division (2 U/Div) the amplitute on the screen is 0.5 division ( 1 / 2 = 0.5).

Setting 0 offset is at the center of the grid which is normal, but setting Negative U/Offset will start above the 0 grid area and positive U/Offset value will start below the 0 offset area. Bug?
This is a bug.

The offset setting is in curve units, and not divisions.

Updated version 1.1 in the first post.

Best regards.
 

Scantech

Well-Known Member
Licensed User
Longtime User
Klaus, See attachment. Roll function works but I get the feeling it's not done right. Maybe you can polish it up. r1 and r2 got me confused.

There is a bug on #3 offset. the Event name is not correct.
 

Attachments

  • Oscilloscope.zip
    10.3 KB · Views: 895

klaus

Expert
Licensed User
Longtime User
Version 1.2 available in the first post with the ROLL mode working, but somewhat slow.
@Scantech
I tried your version, but it's not the right method.
Anyway the solution with copying bitmaps was not the right way to do it because the number of pixels for one step is not an integer.

Best regards.
 

Scantech

Well-Known Member
Licensed User
Longtime User
Well Done Klaus. I like it and works really good on my slow device. Lot better then copying bitmap.
 

Scantech

Well-Known Member
Licensed User
Longtime User
This attachment fixes a bug when switching Modes.

For/Next statement in the Roll can lead to a problem. I never figured out a way how to get out of this loop when exiting app on Android. It will keep looping and App will not reload. Other than that, everything else is smooth.
 

Attachments

  • Oscilloscope.zip
    10.1 KB · Views: 804

alan1968

Active Member
Licensed User
Longtime User
Hello Klaus,

I give you permission to use your code because I also tilt module in my app but less successful than yours

Alan
 

rajeev.piyare

New Member
Licensed User
Longtime User
Dear Klaus
Could you please advice as how can we use this for getting data from Arduino via a Bluetooth. I would like to plot real-time graphs for sensor inputs connected to Arduino analog input pins.

please help.

thanks in advanced.
 
Top