执行不成功

[复制链接]
387|9
手机看帖
扫描二维码
随时随地手机跟帖
stly|  楼主 | 2017-12-24 11:16 | 显示全部楼层 |阅读模式
我在使用cypress的68013的开发板。上位机使用官网提供的基于C#的类库,正在学习相关的例子程序。可是一开始就碰到了棘手的问题,请看下面的代码

    public partial class Form1 : Form
    {
        App_PnP_Callback    evHandler;
        CyUSBDevice        loopDevice  = null;
        USBDeviceList      usbDevices  = null;
        CyBulkEndPoint      inEndpoint  = null;
        CyBulkEndPoint      outEndpoint = null;

        Thread  tXfers;
        bool    bRunning = false;

        int    value;
        long    outCount, inCount;

        const int XFERSIZE  = 256;
        byte[]  outData    = new byte[XFERSIZE];
        byte[]  inData      = new byte[XFERSIZE];

        // These 2 needed for TransfersThread to update the UI
        delegate void UpdateUICallback();
        UpdateUICallback updateUI;
   

        public Form1()
        {
            InitializeComponent();

            // Setup the callback routine for updating the UI
            updateUI    = new UpdateUICallback(StatusUpdate);

            // Setup PnP event handling
            evHandler = new App_PnP_Callback(PnP_Event_Handler);

            // Create a list of CYUSB devices
            usbDevices  = new USBDeviceList(CyConst.DEVICES_CYUSB, evHandler);
            setDevice();
        }

        public void setDevice()
        {
            if (usbDevices.Count > 0)
                loopDevice = usbDevices[0x0547, 0x0080] as CyUSBDevice;

            StartBtn.Enabled = (loopDevice != null);

            if (loopDevice != null)
                Text = loopDevice.FriendlyName;
            else
                Text = "Bulkloop - no device";

            // Set the in and out endpoints per the selected radio buttons.
            EptPair1Btn_Click(this, null);
        }
…………

执行
usbDevices  = new USBDeviceList(CyConst.DEVICES_CYUSB, evHandler);
始终不成功
juventus9554| | 2017-12-24 11:18 | 显示全部楼层
不成功表现什么?

使用特权

评论回复
stly|  楼主 | 2017-12-24 11:20 | 显示全部楼层
无法获得usb设备列表

使用特权

评论回复
stly|  楼主 | 2017-12-24 11:23 | 显示全部楼层
usbDevices.Count一直为零,不知是什么原因?

使用特权

评论回复
pengf| | 2017-12-24 11:33 | 显示全部楼层


你驱动换成了他.net包里头的驱动了吗?

使用特权

评论回复
stly|  楼主 | 2017-12-24 11:36 | 显示全部楼层

这个肯定换了,系统正常识别开发板,控制面板也正常识别开发板,就是他的例子程序无**常识别

使用特权

评论回复
stly|  楼主 | 2017-12-24 11:41 | 显示全部楼层
但基于c++的例子程序就能够正常识别。。

使用特权

评论回复
supernan| | 2017-12-24 11:43 | 显示全部楼层

换台机子试试

使用特权

评论回复
stly|  楼主 | 2017-12-24 11:46 | 显示全部楼层
我换到我的台式机上去,基于.net的c#例子程序就能够认到开发板了。。我的笔记本和台式机都装的一样的framework2.0~~太奇怪了

使用特权

评论回复
stly|  楼主 | 2017-12-24 11:57 | 显示全部楼层
先结贴吧,我明天问问师父

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

433

主题

7058

帖子

0

粉丝