基于USB接口的数据采集系统的研究与设计
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
通用串行总线(USB)具有成本低,使用方便,支持热插拔,传输速率高,功耗低等优点,已被广泛应用于PC机及嵌入式系统中。采用USB接口进行数据采集是本课题的一大特点。
     本文首先研究了USB接口的通信协议,包括USB基本架构与总线结构,硬件规范,NRZI编码方式,控制传输、批量传输、中断传输以及等时传输四种USB数据传输方式,设备枚举及USB设备描述符等内容。
     接着,通过ATMEL的89S52单片机和Philips公司的PDIUSBD12接口芯片实现了模拟信号的采集与传输。其具体实现过程包括单片机端的固件程序设计,USB设备驱动程序设计及其上位机应用程序设计三大模块。
     固件编程设计采用分层结构进行,实现了USB协议的解析和应答,完成了模拟信号的采集和传输等过程,并且通过给出部分源程序代码和程序流程图,采用从下向上的层次顺序详细研究了硬件提取层、PDIUSBD12命令接口层、中断服务程序、标准设备请求及主循环程序的实现过程。
     USB设备驱动程序为上位机应用程序访问硬件设备提供了统一的软件接口,USB的设备驱动程序必须符合Microsoft定义的Win32驱动程序模型(Win32Driver Model,WDM)规格。在此本文选用Numega公司的第三方驱动程序开发工具DriverStudio,由于它所含的DriverWorks工具提供独特的DriverWizard向导,包含丰富的例子和库的完整源代码,可以引导用户根据实际需要完成设备驱动程序开发的全过程,所以利用它大大简化了设备驱动程序的开发过程。
     上位机应用程序采用了C++Builder开发工具,通过调用Win32 API函数的打开设备CreateFile0、读/写设备WriteFile0/ReadFile0、I/O设备控制DeviceIOControl0及关闭设备CloseFile0等函数即可实现与基于USB接口的数据采集系统的通信。
     本设计实现了外部信号的采集并通过USB接口传输到PC机上实现了实时显示。本系统由于引入了USB接口,较以前的传统接口提高了数据传输的速率,支持热插拔,使用更方便。
Universal Serial Bus (USB) has been used widely in PC and embedded systems because of its many merits, such as low-cost, supporting of plug-and-play, high transmission rate and low power consumption. Data acquisition by USB Interface is a marking feature of this research.
     Firstly, this paper introduces the USB communication protocol. It includes USB basic structure, bus architecture, hardware standards, NRZI pattern of coding, control transfer、bulk transfer、interrupt transfer and isochronous transfer four types of transmission, equipment enumeration and USB device descriptors and so on.
     Secondly, the thesis introduces how to collect and transmit analog signal by using 89S52 MCU of ATMEL and PDIUSBD12 interface chip of Philips. The specific design consists of three modules: the firmware design of MCU, design of the USB device driver and application design of PC.
     Firmware programming is the most important task, because it accomplishes the USB protocol analysis and response, and achieves the process of analog signal acquisition and transmission. To identify the peripheral acquisition system of the host, firmware program must be well prepared. After introducing hardware abstraction layer, PDIUSBD12 Command Interface layer, interrupt service requests, standard device requests and the main cycling program, a hierarchical structure is presented. And some source codes and program flow chart are illustrated.
     USB device driver provides a unified software interface for PC application to access hardware device, the USB device driver must be accord with Win32 Driver Model (Win32 Driver Model, WDM) specifications defined by Microsoft Corp. This thesis chooses the third-part driver development tools of DriverStudio designed by Numega Corp. Because the DriverWorks tool provides a unique DriverWizard guidance and contains abundant examples and integrates source codes, it can guide us to develop the device driver during the whole process. It greatly simplifies the development process of device driver.
     The PC application is developed by means of C++ Builder. By calling the Win32 API functions, such as opening the device, reading / writing device, I /O device control and closing device, communication of the peripheral USB acquisition system can be realized at once.
     This design has realized external signal collecting and transmits on PC machine through the USB interface to realize the real time display. Because of introducing the USB interface, compared the traditional interface, the system enhanced the data transmission speed, supporting plug and play and becomes more convenient.
