Design of multi-channel data acquisition system based on ADC0809 and 51 single chip microcomputer

Publisher:VelvetDreamerLatest update time:2014-11-06 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    "Data acquisition" refers to the process of collecting analog physical quantities such as temperature, pressure, flow, displacement, etc. and converting them into digital quantities, and then storing, processing, displaying and printing them by computer. The corresponding system is called a data acquisition system.

    The main task of this paper is to measure the DC voltage of 0~5V and send it to the remote PC for display. Since the DC signal is collected, there is no need to add a sampling and holding circuit for the slowly changing signal. Therefore, the more common successive approximation ADC0809 chip on the market is selected. The chip has a fast conversion speed and low price. It can directly convert the DC voltage into a digital quantity that can be processed by the computer. At the same time, a low-power LCD display device is selected to meet the needs of displaying the acquisition results on the terminal. The terminal keyboard control uses as few keys as possible to realize the control function. In order to prevent misoperation when the keyboard is not in use, a key lock function is also set during the design. In terms of keyboard input debouncing, a software debouncing method is used to reduce hardware overhead and improve the system's anti-interference ability. In terms of software design, the design idea of ​​functional modularization is adopted; the keyboard analog-to-digital conversion is realized by interruption, which greatly improves the efficiency and real-time processing capability of the single-chip microcomputer.

1 Hardware Structure of Data Acquisition System
    The hardware structure of data acquisition system is generally composed of signal conditioning circuit, multiplexer circuit, sample and hold circuit, A/D converter and single chip microcomputer. The hardware block diagram of the system that mainly completes the functions of this paper is shown in Figure 1.

Figure 1 Data acquisition system hardware design block diagram

2 Introduction to ADC0809 analog-to-digital converter
2.1 Structure and function of ADC0809
    This data acquisition system uses a computer as a processor. Electronic computers process and transmit discontinuous digital signals, while most of the analog quantities encountered in practice are continuously changing. After the analog quantity is converted into an electrical signal by the sensor, it needs to be converted into a digital signal by analog/digital conversion before it can be input into the digital system for processing and control. Therefore, the interface circuit that converts the analog quantity into a digital output, that is, the A/D converter, is the bridge for real signal conversion.
    At present, there are many types of A/D converters in the world, such as parallel comparison type, successive approximation type, integral type, etc. This article uses a successive approximation A/D converter, which has high conversion accuracy, fast speed, and moderate price. It is the most diverse and widely used A/D converter at present. The successive approximation A/D converter is generally composed of a comparator, a D/A converter, a register, a clock generator, and a control logic circuit.
    ADC0809 is a CMOS single-chip successive approximation A/D converter, and its internal structure is shown in Figure 2. The chip consists of 8-way analog switches, address latches and decoders, comparators, 8-bit switch tree D/A converters, successive approximation registers, three-state output latches and other circuits. Therefore, ADC0809 can handle 8-way analog inputs and has three-state output capabilities. The device can be connected to various microprocessors or work alone. Its input and output are compatible with TTL.

ADC0809 is an 8-channel 8-bit A/D converter (i.e., 8-bit resolution), with a conversion start-stop control terminal, a conversion time of 100μs, a single +5V power supply, an analog input voltage range of 0 to +5V, and no zero and full-scale calibration is required. The operating temperature range is -40 to +85℃, and the power consumption can reach about 15mW.
    The ADC0809 chip has 28 pins and uses a dual in-line package. Figure 3 shows its pin arrangement. The functions of each pin are as follows:

Figure 3 Pinout of ADC0809
    IN0~IN7: 8-way analog input terminal;
    D0~D7: 8-bit digital output terminal;
    ADDA, ADDB, ADDC: 3-bit address input lines, used to select one of the 8 analog inputs;
    ALE: Address latch enable signal, input, high level is valid;
    START: A/D conversion start signal, input, high level is valid;
    EOC: A/D conversion end signal, output, when the A/D conversion is finished, this terminal outputs a high level (always low level during the conversion);
    OE: Data output enable signal, input, high level is valid. When the A/D conversion is finished, a high level is input to this terminal to open the output tri-state gate, and the output is digital;
    CLK: Clock pulse input terminal. The clock frequency is required to be no higher than 640kHz;
    REF(+), REF(-): reference voltage;
    Vcc: power supply, single +5V;
    GND: ground.
    When ADC0809 is working, first input a 3-bit address and set ALE to 1 to store the address in the address latch. This address can be decoded to select one of the 8 analog inputs to the comparator. The rising edge of START will gradually approach the register reset; the falling edge starts the A/D conversion, after which the EOC output signal becomes low to indicate that the conversion is in progress. Until the A/D conversion is completed, EOC becomes a high level, indicating that the A/D conversion is over, and the result data is stored in the latch. This signal can also be used as an interrupt request. When the OE input is high, the output tri-state gate of the ADC is opened, and the digital value of the conversion result can be output to the data bus.
    The number of bits of the A/D converter determines the accuracy and resolution of the signal acquisition. For an 8-channel input signal, the resolution is 0.5%. The accuracy of the 8-bit A/D converter is:


   
2.2 ADC0809 working timing diagram
    Figure 4 shows the working timing diagram of ADC0809. It can be seen from the timing diagram that the address latch signal ALE latches the three-bit channel address on the rising edge, and the analog quantity of the corresponding channel is sent to the A/D converter through the multi-way analog switch. The rising edge of the start signal START resets the internal circuit, and the falling edge of START starts the conversion. At this time, the conversion end signal EOC is in a low level state. Since the bit-by-bit approximation requires a certain process, during this period, the analog input quantity should remain unchanged, and the comparator should compare again and again until the conversion is completed, at which time it becomes a high level. If the CPU sends an output enable signal OE (output enable is high level), the data can be read. In addition, ADC0809 has a high conversion speed and accuracy, and is less affected by temperature. [page]

