// Sample usage of Oscilloscope library static void Main(string[] args) { // With en-US culture handle all decimal separator with '.' also on non-en-US pc Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); LongMemoryAcquisitionExample(); // Display acquired data Process.Start(csvFileName); // Draw CSV file with GNU Plot GnuPlot gnuPlot = new GnuPlot(); // NB: change path of gnuplot.exe with alternative constructor gnuPlot.DrawGraph(csvFileName, 1); // OscilloscopePromptExample(); }
public void SaveCSV() { if (_osc == null) { MessageBox.Show("Please connect device first"); return; } Cursor = Cursors.WaitCursor; _gnuplot.Path = txtGnuPlotPath.Text; _osc.Run(); // Set up some settings on oscilloscope if (rbNormalPoints.Checked) { _osc.SetWaveformPointsMode(PointsMode.Normal); } else { _osc.SetWaveformPointsMode(PointsMode.Maximum); } // Memory depth if (rbNormal.Checked) { _osc.SetAcquireMemoryDepth(AcquireMemoryDepth.Normal); } else { _osc.SetAcquireMemoryDepth(AcquireMemoryDepth.Long); } _osc.SetTriggerSweep(TriggerSweep.Single); //_osc.Stop(); // Run and wait trigger _osc.Run(); _osc.WaitTriggerStop(); // Get Waveform and save it as CSV file string csvFileName = "data.csv"; if (cbCh1.Checked && cbCh2.Checked) { _osc.GetWaveforms().SaveCSV(csvFileName); _gnuplot.DrawGraph(csvFileName, 2, rbOutPNG.Checked); } else { if (cbCh1.Checked) { _osc.Channel1.GetWaveform().SaveCSV(csvFileName); // Draw CSV file with GNU Plot _gnuplot.DrawGraph(csvFileName, 1, rbOutPNG.Checked); } else if (cbCh2.Checked) { _osc.Channel2.GetWaveform().SaveCSV(csvFileName); _gnuplot.DrawGraph(csvFileName, 1, rbOutPNG.Checked); } else { // Nothing } } // Release oscilloscope remote control _osc.Close(); Cursor = Cursors.Default; }