With the development of microprocessors and their wide application in various fields, people have put forward higher and higher requirements for electronic measurement technology and electronic instrument systems, and the requirements for test speed and accuracy are also increasing day by day. The test system mainly includes three parts: high-speed acquisition of real-time data, on-site display and analysis and processing. The most important part is the high-speed acquisition of real-time data, because it is related to whether the state and performance of the object under test can be truly reflected. According to the actual project needs, this paper designs and implements high-speed acquisition of multi-channel data based on the SPI bus of the 80C51F040 microcontroller and the AD7891 chip. The main hardware circuit of the system and the software programming for timing control are given in this paper.
1 Hardware Implementation of the System
The function of this data acquisition system is to collect and analyze multiple voltages and currents at high speed. It requires high accuracy and good linearity. The acquisition voltage is required to be in units of 1 mV, and the analog signal input range is -10 to +10 V. The system processing chip uses the C8051F040 microcontroller produced by Silicon Laboratories, which is a fully integrated mixed-signal system-on-chip (SOC) with an instruction core that is fully compatible with MCS-51. This series of microcontrollers uses pipeline processing technology and no longer distinguishes between clock cycles and machine cycles. It can pre-process the next instruction during the execution of instructions to improve the efficiency of instruction execution. Moreover, most C8051F040 microcontrollers have the analog and digital peripherals required by the control system, including watchdog, ADC, DAC, voltage comparator, voltage reference output, timer, PWM, timer capture and square wave output, etc., and have a variety of bus interfaces, including UART, SPI, SMBUS (compatible with IC) bus and CAN bus. The C8051F series of single-chip microcomputers adopts Flash ROM technology, integrates JTAG, and supports online programming. The many characteristics and advantages of the C8051F series of single-chip microcomputers make it widely favored by single-chip microcomputer system design engineers and become the preferred model for many measurement and control system designs. Although the C8051F040 provides an internal A/D converter, it is easily interfered with in real-time high-speed acquisition, and the signal-to-noise ratio is relatively low. The A/D conversion speed cannot meet the requirements of the high-speed data acquisition system. In order to meet the system indicators, improve the accuracy of data sampling and the anti-interference ability of the system, this data acquisition system adopts an external A/D conversion chip according to the actual situation.
The A/D chip used in this data acquisition system is an AD7891 12-bit data acquisition system (DAS) launched by ADI of the United States. It has two working modes, parallel and serial, and is suitable for various microprocessors, controllers and digital signal processor interfaces. AD7891 contains multiplexer, sample-and-hold amplifier, 12-bit high-speed ADC, +2.5 V reference voltage source and high-speed interface circuit, and has 8 analog signal channels with overvoltage protection. AD7891-1 can withstand overvoltage of ±17 V. The analog-to-digital conversion time of AD7891 is 1.6μs, and the sampling time is 1.4μs. When sampling only one channel signal, the sampling rate is 500 kSPS; when sampling 8 channel signals one by one, the sampling rate is 62.5 kSPS. AD7891-1 uses hardware or software methods to control the data sampling time of the conversion start to be 0.6μs and 0.7μs respectively, and the corresponding data acquisition rates are 454.5 kSPS and 435 kSPS respectively. AD7891 uses a single power supply, low power consumption, can select the range of input signals, and can also work in parallel or serial. It is very suitable for applications in data acquisition systems, motor control, mobile communication systems and test equipment. The pin function description of AD7891 is shown in Table 1.
Usually in high-speed data acquisition systems, the interface between AD7891 and the microcontroller has two modes: serial and parallel. The software is used to control the data line to meet the acquisition speed required by the system. Since the C80C51F040 microcontroller has the SPI bus interface function, this data acquisition system adopts a serial working mode. The data is read and transmitted through the SPI bus of the microcontroller, which can not only meet the speed requirements of the acquisition system, but also is easier to implement in hardware. Figure 1 is the interface circuit between AD7891 and 80C51F040 microcontroller. [page]
2. System software implementation
In order to achieve high-speed sampling of analog quantities, the timing of AD7891 must be analyzed first. Figure 2 is the serial read operation timing diagram of AD7891, and Figure 3 is the serial write operation timing diagram of AD7891.
Figure 2 is the serial read operation timing diagram of AD7891. It can be seen from Figure 2 that when the microcontroller wants to read data from AD7891, it must first be set low. The serial data is received one bit at a time. During the entire data transmission process, it must always remain at a low level. The data format transmitted is to transmit 16 bits of data at a time. The data transmission starts with the FORMAT bit, followed by 3 address bits, and then 12 data bits, which store the 12-bit AD conversion value. Each bit of data is sent at the rising edge of the clock. After the 16-bit data is sent, the DATA OUT line remains in a high-impedance state until a pulse with a rising edge appears on either the SCLK or the DATA OUT line.
Figure 3 is the serial write operation timing diagram of AD7891. It can be seen from Figure 3 that when the microcontroller writes data to AD7591, it must be set low first. The control register of AD7891 only receives the first 6 bits of data. The first three bits A0, A1, and A2 are used to configure the AD sampling channel. After receiving the first 6 bits of data, no more data is received. Data is received on the falling edge of the clock. The main program code (C language) for channel 1 acquisition is given below:
3 Conclusion Based on the serial SPI communication method, a high-speed data acquisition system was designed in
the language The SPI bus was used to realize data reading, which can meet the requirements of the data acquisition system and has the characteristics of simple hardware structure and easy software programming.
Previous article:Design of GPS/electronic compass attitude measurement and positioning system based on C8051
Next article:Minimized application system of 51 single chip microcomputer
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- Principles and Applications of Single Chip Microcomputers 3rd Edition (Zhang Yigang)
- Principles and Applications of Single Chip Microcomputers and C51 Programming (3rd Edition) (Xie Weicheng, Yang Jiaguo)
- Smart Car Security Attack and Defense Revealed
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- [Hua Diao Experience] 12 Building the Arduino development environment for ESP32C3
- 08. Anlu SparkRoad Domestic FPGA Evaluation [Learning] VGA Display
- Chuanglong Technology Allwinner A40i Development Board Review 3 Installation of Linux SDK and Lessons Learned
- What are the two chips with silkscreen SI4GK and S551J?
- Problems with sensor acquisition circuits
- What are the RF challenges of small cells for 5G networks?
- Is there really no threshold to making cars?
- Why not use plastic rope as wire?
- [MM32 eMiniBoard Review] AD detects thermistor value to achieve serial port temperature printing LED temperature warning
- About ESP32's off-chip RAM configuration. Go to esp-idf official reference