91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 16KB
    文件類型: .cs
    金幣: 1
    下載: 1 次
    發布日期: 2021-06-06
  • 語言: C#
  • 標簽: NIVISA??C#??示波器??

資源簡介

C#開發通過引用Visa獲取泰克示波器采集的數據,大致過程為:打開會話,通過讀寫函數對示波器進行相關設置并讀取相應數據,關閉會話

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;
using?NationalInstruments.VisaNS;

namespace?TBS1072B_csv
{
????public?partial?class?Form1?:?Form
????{????
????????private?MessagebasedSession?TekScope?=?null;
????????string?csvPath;
????????DataTable?myTable?=?new?DataTable();
????????string?Resourcename;
????????int?openresultcloseresult;
????????public?Form1()
????????{
????????????InitializeComponent();???
????????????string?directory?=?Environment.GetFolderPath(Environment.SpecialFolder.Startup);
????????????string?targetpath?=?System.AppDomain.CurrentDomain.SetupInformation.Applicationbase+?“TBS1072B_csv.exe“;????????????
????????????bool?myBool?=?createShortcut(directory?“TBS1072B_csv“?targetpath?null?null);
????????}
????????//對應用程序創建開機自啟動快捷方式
????????public?static?bool?createShortcut(string?directory?string?shortcutName?string?targetPath?string?description?string?iconLocation)
????????{
????????????try
????????????{
????????????????if?(!Directory.Exists(directory))
????????????????{
????????????????????Directory.CreateDirectory(directory);
????????????????}???????????????
????????????????//添加引用?Com?中搜索?Windows?script?Host?object?Model
????????????????string?shortcutPath?=?Path.Combine(directory?string.Format(“{0}.lnk“?shortcutName));
????????????????IWshRuntimeLibrary.WshShell?shell?=?new?IWshRuntimeLibrary.WshShell();
????????????????IWshRuntimeLibrary.IWshShortcut?shortcut?=?(IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(shortcutPath);//創建快捷方式對象
????????????????shortcut.TargetPath?=?targetPath;//指定目標路徑
????????????????shortcut.WorkingDirectory?=?Path.GetDirectoryName(targetPath);//設置起始位置
????????????????shortcut.Windowstyle?=?1;//設置運行方式,默認為常規窗口
????????????????shortcut.Description?=?description;//設置備注
????????????????shortcut.IconLocation?=?string.IsNullOrEmpty(iconLocation)???targetPath?:?iconLocation;//設置圖標路徑
????????????????shortcut.Save();//保存快捷方式

????????????????return?true;
????????????}
????????????catch
????????????{?}
????????????return?false;
????????}

????????//打開Visa會話
????????public?int?OpenVisa(string?ResourceName)
????????{
????????????//?Open?a?connection?to?the?instrument
????????????try
????????????{
????????????????TekScope?=?new?MessagebasedSession(ResourceName);
????????????????TekScope.Clear();
????????????}
????????????catch?(Exception)
????????????{
????????????????TekScope?=?null;
????????????????return?0;
????????????}
????????????return?1;
????????
????????}

????????//通過Visa獲取示波器measurement相關數據
????????public?string?getVisa(string?ResourceName)
????????{

????????????string?temp?myresult;????????????
????????????int?RecLength;
????????????string?ch1freq?ch1max?ch1min?ch1pduty?ch1phase?ch2freq?ch2max?ch2min?ch2pduty?ch2phase;
????????????
???????

??

評論

共有 條評論