【正文】
XX 大學(xué)畢業(yè)設(shè)計(jì)(論文) I 畢業(yè)設(shè)計(jì)論文 基于 單片機(jī)和 USB接口 的 數(shù)據(jù)采集 系統(tǒng)設(shè)計(jì) 基于單片機(jī)和 USB 接口的數(shù)據(jù)采集系統(tǒng)設(shè)計(jì) II 摘 要 通用串行總線 USB(Universal Serial Bus)是一種新型的微機(jī)總線接口規(guī)范。隨著客戶對(duì)系統(tǒng)數(shù)據(jù)采集速度要求的不斷提高, USB 以其使用方便、易于擴(kuò)展、速度快等優(yōu)點(diǎn)而越來(lái)越多的應(yīng)用于數(shù)據(jù)采集系統(tǒng)中。 本文介紹了一種基于 USB 總線的數(shù)據(jù)采集系統(tǒng)的設(shè)計(jì)方法,采用 PHILIPS 公司的USB 接口芯片 PDIUSBD12 與單片機(jī) AT89C51 進(jìn)行通信,并和 PC 機(jī)通信。該系統(tǒng)用傳統(tǒng)的 USB 總線取代了 RS232 串行總線,通過(guò)對(duì) USB 協(xié)議和設(shè)備構(gòu)架的充分理解,對(duì)以單片機(jī) 89C51 和 USB 接口芯片 PDIUSBD12 為主的數(shù)據(jù)采集系統(tǒng)進(jìn)行了硬件設(shè)計(jì)和軟件編程,并在此設(shè)計(jì)的基礎(chǔ)上給出相應(yīng)的原理圖。 硬件設(shè)計(jì)主要解決的是 PDIUSBD12 和 ADC0809 與單片機(jī)之間的接口電路問(wèn)題,軟件編程大致分為三部分 :一是為滿足 D12在 USB上的最大傳輸速率而編寫(xiě)的固件程序 。二是在 PC 機(jī)中的 Windows 2021 工作環(huán)境下編寫(xiě) USB設(shè)備驅(qū)動(dòng)程序;三是充分了解 D12的主要功能特點(diǎn),并編寫(xiě)出應(yīng)用程序。通過(guò)該數(shù)據(jù)采集系統(tǒng),我們可以對(duì) USB 協(xié)議有很深刻的理解,對(duì) D12 接口芯片有很熟練的應(yīng)用,能更好領(lǐng)悟 USB 接口的優(yōu)勢(shì)。 關(guān)鍵詞: 單片機(jī); USB;數(shù)據(jù)采集;固件 XX 大學(xué)畢業(yè)設(shè)計(jì)(論文) III Design of Data Acquisition System Based on Single Chip Computer and USB Interface Abstract Universal Serial Bus is a new specification for microputer bus interface. With the continuing advance of the clients39。 demand for the speed of a data collection system, USB is more and more widely used in data collection system for its advantages such as convenience, expanding port with ease and high speed etc. This paper presents a USBbased data acquisition system design methods, PHILIPS panies using the USB interface chip with PDIUSBD12 Progressive AT89C51 OK munication, and munication and PC. The system using traditional USB replace the RS232 serial bus, Through the USB framework agreement and equipment with the full understanding, right to 89 C51 microcontroller and USB interface chip PDIUSBD12based data acquisition system for the hardware pieces of software design and programming, and in this design is given on the basis of the corresponding diagram. The main solution of Hardware design is the Connection between PDIUSBD12 and ADC0809 with the interface between the microcontroller circuit,The software programme mainly includes: the fireware code in need of D1239。s maximum transmission rate。 USB device driver and client application under the circustance of Win2021 operation system in puter. After this data collection system,we can understand the USB protocol profoundly and apply the interface chipPDIUSBDI2 proficiently. In all, the advantages of this interface technique may helps to your design arrangement. Keywords: MCU。USB。data collection。 firmware 基于單片機(jī)和 USB 接口的數(shù)據(jù)采集系統(tǒng)設(shè)計(jì) IV 目 錄 引 言 ............................................................. 1 第 1 章 緒論 .......................................................... 2 課題的背景 ....................................................... 2 課題的研究意義與現(xiàn)狀 ............................................. 2 系統(tǒng)的設(shè)計(jì)方案 ................................................... 4 第 2 章 USB 協(xié)議簡(jiǎn)介 ................................................... 5 USB 傳輸要件 ..................................................... 5 USB 總線協(xié)議層 ................................................... 5 USB 的傳輸結(jié)構(gòu) ................................................... 6 USB 總線枚舉過(guò)程 ................................................. 8 USB 的設(shè)備描述符 ................................................ 10 USB 請(qǐng)求 ........................................................ 11 第 3 章 數(shù)據(jù)采集系統(tǒng)的硬件設(shè)計(jì) ....................................... 12 硬件系統(tǒng)的結(jié)構(gòu) .................................................. 12 芯片選擇 ........................................................ 12 ADC0809 ................................................... 12 AT89C51 ................................................... 14 PDIUSBD12 ................................................. 16 ......................................................... 18 單片機(jī)最小系統(tǒng) .................................................. 19 單片機(jī)的時(shí)鐘電路 ............................................ 19 單片機(jī)的復(fù)位電路 ............................................ 19 電源 電路 ...................................................... 21 看門狗電路 .................................................... 21 接口硬件電路設(shè)計(jì) ................................................ 22 A/D 與單片機(jī)接口電 路 ...................................... 23 PDIUSBDI2 與單片機(jī)接口電路 ................................. 23 第 4 章 數(shù)據(jù)采集系統(tǒng)軟件設(shè)計(jì) ......................................... 24 A/D 轉(zhuǎn)換時(shí)序控制 ............................................... 24 固件的開(kāi)發(fā) ...................................................... 25 采用 PDIUSBD12 的固件設(shè)計(jì) ........................................ 26 固件編程的主要工作 ........................................ 26 PDIUSBD12 固件程序的編寫(xiě) .................................. 26 固件結(jié)構(gòu) ........................................................ 27 固件的編程實(shí)現(xiàn) .................................................. 28 底層函數(shù) .................................................. 28 命令接口 .................................................. 29 中斷服務(wù)程序 ......................................... 31 主循環(huán) .................................................... 32 USB 設(shè)備驅(qū)動(dòng)程序 ............................................... 32 XX 大學(xué)畢業(yè)設(shè)計(jì)(論文) V USB 設(shè)備應(yīng)用程序設(shè)計(jì) ........................................ 33 第 5 章 調(diào)試 ......................................................... 36 硬件調(diào)試 ........................................................ 36 軟件調(diào)試 ........................................................ 36 結(jié)論與展望 .......................................................... 37 致 謝 ............................................................ 38 參考文獻(xiàn) ............................................................ 39 附錄 A 系統(tǒng)總圖 ................................................ 40 附錄 B 外文文獻(xiàn)及譯文 ............................................... 41 附錄 C 主 要參考文獻(xiàn)及