2.3 Interface circuit between ADC0809 and MCS-51 microcontroller
    The interface circuit between ADC0809 and MCS-51 series microcontroller is shown in Figure 5. In the figure, the lower 3-bit address A2, A1, A0 output by 74LS373 is added to the channel selection terminals A, B, C, which can be used as channel coding. Its channel basic address is 0000H~0007H. After passing through the NOR gate, the WR and P2.7 of 8051 can be connected to the START and ALE pins of ADC0809. After passing through the NOR gate, the RD and P2.7 of 8051 are connected to the OE terminal of ADC0809. After being inverted, the EOC of ADC0809 is connected to P3.3 (INT1) of the 8051 microcontroller.

3. Interconnection between MCU and PC
    The current serial communication interface standards are formed by improving the RS-232 standard. The RS-323C standard is a communication protocol developed by the US EIA (Electronic Industry Association) and BELL and other companies. It is suitable for communication with a data transmission rate in the range of 0 to 20,000 b/s. This standard clearly defines the characteristics of the serial communication interface (such as signal line function and electrical appliances). Since all manufacturers of popular equipment produce communication equipment compatible with the RS-232C standard, it has been widely used as a standard in microcomputer communication interfaces.
3.1 Electrical characteristics
    EIA-RS-232C defines electrical characteristics, logic levels, and various signal line functions. On TxD and RxD, the logic 1 (MARK) level is -3V to -15V, and the logic 0 (SPACE) level
is +3 to +15V; on control lines such as RTS, CTS, DSR, DTR and DCD, the voltage of the valid signal (connected, ON state, positive voltage) is +3V to +15V, and the voltage of the invalid signal (disconnected, OFF state, negative voltage) is -3V to -15V.
    The above provisions explain the definition of the logic level in the RS-323C standard. For data (information code): the level of logic "1" (transmission) is lower than -3V, and the level of logic "0" (space) is higher than +3V; for control signals; the level of the connected state (ON) that is, the valid signal is higher than +3V, and the level of the disconnected state (OFF) that is, the invalid signal is lower than -3V. In other words, when the absolute value of the transmission level is greater than 3V, the circuit can effectively detect it, and the voltage between -3 and +3V is meaningless. Voltages below -15V or above +15V are also considered meaningless. Therefore, in actual operation, the level should be guaranteed to be between ±(3~15)V.
    For the conversion between EIA-RS-232C and TTL, since EIARS-232C uses positive and negative voltages to represent the logic state, it is different from the provisions of TTL that use high and low levels to represent the logic state. Therefore, in order to be able to interface with a computer or connect with the TTL device of the terminal, it is necessary to transform the level and logic relationship between EIA-RS-232C and TTL circuits. The method to achieve this transformation can be discrete components or integrated circuit chips.
3.2 DB-9 connector
    The DB-9 connector is used as a connector to provide two serial interfaces COM1 and COM2 on a multi-function I/O card or motherboard. It only provides 9 signals for asynchronous communication. Since the pin assignment of the DB-9 connector is completely different from the DB-25 pin signal. Therefore, if you want to connect to a DCE device equipped with a DB-25 connector, you must use a special cable.
    The requirement for cable length during design is that when the communication rate is lower than 20kb/s, the maximum physical distance of RS-232C direct connection should be 15m (50 feet).
    According to the RS-232C standard, if MODEM is not used, the maximum transmission distance between DTE and DCE is 15m (50 feet) when the code distortion is less than 4%. Since this maximum distance is given under the premise that the code distortion is less than 4%, in order to ensure the requirement of code distortion less than 4%, this interface standard stipulates in the electrical characteristics that the load capacitance of the driver should be less than 2500pF.
3.3 Connection between microcontroller and MAX232
    MAX232 is a dual-group driver/receiver chip that can complete TTL←→EIA bidirectional level conversion. It contains a capacitive voltage generator on the chip that can provide EIA/TIA-232-E level when powered by a single +5V voltage. Each receiver should convert the EIA/TIA-232-E level to 5VTTL/CMOS level. These receivers have a typical threshold of 1.3V and a typical hysteresis of 0.5V, and can accept 30V inputs. Each driver should convert the TTL/CMOS input level to the EIA/TIA-232-E level. All drivers, receivers, and voltage generators are available as standard units in the Texas Instruments component library. The operating temperature range of the MAX232 is 0 to 70°C.


    Figure 6 shows the working circuit diagram of the MAX232 chip. In practical applications, the device is very sensitive to power supply noise. The four electrolytic capacitors of the same value (1.0μF/16V) in the figure are used to improve the anti-interference ability. This design can select one of the two transmitters and receivers in the MAX232 chip as the interface, but the correspondence between transmission and reception should be paid attention to during design.

4 Conclusion
    This paper presents a hardware implementation method of a multi-channel data acquisition system based on AD0809 and a single-chip microcomputer. This method uses an 8051 single-chip microcomputer as the core in the terminal to control data acquisition and data upload, and converts the 0-5V DC voltage into a digital signal that can be processed by the computer through an A/D converter, and then processes it through the single-chip microcomputer to complete the functions of displaying on the terminal and uploading data. The upper computer in the system completes the functions of displaying the collected data and controlling the lower computer.

Reference address:Design of multi-channel data acquisition system based on ADC0809 and 51 single chip microcomputer

Previous article:Design of temperature measurement and control system based on C8051F040 single chip microcomputer
Next article:Design of Ultrasonic Echo Sputtering Theory Density Meter

Latest Microcontroller Articles
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号