<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 測試測量 > 設計應用 > 基于LabVIEW德USB實時數(shù)據(jù)采集處理系統(tǒng)實現(xiàn)

          基于LabVIEW德USB實時數(shù)據(jù)采集處理系統(tǒng)實現(xiàn)

          作者: 時間:2017-01-12 來源:網(wǎng)絡 收藏



            3.2 USB采集卡的軟件構成

          本文引用地址:http://www.ex-cimer.com/article/201701/337652.htm

            在USB 的Firmware中,采取同步傳輸(Isochronous Transactions)和塊傳輸(Bulk Transactions)兩種傳輸方式。同步方式用來實時傳送采集的數(shù)據(jù),塊傳輸主要用來傳輸主機命令信號和USB的狀態(tài)信息。塊傳輸中利用端點(Endpoint)2。兩種傳輸方式的核心中斷程序如下:

            void ISR_Sutok(void)interrupt 0 //塊傳輸方式

            {

            //initialize the couters in the 8051

            TMOD=0x05;

            TCON=0x10;

            TH0=0;

            TL0=0;

            Thb=0,

            TH0=0;

            TL0=0;

            thb=0;

            EZUSB_IRQ_CLEAR();

            USBIRQ=bmSUTOK; //Clear SUTOK IRQ

            }

            void ISR_Sof(void)interrupt 0 //同步傳輸方式

            {

            if(TCON&0x21){ //Deal with the counter overflow

            TH0=0;

            Tl0=0;

            THB++;

            TCON&=0xdf;}

            IN8DATA=TH0; //3 Bytes counter result

            IN8DATA=TL0;

            IN8DATA=THB;

            EZUSB_IRQ_CLEAR();

            USBIRQ=bmSOF; //Clear SOF IRQ

            }

            在LabVIEW 應用程序中設計了一Usb.dll文件作為LabVIEW與USB的驅動程序。由于EZ-USB開發(fā)系統(tǒng)中已經(jīng)提供了底層驅動程序(GPD)接口函數(shù),用戶只需調用這些函數(shù)即可與USB設備連接。因此在DLL的編制中只需調用它提供的函數(shù),大大節(jié)約了開發(fā)時間,提高了開發(fā)速度。創(chuàng)建的Usb.dll文件中包含了如下五個輸出函數(shù),功能說明如表1所示。

            表1 Usb.dll包含函數(shù)的功能說明

          Control 主機對USB設備的控制
          ReadResult 獲取USB發(fā)送到主機的數(shù)據(jù)
          StartIsoStream 啟動設備的同步傳輸流
          StartThread 得到標準設備的設備描述符
          StopThread 關閉設備的同步傳輸流

            其定義如下:

            LPSTR_declspec(dllexport)_stdcall Control(int input);

            int_declspec(dllexport)_stdcall ReadResult(void);

            int_declspec(dllexport)_stdcall StartIsoStream(void);

            int_declspec(dllexport)_stdcall StartThread(void);

            int_declspec(dllexport)_stdcall StopThread(void);

            開啟設備和獲取采集數(shù)據(jù)的過程如圖2所示。它的主要功能有:開啟或關閉USB設備、檢測USB設備、設置USB數(shù)據(jù)傳輸管道(pipe)和端點(endpoint)、實時從USB接口采集數(shù)據(jù)、顯示并分析數(shù)據(jù)。



          評論


          技術專區(qū)

          關閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();