资源简介
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;
- 上一篇:连锁店管理系统c#含数据库
- 下一篇:WPF 放大镜 VisualBrush
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
评论
共有 条评论