研华PCI1716L的C#编程
2020-01-15 09:07
2391 查看
新建windows窗体项目;
添加引用研华的库文件
将库添加using
整个代码如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Automation.BDaq; using System.IO; namespace 研华1716L { public partial class Form1 : Form { WaveformAiCtrl waveformAiCtrl = new WaveformAiCtrl(); int getDataCount = 12000; short[] sectionBuffer=new short[12000]; void waveformAiCtrl_DataReady(object sender, BfdAiEventArgs e) { waveformAiCtrl.GetData(getDataCount, sectionBuffer); StreamWriter sw = new StreamWriter("1.txt", true, Encoding.Default); for (int j = 0; j < 12000; j++) { sw.WriteLine(sectionBuffer[j]); } sw.Close(); } public Form1() { InitializeComponent(); string deviceDescription = "DemoDevice,BID#0";//根据设备改 waveformAiCtrl.SelectedDevice = new DeviceInformation(deviceDescription); waveformAiCtrl.Prepare(); } private void button1_Click(object sender, EventArgs e) { waveformAiCtrl.DataReady += new EventHandler<BfdAiEventArgs>(waveformAiCtrl_DataReady); waveformAiCtrl.Start(); } } }
实现简单功能点击按钮,将读的文件向TXT中写。原理性的就这些,整体的程序,放在代码仓库吧。
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- C#编程方式使用Silverlight toolkit Chart
- 24点游戏-c#求解-英雄会在线编程题目
- C#温故而知新学习系列之XML编程—8-XMLSerializer类把XML文档反序列化为对象
- C#中的cookie编程
- c#4个编程技巧
- C# Socket编程 同步以及异步通信
- S2 深入.NET和C#编程 一: 深入C#.NET框架
- C#GDI+编程基础
- C# windows编程常用控件
- 黑马程序员--C#编程基础
- 静态类和静态类成员(C# 编程指南)
- C#可扩展编程之MEF(五):MEF高级进阶
- 10个C#编程和Visual Studio使用技巧
- 私有构造函数(C# 编程指南)
- C#编程,for循环
- 黑马程序员---C#编程概述
- 5天玩转C#并行和多线程编程 —— 第五天 多线程编程大总结
- c# winform socket网络编程,点对点传输文件,socket文件传输,监听端口
- C#编程.函数.Main()函数
- C#2.0 Socket套接字编程之实例初探