Design of Multi-channel Data Acquisition System Based on SPI Bus

Publisher:心愿成真Latest update time:2013-01-15 Source: 电子科技 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    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.

a.JPG


    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]

b.JPG

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:

e.JPG

  

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.

 

Reference address:Design of Multi-channel Data Acquisition System Based on SPI Bus

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

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号