打印

无法执行

[复制链接]
296|9
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
pangb|  楼主 | 2018-2-11 11:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
大家好,我在使用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);
始终不成功
沙发
xxmmi| | 2018-2-11 11:47 | 只看该作者

无法获得usb设备列表?

使用特权

评论回复
板凳
pangb|  楼主 | 2018-2-11 11:49 | 只看该作者
是啊,usbDevices.Count一直为零

使用特权

评论回复
地板
chenjunt| | 2018-2-11 11:53 | 只看该作者
驱动换成了他.net包里头的驱动

使用特权

评论回复
5
ousj| | 2018-2-11 11:55 | 只看该作者


基于c++的例子程序就能够正常识别啊?

使用特权

评论回复
6
pangb|  楼主 | 2018-2-11 11:59 | 只看该作者

是啊

使用特权

评论回复
7
kangzj| | 2018-2-11 12:02 | 只看该作者

换到台式机上试试

使用特权

评论回复
8
pangb|  楼主 | 2018-2-11 12:04 | 只看该作者

我笔记本和台式机都装的一样的framework2.0

使用特权

评论回复
9
zwll| | 2018-2-11 12:10 | 只看该作者


楼主从哪找到的例程啊,那个CYAPI有这个USBDeviceList函数吗,最好使用CYAPI里面提供的API函数。

使用特权

评论回复
10
pangb|  楼主 | 2018-2-11 12:14 | 只看该作者
嗯,预料中的结果,先结贴吧,多谢大家啦

使用特权

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

本版积分规则

701

主题

7643

帖子

6

粉丝