1 Data acquisition system
In engineering, computers with PCI, PXI, USB, parallel port and serial port are used to obtain test data, which is called 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 using STC microcontroller as the front end, using the function of USB bus to asynchronous serial port of CH341T chip to transmit the collected data to PC through only one USB line, and finally display, analyze and process the data under LabVIEW platform.
1.1 System composition and working principle
The overall structure diagram of this system is shown in Figure 1. It mainly includes data acquisition, conversion and transmission parts composed of STC12C5410AD microcontroller and CH341T conversion chip, and data processing part composed of PC-based LabVlEW 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, it is transmitted to the PC through the USB interface using the USB to serial port function of the CH341T chip, and finally analyzed and processed by LabVIEW software.
2 Lower computer system design
2.1 Hardware design part
The system hardware schematic diagram 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 upper computer, thus forming a data acquisition system.
[page]
2.1.1 STC12C5410AD MCU The
STC12C5410AD series MCU is a single clock/machine cycle (1T) 8051 core compatible MCU. It is a new generation of high-speed/low-power enhanced 8051 MCU with an internal integrated MAX810 dedicated reset circuit. 10KBFLASH program memory, 512 bytes SRAM, 8-channel 10-bit high-speed A/D converter, the speed can reach 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. 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 requirements 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, but 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 of the upper computer without a serial interface. The characteristics of the CH341T chip are as follows:
(1) Simulate standard serial ports, used to upgrade the original serial port peripherals, or add additional serial ports through USB.
(2) The serial port application under the Windows operating system on the computer is fully compatible and does not require modification.
(3) Hardware full-duplex serial port, built-in transmit and receive buffer, supports communication baud rates of 50b/s~2Mb/s.
(4) Support 5, 6, 7 or 8 data bits, support odd check, even check, blank, mark and no check.
2.2 Software design part
This system uses the P1.0 port of STCl2C5410AD as the channel for A/D conversion. To use the A/D conversion function, the corresponding register settings must be made. 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 ADC power. ADC POWER=1: Turn on the A/D converter power. When the internal A/D conversion analog power is turned on for the first time, a proper delay is required. After the internal analog power is stable, the A/D conversion is started.
ADC_START: Analog-to-digital converter (ADC) conversion start control bit. When set to 1, the conversion starts. 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 bit. When the A/D conversion is completed, ADC_FLAG = 1. It must be cleared to 0 by software.
CHS2/CHS1/CHS0: analog input channel selection as 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.
[page]
3 Upper computer system design
3.1 CH341T driver
Before communicating with the upper computer, the CH341T driver must be installed, 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 program design
VISA (Virtual Instrument Software Architecture) is a high-level application programming interface developed by National Instruments Corporation of the United States for communicating 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. Its essence 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 in LabviEW to develop serial communication software. These include 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 for 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, clear the receiving data area to prepare for the next acquisition. The LabVIEW program block diagram is shown in Figure 4.
4 System test 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 transferred 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:Developing Parts Finishing and Inspection System with LabVIEW
Next article:Application of Virtual Instrument Technology in Metrology
Recommended ReadingLatest update time:2024-11-17 00:40
- Popular Resources
- Popular amplifiers
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Arduino Nano collects temperature and humidity data through LabVIEW and DHT11
- Modern Testing Technology and System Integration (Liu Junhua)
- Computer Control System Analysis, Design and Implementation Technology (Edited by Li Dongsheng, Zhu Wenxing, Gao Rui)
- 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
- Check it out: Things that ST New Chinese official forum doesn’t want to tell netizens
- HyperLynx High-Speed Circuit Design and Simulation (IV) Transmission Line Crosstalk
- What are the advantages of electronic shelf labels with Bluetooth 5.0 technology?
- DSP-F28335 System Resources
- msp430f5529 interrupt notes
- Detailed explanation of multi-layer PCB stacking structure
- Looking for part-time engineers to cooperate
- Modern Communication Technology (4th Edition)
- Are there other ways to reduce heat and power consumption of MOS besides parallel connection? The current cannot be changed. Although the internal resistance can be...
- Can lemons generate electricity?