1 Data Acquisition System
In engineering, computers with PCI, PXI, USB, parallel and serial ports are used to obtain test data, which is called a PC-based data acquisition system. One of them is to directly obtain data and transmit it to the computer through a plug-in data acquisition card. In view of the high price and inconvenient installation of data acquisition cards, this paper proposes a data acquisition system that uses STC microcontrollers as the front-end, and uses the function of the USB bus to asynchronous serial port of the CH341T chip to transmit the collected data to the PC through only one USB line, and finally display, analyze and process the data under the LabVIEW platform.
1.1 System composition and working principle
The overall structure of the system is shown in Figure 1. It mainly includes the data acquisition, conversion, and transmission parts composed of the STC12C5410AD microcontroller and the CH341T conversion chip, and the data processing part composed of the PC-based LabVIEW software. First, the measured voltage analog signal enters the AD conversion channel of the STC microcontroller through the level conversion circuit. After the conversion is completed, the USB to serial port function of the CH341T chip is used to transmit it to the PC through the USB interface, and finally it is analyzed and processed by the LabVIEW software.
2 Lower computer system design
2.1 Hardware Design
The hardware schematic diagram of the system is shown in Figure 2. The MCU used in the system is STC12C5410AD, and the USB interface chip used is CH-341T. The USB to serial port function of the chip is used to transmit data to the host computer, thus forming a data acquisition system.
2.1.1 STC12C5410AD MCU
The STC12C5410AD series microcontroller is a single clock/machine cycle (1T) 8051 core compatible microcontroller. It is a new generation of high-speed/low-power enhanced 8051 microcontroller with an internal integrated MAX810 dedicated reset circuit. It has 10KBFLASH program memory, 512 bytes of SRAM, 8-channel 10-bit high-speed A/D converters, and a speed of up to 100KHz. The actual operating frequency can reach 48MHz. When applied, the crystal frequency needs to be set according to the actual situation. This system uses a 11.0592MHz crystal oscillator. In this example, P1.0 is used as the A/D conversion channel. Since the input voltage range of each A/D conversion channel is 0~5V, for bipolar signals, direct input will cut off the negative half-wave. In order to solve the above problems, a high-speed, low-noise dual operational amplifier NE5532 is used. According to the virtual short and virtual open principles of the operational amplifier circuit, its output OUT=2.5-IN. The level of -2.5V~2.5V can be converted to 0~5V, thus meeting the bipolar requirement of the input signal.
2.1.2 CH341T chip
With the continuous development of computer communication technology, the communication speed of the serial port is increasingly unable to meet the current communication requirements. Therefore, more and more computers, especially laptops, no longer retain serial interfaces, and are replaced by convenient, high-speed, and standard USB interfaces. However, for devices that need to communicate with serial ports, this is a troublesome problem. In order to solve this problem, this system uses the CH341T chip to connect the microcontroller directly to the PC through the USB interface, which facilitates the communication between the upper computer without a serial port and the lower computer, and solves the problem that the upper computer has no serial interface. The characteristics of the CH341T chip are as follows:
(1) Emulates a standard serial port, used to upgrade the original serial port peripherals, or add additional serial ports via USB.
(2) The serial port application under the Windows operating system on the computer is fully compatible and does not need to be modified.
(3) Hardware full-duplex serial port, built-in transmit and receive buffer, supports communication baud rate 50b/s to 2Mb/s.
(4) Supports 5, 6, 7 or 8 data bits, supports odd parity, even parity, blank, mark and no parity.
2.2 Software Design
This system uses the P1.0 port of the STC12C5410AD as the channel for A/D conversion. To use the A/D conversion function, the corresponding register settings must be performed. The registers of the STC microcontroller are shown in Table 1.
1) P1M0, P1M1: P1 port working mode settings P1M0 = 0x01, P1M1 = 0x01. Set P1 port to open drain mode.
2)ADC CONTR: A/D conversion controller
ADC_POWER: ADC power control bit.
ADC_ POWER = 0: Turn off the ADC power supply. ADC POWER = 1: Turn on the A/D converter power supply. When the internal A/D conversion analog power supply is turned on for the first time, a proper delay is required. After the internal analog power supply is stable, the A/D conversion can be started.
ADC_START: Analog-to-digital converter (ADC) conversion start control bit. When it is set to 1, the conversion starts, and it is 0 after the conversion ends.
SPEED1, SPEED0: Analog-to-digital converter conversion speed control bits.
ADC_FLAG: Analog-to-digital converter conversion end flag. When the A/D conversion is completed, ADC_FLAG = 1 and must be cleared to 0 by software.
CHS2/CHS1/CHS0: Analog input channel selection is shown in Table 2.
The lower computer program flow chart is shown in Figure 3. The lower computer program mainly includes three parts: serial port initialization subroutine, A/D conversion initialization subroutine, and serial port sending subroutine. Among them, the A/D conversion initialization subroutine mainly sets the ADC CONTR, P1M0, P1M1 and other registers.
3 Host computer system design
3.1 CH341T Driver
Before communicating with the host computer, you must install the CH341T driver, which can be downloaded from the company website. After the driver is installed, a virtual serial port will be automatically created in the port column of the computer device manager. This virtual serial port is the same as the original COM port of the computer for the application. By selecting this virtual serial port, you can communicate with the lower computer.
3.2 LabVIEW Programming
VISA (Virtual Instrument Software Architecture) is a high-level application programming interface developed by National Instruments Corporation to communicate with various instrument buses. The VISA library resides in the computer system and completes the software connection between the computer and the instrument to realize program control of the instrument. In essence, it is a standard API for virtual instrument systems. VISA itself does not have programming capabilities. It is a high-level API that realizes instrument programming by calling the underlying driver.
This design uses the serial communication subVI of VISA of LabviEW to develop serial communication software. It includes VISA (Configure Serial Port.Vi: initialize the specified serial port according to specific settings. VISA Write.Vi: write the data written to the buffer to the specified device or interface. VISA Read.vi: read the specified number of bytes from the specified device or interface and return the data to the read buffer. VISA Close.Vi: close the open serial port. First, use VISA Configure Serial Port.vi to initialize the serial port, in which the timeout of the read and write operations is set to 10s, the baud rate is 9600, 8 data bits, no parity bit, 1 is the stop bit, and no flow control. Then open the serial port, transfer the data in the read buffer to the waveform chart for real-time display, and use the shift register and connection string control to store the collected data in the receiving data area. When the collected data reaches 950, the amplitude spectrum is transformed and displayed. At the same time, the receiving data area is cleared to prepare for the next acquisition. The LabVIEW program block diagram is shown in Figure 4.
4 System Testing and Results
In order to test the reliability of the system, the P1.0 port and power ground of the system are connected to the DG 2041A digital signal generator for testing. The signal generator generates a sine wave signal with a frequency of 100Hz and a peak-to-peak value of 3V, with a high level of 1.5V and a low level of -1.5V. Through the level conversion circuit, a sine wave with a low level of 1v and a high level of 4V is obtained. The A/D converted data is transmitted to Lab-VIEW. Before displaying, the A/D conversion value of 2.5V voltage must be subtracted by 128, and the scaling ratio of the Y axis of the waveform chart must be set to 0.02, so that it can be displayed correctly. The results of the collection displayed on the LabVIEW software through the designed system are shown in Figure 5.
5 Conclusion
This paper uses the STC microcontroller as the front end of data acquisition, and uses the USB interface to communicate with LabVIEW after conversion by the CH341T chip. At the same time, the powerful signal analysis and processing capabilities of LabVIEW are used to display the signal in real time and perform spectrum analysis on the signal. After debugging and improving the system, the experiment proves that the collected signal can meet the requirements and the system runs well.
Previous article:Application of smoke sensor in hotel fire automatic alarm system
Next article:Design and application of photoelectric sensors in airport logistics industry
Recommended ReadingLatest update time:2024-11-17 08:39
- Popular Resources
- Popular amplifiers
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- usb_host_device_code
- Image acquisition and processing system for panoramic map applications
- Teach you to learn 51 single chip microcomputer-C language version (Second Edition) (Song Xuefeng)
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- 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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- A 6-year STC fan contribution: a general low-level driver function library based on the STC8 series
- The new TMS320F28377S cannot connect to the emulator, what should I do?
- The digital power supply power line & feedback line do not correspond to the battery
- Does anyone know how the baud rate error is calculated?
- msp430G2231 ADC10 configuration
- [Domestic RISC-V Linux Board Fang·Starlight VisionFive Trial Report] Tornado Data Writing and Reading
- stm32 register boundary address problem
- 【Gravity:AS7341 Review】+First Look at AS7341
- With 6 development boards per person and over 10,000 yuan in prize money, ON Semiconductor and Avnet's IoT Innovation Design Competition is waiting for you to join!
- DM6437 peripheral detailed tutorial