| With the development of information technology, and popularization of personal computers, the communication between computers and peripheral equipments becomes particularly important. With this powerful platform, many products have been greatly supported to be in more broad application. USB interface which is simple, fast transmission and hot-pluging is the main interface of computer in communication. With the rapid development of USB in recent years, USB has become a reference on measure of which level a PC have achieved.It reflects the performance of its technical merits if a peripheral device supports USB interface as well.This paper focused on the problem that there is no USB in the early development of the instrument and communication of the device is difficult.So it research and develope a common USB interface.The thesis aimed the lung machine of PuLiMen company,increase the USB port on the original instrument. Base upon,complete the improved hardware design and software and application program.So it can be controlled by the computer or by the machine,increasing the scalability of the instrument.This paper selecte the PIC microcontroller18F67J50as the master controller, re-designed the interface between the controller and the original LCD screen, mini-printers. Using Microchip's MPLAB Integrated Development Environment, program and complete the firmware of slave computer. Achieve the goal which USB device may recive request command by control transfer pipe.The host computer send operating commands to the USB device by the HID class interface, then the device set the instrument state, complete test task and quickly return the test data to the host. Application program open a specified device by using the HID class, then send and receive data through the USB bus. And design the user interface of the application,including output real-time test curve and print test report.The experiments show that the spirometer with a USB interface can transfer data fast and accurate. Application can display the test curve immediately.The test results can be reported by the peripheral standard printer. This system can meet the requirement of hosipitals on test results, so it have a broad market prospect. |