1. Introduction
Digital voltmeter uses digital measurement technology to convert analog quantity into digital quantity and display it. Due to its advantages of high measurement accuracy and strong anti-interference ability, it is widely used in the field of industrial automation instrumentation. The following article uses the Yalong YL-236 single-chip microcomputer training device as a platform to introduce the implementation method of digital voltmeter.
II. Overall Design of the Scheme
This design uses AT89C51 microcontroller as the core control device, uses ADC0809 to realize A/D conversion, and uses 3-digit LED digital tube to display the collected voltage (range 0~5V). The design block diagram is shown in Figure 1.
3. Hardware Design
1. Conversion chip ADC0809
ADC0809 has 8 analog input ports. 8 analog switches select 8 analog channels in time. The converted 8-bit digital quantity is latched into the three-state output latch. When the output is allowed, it can be read from the 8 data lines D7~D0 and can be directly connected to the microcontroller interface. The pin arrangement and specific functions of ADC0809 can be referred to the ADC0809 description file, which will not be described in detail here.
2. Hardware connection between ADC0809 and MCU
The interface circuit between the microcontroller and ADC0809 is shown in Figure 2.
74HC02 can realize 4-way 2-input NOR gate function. When connecting, connect P0.0~P0.7 of the single-chip microcomputer in the host module to the data output terminals D0~D7 of ADC0809 to receive the data converted and output by ADC0809; connect P2.5, P3.6, and P3.7 of the single-chip microcomputer to the CS, WR, and RD terminals of ADC0809 as the control contact lines for A/D sampling; connect A, B, and C of ADC0809 to D0, D1, and D2 ports of ADC0809, and select the sampling channel of ADC through the control of P0.
3. Digital voltmeter hardware module wiring
The hardware module wiring required to achieve this task using the YL-236 training device is shown in Figure 3. The circuit consists of a host module (MCU01), a display module (MCU04), and an ADC/DAC module (MCU07). The clock source 1MHZ is connected to the CLK port of the ADC circuit, and the analog voltage source provides a 0~5V input voltage.
The address latch enable signal ALE is controlled by P3.6 to select the channel address, and WR is used as the write select signal. We connect the ALE signal with the START signal, so that AD0809 can start the A/D conversion while latching the channel address.
Use the P0 port of the MCU in the host module as the segment code displayed by the digital tube, connect it to the a~dp segment ends of the digital tube, connect the P3.6, P2.6, and P2.7 of the MCU to the WR, CS2, and CS1 ends of the digital tube respectively, and perform dynamic scanning and display on the digital tube.
4. Software Design
1.AD conversion
Figure 4 is a flowchart of the program for A/D conversion using ADC0809. [page]
The data after A/D conversion should be sent to the microcontroller for processing. Before data transmission, it is necessary to confirm that the A/D conversion has been completed. The following methods are commonly used:
(1) Timed transmission method;
(2) Query method;
(3) Interrupt control method.
Regardless of which method is used, once the conversion is confirmed to be complete, data can be transferred through instructions.
The analog-to-digital conversion starts after the start signal START is activated. For ADC0809, when the clock frequency is constant, its A/D conversion time is fixed (microseconds). Therefore, we can design a delay function delay() to wait for a period of time (much longer than the A/D conversion time). When the delay time is up, the conversion must have been completed, and then data can be transmitted.
Referring to the flowchart, we can write a C language program to perform A/D conversion on the analog voltage input by analog channel 0. The key statements are as follows:
2. Main function flow chart
The main function flow chart is shown in Figure 5.
When programming, please note that the variable vol is in millivolts.
Because ADC0809 is an 8-bit analog-to-digital converter, the maximum input analog voltage is 5V, that is, 5000mV, so the resolution is 5000mV/28. Therefore, the voltage value measured in the program is the sampled AD value multiplied by 5000mV/255, and then the resulting number is displayed in sequence through the digital tube. After completion, the input DC voltage value can be changed to observe the change of the input voltage.
V. Conclusion
This program introduces the design of the digital voltmeter system in detail, focusing on the hardware connection and software design scheme based on the YL-236 Yalong single-chip microcomputer training device. The system has the advantages of fast conversion speed, high accuracy, stable performance, etc., and the circuit is simple, the work is reliable, and it has good practical value.
Previous article:8051 MCU Modular Programming Skills
Next article:Design and production of a simple digital voltmeter
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Three failure modes of high-voltage connectors for new energy vehicles
- Is it necessary to take a shower for 10 minutes after a burn?
- Sensor Problems
- Latest solutions specifically for battery test equipment, 5G test equipment
- DCDC input capacitance waveform
- If anyone is willing to help improve the size of the building block library, we can share the profits in the future.
- EEWORLD University Hall ---- The second stop of the ADI Road theme tour of Shijian: Instruments
- The features of the SCI module are as follows (these functions can be set through the corresponding registers)
- A very basic question, how to understand the reading timing diagram?
- stm32f1 plays badaplle routine, modify the atomic routine, use vs1053 to decode audio, ucosII to do dual thread