• 大小: 0.09M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2024-04-26
  • 语言: C#
  • 标签: 示波器  编程  控制  C#  

资源简介

C#安捷伦示波器编程控制

资源截图

代码片段和文件信息

/*
 * Keysight VISA COM Example in C#
 * -------------------------------------------------------------------
 * This program illustrates a few commonly used programming
 * features of your Keysight oscilloscope.
 * -------------------------------------------------------------------
 */

using System;
using System.IO;
using System.Text;
using Ivi.Visa.Interop;
using System.Runtime.InteropServices;

namespace InfiniiVision
{
    class VisaComInstrumentApp
    {
        private static VisaComInstrument myScope;

        public static void Main(string[] args)
        {
            try
            {
                myScope = new
                  VisaComInstrument(“USB0::0x0957::0x17A6::MY54450160::0::INSTR“);
                myScope.SetTimeoutSeconds(10);

                // Initialize - start from a known state.
                Initialize();

                // Capture data.
                Capture();

                // Analyze the captured waveform.
                Analyze();
            }
            catch (System.ApplicationException err)
            {
                Console.WriteLine(“*** VISA COM Error : “ + err.Message);
            }
            catch (System.SystemException err)
            {
                Console.WriteLine(“*** System Error Message : “ + err.Message);
            }
            catch (System.Exception err)
            {
                System.Diagnostics.Debug.Fail(“Unexpected Error“);
                Console.WriteLine(“*** Unexpected Error : “ + err.Message);
            }
            finally
            {
                myScope.Close();
            }
            
            
            Console.Write(“按任意键退出...“);
            Console.ReadKey(true);
        }

        /*
         * Initialize the oscilloscope to a known state.
         * --------------------------------------------------------------
         */
        private static void Initialize()
        {
            string strResults;

            // Get and display the device‘s *IDN? string.
            strResults = myScope.DoQueryString(“*IDN?“);
            Console.WriteLine(“*IDN? result is: {0}“ strResults);

            // Clear status and load the default setup.
            myScope.DoCommand(“*CLS“);
            myScope.DoCommand(“*RST“);
        }

        /*
         * Capture the waveform.
         * --------------------------------------------------------------
         */
        private static void Capture()
        {
            // Use auto-scale to automatically configure oscilloscope.
            myScope.DoCommand(“:AUToscale“);

            // Set trigger mode (EDGE PULSe PATTern etc. and input source.
            myScope.DoCommand(“:TRIGger:MODE EDGE“);
            Console.WriteLine(“Trigger mode: {0}“myScope.DoQueryString(“:TRIGger:MODE?“));

            // Set EDGE trigger parameters.
            myScope.DoCommand(“:TRIGger:EDGE:SOURce CHANnel1“)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        187  2020-01-01 22:45  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\App.config

     文件      13824  2020-01-14 14:50  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe

     文件        187  2020-01-01 22:45  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe.config

     文件      22016  2020-01-14 14:50  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.pdb

     文件      24224  2020-01-17 14:48  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe

     文件        187  2020-01-01 22:45  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.config

     文件        490  2010-03-17 22:39  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.manifest

     文件      13312  2020-05-26 08:01  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe

     文件        187  2020-01-01 22:45  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe.config

     文件      22016  2020-05-26 08:01  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.pdb

     文件      24224  2020-05-26 08:03  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.vshost.exe

     文件        187  2020-01-01 22:45  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.vshost.exe.config

     文件        490  2010-03-17 22:39  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.vshost.exe.manifest

     文件       3314  2020-01-01 22:48  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.csproj

     文件       1197  2020-01-17 14:48  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.csproj.FileListAbsolute.txt

     文件        802  2020-01-01 22:47  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.csproj.ResolveComReference.cache

     文件       1755  2020-01-01 22:48  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.csprojResolveAssemblyReference.cache

     文件      13824  2020-01-14 14:50  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.exe

     文件      22016  2020-01-14 14:50  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.pdb

     文件       7005  2020-01-01 22:48  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       5120  2020-01-01 22:47  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Debug\Interop.BASICFORMATTEDIOLib.dll

     文件          0  2020-01-01 22:45  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2020-01-01 22:45  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2020-01-01 22:45  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       2554  2020-05-26 08:03  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Release\ConsoleApplication1.csproj.FileListAbsolute.txt

     文件        802  2020-01-07 10:13  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Release\ConsoleApplication1.csproj.ResolveComReference.cache

     文件       1755  2020-01-07 10:38  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Release\ConsoleApplication1.csprojResolveAssemblyReference.cache

     文件      13312  2020-05-26 08:01  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Release\ConsoleApplication1.exe

     文件      22016  2020-05-26 08:01  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Release\ConsoleApplication1.pdb

     文件       7077  2020-04-29 17:18  安捷伦示波器编程控制\ConsoleApplication1\ConsoleApplication1\obj\Release\DesignTimeResolveAssemblyReferencesInput.cache

............此处省略23个文件信息

评论

共有 条评论