miniscope v3
You can find several different oscilloscope projects on my pages, but documentation is usally not complete. I had not released source code of PC application. I sent it to few interested people. They usally screamed in horror seeing the mess I made.
Miniscope v3 project is intented to create unified and modular user interface
for PC oscilloscopes.
Compiler/IDE: free Turbo C++ Explorer (BDS 2006). Installing current hotfixes (2009.10.14: rollup with Hotfixes 1-10,
additional Hotfixes 11, 12, 13 are available at http://cc.embarcadero.com/ for
registered users) is strongly recommended.
Update: unfortunately Embarcadero support for Turbo C++ 2006 Explorer is discontinued. Currently
there is now way to register new copy and receive free and legal key.
To run program
cc3270MT.dll and cg32.dll libraries may be
required (depending on compilation options used to build specific executable). Place them in application
or system directory.
Miniscope software is licensed as GPL v2. If the integration of miniscope code requires the use of a license other than GPL, an alternative license may be arranged. Contact me for further details.
Docs: doxygen
- 2008.12.30 Initial test project with display interface class and first
implementation (DisplayOpenGL) limited to single channel. Features
plot scaling and moving, screen cursors readout, amplitude spectrum presentation.
Display can be resized at runtime.
- 2009.04.01 Initial main app to input device dll interface.
Archive contains wavein.dll library that collects samples from
WAVEIN / WAVE MAPPER device.
miniscope_v3_0_0_2.7z - 2009.07.02 Main application, updated wavein.dll and brand new armscope.dll library
(for simple hardware based on AT91SAM7S64 you can find on my page) with source code.
Besides of new functionality
some bugs were fixed, including unnecessary CPU cycles consumed when graph content
doesn't need to be updated.
- 2009.07.18 Version 0.0.6:
- persistence of input device settings implemented inside device dll; armscope.dll uses cfg file parsed/generated with JsonCpp,
- changing used device dll without application restart.
- 2009.08.21 Version 0.0.7:
- FIXED: no coupling type update at startup,
- FIXED: plot not updated after resetting zoom/offset,
- FIXED: X axis labels incorrectly displayed in spectrum analyzer mode when there is no data,
- FIXED: no settings update when sensitivity/sampling/trigger trackbar position was changed using keyboard,
- added slow signal recorder mode,
- enabled main form hints, added hints for toolbar buttons,
- added progress bar representing received part of expected data buffer from device,
- armscope.dll: libusb updated to 0.1.12.1,
- turned off "Use dynamic RTL" option (no dependency to cc3270MT.dll),
- cursors are drawn on top of actual plot line,
- current X and Y axis zoom displayed on toolbar,
- added build timestamp to "About" and build-tools\touch.exe to build chain,
- added Statistics.cpp/StatisticsUnit.cpp - calculation of min, max and avg value,
- added dialog on startup when no input device dll is selected,
- added option to export plot image to bitmap file (File menu),
- armscope.dll project is NOT INCLUDED in this package - visit miniscope v2 page to download it.
- 2009.09.06 Version 0.0.8:
- FIXED: AV at startup if input library was not found,
- data vector passed do display represents physical value, not ADC output,
- offset and sensitivity calibration for each sensitivity range (if supported by input dll).
- 2009.09.11 Version 0.0.9:
- FIXED: leading backspace in default filename when saving plot as bitmap and default directory is empty,
- ScreenSnap set to true for some of the windows,
- added fancy hexagonal toolbar for plot (toggled by middle button),
- selecting input device dll is now required, application will abort if device is not selected,
- added feedback form for loading device, initial loading moved to TfrmMain::OnShow,
- added simple plot data export to JSON and CSV format.
- 2009.09.12 Version 0.0.10:
- FIXED: random halt (typically with continuous trigger when system CPU load was high); VCL code (reading GUI state) removed from CallbackTriggerFn,
- FFT is calculated only after receiving full expected data frame from device.
- 2009.09.17 Added hidpic.dll input plugin.
This device + library set is rather proof of concept than useful tool (well, just like wavein.dll). Hardware is PIC microcontroller running Generic HID example from MCHPUSB 2.5 package - reading ADC and switch, toggling LED when requested.
Since PIC microcontroller is configured to send single ADC value per HID report there is no way to get sampling rate over 1000 samples per second (and even at lower sample rates sampling period may be unstable).
On the plus side this is nice example how to create input dll using MinGW (not obvious thing is function name decoration, use -Wl,--add-stdcall-alias or -Wl,--kill-at) and work with HID devices in general.
Dll function names decoration comparison
Important note: project was built using MinGW bundled with Code::Blocks 8.02. When using newer MinGW version (bundled with C::B 10.05, 4.4.1) additional compilation switch -fshort-enums is required (using enum variable as a part of interface was a risky thing).
If you have PICDEM-USB or similar you should be able to test it in few minutes.
Please note that all input dll projects depends on header files that are part of main application and they are intended to be put on the same directory tree level as main application project.
This project is available to download from single-chip DSO page. - 2009.09.23 Version 0.0.11
- FIXED: zoom was not cleared in recorder mode; simplified ActionZoomClearExecute,
- display: auto adjusting plot zoom and position for Y axis; I don't consider similar command useful for X axis right now,
- display: added enum E_OFFSET_ACTION to Display class to allow leave offset untouched or clear it calling SetZoom,
- display: X offset is not changing when using Y axis zoom, Y offset is not changing when using X axis zoom.
- 2009.10.08 Version 0.0.12
- FIXED: plot grid visibility options had no meaning in recorder mode,
- statistics updated after receiving full frame (same as FFT) and when statistics window is opened if full frame is already received,
- statistics window is not shown until device dll is loaded,
- added signal frequency measuring to statistics,
- added transparency setting to plot toolbox; setting is ignored if tranparency is not supported by OS (i.e. Win98).
- 2009.10.20. Version 0.0.13
- FIXED: project failed to build if there was space in project path (incorrect Pre-Build tools command), thanks to £ukasz for report,
- FIXED: FFT was not displayed or displayed incorrectly if data buffer size was not power of two,
- SOLVED: high CPU usage by plot was side effect of using CodeGuard; with CodeGuard turned off (release build) drawing 14k samples takes less than 3 ms on Pentium M @ 600 MHz + ATI R9000 set (30 times faster than previously), d'oh!,
- added auto adjusting plot zoom and position for X axis,
- nicer log window,
- added TimeCounter.h - utility to measure execution time,
- added info about CodeGuard usage and debug build in About window.
- 2009.11.14. Version 0.0.14
- FIXED: on some low-end computers there was blank rectangle (size of the save dialog) visible on image exported to clipboard or file,
- FIXED: incorrectly displayed sensitivity, sampling and incorrect visibility state of buttons related to trigger types when failed to connect to device on startup,
- added JSON file viewer,
- oscilloscope control panel is disabled if device is not connected,
- receive progress bar is hidded when not waiting for data,
- reduced size of exported bitmap file (changed format to 8 bit).
- 2010.01.24 sig_test.dll - test signal generator plugin.
sig_test_dll.7z
- 2010.03.24 Version 0.0.15
-
Framework for signal filters based on factory pattern
(inspired by A. Alexandrescu, Modern C++ Design). This is nicely
scallable pattern - to add new filter type only single cpp file has
to be added to project, no changes in any other files are necessary.
filter.zip - changes to data collecting and drawing: data is buffered in dataOscTmp vector and written to main/displayed buffer (dataOsc) only when temporary buffer acquired full frame or main buffer is not filled yet; this change is useful for miniscope v2a,
- creating TBitmap for data export is now part of ConcreteDisplay,
- FIXED not working saving plot to bitmap and clipboard on Windows Vista and 7 (thanks Jakub Nizio³ek for the report).
-
Framework for signal filters based on factory pattern
(inspired by A. Alexandrescu, Modern C++ Design). This is nicely
scallable pattern - to add new filter type only single cpp file has
to be added to project, no changes in any other files are necessary.
- 2010.04.08 Version 0.0.16
- FIXED no display update/redraw after loading JSON file (thanks Jakub Nizio³ek for the report),
- added data recording to custom binary files (MS3). This file format
can hold up to 4 GB data (thus 1e9 samples since each sample is saved as float).
With miniscope v2a hardware with maximum 0.5MS/s sampling it can record
continuous data stream up to 2000 s length. File content browsing should be fast -
each file has index of data frames positions and only single data frame is loaded to RAM
at the time.
miniscope_v3_0_0_16_src.7z - 2010.05.04 Version 0.0.17
- FIXED: FFT view not updated when switching viewed frame from MS3 file,
- FIXED: can't switch to FFT mode when there is no device connected but data frame is loaded from MS3 file,
- FIXED: incorrect (always "Skipped (non-compatible) libraryname.dll") log message when failed to load/verify input dll (i.e. when loading library failed because some additional dependency was not met),
- FIXED: possible access overrun when opening damaged/false ms3 file,
- device interface: cookie is not checked inside OnLog callback,
- configurable size limit for MS3 files (100 MB default, range from 5 MB to 4000 MB), recording is stopped when limit is reached,
- added new notification window to show messages in a non-blocking way (i.e. when recording was stopped because of file size limit),
- limits for sampling interval of average value recorder (third mode next to FFT, do not confuse this with lately added MS3 recorder): 10 ms ... 7200 s; added OK button to set interval value (previously: value was changed with any change in edit control, value may temporary switch to default when edit control did not contained valid float string),
- MS3 viewer allows to select and view multiple subsequent frames at once; selected frames must have same sampling frequency (currently only this parameter is checked),
- MS3: added "file already exists" warning when selecting file for recording.
Storing and loading large data collections makes it easy to further benchmark graph module performance. On my computer (Pentium M @ 600 MHz + ATI R9000) drawing 1310720 (1.25 M) samples takes about 260 ms. This time seems to be independent from current graph (application window) size but is higly dependentant on CPU speed - switching to 1.6 GHz makes drawing roughly 2 times faster.
miniscope_v3_0_0_17_bin.7z
miniscope_v3_0_0_17_src.7z - 2010.05.16 Version 0.0.18
- FIXED: problem with limits of average value recorder sampling interval,
- added tool repairing damaged ms3 files with missing file footer/index; this is the only only realistic type of damage - it may happen when program was killed (or - hopefully not - halted) in the middle of recording.
- 2010.05.22 Version 0.0.19
- FIXED: possible EZeroDivide exception at glViewport() function in DisplayOpenGL module due to unitialized iWidth, iHeight variables at startup,
- added dll version info to Settings / input plugin list.
- 2010.05.26 Version 0.0.20
- FIXED: possible AV error at startup caused by static variables initialization hazard (DataFilterFactory::Register() called before DataFilterFactory type object was created).
- 2010.06.25 Version 0.0.21
- added FFT window selection built upon factory pattern; each window type comes with short descriptions and windows are sorted by main lobe width (currently: rectangular, Hamming, Hamming, Blackman-Harris and flat top),
- added limit of samples used to perform FFT setting; number of samples used for FFT calculation equals power of two lower than size of captured data frame,
- changed default plot zoom and offset in FFT mode (there is no point in showing negative scale),
- statistics: added RMS value measurement.
- 2010.10.16 Quick-and-dirty Bus Pirate support written with help of ©iklo¹i Jano¹. It uses continuous
sampling mode of this device (~5720 Sps, 10-bit unsigned samples) and it requires Bus Pirate firmware 5.8 or newer. This library gives access to
manual trigger only but other modes can be added including continuous streaming of course. If you'd
like to make some experiments on your own than armscope_dma.dll source code may be helpful (my AT91SAM7S64-based
device is also streaming data continuously, triggering and lower than maximum sampling frequencies are
simulated). This library was built using Code::Blocks 10.05 and bundled MinGW (4.4.1), if you'd like
to create project from scratch don't forget to add -fshort-enums to compilation options and force described
previously function name decoration.
Note: COM port number is COM3 by default and can be changed through configuration file, there is no configuration window for now. Configuration file is created after first run (after closing application actually) and is located inside miniscope /device subdirectory (same place where bus_pirate.dll has to be copied).
bus_pirate_dll_20101016.7z
- 2010.10.21 Bus_pirate.dll: added raising/falling slope trigger and continuous capturing. Same as with AT91SAM7S64/DMA
continuous capturing allows to record very long data stream (configurable
limit up to 10^9 samples in binary ms3 file).
bus_pirate_dll_20101021.7z
- 2010.10.25 Windrider has reported problem with
application hangup when closing. Apparently problem has gone with little changes to dll (bus_pirate_dll_20101025.7z),
but I suspect problem was just hidden, so I would still recommend previous version.