/// <summary> /// Initializes a new instance of the <see cref="iWFS210ViewController"/> class. /// </summary> /// <param name="handle">Handle.</param> public iWFS210ViewController(IntPtr handle) : base(handle) { Oscilloscope = new Oscilloscope(); var markerExist = NSUserDefaults.StandardUserDefaults["markers"]; if (markerExist == null) { NSUserDefaults.StandardUserDefaults.SetBool(true, "markers"); } var demo = NSUserDefaults.StandardUserDefaults.BoolForKey("demo"); if (demo) { ServiceManager = new ServiceManager(Oscilloscope, ServiceType.Demo); } else { ServiceManager = new ServiceManager(Oscilloscope, ServiceType.Live); GetIpAdress(); if (!Service.Activate()) { ServiceManager.ServiceType = ServiceType.Demo; new UIAlertView("No Connection", "Demo mode is now running", null, "OK", null).Show(); } else { Service.RequestSettings(); Service.RequestWifiSettings(); Service.RequestSamples(); } } DisplaySettings = new DisplaySettings(MarkerUnit.dt, SignalUnit.Vdc); }
public void ActivateIn(IEditorContainer newWindow) { container = newWindow; var knob = new KnobControl(); knob.Location = new Point(0, 0); this.Controls.Add(knob); Adorn(knob); Adorn <Connector>(knob).Add("knobOut", new Point(12, 12), Color.SkyBlue); var oscillo = new Oscilloscope(); oscillo.Location = new Point(400, 400); this.Controls.Add(oscillo); Adorn(oscillo); Adorn <Connector>(oscillo).Add("oscilloIn", new Point(12, 12), Color.Pink); var t = new TestGraph(); t.Location = new Point(200, 200); this.Controls.Add(t); Adorn(t); }
/// <summary> /// Initializes a new instance of the <see cref="WFS210.Services.ServiceManager"/> class. /// </summary> /// <param name="oscilloscope">Oscilloscope used to instantiate each service.</param> /// <param name="defaultType">The default service type.</param> public ServiceManager(Oscilloscope oscilloscope, ServiceType defaultType) { AddService(ServiceType.Demo, new DemoService(oscilloscope)); AddService(ServiceType.Live, new LiveService(oscilloscope)); this.ServiceType = defaultType; }
public Spectrograph() { InitializeComponent(); _soundIn = new WasapiLoopbackCapture(); _soundIn.Initialize(); var soundInSource = new SoundInSource(_soundIn); var singleBlockNotificationStream = new SingleBlockNotificationStream(soundInSource); _source = singleBlockNotificationStream.ToWaveSource(); if (!Directory.Exists(_loopbackDir)) { Directory.CreateDirectory(_loopbackDir); } _writer = new WaveWriter(_loopbackDir + "/loopback.wav", _source.WaveFormat); byte[] buffer = new byte[_source.WaveFormat.BytesPerSecond / 2]; soundInSource.DataAvailable += (s, e) => { int read; while ((read = _source.Read(buffer, 0, buffer.Length)) > 0) { _writer.Write(buffer, 0, read); } }; _lineSpectrumProvider = new BasicSpectrumProvider(_source.WaveFormat.Channels, _source.WaveFormat.SampleRate, fftSize); _spectrogramProvider = new BasicSpectrumProvider(_source.WaveFormat.Channels, _source.WaveFormat.SampleRate, fftSize); singleBlockNotificationStream.SingleBlockRead += SingleBlockNotificationStream_SingleBlockRead; _soundIn.Start(); _lineSpectrum = new LineSpectrum(fftSize) { SpectrumProvider = _lineSpectrumProvider, UseAverage = true, BarCount = 22, BarSpacing = 1, IsXLogScale = true, ScalingStrategy = ScalingStrategy.Sqrt }; _oscilloscope = new Oscilloscope(); _spectrogram = new Spectrogram(fftSize) { SpectrumProvider = _spectrogramProvider, UseAverage = true, BarCount = (int)fftSize, BarSpacing = 0, IsXLogScale = true, ScalingStrategy = ScalingStrategy.Sqrt }; _keyboardVisualizer = new KeyboardVisualizer(); UpdateTimer.Start(); }
public FormOscilloscope(Oscilloscope oscilloscope) { this.oscilloscope = oscilloscope; InitializeComponent(); cbChannel.SelectedIndex = 0; Text = "Oscilloscope (" + oscilloscope.Idendity + ")"; RefreshWaveformData(false); new Thread(WaveformThread).Start(); }
public Visualizer() { InitializeComponent(); _graphics = DrawPanel.CreateGraphics(); _graphics.SmoothingMode = SmoothingMode.AntiAlias; _graphics.CompositingQuality = CompositingQuality.AssumeLinear; _graphics.PixelOffsetMode = PixelOffsetMode.Default; _graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; _graphics.Clear(Color.Black); _oscilloscope = new Oscilloscope(); for (int i = 0; i < _pens.Length; i++) { _pens[i] = new Pen(Color.FromArgb(i, i, i)); } _fftProvider = new FftProvider(1, FftSize.Fft4096); _soundIn = new WasapiLoopbackCapture(); _soundIn.Initialize(); var soundInSource = new SoundInSource(_soundIn); var singleBlockNotificationStream = new SingleBlockNotificationStream(soundInSource); _source = singleBlockNotificationStream.ToWaveSource(); if (!Directory.Exists("%AppData%/Spectrograph")) { Directory.CreateDirectory("%AppData%/Spectrograph"); } _writer = new WaveWriter("%AppData%/Spectrograph/loopback.wav", _source.WaveFormat); byte[] buffer = new byte[_source.WaveFormat.BytesPerSecond / 2]; soundInSource.DataAvailable += (s, e) => { int read; while ((read = _source.Read(buffer, 0, buffer.Length)) > 0) { _writer.Write(buffer, 0, read); } }; singleBlockNotificationStream.SingleBlockRead += SingleBlockNotificationStreamOnSingleBlockRead; _soundIn.Start(); }
// 1M data point acquisition static void LongMemoryAcquisitionExample() { Oscilloscope rigol = new Oscilloscope(); rigol.Run(); rigol.SetWaveformPointsMode(PointsMode.Maximum); rigol.SetAcquireMemoryDepth(AcquireMemoryDepth.Long); rigol.SetTriggerSweep(TriggerSweep.Single); rigol.WaitTriggerStop(); rigol.Stop(); WaveForm wave = rigol.Channel1.GetWaveform(); wave.SaveCSV(csvFileName); rigol.Close(); }
/// <summary> /// Simple Command Line Prompt for Rigol oscilloscope /// </summary> static void OscilloscopePromptExample() { Console.WriteLine("Oscilloscope Command Prompt"); Console.WriteLine("Instruments:"); string[] resources = Oscilloscope.GetResources(); for (int i = 0; i < resources.Length; i++) { Console.WriteLine("[" + i.ToString() + "]: " + resources[i]); } int resIndex; menu: if (!int.TryParse(Console.ReadLine().Trim(), out resIndex)) { Console.WriteLine("Please choose instrument "); goto menu; } Console.WriteLine("Example commands:"); Console.WriteLine("*IDN?"); Console.WriteLine(":WAVEFORM:DATA? CHAN1"); Console.WriteLine("quit"); // Create instance of Oscilloscope class and stop any acquisition Oscilloscope rigol = new Oscilloscope(resources[resIndex]); while (true) { Console.Write(">"); string cmd = Console.ReadLine(); if (cmd == "quit") { break; } rigol.Write(cmd); if (cmd.Contains("?")) { Console.WriteLine(rigol.ReadString()); } } rigol.Close(); }
public ControllerTestForm() { InitializeComponent(); oscPortTextBox.Text = "9123"; oscStopButton.Enabled = false; DateTime t1 = DateTime.Now; SettingsPersister.ReadOptions(); TimeSpan ts = DateTime.Now - t1; Tracer.WriteLine("ReadOptions() took " + ts.Milliseconds + " ms"); Tracer.setInterface(statusBar, statusBar2, null); // mainProgressBar); Tracer.WriteLine("GUI up"); periodicMaintenanceTimer = new System.Windows.Forms.Timer(); periodicMaintenanceTimer.Interval = 500; periodicMaintenanceTimer.Tick += new EventHandler(periodicMaintenance); periodicMaintenanceTimer.Start(); Tracer.WriteLine("OK: Maintenance ON"); // put Osc_DLL.dll in C:\Windows string oscilloscopeIniFile = Project.startupPath + "..\\..\\LibOscilloscope\\Scope_Desk.ini"; oscilloscope = Oscilloscope.Create(oscilloscopeIniFile, null); if (oscilloscope != null) { Tracer.Trace("loaded oscilloscope DLL"); oscilloscope.Show(); // appears in separate window } else { Tracer.Error("Couldn't load oscilloscope DLL"); Tracer.Error("Make sure " + oscilloscopeIniFile + " is in place"); Tracer.Error("Make sure C:\\WINDOWS\\Osc_DLL.dll is in place and registered with regsvr32"); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //Create the Oscilloscope this.Oscilloscope = new Oscilloscope(); //Create the ServiceManager this.ServiceManager = new ServiceManager(Oscilloscope, ServiceType.Demo); //Set the IPAdress based on the gateway var liveService = this.ServiceManager.GetService(ServiceType.Live) as LiveService; liveService.Connection.IPAddress = GetIPAdress(); this._ScopeView = FindViewById <SignalView> (Resource.Id.SignalView); _ScopeView.SetLayerType(LayerType.Hardware, null); this._VoltTimeIndicator = FindViewById <TextView> (Resource.Id.VoltTimeIndicator); //TODO Check API Compatibility //this._VoltTimeIndicator.SetZ (999f); this._CalibratingIndicator = FindViewById <TextView> (Resource.Id.CalibratingIndicator); //TODO Check API Compatibility //this._CalibratingIndicator.SetZ (999f); this.DisplaySettings = new DisplaySettings(MarkerUnit.dt, SignalUnit.Vdc); LoadControls(); ServiceManager.SettingsChanged += HandleSettingsChanged; ServiceManager.FullFrame += HandleFullFrame; this._ScopeView.ServiceManager = this.ServiceManager; this._ScopeView.Oscilloscope = this.Oscilloscope; _ScopeView.SelectedChannel = 0; _ScopeView.NewData += (object sender, NewDataEventArgs e) => RunOnUiThread(() => UpdateMeasurements()); _ScopeView.DrawMarkers = true; }
public static void Main() { // Print library information: PrintInfo.PrintLibraryInfo(); // Enable network search: Network.AutoDetectEnabled = true; // Update device list: DeviceList.Update(); // Try to open an oscilloscope with connection test support: Oscilloscope scp = null; for (UInt32 i = 0; i < DeviceList.Count; i++) { DeviceListItem item = DeviceList.GetItemByIndex(i); if (item.CanOpen(DeviceType.Oscilloscope)) { scp = item.OpenOscilloscope(); // Check for connection test support: if (scp.HasConnectionTest) { break; } else { scp.Dispose(); scp = null; } } } if (scp != null) { try { // Get the number of channels: UInt16 channelCount = Convert.ToUInt16(scp.Channels.Count); // Enable all channels that support connection testing: for (UInt16 Ch = 0; Ch < channelCount; Ch++) { scp.Channels[Ch].Enabled = scp.Channels[Ch].HasConnectionTest; } // Start connection on current active channels: scp.StartConnectionTest(); // Wait for connectiontest to complete: while (!scp.IsConnectionTestCompleted) { Thread.Sleep(10); // 10 ms delay, to save CPU time. } // Get data: TriState[] Data = scp.GetConnectionTestData(); // Print results: Console.WriteLine("Connection test result:"); for (UInt16 ch = 0; ch < channelCount; ch++) { Console.Write("Ch" + ch.ToString() + " = "); switch (Data[ch]) { case TriState.Undefined: Console.WriteLine("undefined"); break; case TriState.False: Console.WriteLine("false"); break; case TriState.True: Console.WriteLine("true"); break; default: Console.WriteLine("unknown state"); break; } } } catch (System.Exception e) { Console.WriteLine("Exception: " + e.Message); Environment.Exit(1); } // Close oscilloscope: scp.Dispose(); scp = null; } else { Console.WriteLine("No oscilloscope available with connection test support!"); Environment.Exit(1); } Environment.Exit(0); }
/// <summary> /// Initializes a new instance of the <see cref="WFS210.Services.DemoService"/> class. /// </summary> /// <param name="oscilloscope">Oscilloscope.</param> public DemoService(Oscilloscope oscilloscope) : base(oscilloscope) { signalGenerator = new SignalGenerator(); }
public static void Main() { // Print library information: PrintInfo.PrintLibraryInfo(); // Enable network search: Network.AutoDetectEnabled = true; // Update device list: DeviceList.Update(); // Try to open an oscilloscope with block measurement support and a generator in the same device: Oscilloscope scp = null; Generator gen = null; for (UInt32 i = 0; i < DeviceList.Count; i++) { DeviceListItem item = DeviceList.GetItemByIndex(i); if (item.CanOpen(DeviceType.Oscilloscope) && item.CanOpen(DeviceType.Generator)) { scp = item.OpenOscilloscope(); if ((scp.MeasureModes & Constants.MM_BLOCK) != 0) { gen = item.OpenGenerator(); break; } else { scp.Dispose(); scp = null; } } } if (scp != null && gen != null) { try { // Oscilloscope settings: // Get the number of channels: UInt16 channelCount = Convert.ToUInt16(scp.Channels.Count); // Set measure mode: scp.MeasureMode = MeasureMode.Block; // Set sample frequency: scp.SampleFrequency = 1e6; // 1 MHz // Set record length: scp.RecordLength = 10000; // 10 kS UInt64 recordLength = scp.RecordLength; // Read actual record length. // Set pre sample ratio: scp.PreSampleRatio = 0; // 0 % // For all channels: for (UInt16 ch = 0; ch < channelCount; ch++) { OscilloscopeChannel channel = scp.Channels[ch]; // Enable channel to measure it: channel.Enabled = true; // Set range: channel.Range = 8; // 8 V // Set coupling: channel.Coupling = Coupling.DCV; // DC Volt } // Set trigger timeout: scp.TriggerTimeOut = 1; // 1 s // Disable all channel trigger sources: for (UInt16 ch = 0; ch < channelCount; ch++) { scp.Channels[ch].Trigger.Enabled = false; } // Locate trigger input: TriggerInput triggerInput = scp.TriggerInputs.GetById(Constants.TIID_GENERATOR_NEW_PERIOD); // or Constants.TIID_GENERATOR_START or Constants.TIID_GENERATOR_STOP if (triggerInput == null) { throw new System.Exception("Unknown trigger input!"); } // Enable trigger input: triggerInput.Enabled = true; // Generator settings: // Set signal type: gen.SignalType = SignalType.Triangle; // Set frequency: gen.Frequency = 1e3; // 1 kHz // Set amplitude: gen.Amplitude = 2; // 2 V // Set offset: gen.Offset = 0; // 0 V // Enable output: gen.OutputOn = true; // Print oscilloscope info: PrintInfo.PrintDeviceInfo(scp); // Print generator info: PrintInfo.PrintDeviceInfo(gen); // Start measurement: scp.Start(); // Start signal generation: gen.Start(); // Wait for measurement to complete: while (!scp.IsDataReady) { Thread.Sleep(10); // 10 ms delay, to save CPU time. } // Stop generator: gen.Stop(); // Disable output: gen.OutputOn = false; // Get data: float[][] data = scp.GetData(); // Open file with write/update permissions: string filename = "OscilloscopeGeneratorTrigger.csv"; StreamWriter file = new StreamWriter(filename, false); // Output CSV data: if (File.Exists(filename)) { // Write csv header: file.Write("Sample"); for (UInt16 i = 0; i < channelCount; i++) { file.Write(string.Format(";Ch{0}", i + 1)); } file.Write(Environment.NewLine); // Write the data to csv: for (UInt64 i = 0; i < recordLength; i++) { file.Write(i.ToString()); for (UInt16 ch = 0; ch < channelCount; ch++) { file.Write(";" + data[ch][i].ToString()); } file.Write(Environment.NewLine); } Console.WriteLine("Data written to: " + filename); // Close file: file.Close(); } else { Console.WriteLine("Couldn't open file: " + filename); Environment.Exit(1); } } catch (System.Exception e) { Console.WriteLine("Exception: " + e.Message); Environment.Exit(1); } // Close oscilloscope: scp.Dispose(); scp = null; // Close generator: gen.Dispose(); gen = null; } else { Console.WriteLine("No oscilloscope available with block measurement support!"); Environment.Exit(1); } Environment.Exit(0); }
private void Form1_Load(object sender, EventArgs e) { // List aviable COM ports and select last in list string[] aviablePorts = System.IO.Ports.SerialPort.GetPortNames(); for (int i = 0; i < aviablePorts.Length; i++) { comboBox_COM.Items.Add(aviablePorts[i]); } comboBox_COM.SelectedIndex = comboBox_COM.Items.Count - 1; // Create scope objects scopeA = Oscilloscope.CreateScope("scope_settings.ini", ""); if (scopeA != null) { scopeB = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeC = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeD = Oscilloscope.CreateScope("scope_settings.ini", ""); } // Set default scope channels comboBox_scopeA0.SelectedIndex = 0; comboBox_scopeA1.SelectedIndex = 1; comboBox_scopeA2.SelectedIndex = 2; comboBox_scopeAtrig.SelectedIndex = 12; comboBox_scopeB0.SelectedIndex = 3; comboBox_scopeB1.SelectedIndex = 4; comboBox_scopeB2.SelectedIndex = 5; comboBox_scopeBtrig.SelectedIndex = 13; comboBox_scopeC0.SelectedIndex = 6; comboBox_scopeC1.SelectedIndex = 7; comboBox_scopeC2.SelectedIndex = 8; comboBox_scopeCtrig.SelectedIndex = 14; comboBox_scopeD0.SelectedIndex = 9; comboBox_scopeD1.SelectedIndex = 10; comboBox_scopeD2.SelectedIndex = 11; comboBox_scopeDtrig.SelectedIndex = 15; // Show scopes (else disable scope form controls if .dll error) if (scopeA != null) { scopeA.ShowScope(); } else { label_scopeA.Enabled = false; comboBox_scopeA0.Enabled = false; comboBox_scopeA1.Enabled = false; comboBox_scopeA2.Enabled = false; comboBox_scopeAtrig.Enabled = false; } if (scopeB != null) { scopeB.ShowScope(); } else { label_scopeB.Enabled = false; comboBox_scopeB0.Enabled = false; comboBox_scopeB1.Enabled = false; comboBox_scopeB2.Enabled = false; comboBox_scopeBtrig.Enabled = false; } if (scopeC != null) { scopeC.ShowScope(); } else { label_scopeC.Enabled = false; comboBox_scopeC0.Enabled = false; comboBox_scopeC1.Enabled = false; comboBox_scopeC2.Enabled = false; comboBox_scopeCtrig.Enabled = false; } if (scopeD != null) { scopeD.ShowScope(); } else { label_scopeD.Enabled = false; comboBox_scopeD0.Enabled = false; comboBox_scopeD1.Enabled = false; comboBox_scopeD2.Enabled = false; comboBox_scopeDtrig.Enabled = false; } // Create new DAQ32 data object data = new DAQ32data(); // Start for update timer formUpdateTimer = new Timer(); formUpdateTimer.Interval = 50; formUpdateTimer.Tick += new EventHandler(formUpdateTimer_Tick); formUpdateTimer.Start(); }
private void Form1_Load(object sender, EventArgs e) { // List aviable COM ports and select last in list string[] aviablePorts = System.IO.Ports.SerialPort.GetPortNames(); for (int i = 0; i < aviablePorts.Length; i++) { comboBox_COM.Items.Add(aviablePorts[i]); } comboBox_COM.SelectedIndex = comboBox_COM.Items.Count - 1; // Create scope objects scopeA = Oscilloscope.CreateScope(iniFileName, ""); if (scopeA != null) { scopeB = Oscilloscope.CreateScope(iniFileName, ""); scopeC = Oscilloscope.CreateScope(iniFileName, ""); scopeD = Oscilloscope.CreateScope(iniFileName, ""); } // Set default scope channels comboBox_scopeA0.SelectedIndex = 0; comboBox_scopeA1.SelectedIndex = 1; comboBox_scopeA2.SelectedIndex = 2; comboBox_scopeAtrig.SelectedIndex = 12; comboBox_scopeB0.SelectedIndex = 3; comboBox_scopeB1.SelectedIndex = 4; comboBox_scopeB2.SelectedIndex = 5; comboBox_scopeBtrig.SelectedIndex = 13; comboBox_scopeC0.SelectedIndex = 6; comboBox_scopeC1.SelectedIndex = 7; comboBox_scopeC2.SelectedIndex = 8; comboBox_scopeCtrig.SelectedIndex = 14; comboBox_scopeD0.SelectedIndex = 9; comboBox_scopeD1.SelectedIndex = 10; comboBox_scopeD2.SelectedIndex = 11; comboBox_scopeDtrig.SelectedIndex = 15; // Show scopes and use default settings if .ini file file not present if (scopeA != null) { scopeA.ShowScope(); scopeB.ShowScope(); scopeC.ShowScope(); scopeD.ShowScope(); if (!File.Exists(iniFileName)) { #region default scope settings scopeA.TriggerLevel1 = 2048; scopeA.TriggerLevel2 = 2048; scopeA.TriggerLevel3 = 2048; scopeA.AmplitudeScale1 = 300; scopeA.AmplitudeScale2 = 300; scopeA.AmplitudeScale3 = 300; scopeA.VerticalOffset1 = -2000; scopeA.VerticalOffset2 = -2000; scopeA.VerticalOffset3 = -2000; scopeA.SamplesPerGridCell = 100; scopeA.CellSize = 35; scopeA.Width = 630; scopeA.Height = 470; scopeB.TriggerLevel1 = 2048; scopeB.TriggerLevel2 = 2048; scopeB.TriggerLevel3 = 2048; scopeB.AmplitudeScale1 = 300; scopeB.AmplitudeScale2 = 300; scopeB.AmplitudeScale3 = 300; scopeB.VerticalOffset1 = -2000; scopeB.VerticalOffset2 = -2000; scopeB.VerticalOffset3 = -2000; scopeB.SamplesPerGridCell = 100; scopeB.CellSize = 35; scopeB.Width = 630; scopeB.Height = 470; scopeC.TriggerLevel1 = 2048; scopeC.TriggerLevel2 = 2048; scopeC.TriggerLevel3 = 2048; scopeC.AmplitudeScale1 = 300; scopeC.AmplitudeScale2 = 300; scopeC.AmplitudeScale3 = 300; scopeC.VerticalOffset1 = -2000; scopeC.VerticalOffset2 = -2000; scopeC.VerticalOffset3 = -2000; scopeC.SamplesPerGridCell = 100; scopeC.CellSize = 35; scopeC.Width = 630; scopeC.Height = 470; scopeD.TriggerLevel1 = 2048; scopeD.TriggerLevel2 = 2048; scopeD.TriggerLevel3 = 2048; scopeD.AmplitudeScale1 = 300; scopeD.AmplitudeScale2 = 300; scopeD.AmplitudeScale3 = 300; scopeD.VerticalOffset1 = -2000; scopeD.VerticalOffset2 = -2000; scopeD.VerticalOffset3 = -2000; scopeD.SamplesPerGridCell = 100; scopeD.CellSize = 35; scopeD.Width = 630; scopeD.Height = 470; #endregion } } // disable scope form controls if scope .dll error else { label_scopeA.Enabled = false; comboBox_scopeA0.Enabled = false; comboBox_scopeA1.Enabled = false; comboBox_scopeA2.Enabled = false; comboBox_scopeAtrig.Enabled = false; label_scopeB.Enabled = false; comboBox_scopeB0.Enabled = false; comboBox_scopeB1.Enabled = false; comboBox_scopeB2.Enabled = false; comboBox_scopeBtrig.Enabled = false; label_scopeC.Enabled = false; comboBox_scopeC0.Enabled = false; comboBox_scopeC1.Enabled = false; comboBox_scopeC2.Enabled = false; comboBox_scopeCtrig.Enabled = false; label_scopeD.Enabled = false; comboBox_scopeD0.Enabled = false; comboBox_scopeD1.Enabled = false; comboBox_scopeD2.Enabled = false; comboBox_scopeDtrig.Enabled = false; } // Create new DAQ32 data object data = new DAQ32data(); // Start for update timer formUpdateTimer = new Timer(); formUpdateTimer.Interval = 50; formUpdateTimer.Tick += new EventHandler(formUpdateTimer_Tick); formUpdateTimer.Start(); }
public static void PrintDeviceInfo(Device dev) { try { Console.WriteLine("Device:"); Console.WriteLine(" Name : " + dev.Name); Console.WriteLine(" Short name : " + dev.NameShort); Console.WriteLine(" Serial number : " + dev.SerialNumber.ToString()); try { Console.WriteLine(" Calibration date : " + dev.CalibrationDate); } catch (System.Exception) { } Console.WriteLine(" Product id : " + dev.ProductId.ToString()); Console.WriteLine(" Vendor id : " + dev.VendorId.ToString()); try { Console.WriteLine(" Driver version : " + dev.DriverVersion.ToString()); } catch (System.Exception) { } try { Console.WriteLine(" Firmware version : " + dev.FirmwareVersion.ToString()); } catch (System.Exception) { } try { Console.WriteLine(" IPv4 address : " + dev.IPv4Address.ToString()); } catch (System.Exception) { } try { Console.WriteLine(" IP port : " + dev.IPPort.ToString()); } catch (System.Exception) { } Console.WriteLine(" Has battery : " + dev.HasBattery.ToString()); if (dev.HasBattery) { Console.WriteLine(" Battery:"); try { Console.WriteLine(" Charge : " + dev.BatteryCharge.ToString() + " %"); } catch (System.Exception) { } try { Console.WriteLine(" Time to empty : " + dev.BatteryTimeToEmpty.ToString() + " minutes"); } catch (System.Exception) { } try { Console.WriteLine(" Time to full : " + dev.BatteryTimeToFull.ToString() + " minutes"); } catch (System.Exception) { } try { Console.WriteLine(" Charger connected : " + dev.IsBatteryChargerConnected.ToString()); } catch (System.Exception) { } try { Console.WriteLine(" Charging : " + dev.IsBatteryCharging.ToString()); } catch (System.Exception) { } try { Console.WriteLine(" Broken : " + dev.IsBatteryBroken.ToString()); } catch (System.Exception) { } } Oscilloscope scp = dev as Oscilloscope; if (scp != null) { PrintOscilloscopeInfo(scp); } Generator gen = dev as Generator; if (gen != null) { PrintGeneratorInfo(gen); } I2CHost i2c = dev as I2CHost; if (i2c != null) { PrintI2CInfo(i2c); } } catch (System.Exception e) { Console.WriteLine("Exception: " + e.Message); } }
public static void Init_e(string name) { switch (name) { case "MAH": try { MAH.TopMost = true; MAH.Show(); } catch { MAH = new mahovik {TopMost = true}; MAH.Show(); } break; case "targetCtrl": try { targetCtrl.TopMost = true; targetCtrl.Show(); } catch { targetCtrl = new targetControl {TopMost = true}; targetCtrl.Show(); } break; case "OSC": try { OSC.TopMost = true; OSC.Show(); } catch { OSC = new Oscilloscope(@"graph\clean.txt") {TopMost = true}; OSC.Show(); } break; case "vi001": try { vi001.ShowDialog(); } catch { vi001 = new vi001 {Name = "vi001", Text = "ВИ-001"}; vi001.ShowDialog(); } break; case "uvch": try { uvch.ShowDialog(); } catch { uvch = new uvch {Name = "uvch", Text = "Блок УВЧ"}; uvch.ShowDialog(); } break; case "vi002": try { vi002.ShowDialog(); } catch { vi002 = new vi001 {Name = "vi002", Text = "ВИ-002"}; vi002.ShowDialog(); } break; case "bk008": try { bk008.ShowDialog(); } catch { bk008 = new bk008 {Name = "bk008", Text = "БК-008"}; bk008.ShowDialog(); } break; case "hlp": try { if (hlp.helpEnabled()) hlp.Show(); } catch { hlp = new helper(); } break; case "MAIN1": try { MAIN1.ShowDialog(); } catch { MAIN1 = new MAIN(); MAIN1.ShowDialog(); } break; case "bv012": try { bv012.ShowDialog(); } catch { bv012 = new bv012(); bv012.ShowDialog(); } break; case "bsh0031": try { bsh03.ShowDialog(); } catch { bsh03 = new bsh003(); bsh03.ShowDialog(); } break; case "bp103": try { bp13.ShowDialog(); } catch { bp13 = new bp103(); bp13.ShowDialog(); } break; case "bp1162": try { bp62.ShowDialog(); } catch { bp62 = new bp116(); bp62.ShowDialog(); } break; case "bp1161": try { bp61.ShowDialog(); } catch { bp61 = new bp116(); bp61.ShowDialog(); } break; case "bg0022": try { bg22.ShowDialog(); } catch { bg22 = new bg002(); bg22.ShowDialog(); } break; case "bg0021": try { bg21.ShowDialog(); } catch { bg21 = new bg002(); bg21.ShowDialog(); } break; case "bg0032": try { bg32.ShowDialog(); } catch { bg32 = new bg003(); bg32.ShowDialog(); } break; case "bg0031": try { bg31.ShowDialog(); } catch { bg31 = new bg003(); bg31.ShowDialog(); } break; case "bg0052": try { bg52.ShowDialog(); } catch { bg52 = new bg005(); bg52.ShowDialog(); } break; case "bg0051": try { bg51.ShowDialog(); } catch { bg51 = new bg005(); bg51.ShowDialog(); } break; case "bv0041": try { bv41.ShowDialog(); } catch { bv41 = new bv004(1); bv41.ShowDialog(); } break; case "bv0042": try { bv42.ShowDialog(); } catch { bv42 = new bv004(2); bv42.ShowDialog(); } break; case "bm0051": try { bm51.ShowDialog(); } catch { bm51 = new bm005(); bm51.ShowDialog(); } break; case "bm0061": try { bm61.ShowDialog(); } catch { bm61 = new bm005(); bm61.ShowDialog(); } break; case "bg0042": try { bg0042.ShowDialog(); } catch { bg0042 = new bg004(); bg0042.ShowDialog(); } break; case "bg0041": try { bg0041.ShowDialog(); } catch { bg0041 = new bg004(); bg0041.ShowDialog(); } break; case "bg0012": try { bg0012.ShowDialog(); } catch { bg0012 = new bg001(); bg0012.ShowDialog(); } break; case "bg0011": try { bg0011.ShowDialog(); } catch { bg0011 = new bg001(); bg0011.ShowDialog(); } break; case "br0072": try { br72.ShowDialog(); } catch { br72 = new br007(); br72.ShowDialog(); } break; case "br0071": try { br71.ShowDialog(); } catch { br71 = new br007(); br71.ShowDialog(); } break; case "bv0092": try { bv9kit2.ShowDialog(); } catch { bv9kit2 = new bv009(); bv9kit2.ShowDialog(); } break; case "bv0091": try { bv9kit1.ShowDialog(); } catch { bv9kit1 = new bv009(); bv9kit1.ShowDialog(); } break; case "bv41": try { bv41.ShowDialog(); } catch { bv41 = new bv004(1); bv41.ShowDialog(); } break; case "bv010": try { bv10.ShowDialog(); } catch { bv10 = new bv010(); bv10.ShowDialog(); } break; case "bk8": try { bk8.ShowDialog(); } catch { bk8 = new bk008(); bk8.ShowDialog(); } break; case "bv002": try { bv2dal.Name = "bv002"; bv2dal.ShowDialog(); } catch { bv2dal = new bv001 {Name = "bv002"}; bv2dal.ShowDialog(); } break; case "bv001": try { bv1.Name = "bv001"; bv1.ShowDialog(); } catch { bv1 = new bv001 {Name = "bv001"}; bv1.ShowDialog(); } break; case "bya1": try { bya1.ShowDialog(); } catch { bya1 = new bya001(); bya1.ShowDialog(); } break; case "br0042": try { br42.ShowDialog(); } catch { br42 = new br004(2); br42.ShowDialog(); } break; case "br0041": try { br41.ShowDialog(); } catch { br41 = new br004(1); br41.ShowDialog(); } break; case "bsh0011": try { BSH001.ShowDialog(); } catch { BSH001 = new bsh001(); BSH001.ShowDialog(); } break; case "bsh0021": try { BSH002.ShowDialog(); } catch { BSH002 = new bsh002(); BSH002.ShowDialog(); } break; case "bk0061": try { bk0061.ShowDialog(); } catch { bk0061 = new bk006(); bk0061.ShowDialog(); } break; case "bk0071": try { BK007.ShowDialog(); } catch { BK007 = new bk007(); BK007.ShowDialog(); } break; case "bt006": try { BT006.ShowDialog(); } catch { BT006 = new bt006(); BT006.ShowDialog(); } break; case "bk005": try { BK005.ShowDialog(); } catch { BK005 = new bk005(); BK005.ShowDialog(); } break; case "shp001": try { shp1.ShowDialog(); } catch { shp1 = new shp001(); shp1.ShowDialog(); } break; case "bp119": try { bp19.ShowDialog(); } catch { bp19 = new bp119(); bp19.ShowDialog(); } break; case "br0031": try { br0031.Name = "br31"; br0031.ShowDialog(); } catch { br0031 = new br003 {Name = "br31"}; br0031.ShowDialog(); } break; case "br0032": try { br0031.Name = "br32"; br0032.ShowDialog(); } catch { br0032 = new br003 {Name = "br32"}; br0032.ShowDialog(); } break; case "IKO": try { IKO.ShowDialog(); } catch { IKO = new IKO(); IKO.ShowDialog(); } break; case "shp002": try { shp2.ShowDialog(); } catch { shp2 = new shp002(); shp2.ShowDialog(); } break; case "tuts": try { tuts1.ShowDialog(); } catch { tuts1 = new tuts(); tuts1.ShowDialog(); } break; case "tuts2": try { bya1.Show(); tuts1.Show(); } catch { tuts1 = new tuts(); bya1 = new bya001(); bya1.Show(); tuts1.Show(); } break; } }
public static void Main() { // Print library information: PrintInfo.PrintLibraryInfo(); // Enable network search: Network.AutoDetectEnabled = true; // Update device list: DeviceList.Update(); // Try to open an oscilloscope with block measurement support: Oscilloscope scp = null; for (UInt32 i = 0; i < DeviceList.Count; i++) { DeviceListItem item = DeviceList.GetItemByIndex(i); if (item.CanOpen(DeviceType.Oscilloscope)) { scp = item.OpenOscilloscope(); // Check for block measurement support: if ((scp.MeasureModes & Constants.MM_BLOCK) != 0) { break; } else { scp.Dispose(); scp = null; } } } if (scp != null) { try { // Get the number of channels: UInt16 channelCount = Convert.ToUInt16(scp.Channels.Count); // Set measure mode: scp.MeasureMode = MeasureMode.Block; // Set sample frequency: scp.SampleFrequency = 1e6; // 1 MHz // Set record length: scp.RecordLength = 10000; // 10 kS UInt64 recordLength = scp.RecordLength; // Read actual record length. // Set pre sample ratio: scp.PreSampleRatio = 0; // 0 % // For all channels: for (UInt16 ch = 0; ch < channelCount; ch++) { OscilloscopeChannel channel = scp.Channels[ch]; if (!channel.IsAvailable) { continue; } // Enable channel to measure it: channel.Enabled = true; // Set range: channel.Range = 8; // 8 V // Set coupling: channel.Coupling = Coupling.DCV; // DC Volt } // Set trigger timeout: scp.TriggerTimeOut = 100e-3; // 100 ms // Disable all channel trigger sources: for (UInt16 ch = 0; ch < channelCount; ch++) { scp.Channels[ch].Trigger.Enabled = false; } // Setup channel trigger: OscilloscopeChannelTrigger channelTrigger = scp.Channels[0].Trigger; // Ch 1 // Enable trigger source: channelTrigger.Enabled = true; // Kind: channelTrigger.Kind = TriggerKind.RisingEdge; // Level: channelTrigger.Level[0] = 0.5; // 50 % // Hysteresis: channelTrigger.Hysteresis[0] = 0.05; // 5 % // Print oscilloscope info: PrintInfo.PrintDeviceInfo(scp); // Start measurement: scp.Start(); // Wait for measurement to complete: while (!scp.IsDataReady) { Thread.Sleep(10); // 10 ms delay, to save CPU time. } // Get data: float[][] data = scp.GetData(); // Open file with write/update permissions: string filename = "OscilloscopeBlock.csv"; StreamWriter file = new StreamWriter(filename, false); // Write the data to csv: if (File.Exists(filename)) { // Write csv header: file.Write("Sample"); for (UInt16 i = 0; i < channelCount; i++) { file.Write(string.Format(";Ch{0}", i + 1)); } file.Write(Environment.NewLine); // Write the data to csv: for (UInt64 i = 0; i < recordLength; i++) { file.Write(i.ToString()); for (UInt16 ch = 0; ch < channelCount; ch++) { file.Write(";"); if (data[ch] != null) { file.Write(data[ch][i].ToString()); } } file.Write(Environment.NewLine); } Console.WriteLine("Data written to: " + filename); // Close file: file.Close(); } else { Console.WriteLine("Couldn't open file: " + filename); Environment.Exit(1); } } catch (System.Exception e) { Console.WriteLine("Exception: " + e.Message); Environment.Exit(1); } // Close oscilloscope: scp.Dispose(); scp = null; } else { Console.WriteLine("No oscilloscope available with block measurement support!"); Environment.Exit(1); } Environment.Exit(0); }
public Channel(uint channelID, Oscilloscope oscilloscope) { _channelID = channelID; _oscilloscope = oscilloscope; }
private void Form1_Load(object sender, EventArgs e) { // List aviable COM ports and select last in list string[] aviablePorts = System.IO.Ports.SerialPort.GetPortNames(); for (int i = 0; i < aviablePorts.Length; i++) { comboBox_COM.Items.Add(aviablePorts[i]); } comboBox_COM.SelectedIndex = comboBox_COM.Items.Count - 1; // Create scope objects scopeA = Oscilloscope.CreateScope("scope_settings.ini", ""); if (scopeA != null) { scopeB = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeC = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeD = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeE = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeF = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeG = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeH = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeI = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeJ = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeK = Oscilloscope.CreateScope("scope_settings.ini", ""); } // Set default scope channels comboBox_scopeA0.SelectedIndex = 0; comboBox_scopeA1.SelectedIndex = 1; comboBox_scopeA2.SelectedIndex = 2; comboBox_scopeAtrig.SelectedIndex = 0; comboBox_scopeB0.SelectedIndex = 3; comboBox_scopeB1.SelectedIndex = 4; comboBox_scopeB2.SelectedIndex = 5; comboBox_scopeBtrig.SelectedIndex = 3; comboBox_scopeC0.SelectedIndex = 6; comboBox_scopeC1.SelectedIndex = 7; comboBox_scopeC2.SelectedIndex = 8; comboBox_scopeCtrig.SelectedIndex = 6; comboBox_scopeD0.SelectedIndex = 9; comboBox_scopeD1.SelectedIndex = 10; comboBox_scopeD2.SelectedIndex = 11; comboBox_scopeDtrig.SelectedIndex = 9; comboBox_scopeE0.SelectedIndex = 12; comboBox_scopeE1.SelectedIndex = 13; comboBox_scopeE2.SelectedIndex = 14; comboBox_scopeEtrig.SelectedIndex = 12; comboBox_scopeF0.SelectedIndex = 15; comboBox_scopeF1.SelectedIndex = 16; comboBox_scopeF2.SelectedIndex = 17; comboBox_scopeFtrig.SelectedIndex = 15; comboBox_scopeG0.SelectedIndex = 18; comboBox_scopeG1.SelectedIndex = 19; comboBox_scopeG2.SelectedIndex = 20; comboBox_scopeGtrig.SelectedIndex = 18; comboBox_scopeH0.SelectedIndex = 21; comboBox_scopeH1.SelectedIndex = 22; comboBox_scopeH2.SelectedIndex = 23; comboBox_scopeHtrig.SelectedIndex = 21; comboBox_scopeI0.SelectedIndex = 24; comboBox_scopeI1.SelectedIndex = 25; comboBox_scopeI2.SelectedIndex = 26; comboBox_scopeItrig.SelectedIndex = 24; comboBox_scopeJ0.SelectedIndex = 27; comboBox_scopeJ1.SelectedIndex = 28; comboBox_scopeJ2.SelectedIndex = 29; comboBox_scopeJtrig.SelectedIndex = 28; comboBox_scopeK0.SelectedIndex = 30; comboBox_scopeK1.SelectedIndex = 31; comboBox_scopeK2.SelectedIndex = 0; comboBox_scopeKtrig.SelectedIndex = 30; // Show scopes else disable controls if .ini file file not present if (scopeA != null) { //button_scopeAshow.PerformClick(); //button_scopeBshow.PerformClick(); //button_scopeCshow.PerformClick(); //button_scopeDshow.PerformClick(); //button_scopeEshow.PerformClick(); //button_scopeFshow.PerformClick(); //button_scopeGshow.PerformClick(); //button_scopeHshow.PerformClick(); //button_scopeIshow.PerformClick(); //button_scopeJshow.PerformClick(); //button_scopeKshow.PerformClick(); } else { button_scopeAshow.Enabled = false; button_scopeBshow.Enabled = false; button_scopeCshow.Enabled = false; button_scopeDshow.Enabled = false; button_scopeEshow.Enabled = false; button_scopeFshow.Enabled = false; button_scopeGshow.Enabled = false; button_scopeHshow.Enabled = false; button_scopeIshow.Enabled = false; button_scopeJshow.Enabled = false; button_scopeKshow.Enabled = false; } // Create new DAQ32 data object data = new DAQ32data(); // Start for update timer formUpdateTimer = new Timer(); formUpdateTimer.Interval = 50; formUpdateTimer.Tick += new EventHandler(formUpdateTimer_Tick); formUpdateTimer.Start(); }
/// <summary> /// Initialises a new instance of the <see cref="SimpleOscilloscope"/> class. /// </summary> public SimpleOscilloscope(string caption, string scopeSettingsFileName) { oscilloscope = Oscilloscope.CreateScope(scopeSettingsFileName, ""); Caption = caption; }
/// <summary> /// Generates a signal. /// </summary> /// <param name="channel">Channel.</param> /// <param name="addNoise">If set to <c>true</c> add noise.</param> public void GenerateSignal(Channel channel, bool addNoise = true) { Oscilloscope oscilloscope = channel.DeviceContext.Device; Random random = new Random(); double randomPhase = random.Next(0, 628) / 100; if (!oscilloscope.Hold) { channel.Samples.Overflow = false; for (int i = 0; i < channel.Samples.Count; i++) { double gnd = 1, input = 0; double tl = oscilloscope.Trigger.Level; switch (channel.InputCoupling) { case InputCoupling.AC: gnd = 1; input = 0; break; case InputCoupling.DC: gnd = 1; input = 1; break; case InputCoupling.GND: gnd = 0; input = 0; break; } double samplesPerVolt = 25 / VoltsPerDivisionConverter.ToVolts(channel.VoltsPerDivision, channel.AttenuationFactor); double a = Amplitude * samplesPerVolt; double o = input * Offset * samplesPerVolt; double samplesPerDiv; switch (oscilloscope.TimeBase) { case TimeBase.Tdiv1us: samplesPerDiv = 10; break; case TimeBase.Tdiv2us: samplesPerDiv = 20; break; default: samplesPerDiv = 50; break; } double t = i * TimeBaseConverter.ToSeconds(oscilloscope.TimeBase) / samplesPerDiv; if ((Math.Floor(a) == 0) || (Math.Floor(gnd) == 0)) { Phase = 0; } else if ((tl < (channel.YPosition - (o + a))) || (tl > (channel.YPosition + (o + a)))) { Phase = randomPhase; } else if (oscilloscope.Trigger.Slope == TriggerSlope.Rising) { Phase = Math.Asin(((channel.YPosition - o) - tl) / a); } else { Phase = Math.PI - Math.Asin((tl - (channel.YPosition - o)) / a); } int value = (int)Math.Round(channel.YPosition - gnd * (o + a * Math.Sin(2 * Math.PI * Frequency * t + Phase))); channel.Samples [i] = (byte)value.LimitToRange(0, 255); } if (addNoise) { GenerateNoise(channel); } } }
private void btnConnect_Click(object sender, EventArgs e) { _osc = new Oscilloscope(cbResources.Text); }
public static void PrintOscilloscopeInfo(Oscilloscope scp) { try { Console.WriteLine("Oscilloscope:"); Console.WriteLine(" Channel count : " + scp.Channels.Count.ToString()); Console.WriteLine(" Connection test : " + scp.HasConnectionTest.ToString()); Console.WriteLine(" Measure modes : " + MeasureModeToStr(scp.MeasureModes)); Console.WriteLine(" Measure mode : " + MeasureModeToStr((UInt32)scp.MeasureMode)); Console.WriteLine(" Auto resolution modes : " + AutoResolutionModeToStr(scp.AutoResolutionModes)); Console.WriteLine(" Auto resolution mode : " + AutoResolutionModeToStr((UInt64)scp.AutoResolutionMode)); Console.WriteLine(" Resolutions : " + String.Join(", ", Array.ConvertAll(scp.Resolutions, x => x.ToString()))); Console.WriteLine(" Resolution : " + scp.Resolution.ToString()); Console.WriteLine(" Resolution enhanced : " + scp.IsResolutionEnhanced.ToString()); Console.WriteLine(" Clock outputs : " + ClockOutputToStr(scp.ClockOutputs)); Console.WriteLine(" Clock output : " + ClockOutputToStr((UInt32)scp.ClockOutput)); try { Console.WriteLine(" Clock output frequencies : " + String.Join(", ", Array.ConvertAll(scp.ClockOutputFrequencies, x => x.ToString()))); Console.WriteLine(" Clock output frequency : " + scp.ClockOutputFrequency.ToString()); } catch { } Console.WriteLine(" Clock sources : " + ClockSourceToStr(scp.ClockSources)); Console.WriteLine(" Clock source : " + ClockSourceToStr((UInt32)scp.ClockSource)); try { Console.WriteLine(" Clock source frequencies : " + String.Join(", ", Array.ConvertAll(scp.ClockSourceFrequencies, x => x.ToString()))); Console.WriteLine(" Clock source frequency : " + scp.ClockSourceFrequency.ToString()); } catch { } Console.WriteLine(" Record length max : " + scp.RecordLengthMax.ToString()); Console.WriteLine(" Record length : " + scp.RecordLength.ToString()); Console.WriteLine(" Sample frequency max : " + scp.SampleFrequencyMax.ToString()); Console.WriteLine(" Sample frequency : " + scp.SampleFrequency.ToString()); if (scp.MeasureMode == MeasureMode.Block) { Console.WriteLine(" Segment count max : " + scp.SegmentCountMax.ToString()); if (scp.SegmentCountMax > 1) { Console.WriteLine(" Segment count : " + scp.SegmentCount.ToString()); } } if (scp.HasTrigger) { Console.WriteLine(" Pre sample ratio : " + scp.PreSampleRatio.ToString()); Double timeout = scp.TriggerTimeOut; Console.Write(" Trigger time out : "); if (timeout == Constants.TO_INFINITY) { Console.WriteLine("Infinite"); } else { Console.WriteLine(timeout.ToString()); } if (scp.HasTriggerDelay) { Console.WriteLine(" Trigger delay max : " + scp.TriggerDelayMax.ToString()); Console.WriteLine(" Trigger delay : " + scp.TriggerDelay.ToString()); } if (scp.HasTriggerHoldOff) { Console.WriteLine(" Trigger hold off count max: " + scp.TriggerHoldOffCountMax.ToString()); Console.WriteLine(" Trigger hold off count : " + scp.TriggerHoldOffCount.ToString()); } } for (UInt16 ch = 0; ch < scp.Channels.Count; ch++) { OscilloscopeChannel channel = scp.Channels[ch]; Console.WriteLine(" Channel" + (ch + 1).ToString() + ":"); Console.WriteLine(" Connector type : " + ConnectorTypeToStr((UInt32)channel.ConnectorType)); Console.WriteLine(" Differential : " + channel.IsDifferential.ToString()); Console.WriteLine(" Impedance : " + channel.Impedance.ToString()); Console.WriteLine(" Connection test : " + channel.HasConnectionTest.ToString()); Console.WriteLine(" Available : " + channel.IsAvailable.ToString()); Console.WriteLine(" Enabled : " + channel.Enabled.ToString()); Console.WriteLine(" Bandwidths : " + String.Join(", ", Array.ConvertAll(channel.Bandwidths, x => x.ToString()))); Console.WriteLine(" Bandwidth : " + channel.Bandwidth.ToString()); Console.WriteLine(" Couplings : " + CouplingToStr(channel.Couplings)); Console.WriteLine(" Coupling : " + CouplingToStr((UInt64)channel.Coupling)); Console.WriteLine(" Auto ranging : " + channel.AutoRanging.ToString()); Console.WriteLine(" Ranges : " + String.Join(", ", Array.ConvertAll(channel.Ranges, x => x.ToString()))); Console.WriteLine(" Range : " + channel.Range.ToString()); Console.WriteLine(" Probe gain : " + channel.ProbeGain.ToString()); Console.WriteLine(" Probe offset : " + channel.ProbeOffset.ToString()); if (channel.HasSafeGround) { Console.WriteLine(" SafeGround enabled : " + channel.SafeGroundEnabled.ToString()); Console.WriteLine(" SafeGround threshold max: " + channel.SafeGroundThresholdMax.ToString()); Console.WriteLine(" SafeGround threshold min: " + channel.SafeGroundThresholdMin.ToString()); Console.WriteLine(" SafeGround threshold : " + channel.SafeGroundThreshold.ToString()); } if (channel.HasTrigger) { OscilloscopeChannelTrigger trigger = channel.Trigger; Console.WriteLine(" Trigger:"); Console.WriteLine(" Available : " + trigger.IsAvailable.ToString()); Console.WriteLine(" Enabled : " + trigger.Enabled.ToString()); Console.WriteLine(" Kinds : " + TriggerKindToStr(trigger.Kinds)); Console.WriteLine(" Kind : " + TriggerKindToStr((UInt64)trigger.Kind)); Console.WriteLine(" Level modes : " + TriggerLevelModeToStr(trigger.LevelModes)); Console.WriteLine(" Level mode : " + TriggerLevelModeToStr((UInt32)trigger.LevelMode)); if (trigger.Level.Count != 0) { Double[] levels = new Double[trigger.Level.Count]; for (UInt32 i = 0; i < trigger.Level.Count; i++) { levels[i] = trigger.Level[i]; } Console.WriteLine(" Levels : " + String.Join(", ", Array.ConvertAll(levels, x => x.ToString()))); } if (trigger.Hysteresis.Count != 0) { Double[] hysteresis = new Double[trigger.Hysteresis.Count]; for (UInt32 i = 0; i < trigger.Hysteresis.Count; i++) { hysteresis[i] = trigger.Hysteresis[i]; } Console.WriteLine(" Histeresis : " + String.Join(", ", Array.ConvertAll(hysteresis, x => x.ToString()))); } Console.WriteLine(" Conditions : " + TriggerConditionToStr(trigger.Conditions)); if (trigger.Conditions != Constants.TCM_NONE) { Console.WriteLine(" Condition : " + TriggerConditionToStr((UInt32)trigger.Condition)); } if (trigger.Time.Count != 0) { Double[] times = new Double[trigger.Time.Count]; for (UInt32 i = 0; i < trigger.Time.Count; i++) { times[i] = trigger.Time[i]; } Console.WriteLine(" Times : " + String.Join(", ", Array.ConvertAll(times, x => x.ToString()))); } } } PrintTriggerInputsInfo(scp.TriggerInputs); PrintTriggerOutputsInfo(scp.TriggerOutputs); } catch (System.Exception e) { Console.WriteLine("Exception: " + e.Message); } }
/// <summary> /// Initializes a new instance of the <see cref="WFS210.Services.LiveService"/> class. /// </summary> /// <param name="oscilloscope">Oscilloscope.</param> public LiveService(Oscilloscope oscilloscope) : base(oscilloscope) { this.connection = new TcpConnection(); }
public void RefreshDevices() { cbResources.Items.Clear(); cbResources.Items.AddRange(Oscilloscope.GetResources()); cbResources.SelectedIndex = cbResources.Items.Count - 1; }
public OscilloscopeView() { oscillModel = new Oscilloscope(); }
/// <summary> /// Initializes a new instance of the <see cref="WFS210.Services.Service"/> class. /// </summary> /// <param name="oscilloscope">Oscilloscope.</param> protected Service(Oscilloscope oscilloscope) { this.oscilloscope = oscilloscope; }