1 Introduction
With the continuous development of science and technology, people have higher and higher requirements for the performance indicators of data acquisition, and traditional data acquisition methods can no longer meet the needs. Universal Serial Bus (USB) has the advantages of fast transmission speed, plug and play, easy expansion, and less system resource occupation; ?C/OS-Ⅱ in embedded real-time operating system (RTOS) has the characteristics of high code efficiency, small space occupation, good real-time performance and reliability. This paper combines the two with traditional data acquisition technology, and designs and implements a data acquisition system based on USB communication and ?C/OS-Ⅱ that integrates data acquisition, analysis, and display.
2 System Architecture
The architecture of the data acquisition system based on USB communication is shown in Figure 1. The working process of the system is a data acquisition process, and each step requires the support of different groups. First, the temperature and pressure parameters are converted into analog signals by the sensor, and the analog signals are converted into digital signals that can be recognized by the microcontroller through A/D conversion. After the microcontroller processes the digital signal, it can be sent to the LED display or to the USB interface chip. When the host needs it, the USB interface chip sends the received data to the host through the USB for processing and display. The communication between the host and the USB interface requires the support of the device firmware program, the USB device driver and the USB host application.
3 Hardware Circuit Design of USB Data Acquisition System
The hardware circuit structure of the USB data acquisition system mainly includes the following parts: USB communication circuit part, data acquisition circuit part, digital display circuit part and firmware program download circuit part. The functions of these modules are all realized on the hardware platform with ATmega16 as the core.
3.1 Design of USB communication circuit
The function of the USB communication circuit is to realize the communication between the device side and the host side of the data acquisition system. This function is mainly realized by the core microcontroller ATmega16 and the USB control device PDIUSBD12. Among them, PDIUSBD12 is a chip that complies with the USB1.1 protocol and plays the role of a bridge between the device and the host in the USB communication circuit. The microcontroller ATmegal6 and the USB controller PDIUSBD12 communicate through an 8-bit parallel bus. The 8-bit parallel bus needs to connect 8 I/O ports at the ATmegal6 end. The PDIUSBD12 chip integrates a clock multiplication PLL, and the crystal oscillator circuit uses a 6MHZ crystal oscillator and two 2pF to 68pF capacitors. The signal output terminals D+/D-1 of the PDIUSBD12 should each be connected in series with an 18-ohm matching resistor. The communication circuit is shown in Figure 2.
3.2 Design of data acquisition circuit The function of data acquisition circuit is to convert the temperature, pressure and stress data in the field into appropriate analog signals, and then transmit the analog signals to A/D conversion circuit. This module includes temperature acquisition module and pressure acquisition module. [page]
Since the ATmegal6 chip integrates an adjustable gain differential amplifier circuit and an A/D conversion channel, the temperature acquisition circuit consists of only one bridge for temperature measurement. The specific method is to use the copper thermal resistor as one arm of the bridge according to the characteristic that the resistance value of the thermal resistor changes with temperature. When the temperature changes, the output voltage of the bridge also changes accordingly. The output voltage of the bridge is sent to the sampling and holding circuit inside the ATmegal6, and then amplified and A/D converted, and then the measured temperature can be obtained after conversion by the firmware program.
In this system, the device used to measure pressure is a pressure transmitter produced by Guangzhou Senax Instrument Co., Ltd., with a range of 0.0lMPa and an output signal of 4~20mA current. When the pressure changes, the output current also changes accordingly, so a precision resistor is connected to the signal output end, and then the voltage across the resistor is sampled and converted, and then the measured pressure can be obtained after conversion by the firmware program.
3.3 Firmware download circuit
The function of the firmware program download circuit is to download the compiled program code to the Flash of the ATmegal6 microcontroller. ATmega16 supports multiple programming modes, among which the simpler and more convenient one is the ISP (In-system-programming) mode, which is to download the compiled program code debugged in Windows to the memory of ATmegal6 through the serial SPI (serial peripheral interface) bus. Flash program memory, EEPROM data memory, fuse bits and encryption lock bits can all be programmed in this mode. The firmware program download circuit is shown in Figure 3.
3.4 LED display design
As shown in Figure 4, the system display is an 8-bit stable static display implemented by MAX7219. MAX7219 is a serial common cathode digital tube dynamic scanning display driver chip. It only uses a 3-wire serial interface to transmit data and can be directly interfaced with the microcontroller. Users can also easily modify its internal parameters to achieve multi-digit LED display. Therefore, the serial port of the microcontroller can be used to send display data conveniently. It takes less time and is convenient for programming and signal detection.
4 Software Development of USB Data Acquisition System
The USB data acquisition system is a multi-tasking system, and the program structure is relatively complex. In order to improve the development rate, enhance the stability of the system, and reduce the development and maintenance costs, an embedded operating system is needed as a platform for system development and operation. ?C/OS-Ⅱ is a free embedded real-time operating system with open source code. It has good stability and high reliability. ?C/OS-Ⅱ also has the characteristics of good portability, curability, and tailorability, making it very suitable as a development platform for USB data acquisition systems.
[page]
The software of the USB data acquisition system consists of three parts: the USB device firmware program, the USB device driver on the host PC, and the client application on the host. The composition of the system software and the relationship between the parts are shown in Figure 5.
The firmware program can be divided into USB communication program, A/D conversion program and LED display program according to its function. The USB communication program is the main part of the entire firmware program, and its function is to realize USB device enumeration and data transmission. USB device enumeration is the process of exchanging information and automatically configuring the host and device after the USB device is plugged in. After the enumeration is successful, the USB interface can communicate with the host.
The device driver is the link between the device and the host application. It provides the application access interface (API) upward and implements the access and management functions of specific devices downward. The driver is closely related to the device hardware and the upper user program, and plays the role of an intermediary for information conversion and transmission in the middle of the USB system. When developing USB devices, the design of the device driver is a very important link, which directly affects the performance of the entire device system.
This system uses Driverworks to develop a WDM USB device driver. The main functions of the application are to find the device in the device driver, exchange data with the device, and process and display the data sent by the device. The communication between the application and the driver is achieved by accessing the application program interface (API) function, so the application must be developed on a platform that can access the API function. Visual C++ 6.0 provided by Microsoft is a powerful programming tool that supports API functions. The host application of this design is developed based on VC. Its main functions include finding USB devices, exchanging data with USB devices, and dynamically displaying data curves.
5 Conclusion
The innovation of this paper lies in the data acquisition system based on USB interface and ?C/OS-Ⅱ, with a sampling frequency of up to 15KSPS (samples per second), a data transmission error recovery rate of more than 99%, plug-and-play, easy to use and with very low development cost, which can provide an effective solution and a convenient and efficient transmission device form for data acquisition, especially battery-powered mobile or handheld acquisition devices; secondly, Microsoft's recent WDM driver model is introduced on the PC side, and a device driver for the data acquisition system is developed on its basis, which can successfully identify and configure the device, and provides an application interface for exchanging data with the device. Based on these interfaces, a PC-side application with functions such as querying the device, exchanging data with the device and drawing the data into dynamic curves is compiled.
Previous article:Research and design of automatic detection device for ground potential in substation
Next article:High-performance test system architecture for aerospace measurement and control based on ATCA
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- TouchGFX design——by supermiao123
- EEWORLD University Hall----Overview of THS6222 Broadband PLC Line Driver
- Optimization and Implementation Method of Task Scheduling in μC/OS
- Does anyone know what model this monster is?
- MSP430 MCU Development Record (6)
- Using ESP's rtc memory in mpy
- Linux serial communication 1——96-N-8-1 format
- [STM32WB55 Review] Summary
- I need help with the simplest program to control 12864 with keys
- TUSB9261 -- USB3.0 to SATA interface bridge chip programming guide