当前位置:编程学习 > C#/ASP.NET >>

北京安迈泽成的板卡 PCI7209那位大侠在C#里面用过,我的程序无法向卡端口写数据

北京安迈泽成的板卡 PCI7209那位大侠在C#里面用过,我的程序无法向卡端口写数据,用厂家提供的例程更不行,他们提供的例程编译时都是错误的,用他们提供的VB_TEST完全可以(VB6.0环境),我目前使用的两块板卡,一块是PCI9114(地址是0),另一块是PCI7209(地址是1),PCI9114已经调通,可以使用了,已经调了两天了就是pci7209怎么弄都不行,文件是我调试使用的文件,希望各位能帮帮我,看看我的文件为什么不行,到底错在那里了,我也反复的看了执行的步骤、使用的参数(除了操作句柄)跟VB_TEST的都一样,

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

//必须增加引用
using System.Runtime.InteropServices;

namespace Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        //dll引用声明
        [DllImport("AMPCI.dll")]
        public static extern bool AMPCI_IO_OUT1(long hDevice, Int16 dat);
         

        [DllImport("AMPCI.dll")]
        public static extern Int16 AMPCI_IO_IN(long hDevice);
         

        [DllImport("AMPCI.dll")]
        public static extern bool PLX9052_Open(ref long phPLX9052, int VendorID, int DeviceID, int nCardNum, int Options);
        

        [DllImport("AMPCI.dll")]
        public static extern Int16 PLX9052_ReadWord(long phPLX9052, int addrSpace, int Offset);
         

        [DllImport("AMPCI.dll")]
        public static extern void PLX9052_WriteWord(long phPLX9052, int addrSpace, int Offset, Int16 data);
        

        [DllImport("AMPCI.dll")]
        public static extern void PLX9052_Close(long phPLX9052);
         

        private void button1_Click(object sender, EventArgs e)
        {
            long hPLX90520 = -1;//此处改为1可以正确获取操作句柄,但仍无法写端口
            bool i = PLX9052_Open(ref hPLX90520, 0x10b5,0x9050 , 1, 0);
            PLX9052_WriteWord(hPLX90520,3,0x0c,0);
             
    PLX9052_Close(hPLX90520);
            
        }
    }
} PCI7209, 板卡 无法向卡端口写数据 --------------------编程问答-------------------- 去资询设备厂商
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,