EZUSB_68013_上位机问题

[复制链接]
 楼主| hanwe 发表于 2010-11-22 19:39 | 显示全部楼层 |阅读模式
大家好,我在使用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);
始终不成功
llia 发表于 2010-11-22 19:54 | 显示全部楼层
无法获得usb设备列表?
 楼主| hanwe 发表于 2010-11-22 20:02 | 显示全部楼层
是啊,usbDevices.Count一直为零
llia 发表于 2010-11-22 20:36 | 显示全部楼层
驱动换成了他.net包里头的驱动
 楼主| hanwe 发表于 2010-11-22 20:49 | 显示全部楼层
驱动我也已经换成了他.net包里头的驱动了,系统正常识别开发板,控制面板也正常识别开发板,就是他的例子程序无**常识别
llia 发表于 2010-11-22 20:55 | 显示全部楼层
基于c++的例子程序就能够正常识别啊?
 楼主| hanwe 发表于 2010-11-22 21:00 | 显示全部楼层
是啊
wangpe 发表于 2010-11-22 21:07 | 显示全部楼层
换到台式机上试试
 楼主| hanwe 发表于 2010-11-22 21:13 | 显示全部楼层
我笔记本和台式机都装的一样的framework2.0
wangpe 发表于 2010-11-22 21:27 | 显示全部楼层
呵呵,你试试
 楼主| hanwe 发表于 2010-11-22 21:31 | 显示全部楼层
嗯,明天试试,多谢楼上几位
cosmicy 发表于 2010-11-23 21:50 | 显示全部楼层
楼主怎么知道它就没有执行成功呢?
cosmicy 发表于 2010-11-23 21:52 | 显示全部楼层
楼主从哪找到的例程啊,那个CYAPI有这个USBDeviceList函数吗,最好使用CYAPI里面提供的API函数。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

979

主题

8749

帖子

4

粉丝
快速回复 在线客服 返回列表 返回顶部

979

主题

8749

帖子

4

粉丝
快速回复 在线客服 返回列表 返回顶部