Downloads of the Java-oscilloscope-files

Here are some files for building the PC-side of the oscilloscope. This can be relatively complicated to handle, and I am not willing to assist very much in building this system. As there is currently not any Java USB object (at least that I know of), I have had to build the USB interface in C. But you can probably easily see, that I am not a C programmer. You should compile the program Port.c in such a way, that you get a dll-file Port.dll. Then you should be able to compile the Java programs OscDig.java and OscAn.java for the Oscilloscope in digital and analog mode.

I now have a 64 bit Windows, but I still have a 32 bit Borland C compiler. Consequently I have to compile the Java programs in 32 bit mode, which is done by using an older version of JDK (Java Development Kit).

Also note in Port.c the primitive way I have handled the port numbers. If you happen to be assigned another port numbers than the ones mentionened in Port.c, you have to add a similar code. But I'm sure you can do this better. Also, I handle the ports in a primitive way, by returning 256, if there is no data in the Virtual Com Port. Then the java program has to note the 256 value, and ask again.

Here are the files to download:

  1. OscDig.java
  2. OscAn.java
  3. Figur.java
  4. Plot.java
  5. PlotScreen.java
  6. ValueList.java
  7. VarList.java
  8. Text.java
  9. Time.java
  10. InFile.java
  11. OutFile.java
  12. StringOp.java
  13. Time.java
  14. GIF.java
  15. LZW.java
  16. Port.java
  17. Port.h
  18. Port.c
  19. .Serial.h
  20. Serial.obj
  21. Jni.h
  22. Jni_md.h
Please note the following. The object GIF makes gif-files of the screen pictures you get. They are encoded using the LZW object. The gif-format has been patent protected, and it means that commercial use of the files created by GIF and LZW was prohibited. To my understanding, the patent has run out now, but if you considering making commercial use of these gif-files, you should check this.

A short manual to the plot program

When you start the main program, OscDig.java (OscAn behaves similarly), you get a small white window. That window receives your keyboard commands, so if you put the mouse there, and hit 'q', the program will exit.

When you have pressed the red trigger button, and 50000 samples have been received, a graphics window will appear. (That window will also be a receiver of keyboard commands.) After some manipulation, it may look something like this:



The variables are named in the upper right corner. There is, in this case, the time t, two binary variables x1 and x2, and the time stamp signal. You adress these variables by their numbers in the left column. If you type 1≺CR≻, x1 gets plotted as a function of time. If you want to see x2 now, and maintain x1, you type p2≺CR≻ (p for "parallell"). You can draw x1 as a function of x2 (which is rarely. very interesting, but...) by typing 12≺CR≻.

Initially, you get everything in automatic scaling, and consequently you cover the whole time range from 0 to 0.168 seconds.

Now you can zoom into the plot, by using the "menu" at the lower right corner. The marked alternative in the menu is typed in red, and you move through the menu with the control button and the arrow keys. [cntrl]up moves you up. Choosing the "last" alternative and using the left key, you can move the final time of the plot. Choosing the "first" alternative, you can move the initial time of the plot. In the figure above, we have used that to pick out a small fraction of the total time, to look at a detail. Which fraction of the total sampled time it is, is indicated by the small blue lines under the time scale. The exact initial and final times are also given at the ends of the time scale. Once you think that the span of time between the initial and final time is OK, you can slide through the plot by choosing the "slide" alternative. In the figure I have also moved the lower and higher limits of the plot outwards. That makes the pulses a little lower which makes them easier to recognize as pulses. The zero level is marked with a grey line. The pulses are separated in level, to make it easier to distinguish them.

The figure comes from a test with the FM radio. The blue curve shows the clock pulses, and the red curves shows data on the I2C bus.

As mentioned, 'q' quits the program. 'g' makes a gif-image file of the current plot. You will be prompted for a file name. If you move the mouse into the plot area, the coordinates of the mouse position will be give on top of the plot. There will also be a cross hair centered at the mouse cursor. By choosing the "cross" alternative, you can move that cross hair slowly over the picture with the arrow keys.

OscDig.java saves the result of the sampling on a file named "oscd#0.dat". (OscAn changes the number after '#' each time, but the numbers returns to 0, when you start the program over). That file can obviously be copied to other files with new names for archiving. The Plot.java program has a main program, so you can run it stand alone, to look at archived files. Just make

java Plot <filename>