节点文献

基于USB总线的家庭监护数据采集系统的设计

【作者】 魏巍

【导师】 王秀章;

【作者基本信息】 中国医科大学 , 生物医学工程, 2002, 硕士

【摘要】 本文提出了一种基于PC机上Microsoft Windows98/2000平台的USB总线接口方式家庭监护数据采集系统的设计与实现,其目的主要是将其应用在家庭监护系统中,使家庭监护系统更易于操作,经济实用。通用串行总线(USB)作为一种崭新的微机总线接口规范,其特点使其非常适合作为主机与医学仪器之间的通讯接口。本系统充分利用了现代PC机所具备的通用串行总线的数据传输功能,可与带USB接口的各种台式计算机,笔记本机连接构成高性能的数据采集测量设备,且具有USB设备体积小巧,连接方便,无需外接电源,即插即用,支持热插拔(PNP),动态加载驱动程序,方便使用等特有优点,在主机和家庭监护系统之间,可以实现简单、快捷、可靠的连接和通讯。所以基于USB总线的数据采集方式非常适用于家庭监护系统。 本系统包括硬件设计、FirmWare(固件)程序设计、基于Windows98/2000驱动程序模型(WDM)的设备驱动程序设计。最多支持8个通道的数据采集,采样频率可调(20~1KHz),采样精度为8bit。 本数据采集系统的硬件构成主要有三部分。第一部分为A/D转换芯片,我们采用八位逐次逼近式A/D转换器ADC0809。它包括8通道多路转换器、8位模/数转换器和与微处理器兼容的控制逻辑;第二部分为数据缓冲存储器,采用8K×9先进先出(FIFO)缓冲存储器IDT7205,其读和写操作可同时进行,可实现数据块的连续采集;第三部分为USB接口芯片,主要负责与主机间的USB通讯。接口芯片采用PHILIPS公司的并行USB接口芯片PDIUSBD12,符合USB1.1版本规范,支持12Mbps全速传输,支持四种传输方式,提供3个端点(Endpoint),除端点0外,每个端点的传输类型、传输方向均可自由配置。另外,它还具有320字节FIFO数据缓冲区。设备的工作原理是:8路模拟输人信号由89C52控制将其中的某一路信号接人 ADC0809并启动 A/D,A/D转换的结果自动写人 FIFO存储器 ID’17205,89C52将数据从 FIFO存储器中读出并通过PDIUSBD12送到主机。 Firmware固件程序设计采用CSI语言编写。89C52单片机的固件程序主要完成两个方面的工作:一是控制A/D以要求的采样频率进行采样,并控制采样通道的选择;二是控制仍B接口芯片与主机间进行通讯。对于89C52单片机控制A/D采样的工作,我们采用定时器TI定时中断的方法,将定时器TI设置为模式2,其中断优先级为高。每次定时中断产生时,89 C52将采样通道更新,并触发A/D开始采样。对于 89C52单片机控制 USB接口芯片与主机间的通讯的固件程序设计成完全的中断驱动方式。当CPU处理前台任务时,USB的传输可在后台运行,这就确保了最佳的传输速率和更好的软件结构,同时简化了编程和调试。后台中断服务程序(IS)和前台主循环之间的数据交换通过事件标志和数据缓冲区来实现。由于这种结构,主程序不关心数据是来自USB、串口还是并口,它只检查循环缓冲区内需要处理的新数据,这样主循环程序专注于数据的处理,而ISR能够以最大可能的速度进行数据的传输。控制端点在数据包处理时采用了同样的概念,ISR接收和保存数据缓冲区中的控制传输并设置相应的标志寄存器,主循环向协议处理程序发出请求,由于所有的标准设备。接口和厂商请求都是在协议处理程序中进行处理,ISR得以保持它的效率。而且一旦增加新的请求,只需要在协议层进行修改。 设备驱动程序的设计采用 WDM模型(Windows Driver Mod-el人 WDM是微软公司为当前主流操作系统 Win98和 Win 2000的驱动程序设计的一种构架。WDM采用分层驱动程序模型,对于USB设备来说,可分为USB总线驱动程序(USBD)和USB功能驱动程序。USB总线驱动程序由操作系统提供,他位于USB功能 ·2·驱动程序的下面,负责与实际的硬件打交道,实现烦琐的低层通讯。USB功能驱动程序由设备开发者编写,位于USB总线驱动程序的上面,不与实际的硬件打交道,而是通过向USB总线驱动程序发送包含URB(USB Request Block,USB请求块)的IRP(I/OReqUest Packet人O请求包X来实现对 USB设备信息的发送和接收。当应用程序想对设备进行I/O操作时,它便使用Wi叫OOSAPI函数对hN32子系统进行WIN32调用。此调用由I/O管理器将此请求构造成一个合适的Ign并把它传递给USB功能驱动程序。USB功能驱动程序接收到这个IRP后,根据Ign中包含的具体操作代码,构造相应的URB并把它放到一个新的IRP中,然后把此 IRP传递到 USB总线驱动程序,USB总线驱动程序根据Iny中所包含的URB执行相应的操作,并把操作结果通过IRP返还给USB功能驱动程序。USB功能驱动程序接收到此IRP后,将操作结果通过IRP返还给I/O管理器,最后I/O管理器将此Igy中操作结果返还给应用程序,至此应用程序对USB设备的一次l/O操作完成。驱动程序的入口函数是DriverEnny(厂所有对各种IRP的处理例程都在此人口函数中做出定义。本系统的驱动程序采用Numega公司的DriverstudioZ.5开发工具通用内核模式的开发包 Driverworks 和Mc。soft,公司的 2

【Abstract】 The article introduces one home monitor data acquisition system, designed over USB bus interface based on Microsoft Windows98/2000 platform of personal computer. The main goal makes home monitor system more economical, practical and easy to operate. As a kind of novel PC bus interface specification, Universal Serial Bus is perfectly adapted to become communication interface in the middle of host and medical instrument. This system takes full advantage of Universal Serial Bus data - transmission capability. It can connect with all kind of desk PC, pocket PC and constitute high performance data acquisition measure instrument. This instrument has advantages of elaborated, easy to link, none of external power, plus and play, PnP, dynamic loading driver of USB instrument. Link and communication of host and household ward system become simple, fast and reliable. Data acquisition mode based on USB is very suited as home monitor system.This system includes hardware design, Firm Ware program design and device driver program design based on WDM. It can most support 8 channels data acquisition. Sampling frequency is 20 ~ 1 KHz per one channel and sampling precision is 8 bits.The hardware of this Data acquisition system has three parts. Fist part, A/D conversi6n chip (8 - bit A/D converter - ADC0809 uses successive approximation as conversion technique) has 8 - channel multiplexer and microprocessor compatible control logic; Second part, data buffers is IDT7205 ( 8K x 9) , which is dual - port buffers with internal pointers that load and empty data on first - in/first - out basis. Data is toggled in and out of the device through the Write ( W) and Read (R) pins. The Write -operating and Read -operating is inde-pendent each other. IDT7205 enable the data - hulk continually acquired. Third part, USB interface chip is PDIUSBD12( parallel interface) manufactured by PHILIPS. Its mostly responsible for communication between data acquisition system and host. PDIUSBD12 follows Universal Serial Bus specification revision 1.1, supporting 12Mbps full speed transfer and four kinds of transfer types. It has three end-points. Except for endpoint 0, every endpoint can be configured freely transfer type and transfer direction. In addition, it integrates 320 bytes of multi - configuration FIFO memory and offers two sets of FIFO data buffers for every endpoint. The theory of operation; under the control of 89C52(MCU) , 8 -channel multiplexer in ADC0809 switch one channel. The results of A/D conversion will be automatically written into IDT7205. The 89C52 will read data from IDT7205 and send it to host through PDIUSBD12.Firm Ware program is designed with C51 programming language. The firmware mainly performs two tasks. One is to control A/D sampling with desired sampling speed, the other is to control communication between PDIUSBD12 and host. For the first task, we use the timer Tl to time interruption. Set Tl to mode 2 and interrupt priority level to high. When the timing interruption happens, the 89C52 will update the sampling channel arid trigger ADC0809 sampling. For the second work, the firmware of PDIUSBD12 is designed to be fully interrupt - driven. While CPU is doing its foreground task, the USB transfer is being handled in the background. This assures best transfer rate and better software structure and also simplifies programming and debugging. The data exchange between the background ISR (Interrupt Service Routine) and the foreground Main Loop is achieved by event flags and data buffers. With this structure, the Main Loop does notcare whether the data source is from USB, serial port, or parallel port. The Main Loop only checks the circular buffer for new data to be processed. This concept is very important. Thus, the Main Loop program can target on data processing and the ISR can do the job of data transfer at the fastest speed possible. Similarly, the control endpoint uses the same concept in data packet handling. The ISR receives and stores control transfers in data buffers and sets the corresponding flag reg

【关键词】 数据采集USBWDM家庭监护
【Key words】 data acquisitionUSBWDMhome monitor
  • 【分类号】R-39
  • 【被引频次】1
  • 【下载频次】218
节点文献中: 

本文链接的文献网络图示:

本文的引文网络