华研采集卡C#二次开发-小白

1.安装驱动,研华DAQNavi软件开发工具包下载地址:https://support.advantech.com/Support/DownloadSRDetail_New.aspx?SR_ID=1-13L33UP&Doc_Source=Download
在这里插入图片描述
安装之后可参考例程进行开发
在这里插入图片描述
在这里插入图片描述
还有开发手册
在这里插入图片描述

2.可添加华研采集卡控件
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
3代码添加控件

        private void InitializeComponent()
        {
            this.SuspendLayout();

           
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(274, 80);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            // 
            // udCounterCtrl1
            // 
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpDownCounterForm));
            this.udCounterCtrl1 = new Automation.BDaq.UdCounterCtrl(this.components);
            this.udCounterCtrl1._StateStream = ((Automation.BDaq.DeviceStateStreamer)(resources.GetObject("udCounterCtrl1._StateStream")));

        }

        #endregion
        private Automation.BDaq.UdCounterCtrl udCounterCtrl1;

在这里插入图片描述
4.C#对象创建instantDiCtrl.SelectedDevice = new DeviceInformation(“PCI-1750,BID#0”),卡名称可在安装的驱动软件中找到,或者输入卡号,代码示例:


        public UpDownCounterForm(int deviceNumber)
        {
            InitializeComponent();
            udCounterCtrl1.SelectedDevice = new DeviceInformation(deviceNumber);
        }

        private void UpDownCounterForm_Load(object sender, EventArgs e)
        {   
            if (!udCounterCtrl1.Initialized)
            {
                MessageBox.Show("No device be selected or device open failed!", "UpDownCounter");
                this.Close();
                return;
            }

            //set the title
            this.Text = "UpDown Counter(" + udCounterCtrl1.SelectedDevice.Description + ")";
    
        }

5.不想写了,其他可参考官方示例代码

  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值