Design of digital voltmeter based on PC

Publisher:幸福之路Latest update time:2006-08-16 Source: 今日电子 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  Digital voltmeters have been designed and developed in many types and styles. Traditional digital voltmeters have their own characteristics. They are suitable for manual measurement on site. To complete remote measurements and further analyze and process the measurement data, traditional digital voltmeters cannot complete it. However, a digital voltmeter based on PC communication can not only complete the transmission of measurement data, but also use the PC to process the measurement data. Therefore, this type of digital voltmeter has characteristics that traditional digital voltmeters cannot match in terms of function and practical application, which makes its development and application have good prospects.

Overall design of new digital voltmeter

  The measurement voltage type of this new digital voltmeter is DC, and the measurement range is -5~+5V. The whole machine circuit includes: MCU minimization design of data acquisition circuit, MCU and PC interface circuit, MCU clock circuit, reset circuit, etc. The lower computer uses AT89S51 chip, and the A/D conversion uses AD678 chip. Communicates with the PC through the RS232 serial port and transmits the measured DC voltage data. The whole system circuit is shown in Figure 1.

The principle of data acquisition circuit

  In the design of the microcontroller data acquisition circuit, the circuit design was minimized, that is, no additional logic devices were used as interface circuits, and the microcontroller's operation of the AD678 conversion chip was realized.

  AD678 is a high-end, multi-functional 12-bit ADC. Since it has built-in sample and hold, high-precision reference power supply, internal clock and three-state buffered data output, it only requires a few external components. It constitutes a complete data acquisition system, and an A/D conversion only takes 5ms.

  In the circuit application, AD678 adopts synchronous working mode, and the 12-bit digital output adopts 8-bit operation mode, that is, the 12-bit converted digital quantity is read twice, first reading the high 8 bits, and then reading the low 4 bits. Bit. According to the timing relationship, when the chip selects /CS=0, the conversion terminal /SC changes from high to low once, and the A/D conversion can be started once. Then query the conversion end end /EOC to see if the conversion has ended. If it ends, the output enable /OE will become low and the output will be valid. The reading of 12-bit digital quantity requires controlling the high byte valid end/HBE, reading the high byte first, and then reading the low byte. The entire A/D operation is roughly the same, and it is adjusted in actual development and application.


Figure 1 Circuit diagram of digital voltmeter

  Since the bipolar input mode of AD678 is used in the circuit, the input voltage range is -5~+5V. According to the formula Vx=10(V)/4096*Dx, the measured voltage Vx value can be calculated. In the formula, Dx is the 12-bit digital value after conversion of the measured DC voltage.

Design of RS232 interface circuit

  The interface circuit between AT89S51 and PC uses chip Max232. Max232 is a chip launched by Texas Instruments (TI) that is compatible with the RS232 standard. The device contains 2 drivers, 2 receivers and a voltage generator circuit providing TIA/EIA-232-F levels. The Max232 chip has a level conversion function to match the TTL level of the microcontroller with the RS232 level of the PC.

  The RS232 interface for serial communication uses a 9-pin serial port DB9. Serial port data transmission can be realized as long as there are receiving data pins and sending pins: the receiving pins and sending pins of the same serial port are directly connected with wires, two serial ports are connected or one serial port and multiple serial port connection. In the experiment, timer T1 is used as the baud rate generator, and its initial counting value X is calculated according to the following formula:

Baud rate = *(T1 overflow rate)


= *


  The serial communication baud rate is set to 1200b/s, while SMOD=1, fosc=6MHz, and the initial counting value X=0f3H is calculated. Just load it into TL1 and TH1 during programming.

  In order to facilitate observation, when each time the voltage is measured and data is collected, when the microcontroller has a port output, it is indicated by a light-emitting diode (LED).

software programming

  The software programs mainly include: data acquisition program of the lower computer, visual interface program of the upper computer, and serial communication program between the microcontroller and PC. The single-chip microcomputer is programmed with C51 language, and the operation display interface of the host computer is visually programmed with VC++6.0. During the serial communication debugging process, with the help of the "Serial Port Debugging Assistant" tool, this tool can be effectively used to improve the efficiency of the entire system.

Microcontroller programming

  The data collection communication main program flow of the lower computer microcontroller is shown in Figure 2, the interrupt subroutine is shown in Figure 3, and the collection subroutine is shown in Figure 4. With the help of WAVE2000 emulator for programming simulation and debugging of microcontroller, this system has an integrated ISP simulation and debugging environment.


Figure 2 Microcontroller communication main program collection

  In the acquisition program, the programming operation of the microcontroller must fully comply with the timing specification requirements of AD678. In actual development, it must be continuously debugged. Finally, the .bin file generated by the successful debugging of the lower computer is solidified into the Flash unit of AT89S51.

  
Figure 3 Interrupt service subroutine Figure 4 Collection subroutine

Human-computer interface programming

  Open VC++6.0 and create a dialog-based MFC application. Serial communication is implemented using the MSComm control. Other operations will not be described here. Programming implements a good human-machine interface. The operation interface of the digital DC voltmeter is shown in Figure 5. By running the Windows program programmed with VC++6.0, the entire prototype function can be realized.

Functional results

  According to the working principle and implementation plan mentioned above, the functions of the entire prototype have been well realized in practice, and all indicators have met the pre-design requirements. The circuit works stably, each measurement is accompanied by LED lighting instructions, and the visual interface display is also normal.


Figure 5 Human-machine interface of digital voltmeter

  AD678 conversion accuracy is 12 bits, and its resolution is 1/4096. This provides a guarantee for the high accuracy of the entire machine system. In order to improve the measurement accuracy, the AD678's own calibration circuit is used, which makes its A/D conversion accuracy higher. In the actual measurement, the measurement accuracy of the whole machine reached 0.8%.

Reference address:Design of digital voltmeter based on PC

Previous article:Design of portable multifunctional real-time physiological parameter monitor
Next article:Design of vehicle-mounted compaction real-time detection system based on DSP

Latest Test Measurement 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号