//Get time function private float getTime() { dso.clearOffset(); //clear offset dso.setTimeScale(1.0f / (500.0f)); //set time scale dso.setScale(20.0F); //set volts scale dso.setTrigerSlopePos(); //set to trigger off positve slope of wavefrom dso.setTrigerLevel(-0.3F); //triggers off of level edge dso.setCoupling(DSO.Coupling.DC); //set coupling to DC dso.clearMeasure(); //clear measurements Thread.Sleep(500); //wati .5 sec var data = dso.getdata(); //var data set to getdata from DSO function data = data.Skip(data.Length / 2).ToArray(); //skip the first half of data, send to another array called data var xinc = 0F; try { xinc = dso.getXInc(); //get time between each x corridonate } catch { xinc = dso.getXInc(); } dso.isDone(); //set d to abs, finds all values that are less than 1V,multiplies it by x increment, send to array time. var time = data.Where((d) => Math.Abs(d) < 1).ToArray().Length *xinc; return(time); }
private float getTime() { dso.clearOffset(); dso.setTimeScale(1.0f / (500.0f)); dso.setScale(20.0F); dso.setTrigerSlopePos(); dso.setTrigerLevel(-0.3F); dso.setCoupling(DSO.Coupling.DC); dso.clearMeasure(); Thread.Sleep(500); var data = dso.getdata(); data = data.Skip(data.Length / 2).ToArray(); var xinc = dso.getXInc(); var time = data.Where((d) => Math.Abs(d) < 1).ToArray().Length *xinc; //gets on time return(time); }