Home - nrmtmt/DSO GitHub Wiki

Welcome to the DSO project wiki!

Introduction:

This library is intended to work with variety of JyeTech scopes. It has simple interface and can be easily added to other projects. More information below.

System requirements:

This library needs .NET framework v4.0 and above. So it can run under all version of Windows starting from Windows XP.

Supported models:

  • DSO068 - fully supported
  • DSO112A - partially supported (scope has bugs in serial interface)
  • Other JyeScope scopes that support serial interface (DSO094, DSO082 etc.) should work in DSO068 mode but this is untested.

How to initialize:

First you need to create SerialPortAdapter object.

SerialPortAdapter Adapter = new SerialPortAdapter(SerialPort serialPort)

Where SerialPort is System.IO.Ports.SerialPort port of JyeScope device. After creating port you can create scope object. All scopes that are supported inherites from abstract JyeScope class that implement IScope interface. You can manually initialize scope as shown below:

IScope scope = new DSO.DSO068(SerialPortAdapter Adapter)

or

IScope scope = new DSO.DSO112(SerialPortAdapter Adapter)

where SerialPortAdapter is object that use IStreamResource interface

You can also use static Initialization class to automatically get proper scope object:

IScope scope = DSO.Initialization.GetScope(SerialPortAdapter Adapter)

IScope interface overview:

JyeScope class implements IScope interface:

 public interface IScope
    {
        event EventHandler NewDataInBuffer;
        bool Destroy();
        bool Connect();
        bool Disconnect();
        bool StartCapture();
        bool StopCapture();
        string ScopeName { get; }
        IParameter<float> CurrentVoltageLimit { get; }
        IParameter<int> DataSamplesPerDiv { get; }

        List<IParameter<Config.Timebase>> AvailableTimebaseSettings { get; }
        List<IParameter<Config.Coupling>> AvailableCoupleSettings { get; }
        List<IParameter<Config.Slope>> AvailableTriggerSlopeSettings { get; }
        List<IParameter<Config.VerticalSensitivity>> AvailableSenitivitySettings { get; }
        List<IParameter<Config.TriggerMode>> AvailableTriggerModeSettings { get; }
        List<IParameter<Config.RecordLength>> AvailableRecordLength { get; }

        IParameter<Config.Timebase> TimeBase { get; set; }
        IParameter<Config.Coupling> Couple { get; set; }
        IParameter<Config.Slope> TriggerSlope { get; set; }
        IParameter<Config.VerticalSensitivity> Sensitivity { get; set; }
        IParameter<Config.TriggerMode> TriggerMode { get; set; }
        IParameter<Config.RecordLength> RecordLength { get; set; }
        int TriggerPosition { get; set; }
        float TriggerLevel { get; set; }
    }

where IParameter is:

public interface IParameter<T>
    {
        string ParameterName { get; }
        string ParameterValue { get; }
        string ParameterUnit { get; }
        bool IsReadOnly { get; }
        T GetParameter { get; }
    }

All Booleans values returns true if command is executed succesfully.

event EventHandler NewDataInBuffer;

This is event fired when there are new data readed in buffer.
Sender object is float[] array. Values are in same units as CurrentVoltageLimit.

Register to the event:

scope.NewDataInBuffer += Scope_NewDataInBuffer;

Read data from event sender:

private void Scope_NewDataInBuffer(object sender, EventArgs e)
        {
            float[] values = (float[])sender;
        }

bool Destroy();

Scope exits from USB mode. This command frees also all resources used by scope (serial port etc.) and disposes Scope object.

scope.Destroy();

bool Connect();

Command to connect with scope. Returns true if connection is succesfull. After invoking this command, all scope parameters and fields are filled with proper values supported by scope. Also current measurements are getting read and at this point you can receive measurements and control scope via PC.

scope.Connect();

bool Disconnect();

Scope exits from USB mode and also read from serial port is halted.

scope.Disconnect();

bool StartCapture();

Scope enters USB mode. To use this command scope need to be connected. This command is mainly used for start capture data from scope after invoking StopCapture command.

scope.StartCapture();

bool StopCapture();

Scope exits from USB mode but read from serial port is not halted (scope is not disconnected). Useful for manually change parameters in scope. To resume capture use StartCapture command.

scope.StopCapture();

string ScopeName { get; }

Return scope name.

string name = scope.ScopeName();

IParameter CurrentVoltageLimit { get; }

Return voltage limit for actual scope settings.

float voltageLimit = CurrentVoltageLimit.GetParameter();

IParameter DataSamplesPerDiv { get; }

Return current value of data samples per division.

int samplesPerDiv = DataSamplesPerDiv.GetParameter();

List<IParameter<(setting)>> Setting { get; }
IParameter<(setting)> Setting { get; set; }

List of IParameter objects that corresponds to all available settings of that parameter supported by scope. You can select exact object from that list and set it to appropriate parameter of scope. Below is example showing select desired timebase from list and assign it to correct scope field. Every other parameter that you can choose from list work in same manner.

Scope.Timebase = AvailableTimebaseSettings[1];

int TriggerPosition { get; set; }

Trigger position in percentage of buffer. For exapmple if you set trigger position to 50 it would mean that signal is triggered exactly in the middle of buffer

Scope.TriggerPosition = 50;

float TriggerLevel { get; set; }

Actual trigger level of scope. Units are same as in CurretVoltageLimit

Scope.TriggerLevel = 3.17; //Volts

Exceptions

ScopeNotRecognizedException

Throwns by Initialization class

throw new ScopeNotRecognizedException($"Scope not recognized. Returned scope type: {(int)Ready.ScopeType}.");

Exception is being thrown when scope is not recognized but it somehow responds to standard jyeScope commands. At that point you can manually create JyeScope object (DSO068 or DSO112, but DSO068 is more generic so it's better to choose it first) and check if you can control scope.

ScopeNotSupportedException

Throwns by Initialization class

throw new ScopeNotSupportedException($"Scope recognized but not supported. Returned scope type: {(int)Ready.ScopeType}.");

Exception is being thrown when scope is recognized but not yet implemented (this is the case of DSO082, DSO094). You can try to treat them as DSO068 scope.

ScopeNotDetectedException

Throwns by Initialization class

throw new ScopeNotDetectedException("Scope not detected.");

Exception is thrown when object is not correctly responds while trying to establish connection or there is no response at all.

ParametersNotSetException

Exception is thrown when setting parameter (for example Timebase) to scope failed.

FrameNotAcknowledgedException

Exception is thrown when there is no acknowledgement from scope that it received command. (This exception is internal and shouldn't being thrown outside. If this situation happen this must be considered as a bug in library).

InvalidDataFrameException

Exception is being thrown when DataFrame cannot be created from current buffer. (This exception is internal and shouldn't being thrown outside. If this situation happen this must be considered as a bug in library).

⚠️ **GitHub.com Fallback** ⚠️