Design of digital voltmeter based on YL-236 single chip computer training device

Publisher:sky0001Latest update time:2014-02-14 Source: 21icKeywords:YL-236 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  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.

Keywords:YL-236 Reference address:Design of digital voltmeter based on YL-236 single chip computer training device

Previous article:8051 MCU Modular Programming Skills
Next article:Design and production of a simple digital voltmeter

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号