引文
[1]胡晓军,张爱成.USB接口开发技术.西安:西安电子科技大学出版社,2005.1-2
    [2]Joyce,John.Comprehensive guide to instrument interfaces.Scientific Computing and Instrument,1999.16(2):25-28
    [3]USB Implementer's Forum.Universal Serial Bus Specification(Revisionl.1),http//www.usb.org,1998
    [4]Joyce,John.Comprehensive guide to instrument interfaces.Scientific Computing and Instrument,2001.16(2):25-28
    [5]许永和.EZ-USB FX系列单片机USB外围设备设计与应用.北京:北京航空航天大学出版社,2002.3-81
    [6]余瑞璇.USB市场应用发展趋势.www.ic37.com,2005
    [7]中国专利技术博览会.http://www.sinofint.com.cn,2004
    [8]Wooi Ming Tan.Developing USB PC Peripherals Using the Intel 9x930Ax USB Microsoftcontrollor.Annabooks,2000.45-52
    [9]钱峰.EZ-USB FX2单片机原理、编程及应用.北京:北京航空航天大学出版社,2006.4-19
    [10]许永和.8051单片机USB接口程序设计.北京:北京航空航天大学出版社,2004.3-4
    [11]Don Anderson.USB系统体系(精英科技).北京:中国电力出版社,2000.97-99
    [12]Danny Simpson.An Overview of the Universal Serial Bus(USB).Originally published in the December 2000 issue of SSS Online,2000
    [13]武庆生,仇梅.单片机及接口实用教程.北京:电子科技大学出版社,1997.78-89
    [14]Stuart Allman.Implementing a Simple USB Interface for an Embedded Processor.Cypress Semiconductor.2006.34(2):245-247
    [15]Don Anderson.Universal Serial Bus System Archicecture.Addison Wesley,2001.37-39
    [16]陈启美,王刚.USB技术概况.电力自动化设备.2001.13(2):55-59
    [17]William Wong.Four-pin USB"A"connectors feature 12-Mbits/s performance.Electronics design,2000.27(4):46-50
    [18]Lynn,Kevin.Universal Serial Bus(USB)power management.Wescon Conference Record.1998.27(6):194-201
    [19]金峦.USB Host在温度检测系统中的应用与研究:[硕士学位论文].武汉:武汉理工大学,2007
    [20]刘益成.USB接口技术-USB简介.石油仪器.2002.16(1):57-58
    [21]戴江梅,胡仁杰.USB(通用串行总线)及USB外设的开发.电测与仪表.2000.27(12):18-20
    [22]Compaq,Hewlett-Packard,Intel,Lucent,Microsoft,NEC,Philips.USB2.0 Specification.2000.45(2):28-30
    [23]张念准,江浩.USB总线接口开发指南.北京:国防工业出版社,2001.78-89
    [24]Jou S,Kuo S,Chiu J,King C,Lee C.A Serial link transceiver for USB2.0 high-speed mode,Materials Research Society,2000
    [25]萧世文,宋延清.USB2.0硬件设计.北京:清华大学出版社.2006.27-167
    [26]Compaq,Intel,Microsoft,NEC.USB Class Definitions for Communication Devices,1999.23(1):30-39
    [27]M.Caldari,M.Conti,P.Crippa,S.Orcioni,M.Sbrega,C.Turchetti.Object-oriented design methodology applied to the modeling of USB device and bus interface layers.IEEE International Symposium on Circuits and Systems.2002.2:Ⅱ-368-Ⅱ-371
    [28]蒋兆林.用SL811HS实现OTG设备互联.电子设计应用.2003.6(4):13-16
    [29]王建校,杨建国,危建国.51系列单片机及C51程序设计.北京:科学出版社.2002.178-190
    [30]Jike Zerkus,Johm Lusher,onathan Ward.USB Primer Practical Design Guid.Circuit cellar.1999.106(6):58-69
    [31]吴迪,张军平,张文军.嵌入式计算机中USB主机控制器的研究与设计.计算机工程学报,2004.30(23):174-176
    [32]高有堂,常进.PDIUSBD12芯片在USB接口电路中的应用.现代电子技术,2003.1(9):56-58
    [33]Compaq,Intel,Microsoft,NEC.Universal Serial Bus Specification(Revision1.1).1998.183-205
    [34]Universal Serial Bus-the new standard for connecting peripherals.Apple Computer Inc.1999
    [35]边海龙,贾少华.USB2.0设备的设计与开发.北京:人民邮电出版社.2004.56-65
    [36]MAX146,MAX147芯片手册.http://www.maxim-ic.com/quick_view2.cfm/qv_pk/1591,1997
    [37]王朔,李刚.USB接口器件PDIUSBD12的接口应用设计.单片机与嵌入式应用,2002. (4):56-57
    [38]周立功.PDIUSBD12 USB固件编程与驱动开发.北京:北京航空航天大学出版社,2003.27
    [39]张冲.SPR光谱分析仪CCD传感器的USB接口的研究:[硕士学位论文].南京:南京林业大学.2006
    [40]Philips Semiconductors.Firmware Programming Guide for PDIUSBD12(Version1.0),1998
    [41]徐爱均,彭秀华.单片机高级语言C51 Windows环境编程与应用.北京:电子工业出版社,2001.56-70
    [42]Walter Oney.Programming the Microsoft Windows Driver Model.Microsoft,1999
    [43]Chris Cant.Writing Windows WDM Device Drivers.R&D Books,1999.35(6):3-8
    [44]武安河,邰铭,于洪涛.Windows 2000/XP WDM设备驱动程序开发.北京:电子工业出版社,2003.6
    [45]Cypress Semiconductor Corporation.Designing a Low-Cost Analog USB Joystick with the CyPress Semiconductor CY7C63000 USB Microcontroller.Cypress Semiconductor Corporation,1997
    [46]张惠娟,周利华等.Windows环境下的设备驱动程序设计.西安:西安电子科技大学出版社,2002.234-256
    [47]兰晓红.Windows下基于WinDriver驱动的USB程序设计.重庆师范大学学报,2006.21(4):32-34
    [48]王险峰,刘宝宏.Windows环境下的多线程编写与应用.北京:清华大学出版社,2002.69-72
    [49]徐科,杨朝林,李滨涛.C++ Builder实用技术与典型案例.北京:清华大学出版社,2006.89-105
    [50]廖济林.USB应用系统开发实例精讲.北京:电子工业出版社,2006.218-247
    [51]范逸之,江文贤,陈立元.C++ Builder与RS-232串行通信控制.北京:清华大学出版社,2006.63-74
    [52]马伟,邵贝贝.OTG补充协议开辟USB的新篇章.电子产品世界,2002.68-69

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700